Open hats-bug-reporter[bot] opened 5 months ago
Dude, solidity...
We sadly need a PoC for this. You can use our return bomber contact to create a PoC: https://github.com/catalystdao/GeneralisedIncentives/blob/main/test/mocks/ReturnBomber.sol
The reason why I need a PoC is because I don't think it is that bad. You can't do a lot of damage in 2300 gas.
Github username: -- Twitter username: -- Submission hash (on-chain): 0xf02c0b7844e9d7a3abbeb774c75a730330692d61cd56b91c1ada9f7f49027e30 Severity: high
Description: Description\ The
IncentivizedMessageEscrow._handleAck
function performs Solidity'ssend
call to transfer native tokens.https://github.com/catalystdao/GeneralisedIncentives/blob/main/src/IncentivizedMessageEscrow.sol#L437-L439
Even though the
send
call only forwards 2300 gas still it is susceptible toreturn-data-bomb
attack, i.e, the recipient can return a huge amount of data which will be copied to memory of_handleAck
call. This happens by default. This large amount of returned data can cause the_handleAck
call to revert due to block gas limit.Hence the acknowledgement cannot be processed, all attempts of calling
IncentivizedMessageEscrow.processPacket
will get reverted.This can lead to huge amount of losses for protocol.
Attack Scenario
Vault.sendAssets
withrefundGasTo
set to a malicious contract address. The tokens deposited by attacker gets added to escrowed amount in vault.IncentivizedMessageEscrow.processPacket
call on destination chain. Attacker receives funds on destination chain.IncentivizedMessageEscrow.processPacket
to submit acknowledgement on source chain, the function tries to callsend
on maliciousrefundGasTo
address.refundGasTo
performs the return data bomb and theprocessPacket
(ack) call gets reverted.processPacket
cannot be executed. FurtherrecoverAck
cannot be executed due to this statement.The escrowed tokens are lost forever.
The attack can be performed by any of the recipients of the
send
call.Attachments
Proof of Concept (PoC) File Provided above
Revised Code File (Optional) Consider using assembly for transferring funds to
refundGasTo
address.