Closed c4-submissions closed 1 year ago
Flagging but I think if you hold both tokens you can rescind
0xfoobar (sponsor) acknowledged
Extend-frontrunning is a valid griefing issue, though unclear why people would do this (and PT holders can rescind if they get ahold of the DT).
GalloDaSballo changed the severity to QA (Quality Assurance)
This is a valid concern to check, but ultimately the burden is on the purchaser + they have the ability to withdraw at any time if they also own the Delegate Token
So arguably an OTC Buyer should:
I think it's best categorized as QA / Gotcha
Lines of code
https://github.com/code-423n4/2023-09-delegate/blob/main/src/DelegateToken.sol#L368
Vulnerability details
Impact
With the
PrincipalToken
token owners can withdraw assets from theDelegateToken
contract:Additionally, the
DelegateToken
contract has a functionextend
where principal token owners may increase the expiration date (max date istype(uint96).max
).Furthermore, in the overview of the audit details, Delegate team has specified
This means that the
DelegateToken
token andPrincipalToken
token are expected to be sold on the secondary market.This allows a malicious user to list his principal token on the secondary market and set the expiry date to
type(uint96).max
right before the token is sold, which would essentially lock/burn the assets forever.Proof of Concept
As mentioned before, there are 2 ways to withdraw assets from
DelegateToken
as principal token owner:Here is the
DelegateToken.extend
function that allows principal token owners to increase the expiry date:Example
As an example, I will take Opensea as the ERC721 secondary market. The way Opensea works is that users sign permission for Opensea to transfer their ERC721 tokens when the sale happens, while those tokens sit in users' wallets.
Bob the attacker owns 2 Bored Apes at a 28 ETH valuation.
Bob delegates 1 Bored Ape in
DelegateToken
with the following rules:Bob's next actions are as follows:
DelegateToken.extend
and sets the expiry date totype(uint96).max
, which is year 4480 which essentially means that the token is locked forever/burned.type(uint96).max
.In conclusion - Alice loses 27 ETH while Bob has reduced the Bored Ape total supply and his other Bored Ape has risen in value because of it.
Tools Used
Manual Review
Recommended Mitigation Steps
The
DelegateToken.extend
function is too risky for buyers on the secondary market.My suggestion is to remove the
DelegateToken.extend
function completely. If there are users that want to increase the expiry date, my suggestion is:Assessed type
Context