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: 33/84
Findings: 1
Award: $340.79
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: rvierdiiev
Also found by: UniversalCrypto, __141345__
340.7853 USDC - $340.79
EIP-2612
allows a signer
to create a signature which specifies any address as spender
, which should allow the spender
to use the signature created to validate transactions. However, in Trading.sol
this spender
cannot use initiateMarketOrder
preventing them from opening positions on behalf of the signer
.
Originally in 07.Trading.js
test file, a signature is created like this which passes:
permitSig = await signERC2612Permit(owner, MockDAI.address, owner.address, Trading.address, ethers.constants.MaxUint256);
For this POC we will assume the owner
wants to approve user
as a spender:
permitSig = await signERC2612Permit(owner, MockDAI.address, user.address, Trading.address, ethers.constants.MaxUint256);
This should allow user
to open positions using tokens from owner
.
On Line 185: https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/test/07.Trading.js#L185
The owner
opens a trade using owner.address
as the trader.
In this example the spender
should be able to open a trade using the signature created by the owner
, however, in all cases, this will revert.
await trading.connect(user).initiateMarketOrder(TradeInfo, PriceData, sig, PermitData, owner.address);
await trading.connect(user).initiateMarketOrder(TradeInfo, PriceData, sig, PermitData, user.address);
await trading.connect(owner).initiateMarketOrder(TradeInfo, PriceData, sig, PermitData, user.address);
Manual Audit
Specify whether signatures with a different signer
to spender
will not be validated.
#0 - c4-judge
2022-12-22T02:08:34Z
GalloDaSballo marked the issue as primary issue
#1 - GalloDaSballo
2022-12-22T02:08:39Z
Somewhat coded POC -> Primary
#2 - c4-sponsor
2023-01-09T16:07:10Z
TriHaz marked the issue as sponsor acknowledged
#3 - GalloDaSballo
2023-01-17T10:22:03Z
Removing primary as POC here is shaky (I think it's just not approved proxy)
#4 - c4-judge
2023-01-17T10:23:12Z
GalloDaSballo marked the issue as duplicate of #124
#5 - c4-judge
2023-01-22T17:50:52Z
GalloDaSballo marked the issue as satisfactory