Platform: Code4rena
Start Date: 14/06/2022
Pot Size: $100,000 USDC
Total HM: 26
Participants: 59
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 9
Id: 133
League: ETH
Rank: 25/59
Findings: 5
Award: $828.01
🌟 Selected for report: 1
🚀 Solo Findings: 0
126.3383 USDC - $126.34
782.2807 CANTO - $126.34
The updateBaseRate()
function is public and lacks access control, so anyone can set the critical variable baseRatePerYear
once the block delta has surpassed the updateFrequency
variable. This will have negative effects on the borrow and supply rates used anywhere else in the protocol.
The updateFrequency is explained to default to 24 hours per the comments, so this vulnerability will be available every day. Important to note, the admin can fix the baseRatePerYear
by calling the admin-only _setBaseRatePerYear()
function. However, calling this function does not set the lastUpdateBlock
so users will still be able to change the rate back after the 24 hours waiting period from the previous change.
function updateBaseRate(uint newBaseRatePerYear) public { // check the current block number uint blockNumber = block.number; uint deltaBlocks = blockNumber.sub(lastUpdateBlock); if (deltaBlocks > updateFrequency) { // pass in a base rate per year baseRatePerYear = newBaseRatePerYear; lastUpdateBlock = blockNumber; emit NewInterestParams(baseRatePerYear); } }
Manual review.
I have trouble understanding the intention of this function. It appears that the rate should only be able to be set by the admin, so the _setBaseRatePerYear()
function seems sufficient. Otherwise, add access control for only trusted parties.
#0 - GalloDaSballo
2022-08-04T17:39:49Z
The warden has shown how, due to probably an oversight, a core function that has impact in determining the yearly interest rate was left open for anyone to change once every 24 hrs.
Because the impact is:
And anyone can perform it
I believe that High Severity is appropriate.
Mitigation requires either deleting the function or adding access control
1207.2233 CANTO - $194.97
194.9666 USDC - $194.97
The approval logic is incorrect in WETH.sol
. Given that there are no references to msg.sender
, the approval parameters are simply inputs. This means that an attacker can set approvals on anyone's tokens.
An attacker calls:
approve(tokenOwner, attacker);
This calls:
_approve(tokenOwner, attacker, _balanceOf[tokenOwner]);
Which sets the allowance for the attacker to spend the owner's entire balance:
_allowance[tokenOwner][attacker] = amount;
Manual review.
The top-level approve()
function needs to take msg.sender
as the owner
parameter so that the owner is not set arbitrarily.
#0 - tkkwon1998
2022-06-21T03:27:54Z
duplicate of issue #19
#1 - GalloDaSballo
2022-08-04T20:03:38Z
Dup of #19
🌟 Selected for report: joestakey
Also found by: 0x1f8b, 0x29A, 0x52, 0xDjango, 0xNazgul, 0xf15ers, 0xmint, Bronicle, Dravee, Funen, JMukesh, Limbooo, MadWookie, Picodes, Ruhum, TerrierLover, TomJ, Tutturu, WatchPug, Waze, _Adam, asutorufos, c3phas, catchup, cccz, codexploder, cryptphi, csanuragjain, defsec, fatherOfBlocks, gzeon, hake, hansfriese, hyh, ignacio, k, nxrblsrpr, oyc_109, robee, sach1r0, saian, simon135, technicallyty, zzzitron
74.2759 USDC - $74.28
687.9945 CANTO - $111.11
to
in mint() event emission similar to burn()https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Governance/GovernorBravoDelegate.sol#L162 https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Accountant/AccountantDelegator.sol#L42 https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Treasury/TreasuryDelegator.sol#L29
#0 - GalloDaSballo
2022-08-01T23:04:37Z
Comp engineers are prepared for the downfall of secp256k1
Valid Refactoring
NC
Valid Ref
Valid Ref
Valid Ref
Valid NC
4 R 2 NC