Skip to content
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

Mean Malachite Frog - All swap calls to any target address can be easily DOS'ed #889

Open
sherlock-admin3 opened this issue Dec 9, 2024 · 0 comments

Comments

@sherlock-admin3
Copy link
Contributor

Mean Malachite Frog

High

All swap calls to any target address can be easily DOS'ed

Summary

The execute function calls safeApprove on the token contract to approve amountIN of tokenIn to the target contract. This is done because after this, the target contract which is expected to be a DEX will be called with txData to swap these tokenIN to tokenOut.

But the problem is that the safeApprove() logic reverts if the spender (ie. target) already has a non-zero allowance for the tokenIN.

This can be used to easily DOS swaps for any and all tokens by putting in one exact output swap in the orders and filling it.
Such an exact output order will leave some amount of approval (even 1 wei will work)

Thereafter, whenever someones fills an order, the logic will reach execute()=> where safeApprove() will revert due to an existing non-zero approval.

https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/interfaces/openzeppelin/SafeERC20.sol#L45-L54

This is imported in Bracket.sol where :

https://github.com/sherlock-audit/2024-11-oku/blob/ee3f781a73d65e33fb452c9a44eb1337c5cfdbd6/oku-custom-order-types/contracts/automatedTrigger/Bracket.sol#L539

safeapprove is done for amountIN but the whole execute flow does not reset the approval to zero after the operation, possibly resulting in a non zero approval pending

Root Cause

No response

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

Permanent DOS for all swaps of all tokens is possible, by an attacker leaving out tiny approvals for target DEXes

PoC

No response

Mitigation

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant