Missing return values in IERC20.transferFrom. #146
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
edited-by-warden
insufficient quality report
This report is not of sufficient quality
🤖_primary
AI based primary recommendation
Lines of code
https://github.com/kkrt-labs/kakarot/blob/7411a5520e8a00be6f5243a50c160e66ad285563/src/backend/starknet.cairo#L264
Vulnerability details
Summary
Missing Return Values in IERC20.transferFrom.
ERC20 token behaviors in scope
Missing return values: In scope
Vulnerability details
Some tokens do not return a bool (e.g. USDT, BNB, OMG) on ERC20 methods. see here for a comprehensive (if somewhat outdated) list.
Some tokens (e.g. BNB) may return a bool for some methods, but fail to do so for others. This resulted in stuck BNB tokens in Uniswap v1 (details). Some particularly pathological tokens (e.g. Tether Gold) declare a bool return, but then return false even when the transfer was successful (code).
A good safe transfer abstraction (example) can help somewhat, but note that the existence of Tether Gold makes it impossible to correctly handle return values for all tokens.
Proof Of Concept
As seen below, there is a missing return value as
transferFrom
. It does not return a bool for the ERC20 token transfer operation.Tools Used
Manual Review
Recommendation Mitigaiton Steps
The protocol should use the safe transfer method from open zeppelin.
Assessed type
ERC20
The text was updated successfully, but these errors were encountered: