-
Notifications
You must be signed in to change notification settings - Fork 0
WATCHPUG - Attacker can steal the accumulated topup fees in the topupproxy
contract's balance
#112
Comments
Hey @McMannaman, since #38 is also considered a duplicate, which is considered medium. Shouldn't the rest of the issues be medium too? |
@hrishibhat correct, as @McMannaman mentioned - this is not a "high" vulnerability since no user funds are at risk, there is a tag "disagree with severity" |
We will not change the severity of this issue as protocol funds are at risk. |
The fixes are in https://github.com/viaMover/2022-10-mover/pull/1 |
Bringing over some comments from https://github.com/viaMover/2022-10-mover/pull/1 McMannaman WatchPug
McMannaman
(non-swap scenario):
(swap scenario):
so there are several assumptions we're working with:
Please point if I'm missing something (no code examples needed, just a description would be enough). WatchPug
Yeah, I think this is the case where the accumulated fees on the I agree that this is not a major risk, though. |
WATCHPUG
high
Attacker can steal the accumulated topup fees in the
topupproxy
contract's balanceSummary
The accumulated fees in the
topupproxy
contract's balance can be stolen by an attacker by using malicious_bridgeTxData
and using1inch
's astargetAddress
.Vulnerability Detail
This attack vector is enabled by multiple traits of the
topupproxy
contract:1. Shared whitelist
Per to deploy script, the same
trustedregistry
will be shared amongexchangeproxy
andtopupproxy
.Therefore, the 2 whitelisted swap aggregator contracts will also be allowed to be called on
topupproxy
:And the 2 whitelisted bridge contracts can be called on
exchangeproxy
:2. Unlimited allowance rather than only the amount of the current topup to the bridge's
targetAddress
At L414, the
targetAddress
will be granted an unlimited allowance rather than just the amount of the current transaction.https://github.com/sherlock-audit/2022-10-mover/blob/main/cardtopup_contract/contracts/HardenedTopupProxy.sol#L414
3.
1inch
can be used to pull an arbitrary amount of funds from the caller and execute arbitrary callThe design of
1inch
'sAggregationRouterV4
can be used to pull funds from thetopupproxy
and execute arbitrary external call:https://polygonscan.com/address/0x1111111254fb6c44bAC0beD2854e76F90643097d#code
See L2309-2321.
4. The topup fee will be left in the contract's balance
https://github.com/sherlock-audit/2022-10-mover/blob/main/cardtopup_contract/contracts/HardenedTopupProxy.sol#L348-L352
Combining all the 3 above together, the attacker can call
CardTopupPermit() -> _processTopup() -> 1inch#swap()
and drain all the funds in the contract:Impact
All the accumulated fees can be stolen by the attacker.
Code Snippet
https://polygonscan.com/address/0x1111111254fb6c44bAC0beD2854e76F90643097d#code
https://github.com/sherlock-audit/2022-10-mover/blob/main/cardtopup_contract/contracts/HardenedTopupProxy.sol#L348-L352
https://github.com/sherlock-audit/2022-10-mover/blob/main/cardtopup_contract/migrations/5_connect_contracts.js#L54-L61
Tool used
Manual Review
Recommendation
targetAddress
the allowance of the amount (_amount
) transferred into thetopupproxy
contract within this transaction from the caller;The text was updated successfully, but these errors were encountered: