Platform: Code4rena
Start Date: 25/10/2022
Pot Size: $50,000 USDC
Total HM: 18
Participants: 127
Period: 5 days
Judge: 0xean
Total Solo HM: 9
Id: 175
League: ETH
Rank: 82/127
Findings: 1
Award: $36.73
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0x1f8b
Also found by: 0xNazgul, 0xSmartContract, Aymen0909, B2, Bnke0x0, Deivitto, Diana, Dinesh11G, ElKu, JC, Josiah, Rahoz, RaymondFam, ReyAdmirado, Rolezn, Waze, __141345__, adriro, aphak5010, brgltd, c3phas, c7e7eff, carlitox477, cducrest, ch0bu, chrisdior4, cryptonue, cryptostellar5, cylzxje, d3e4, delfin454000, enckrish, evmwanderer, fatherOfBlocks, gogo, hansfriese, horsefacts, immeas, leosathya, lukris02, neumo, oyc_109, pedr02b2, rbserver, robee, rotcivegaf, rvierdiiev, sakshamguruji, shark, simon135, tnevler, trustindistrust, wagmi
36.7345 USDC - $36.73
Description: If there is an existing allowance from Alice to Bob of x, and Alice wants to update it to y, she will call
approve(Bob, y)
. If before transaction execution (e.g. via front-running) Bob calls transferFrom(Alice, Bob, x)
, he will
be able to withdraw x
before the approval and y
again after the execution of Alice's approve
. The same reasoning applies
to the permit
function.
Suggestion: Add a require(allowance[msg.sender][spender] == 0)
in approve
and require(allowance[owner][spender] == 0)
in permit
.
Reference: https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L159 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L224
Description: The protocol makes no sense and is vulnerable if dbr.replenishmentPriceBps
is lower than 10_000
.
It would mean the replenishment costs are lower than the amount minted to users on replenishment (i.e. the market operates at a loss).
Suggestion: Add require(replenishmentPriceBps >= 10_000)
in constructor and setReplenishmentPriceBps
of DolaBorrowingRights
Reference: https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L330
Description: In market.sol setLiquidationFactorBps
and setReplenismentIncentiveBps
cannot set the liquidationFactorBps
and replenishmentIncentiveBps
to 0
while the constructor can.
Suggestion: Use similar requirements in the constructor and setters function
Reference: https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L161 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L172
#0 - c4-judge
2022-11-08T00:31:12Z
0xean marked the issue as grade-b