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: 31/59
Findings: 4
Award: $539.94
🌟 Selected for report: 0
🚀 Solo Findings: 0
126.3383 USDC - $126.34
782.2807 CANTO - $126.34
updateBaseRate()
was a publicly accessible function, which allowed any user to set an arbitrary value for the baseRatePerYear
variable after a 24 hour delay from the last time it was set. This value was used in the calculation of the getBorrowRate()
and getSupplyRate()
functions, which in turn influenced rates for Notes.
The issue was simple to identify and execute, but given that the value could be reset by an admin calling the _setBaseRatePerYear()
function and the requirement of a 24 hour delay, the issue was rated as a medium.
N/A
N/A
The intent behind the function was not internally clear. If the intention was to users to control the function, some validation should be put in place to ensure the value is within certain bounds (e.g. min-max bounds or within a certain percentage of the last value set). If the function should not be publicly accessible, access control should be added to ensure only specific accounts can call the function.
#0 - nivasan1
2022-06-23T02:26:28Z
duplicate of #22
🌟 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
72.3808 USDC - $72.38
687.9945 CANTO - $111.11
_internalFunction()
). Usage of underscore naming was unconventional and inconsistent throughout the codebase. For example, in Comptroller.sol functions prefixed with underscores included:
_setPriceOracle
- public function_setCloseFactor
- external function_addMarketInternal
- internal function
It is recommended that a consistent naming pattern is used for functions to improve with readability and communicate clearly what the visibility of the function should be.TODO
comments (e.g. 1 and unused variables (e.g. 2) were found throughout the codebase, which made it difficult to establish what was and wasn’t intended functionality.canceled
→ cancelled
for proposal type. This should be changed in the struct, as well as the comments and events that reference it https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Governance/GovernorBravoInterfaces.sol#L102 and in events and commentsarity
→ parity
https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Governance/GovernorBravoDelegate.sol#L45#0 - GalloDaSballo
2022-08-02T20:47:48Z
R
NC
Both are invalid
canceled
is fine
arity
means amount of inputs
in nerd-speak
1 R 1 NC
🌟 Selected for report: _Adam
Also found by: 0v3rf10w, 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, 0xf15ers, 0xkatana, 0xmint, Chom, Dravee, Fitraldys, Funen, JC, Limbooo, MadWookie, Picodes, Ruhum, TerrierLover, TomJ, Tomio, Waze, ak1, c3phas, catchup, defsec, fatherOfBlocks, gzeon, hake, hansfriese, joestakey, k, oyc_109, rfa, robee, sach1r0, saian, simon135, ynnad
39.6748 USDC - $39.67
396.9199 CANTO - $64.10
assert
BaseV1-periphery.sol#L82 made use of assert
in the fallback function to ensure the caller was only ever the WETH contract. As assert
should only be used to examine invariants and test for internal problems, the use of assert
here appears to be inappropriate as a user may accidentally call into the fallback function when interacting with the contract.
The GovernorBravoDelegate contract made use of Solidity ^0.8.10, while also using add256()
and sub256()
functions to validate for under- and overflows. As the operations were not delimited by unchecked
blocks, it was safe to perform the operations without using the safe function equivalents - which wasted gas.
require
messagesrequire
statements were used throughout the codebase. Replacing all require
statements with custom errors will reduce the gas cost of deployment, as well as runtime costs when the revert condition is met.
#0 - GalloDaSballo
2022-08-04T00:30:48Z
10 gas saved
#1 - GalloDaSballo
2022-08-04T00:30:53Z
Report looks nice I guess