Platform: Code4rena
Start Date: 28/06/2022
Pot Size: $25,000 USDC
Total HM: 14
Participants: 50
Period: 4 days
Judge: GalloDaSballo
Total Solo HM: 7
Id: 141
League: ETH
Rank: 37/50
Findings: 1
Award: $43.14
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: zzzitron
Also found by: 0v3rf10w, 0x1f8b, 0x29A, AlleyCat, Bnke0x0, Chom, Funen, JC, Lambda, Limbooo, Meera, Picodes, Sm4rty, TerrierLover, TomJ, __141345__, asutorufos, aysha, c3phas, cccz, defsec, fatherOfBlocks, grGred, hake, ignacio, ladboy233, mrpathfindr, oyc_109, rfa, sach1r0, samruna, slywaters, ynnad
43.1396 USDC - $43.14
Governance/Comp.sol is an ERC20 and it is not preventing allowance front-running issue, approving tokens to other accounts might be vulnerable to the front-running attack. more info here
in Governance/Comp.sol#approve() if there is non empty value in allowances[account][spender]
the spender can use the 2 of the approvment even if the original account didn't want this.
Define increaseAllowance and decreaseAllowance as ERC20 implementation.
or revert when allowances[account][spender]
has a value only if the amount approved != 0 so the approver can cancel his approvement.
When use msg.sender == address(0)
its actually never would be true
in every cases. I believe it's a mistake and it's meant to revert when updatedAddress == address(0)
.
when pendingAdmin
call CToken.sol#_acceptAdmin()
and Unitroller.sol#_acceptAdmin()
will take the pendingAdmin
from storage and assign it as admin. But when contract initialize pendingAdmin
will be address(0)
and this is never checked either in CToken.sol#_setPendingAdmin()
nor in Unitroller.sol#_setPendingAdmin()
.
In these lines: CToken.sol#_acceptAdmin()
and Unitroller.sol#_acceptAdmin()
// Check caller is pendingAdmin and pendingAdmin ≠address(0) if (msg.sender != pendingAdmin || msg.sender == address(0)) { ...
I believe it meant to be
if (msg.sender != pendingAdmin) { ...
or
if (msg.sender != admin && pendingAdmin == address(0)) { ...
#0 - GalloDaSballo
2022-08-13T22:50:53Z
Disputed as the allowance front-running is not to be fixed by the token, but by the caller, see the standard <img width="1457" alt="Screenshot 2022-08-14 at 00 49 43" src="https://user-images.githubusercontent.com/13383782/184515818-120f0877-d1a7-4f75-a378-324792fb406c.png">
NC
1 NC