Open sherlock-admin2 opened 6 months ago
Same fix as #239 so will fix
The protocol team fixed this issue in the following PRs/commits: https://github.com/teller-protocol/teller-protocol-v2-audit-2024/pull/30
Highlights only transfer/transferFrom boolean reverts
Highlights only approval boolean reverts
Highlights both transfer/transferfrom and approval boolean reverts
Highlights only unchecked boolean return values for certain tokens (e.g. ZRX, BNB)
Highlights both transfer/transferfrom reverts and unchecked boolean return values
There are 2 impacts, although same fix is employed. Likely duplicates given same root cause of not using safe ERC20 transfers/approve
After discussions with @cvetanovv, planning to duplicate duplicates of #239 and #50 given same root cause of not using safe ERC20 transfers/approve. Given issue #239 has shown a potential high impact, all of its duplicates will be high severity as well based on sherlock duplications rules
Scenario A: There is a root cause/error/vulnerability A in the code. This vulnerability A -> leads to two attack paths:
- B -> high severity path
- C -> medium severity attack path/just identifying the vulnerability. Both B & C would not have been possible if error A did not exist in the first place. In this case, both B & C should be put together as duplicates.
The Lead Senior Watson signed off on the fix.
DenTonylifer
high
Anyone can steal pool shares from lender group if no-revert-on-failure tokens are used
Summary
Anyone can steal pool shares from lender group if no-revert-on-failure tokens are used.
Vulnerability Detail
The README says that the protocol supports all tokens from previous audit with an additional condition - tokens are assumed to be able to work with Uniswap V3.
ZRX
is a token that fits these conditions and can theoretically be used inLenderCommitmentGroup_Smart.sol
as a principal token. https://coinmarketcap.com/dexscan/ethereum/0xfa97aa5002124fe7edd36584628300e8d81df042/ An attacker can take advantage of this, because theaddPrincipalToCommitmentGroup()
function uses an outdated token transfer method:ZRX is a token that do not revert on failure, instead it simply returns a
bool
value that is not checked:Here is a simple POC that illustrates the issue: the transaction will not revert even if
balanceOf[msg.sender] < amount
, and the entire body of the function will be executed. Test this code in Remix: call thestealFunds()
function using a different address then at deploying:Impact
An attacker could call the function
addPrincipalToCommitmentGroup()
with arguments(ex. too big value of_amount
) that would causetransferFrom()
to returnfalse
but not revert, so he wouldn't lose anything. Then pool shares will be minted to his address, which he can exchange for principal tokens of other users using theburnSharesToWithdrawEarnings()
function:It will also break the calculation of an important variables
totalPrincipalTokensCommitted
andtotalPrincipalTokensWithdrawn
, which will have a bad effect on other users.Code Snippet
https://github.com/sherlock-audit/2024-04-teller-finance/blob/defe55469a2576735af67483acf31d623e13592d/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L313
Tool used
Manual Review
Recommendation
Consider using
safeTransferFrom()
instead oftransferFrom()
or check its return value and revert if it'sfalse
.