Platform: Code4rena
Start Date: 08/05/2023
Pot Size: $90,500 USDC
Total HM: 17
Participants: 102
Period: 7 days
Judge: 0xean
Total Solo HM: 4
Id: 236
League: ETH
Rank: 46/102
Findings: 1
Award: $192.11
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: berlin-101
Also found by: 0xadrii, Audit_Avengers_2, Emmanuel, Team_Rocket, YungChaza, bin2chen, fs0c, sashik_eth
192.105 USDC - $192.11
Impact is High. If erc777 tokens are added to the Vtoken contract as underlying, then that would enable malicious actor to brick the bidding process indefinitely by making a bid via malicious contract. once a valid bidder outbids him, the placebid function would transfer back the malicious bidders tokens, which could just keep reverting via the erc777 tokensreceived hook, ergo no one else can place any bids any longer.
Severity is Low since im assuming Vtokens added to a pool are done by owners/maintainers of the protocol, so they can validate beforehand whether underlying is erc777 or not, and only add underlyings that dont fire a transfer hook.
if (auction.auctionType == AuctionType.LARGE_POOL_DEBT) { if (auction.highestBidder != address(0)) { uint256 previousBidAmount = ((auction.marketDebt[auction.markets[i]] * auction.highestBidBps) / MAX_BPS); //@audit if token is erc777, malicious actor can just revert transaction via hook erc20.safeTransfer(auction.highestBidder, previousBidAmount); } uint256 currentBidAmount = ((auction.marketDebt[auction.markets[i]] * bidBps) / MAX_BPS); erc20.safeTransferFrom(msg.sender, address(this), currentBidAmount); } else { if (auction.highestBidder != address(0)) { //@audit if token is erc777, malicious actor can just revert transaction via hook erc20.safeTransfer(auction.highestBidder, auction.marketDebt[auction.markets[i]]); } erc20.safeTransferFrom(msg.sender, address(this), auction.marketDebt[auction.markets[i]]); }
As you can see from code above, the placebid function attempts to return the bidded tokens to the previous bidder, but if the underlying is an erc777 and the previous bidder is a contract, they can just force the hook to revert always, thereby disabling the ability to place any bids by anyone.
Do not add erc777 or another other tokens that fire hooks on transfer. this could be also validated by a helper method for instance that is called when the underlying is sanity checked within the Vtoken contract.
// Set underlying and sanity check it underlying = underlying_; IERC20Upgradeable(underlying).totalSupply(); require(!isERC777(underlying), "ERC777 tokens are not allowed"); //@audit
DoS
#0 - c4-judge
2023-05-18T02:33:12Z
0xean marked the issue as duplicate of #513
#1 - c4-judge
2023-05-18T02:33:37Z
0xean marked the issue as not a duplicate
#2 - c4-judge
2023-05-18T02:33:51Z
0xean marked the issue as duplicate of #376
#3 - c4-judge
2023-06-05T14:05:02Z
0xean marked the issue as satisfactory