soroban-env-host
Affected
- introduced
0, fixed26.0.0(semver)
Fixed versions
26.0.0
Fix
- Fixed version
26.0.0cargo update -p soroban-env-host --precise 26.0.0
Advisory
Also known as: None
Soroban: Muxed address<->ScVal conversions may break after a conversion failure
Summary
Soroban host ensures that MuxedAddress objects can't be used as storage keys in order to proactively prevent the contract logic bugs. However, due to a bug in Soroban host implementation, a failure in Val->ScVal conversion during the storage key computation will have the flag indicating that storage conversion is happening stuck in the true state until the next storage access. While the flag is stuck in true state, any MuxedAddress object conversions to ScVal will fail, i.e. a failure will occur if a MuxedAddress is emitted in the event or is serialized to XDR via a host function.
Impact
The bug may cause unexpected contract failures in the rare edge case scenarios. In the worst case scenario the whole transaction will fail and the changes will be rolled back. Because the contract call is simply rolled back, there is no risk of the state corruption.
An example scenario that would be affected by the bug is as follows:
try_callput_contract_data) with a non-convertible Val as a key (e.g. a MuxedAddress object, or a deeply nested vector)MuxedAddress argument. That should be allowed, but instead of succeeding, contract A fails.Patches
The bug will be fixed in protocol 26.
Workarounds
We believe that the bug is highly unlikely to occur in practice, as it involves three rare events happening simultaneously: Val conversion failure (these should normally not occur for the audited protocols), graceful handling of a cross-contract call failure (most protocols need cross-contract calls to succeed, or fail with a contract error), and MuxedAddress write (most of the contracts don't support MuxedAddress at all).
In the case if the bug does occur, the mitigation depends on the reason of the value conversion failure:
In both scenarios the mitigation is to basically retry the transaction with proper arguments.
Low Basis: The source's own band: LOW
0, fixed 26.0.0 (semver)26.0.0
26.0.0cargo update -p soroban-env-host --precise 26.0.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0