-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix: Guard against malicious processors [SUP-8873] #639
fix: Guard against malicious processors [SUP-8873] #639
Conversation
…erfromRouterPlusAsync.sol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in RouterPlus async look good to me.
Please review formatting changes in all the other src files and forge-scripts folder (which should be reverted to their original state).
Once you commit CI should run and let us know if there was any coverage drop with the function changes.
Also wondering why yAudit mentioned to revert at slippage check failure, it doesn't seem necessary to me - after we clean up let's bring this PR for discussion in discord for them to review the fix.
…-against-malicious-processors
…ttps://github.com/superform-xyz/superform-core into tamara-sup-8873-guard-against-malicious-processors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few final fixes and LGTM
Problem
A malicious processor can take advantage of the refund mechanism.
completeCrossChainRebalance()
complete a cross chain rebalance initiated by the user withstartCrossChainRebalance()
. This function could be called only by an address with aROUTER_PLUS_PROCESSOR_ROLE
. As the processor can pass arbitrary data as function arguments to both functions he can take advantage of the refund mechanism, leading to two possible scenarios:Processor can force unnecessary refunds in
completeCrossChainRebalance()
: by passing a specificexpectedAmountInterimAsset
, he can force unnecessary refunds on every payload to be processed.Processor can steal all SuperformRouterPlusAsync funds: by starting a cross chain rebalance himself and thus passing a fake
expectedAmountInterimAsset
, he can issue a refund to himself stealing funds from the SuperformRouterPlusAsync contract.Solution
Refactor refund mechanism to include a
requestRefund()
function and a correspondingapproveRefund()
function that is only callable byCORE_STATE_REGISTRY_RESCUER
Update tests