Canto contest - 0xDjango's results

Execution layer for original work.

General Information

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

Canto

Findings Distribution

Researcher Performance

Rank: 25/59

Findings: 5

Award: $828.01

🌟 Selected for report: 1

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: 0xDjango

Also found by: 0x52, Chom, JMukesh, Picodes, Soosh, WatchPug, csanuragjain, k, oyc_109

Labels

bug
3 (High Risk)
sponsor confirmed

Awards

126.3383 USDC - $126.34

782.2807 CANTO - $126.34

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/NoteInterest.sol#L118-L129

Vulnerability details

Impact

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.

Proof of Concept

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); } }

Tools Used

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:

  • Potential bricking of integrating contracts
  • Economic exploits

And anyone can perform it

I believe that High Severity is appropriate.

Mitigation requires either deleting the function or adding access control

Findings Information

🌟 Selected for report: Soosh

Also found by: 0x52, 0xDjango, TerrierLover, WatchPug, cccz, saian, zzzitron

Labels

bug
duplicate
3 (High Risk)

Awards

1207.2233 CANTO - $194.97

194.9666 USDC - $194.97

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/WETH.sol#L85-L101

Vulnerability details

Impact

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.

Proof of Concept

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;

Tools Used

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

Awards

74.2759 USDC - $74.28

687.9945 CANTO - $111.11

Labels

bug
QA (Quality Assurance)

External Links

#0 - GalloDaSballo

2022-08-01T23:04:37Z

[L-01] It's not possible for msg.sender to equal address(0)

Comp engineers are prepared for the downfall of secp256k1

Valid Refactoring

[N-01] Add to in mint() event emission similar to burn()

NC

[N-02] Consants should be all caps

Valid Ref

[N-03] Interfaces should start with "I"

Valid Ref

[N-04] External/public functions should not start with "_". Reserved for internal/private functions.

Valid Ref

[N-05] Extra space in parameters

Valid NC

4 R 2 NC

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter