Signature replay attacks for different identities (nonce on wrong party)
The signature hash used in QuickAccManager.send did not include the identity address, and nonces were tracked per identity rather than per signer. An attacker could replay a valid transaction on a second identity that shares the same QuickAccount, causing duplicate payments or other unauthorised actions.
Submitted by cmichel, also found by WatchPug
A single QuickAccount can serve as the “privilege” for multiple identities, see the comment in QuickAccManager.sol:
NOTE: a single accHash can control multiple identities, as long as those identities set it’s hash in privileges[address(this)]. this is by design
If there exist two different identities that both share the same QuickAccount (identity1.privileges(address(this)) == identity2.privileges(address(this)) == accHash) the following attack is possible in QuickAccManager.send:
Upon observing a valid send on the first identity, the same transactions can be replayed on the second identity by an attacker calling send with the same arguments and just changing the identity to the second identity.
This is because the identity is not part of the hash. Including the nonce of the identity in the hash is not enough.
Two fresh identities will both take on nonces on zero and lead to the same hash.
Impact
Transactions on one identity can be replayed on another one if it uses the same QuickAccount. For example, a transaction paying a contractor can be replayed by the contract on the second identity earning the payment twice.
Recommended Mitigation Steps
- Nonces should not be indexed by the identity but by the
accHash. This is because nonces are used to stop replay attacks and thus need to be on the signer (QuickAccountin this case), not on the target contract to call. - The
identityaddress itself needs to be part ofhashas otherwise thesendcan be frontrun and executed by anyone on the other identity by switching out theidentityparameter.
Other occurrences
This issue of using the wrong nonce (on the identity which means the nonces repeat per identity) and not including identity address leads to other attacks throughout the QuickAccManager:
cancel: attacker can use the same signature to cancel the same transactions on the second identityexecScheduled: can frontrun this call and execute it on the second identity instead. This will make the original transaction fail asscheduled[hash]is deleted.sendTransfer: same transfers can be replayed on second identitysendTxns: same transactions can be replayed on second identity
duplicate of #24, but it’s better documented
mitigation step 1 is not going to be done, since there’s already plenty of upper level code relying on indexing by identity, and it doesn’t really hurt if the replay attack is mitigated
plus, it makes it harder to look up the nonce value, as we have to compute the accHash in the client-side code
the replay attack has been fixed here https://github.com/AmbireTech/adex-protocol-eth/commit/f70ca38f368da30c9881d1ee5554fd0161c94486
GalloDaSballo (judge) commented:
The warden identified a Signature Replay attack, allowing to re-use a signature throughout the system.
Requiring the identity to be part of the signatures mitigates the vulnerability
The sponsor has mitigated in a subsequent PR
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the signed hash omitted the identity address and the nonce was stored per identity instead of per signer, so the same signature was valid for multiple identities sharing a QuickAccount.
Impact
Transactions on one identity can be replayed on another identity that shares the same QuickAccount, potentially causing duplicate payments or other unauthorised actions.
What the attacker needed
Two identities share the same QuickAccount; attacker can observe a valid transaction
The fix
The replay attack was fixed by including the identity address in the signed hash; the nonce indexing change was not implemented.
How it was found
- Observe a valid send transaction on the first identity.
- Call send with the same arguments but change the identity to the second identity.
- The transaction is replayed on the second identity.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract wallet lets one account control several identities. The code checked a signature but forgot to include which identity the transaction was for, and it counted transactions separately for each identity. So a signed payment for one identity could be copied and used on another identity that shares the same wallet, making the same payment happen twice.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.