Submitted by Sentryx
The Ante handler for MsgEthereumTx transactions is responsible for ensuring messages are coming with correct nonces. After doing so, itll increment the accounts sequences for each message that the account has signed and broadcasted.
The problem is that when the EthereumTx() message server method calls ApplyEvmMsg() itll override the account nonce when the currently processed EVM transaction message is a contract creation and will set it to the nonce of the message. When a non-contract creation EVM transaction message is processed, however, the ApplyEvmMsg() method does not touch the accounts nonce.
This opens up an exploit window where a malicious user can replay a TX multiple times and reuse their nonces. Users can manipulate their Sequence (nonce) by submitting a contract creation EVM transaction message and multiple call/transfer EVM transaction messages in a single SDK transaction.
The code relies on evmObj.Call() and later stateDB.commitCtx() to persist a correct nonce in state but the Call() method on evmObj does not handle account nonces, it just executes the transaction. As we can see the method in geth thats normally used to transition the state increments the senders nonce by 1 in either case:
https://github.com/NibiruChain/go-ethereum/blob/nibiru/geth/core/state_transition.go#L331-L337
https://github.com/NibiruChain/go-ethereum/blob/nibiru/geth/core/vm/evm.go#L498-L501
https://github.com/NibiruChain/go-ethereum/blob/7fb652f186b09b81cce9977408e1aff744f4e3ef/core/vm/evm.go#L405-L418
But ApplyEvmMsg() calls evmObj.Call() (st.evm.Call() in the above code snippet) directly and does not increment senders nonce:
Set the senders nonce to msg.Nonce() + 1 when contractCreation is false.
berndartmueller (judge) commented:
k-yang (Nibiru) confirmed and commented:
onikonychev (Nibiru) commented:
Unique-Divine (Nibiru) disputed and commented:
berndartmueller (judge) commented:
flacko (warden) commented:
berndartmueller (judge) decreased severity to Medium and commented:
Nibiru mitigated:
Status: Mitigation confirmed. 
