Canto v2 contest - Lambda's results

Execution layer for original work.

General Information

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

Canto

Findings Distribution

Researcher Performance

Rank: 5/50

Findings: 4

Award: $2,274.77

🌟 Selected for report: 1

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: 0x1f8b

Also found by: Lambda

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed

Awards

1074.0464 USDC - $1,074.05

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market-v2/blob/2646a7676b721db8a7754bf5503dcd712eab2f8a/contracts/CNote.sol#L148

Vulnerability details

Impact

In doTransferOut, the underlying balance of the CNote has to be 0 after the transfer. While this works fine when the underlying balance of the CNote was 0 before the call (i.e., in the normal case), the function will always revert when the balance was greater than 0 before the transfer. An attacker can therefore block all withdrawals by sending a tiny amount of the underlying token to the CNote.

Proof of Concept

User A holds multiple CNotes with an arbitrary underlying Token TKN. After some time, he wants to redeem his CNote for TKN and therefore calls redeemFresh. However, before he does that, an attacker transfers 1 TKN to the contract address of the CNote. In doTransferOut, amount is sent to the CNote and then transferred to user A. However, after the transfer, token.balanceOf(address(this)) > 0, meaning the transfer will always fail.

Store the balance before the transfer and check that the difference is equal to the amount.

#0 - GalloDaSballo

2022-08-16T15:49:54Z

Dup of #43

Findings Information

🌟 Selected for report: Lambda

Also found by: Chom

Labels

bug
3 (High Risk)
sponsor confirmed

Awards

1074.0464 USDC - $1,074.05

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market-v2/blob/2646a7676b721db8a7754bf5503dcd712eab2f8a/contracts/NoteInterest.sol#L118 https://github.com/Plex-Engineer/lending-market-v2/blob/2646a7676b721db8a7754bf5503dcd712eab2f8a/contracts/CToken.sol#L209

Vulnerability details

Impact

According to the documentation in InterestRateModel, getBorrowRate has to return the borrow rate per block and the function borrowRatePerBlock in CToken directly returns the value of getBorrowRate. However, the rate per year is returned for NoteInterest. Therefore, using NoteInterest as an interest model will result in completely wrong values.

Return baseRatePerBlock.

#0 - GalloDaSballo

2022-08-16T16:54:34Z

The warden has shown that the borroRate is returning per-year values instead of per-block values

The effect of this is that the accounting will be magnified massively.

While impact should be mostly loss of value to interest and incorrect yield, due to the math being wrong I do agree with High Severity

Awards

104.8725 USDC - $104.87

Labels

bug
QA (Quality Assurance)

External Links

#0 - GalloDaSballo

2022-08-13T22:48:02Z

Existing proposals can be overwritten in the function AddProposal

Valid Low

This comment in Proposal-Store.sol

NC

In NoteInterest.sol, it is mentioned that adjusterCoefficient

Because the comment leads to believe the intended default value should be 1, but the value is 0, I think Low is appropriate

This check in CErc20.sol is problematic for tokens that have multiple entry points

This is the TUSD vuln, I think exploited against Rari or Scream

See POC: https://github.com/Rivaill/CryptoVulhub/tree/master/CompoundTUSDSweepTokenBypass

Consider checking for the 0 address

Valid Low

In ProposalStore.go,

NC

In the function doTransferIn

NC

Amazing little report, decent format, concise, great to see!

#1 - GalloDaSballo

2022-08-13T22:48:16Z

4L 3NC

#2 - GalloDaSballo

2022-08-16T21:12:19Z

Because no Med Submission mentioned the double address, I think Low is still correct here

Additionally, with the information that we have (Code under scope), the sponsor is not going to deploy a token with two addresses, so for that reason I think Low is appropriate

Awards

21.8032 USDC - $21.80

Labels

bug
G (Gas Optimization)

External Links

In NoteInterest.sol and Timelock.sol, SafeMath is used, although the Solidity version is >= 0.8.0.

#0 - GalloDaSballo

2022-08-14T20:50:37Z

Saves 20 gas

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