Submitted by berndartmueller
ZetaChain blocks can be griefed by a single observer, resulting in the block space being filled with MsgGasPriceVoter messages, preventing other transactions from being processed.
Observers submit the gas prices of the external (connected) chains by sending the MsgGasPriceVoter message to ZetaChain. This message is handled in the GasPriceVoter function.
The median gas price is then set in the zEVMs system contract by calling the SetGasPrice function in line 174.
As this is a call to the zEVM (Evmos) and gas for this EVM call is accounted differently than gas in Cosmos SDK, the gas meter is reset in line 184 by calling the ResetGasMeterAndConsumeGas function to match the EVMs gas consumption, i.e., consume the amount of gas the EVM has consumed instead of the Cosmos SDK gas.
This is typically done by Evmos for MsgEthereumTx messages, as explained in the Evmos documentation - Matching EVM Gas consumption.
In this instance, the MsgGasPriceVoter message (sent by observers), specifically, the consumed gas, does not necessarily have to match the EVM gas model.
However, contrary to Evmos, the transactions gas meter is reset on every MsgGasPriceVoter message, ignoring the accumulated gas consumption for multiple messages within a Cosmos SDK transaction (Cosmos allows multiple messages per transaction).
Concretely, Evmos uses the accumulated gas used by multiple messages to ensure that the gas meter accounts for the gas consumed by all messages.
As a result, only the gas for the last MsgGasPriceVoter message is accounted for, and the gas for all previous messages is ignored, allowing the sender (observer) to send a high number of MsgGasPriceVoter messages and only paying the gas for a single message execution.
Consequently, a malicious observer can exploit this to grief ZetaChain blocks so that blocks are mostly filled with MsgGasPriceVoter messages (or any other messages that consume a lot of gas), preventing other transactions from being processed.
This represents a privilege escalation as single observes are not supposed to have such a significant impact on the ZetaChains block space, and thus, medium severity was chosen.
This quick and dirty proof of concept should demonstrate that the transaction gas meter only consumes a single MsgGasPriceVoter message.
Consider not resetting the gas meter for MsgGasPriceVoter messages.
lumtis (ZetaChain) confirmed
