Platform: Code4rena
Start Date: 09/12/2022
Pot Size: $90,500 USDC
Total HM: 35
Participants: 84
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 12
Id: 192
League: ETH
Rank: 77/84
Findings: 1
Award: $1.15
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xA5DF
Also found by: 0xA5DF, 0xNazgul, 0xSmartContract, 0xbepresent, 0xdeadbeef0x, 8olidity, Englave, Faith, HE1M, JohnnyTime, Madalad, Mukund, Ruhum, SmartSek, __141345__, aviggiano, carlitox477, cccz, chaduke, francoHacker, gz627, gzeon, hansfriese, hihen, imare, jadezti, kwhuo68, ladboy233, orion, peanuts, philogy, rbserver, wait, yjrwkk
1.1472 USDC - $1.15
https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/contracts/Trading.sol#L79 https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/contracts/Position.sol#L9 https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/contracts/utils/MetaContext.sol#L9
The use of EIP-2771 allows for meta transactions that authenticate users not only via msg.sender
but also via "trusted" forwarders who are meant to authenticate the caller with some alternative mechanism e.g. message signatures. However the forwarders defined by the MetaContext
parent contract can be arbitrarily assigned by the owner()
address. This would allow a malicious owner to bypass caller authentication entirely by approving a custom forwarder, once in place the owner could then leverage ERC20 approvals, modify positions and withdraw assets of users without their express authentication.
As the Position
and Trading
contract owner()
:
setTrustedForwarder
methodtransferFrom
or safeTransferFrom
methods, imitating the user using the malicious forwarder.Note that step 3. and 4. can be changed to not only steal positions but for instance leverage any remaining approval from a user to the Trading
contract by calling Trading.addToPosition
or Trading.addMargin
on their behalf, increasing the potential damage even further.
Manual review.
Either remove EIP2771 support entirely or ensure that there's a single, known forwarder which is hard coded as a constant or set upon deploy as an immutable variable to prevent the owner
from being able to arbitrarily set custom forwarders.
#0 - GalloDaSballo
2022-12-19T21:00:20Z
TrustedForwarder implementation allows Owner to Rug by impersonating other users
Will need to verify but will flag
#1 - TriHaz
2023-01-09T18:01:35Z
We are aware of the centralization risks, initially, all contracts will have a multi-sig as owner to prevent a sole owner, later on a DAO could be the owner.
#2 - c4-sponsor
2023-01-09T18:01:40Z
TriHaz marked the issue as sponsor acknowledged
#3 - c4-judge
2023-01-15T14:01:48Z
GalloDaSballo marked the issue as duplicate of #377
#4 - c4-judge
2023-01-22T17:33:38Z
GalloDaSballo marked the issue as satisfactory