-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attacker can perform griefing for process() in PromiseRouter by reverting calls to callback() in callbackAddress #225
Comments
If the callback would revert, normally it won't be called. However, the attacker (griefer) could potentially frontrun the relayer's callback transaction (which is already submitted / in the mempool) and update the state of their callback contract in such a way to cause this subsequent callback to fail. Why would they do that? Nothing is gained, only losses are incurred on both sides. This seems like it should be invalid, but it also seems like we should be doing a try/catch on principle though. Perhaps the issue is misrepresented here - it's not so much an attack vector as it's 'best practice' / QA issue.
EDIT: Changed my mind, think the risk level is appropriate. |
If you change the message, the following check(s) would fail (since the hash is put onchain when the message is propagated by nomad): bytes32 messageHash = messageHashes[transferId];
if (messageHash == bytes32(0)) revert PromiseRouter__process_invalidTransferId();
bytes29 _msg = _message.ref(0).mustBePromiseCallback();
if (messageHash != _msg.keccak()) revert PromiseRouter__process_invalidMessage(); An attacker cannot falsify this message because sending messages on the router is restricted via the If we extend this concern to any failing Don't think this qualifies as a value leak, but because it is potentially unprocessable will leave the severity at 2 and move the label to "acknowledged" |
I guess this issue has the same concerns as #220. Even if the onus is on the caller of I don't think its realistic that relayers would call this function without first simulating the transaction to see if the callback fails, but I guess the bridge user could set the callback address up as a honey pot such that simulated transactions are successful. It probably makes sense to remove the main culprit of the issue by using a try/catch statement for the |
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/promise/PromiseRouter.sol#L226-L262
Vulnerability details
Impact
process()
inPromiseRouter
is used for process stored callback function and anyone calls it getscallbackFee
and it callscallback()
function ofcallbackAddress
. but attacker set acallbackAddress
that reverts oncallback()
and causeprocess()
caller griefing. attacker can perform this buy front running or complex logic.Proof of Concept
This is
process()
code:As you can see it calls
ICallback(callbackAddress).callback(transferId, _msg.returnSuccess(), _msg.returnData());
and if that call reverts then whole transaction would revert. so attacker can setupcallbackAddress
that revert and the caller ofprocess()
wouldn't get any fee and lose gas.Tools Used
VIM
Recommended Mitigation Steps
change the code so it won't revert if call to
callbackAddress
reverts.The text was updated successfully, but these errors were encountered: