Closed c4-submissions closed 1 year ago
141345 marked the issue as sufficient quality report
141345 marked the issue as duplicate of #91
hansfriese marked the issue as satisfactory
hansfriese marked the issue as duplicate of #90
hansfriese changed the severity to QA (Quality Assurance)
hansfriese marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2023-10-ens/blob/ed25379c06e42c8218eb1e80e141412496950685/contracts/ERC20MultiDelegate.sol#L170 https://github.com/code-423n4/2023-10-ens/blob/main/contracts/ERC20MultiDelegate.sol#L148
Vulnerability details
Impact
ERC20MultiDelegate is expected to work with any ERC20-compliant tokens as long as they provide the same functionality and interface as ERC20Votes from OpenZeppelin. This makes it possible for ERC20MultiDelegate to work with a token that signals
token.transferFrom
failure by returningfalse
instead of reverting, as the ERC-20 standard doesn't requiretoken.transferFrom
tothrow
in every case of failure.There are two situations where not checking the return value of
token.transferFrom
may cause funds to get stuck.The first one happens when trying to delegate from an Address A to an Address B using
delegateMulti
andtoken.transferFrom
fails. This will cause an update ofERC20MultiDelegate.balanceOf(Adress, AddressA)
andERC20MultiDelegate.balanceOf(Adress, AddressB)
without updating the token balance of the proxies associated with AddressA and AddressB and thus causing the funds to be stuck.The second one happens when reimbursing a user of ERC20MultiDelegate and
token.transferFrom
fails causing the value ofERC20MultiDelegate.balanceOf(Address, AddressX)
to decrease without updating the token balance of the user and the proxy associated with the address. This results in the amount of funds that would be reimbursed to get stuck.Proof of Concept
Add the following code to
ENSToken.sol
so it's easy to mock a situationtoken.transferFrom
failsAdd the it blocks below to
test/delegatemulti.js
inside thedescribe block
"ENS Multi Delegate"Tools Used
Manual Review
Recommended Mitigation Steps
Check
token.transferFrom
return value and revert if it's false.Assessed type
ERC20