Platform: Code4rena
Start Date: 05/07/2023
Pot Size: $390,000 USDC
Total HM: 136
Participants: 132
Period: about 1 month
Judge: LSDan
Total Solo HM: 56
Id: 261
League: ETH
Rank: 40/132
Findings: 7
Award: $1,273.01
🌟 Selected for report: 1
🚀 Solo Findings: 1
🌟 Selected for report: Ack
Also found by: 0xG0P1, 0xRobocop, 0xStalin, KIntern_NA, Koolex, Oxsadeeq, RedOneN, TiesStevelink, ayeslick, bin2chen, cergyk, kaden, ladboy233, ltyu, plainshift, rvierdiiev, xuwinnie, zzzitron
20.4247 USDC - $20.42
https://github.com/Tapioca-DAO/tapioca-bar-audit/blob/master/contracts/markets/bigBang/BigBang.sol#L288 https://github.com/Tapioca-DAO/tapioca-bar-audit/blob/master/contracts/markets/singularity/Singularity.sol#L235
The allowedBorrow()
modifier on the addCollateral()
checks if msg.sender
is allowed to interact on from
’s behalf via an allowanceBorrow
mapping located in the MarketERC20
contract. If so _addCollateral()
is called. An if statement checks if share
is zero if so it sets share
to the value returned by the call to yieldBox.toShare
where amount is used.
An operator can set share
to zero which passes the check in the allowedBorrow()
modifier since 0 isn’t greater than 0. An operator can set amount
to a number that doesn’t exceed the amount of collateral from
has. When _addCollateral()
sees that share == 0
it will set share
to the value returned from yieldBox.toShare
using amount
passed in by the operator. From here share
is added to the operator’s address and then deducted from from
. The operator can then withdraw this collateral via removeCollateral()
.
Operator calls addCollateral setting to
to an address he controls, from to a customer, amount to an amount from has, and share to zero.
Operator bypasses the allowedBorrow modifier with share set to zero.
In _addCollateral attackers share is adjusted by yieldBox.toShare using the amount the operator passed in
Share is added to the operator
Share is deducted from customer
Operator then calls removeCollateral with share matching the share he just received
Operator receives collateral
manual
Remove amount variable.
OR
Don’t allow share to be zero.
Other
#0 - c4-pre-sort
2023-08-05T02:55:42Z
minhquanym marked the issue as duplicate of #55
#1 - c4-judge
2023-09-12T17:31:20Z
dmvt marked the issue as satisfactory
154.5795 USDC - $154.58
https://github.com/Tapioca-DAO/tapioca-bar-audit/blob/master/contracts/usd0/USDO.sol#L88
Based on the name, maxFlashLoan()
, one assumes the goal is to prevent customers from obtaining too much, >maxFlashMint
, USDO via flashMint()
for a given transaction. However, when onFlashLoan()
is called on the receiver
contract it can call flashLoan()
again to receive more tokens beyond maxFlashMint
.
This is because maxFlashLoan()
checks if amount
is greater than maxFlashMint
not if the total amount the receiver
has minted is >maxFlashMint
.
flashLoan()
flashLoan()
againcontract ReceiverContract { ITapiocaFlashLoan public tapioca; uint256 public loop; constructor(address _tapioca) { tapioca = ITapiocaFlashLoan(_tapioca); } function initiateFlashLoan(uint256 amount) public { tapioca.flashLoan(address(this), amount); } function onFlashLoan(uint256 amount) external { ++loop; if (loop < 3) { tapioca.flashLoan(address(this), amount); } // Logic to handle the flash loan } }
manual
In the maxLoan()
do the following:
if (totalSupply() + amount > maxFlashMint) revert();
Other
#0 - c4-pre-sort
2023-08-05T10:35:15Z
minhquanym marked the issue as duplicate of #1043
#1 - c4-judge
2023-09-18T14:59:04Z
dmvt changed the severity to 3 (High Risk)
#2 - c4-judge
2023-09-18T15:08:01Z
dmvt marked the issue as satisfactory
🌟 Selected for report: ayeslick
1008.3444 USDC - $1,008.34
https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/aave/AaveStrategy.sol#L192 https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/curve/TricryptoNativeStrategy.sol#L169 https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/convex/ConvexTricryptoStrategy.sol#L206 https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/curve/TricryptoLPStrategy.sol#L178
When swapper.getOutputAmount
is reached swapData
and a blank string, ""
, are passed. CurveSwappers’ getOutputAmount
expects dexOption
s to be an array of uint256
, not a blank string, “”
. As a result, the transaction will revert which will prevent these strategies from compounding.
manual
If CurveSwapper ensure that the correct parameters are passed
DoS
#0 - c4-pre-sort
2023-08-08T14:38:49Z
minhquanym marked the issue as primary issue
#1 - c4-sponsor
2023-08-25T16:55:41Z
0xRektora marked the issue as sponsor confirmed
#2 - c4-judge
2023-09-30T14:35:43Z
dmvt marked the issue as selected for report
46.3738 USDC - $46.37
Singularity, Penrose, and USDO implement a pause feature that when it's activated prevents customers from taking any actions. This can negatively impact a customer who is close to liquidation when a pause occurs. It is possible that by the time the pause ends, the customer's position will be liquidatable. As such, unless the customer has an MEV liquidation bot that beats out other bots to repay his debt before they liquidate his position. Running such a bot seems like a high barrier to set for customers.
manual
Implement a method(s) that smoothly transitions the accumulated changes over time rather than applying them all at once when the contract is unpaused. If possible, take a snapshot of the relevant state variables at the time of pausing, and restore that snapshot when unpausing, followed by a gradual adjustment to the current state.
Other
#0 - c4-pre-sort
2023-08-04T23:44:21Z
minhquanym marked the issue as duplicate of #1169
#1 - c4-judge
2023-09-29T19:16:18Z
dmvt marked the issue as satisfactory
🌟 Selected for report: 0xWaitress
Also found by: Ack, BPZ, Breeje, LosPollosHermanos, Madalad, Nyx, Ruhum, SaeedAlipoor01988, ayeslick, c7e7eff, carrotsmuggler, cergyk, dirk_y, hack3r-0m, iglyx, kaden, kodyvim, kutugu, ladboy233, ltyu, mojito_auditor, n1punp, rvierdiiev, unsafesol, zzzitron
2.1417 USDC - $2.14
https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/aave/AaveStrategy.sol#L192 https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/curve/TricryptoLPStrategy.sol#L178 https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/curve/TricryptoNativeStrategy.sol#L169 https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/master/contracts/convex/ConvexTricryptoStrategy.sol#L206
If swapper
uses UniswapV2Swapper
then calcAmount
is determined by calling the getAmountsOut()
on the UniswapV2 router
, resulting in a spot price at that specific moment. This can allow an MEV bot to strategically place transactions around a call to the compound()
. By front-running the call, the bot can manipulate the price, and then by back-running, it can further exploit the price difference.
manual
Use TWAP instead of spot pricing.
MEV
#0 - c4-pre-sort
2023-08-08T14:40:26Z
minhquanym marked the issue as duplicate of #245
#1 - c4-judge
2023-09-22T22:17:43Z
dmvt marked the issue as satisfactory