Canto contest - p4st13r4'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: 10/59

Findings: 10

Award: $3,134.46

🌟 Selected for report: 2

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: Soosh

Also found by: 0x1f8b, Ruhum, TerrierLover, WatchPug, cccz, csanuragjain, hake, p4st13r4, zzzitron

Labels

bug
duplicate
3 (High Risk)

Awards

782.2807 CANTO - $126.34

126.3383 USDC - $126.34

External Links

Lines of code

https://github.com/Plex-Engineer/manifest/blob/688e9b4e7835854c22ef44b045d6d226b784b4b8/contracts/Proposal-Store.sol#L49

Vulnerability details

Impact

Affected code:

The function AddProposal() allows anyone to manipulate the mapping of proposals, which means that anyone is able to add new proposals, as well as to replace existing ones. This is malicious behaviour which could led to governance wrongdoings

Tools Used

Editor

The function is possibly missing some access control guard. Anyway, the contract should keep a lastProposal variable, use it anytime a new proposal is created, and increment it later

#0 - tkkwon1998

2022-06-22T19:45:28Z

Duplicate of #26

#1 - GalloDaSballo

2022-08-10T22:14:19Z

Dup of #26

Findings Information

🌟 Selected for report: Tutturu

Also found by: 0x52, WatchPug, hyh, p4st13r4

Labels

bug
duplicate
3 (High Risk)

Awards

2649.5985 CANTO - $427.91

427.9102 USDC - $427.91

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L43 https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L54 https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L114 https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L198 https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L214 https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L310

Vulnerability details

Impact

Affected code:

When calling borrowFresh(), the contract checks that initial balance of Note for the contract itself is zero and that after the mint the balance is exactly equal to the mint amount. This is very dangerous because an attacker could transfer 1 wei to the contract and make impossible for everybody to actually borrow any money.

This checks are spread into all the other functions of the contract: repayBorrowFresh(), mintFresh(), redeemFresh(). The impact is exactly the same (DOS), but during different phases of the interactions with the contract.

Proof of Concept

  1. Attacker deposit 1 wei of Note to CNote.sol contract
  2. Now anyone that calls borrowFresh has the tx revert with the reason CNote::borrowFresh:Impossible reserves in CNote market Place

Tools Used

Editor

Remove the checks for zero amounts, and transform the == checks into >= checks

#0 - ecmendenhall

2022-06-21T22:51:24Z

#1 - tkkwon1998

2022-06-22T19:47:33Z

Duplicate of #227

Findings Information

🌟 Selected for report: p4st13r4

Also found by: Ruhum, TerrierLover, WatchPug, hansfriese, zzzitron

Labels

bug
3 (High Risk)
sponsor confirmed

Awards

320.9326 USDC - $320.93

1987.1989 CANTO - $320.93

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/WETH.sol#L47

Vulnerability details

Impact

Affected code:

WETH.sol is almost copied from the infamous WETH contract that lives in mainnet. This contract is supposed to receive the native currency of the blockchain (for example ETH) and wrap it into a tokenized, ERC-20 form. This contract computes the totalSupply() using the balance of the contract itself stored in the balanceOf mapping, when instead it should be using the native balance function. This way, totalSupply() always returns zero as the WETH contract itself has no way of calling deposit to itself and increase its own balance

Proof of Concept

  1. Alice transfers 100 ETH to WETH.sol
  2. Alice calls balanceOf() for her address and it returns 100 WETH
  3. Alice calls totalSupply(), expecting to see 100 WETH, but it returns 0

Tools Used

Editor

function totalSupply() public view returns (uint) {
    return address(this).balance
}

#0 - GalloDaSballo

2022-08-10T22:31:43Z

The warden has shown how, due to a programming mistake, the WETH totalSupply will be incorrect.

Mitigation seems straightforward, however, because the vulnerability would have causes totalSupply to return 0, and shows a broken functionality for a core contract, I think High Severity to be appropriate

#1 - auditor0517

2022-08-15T08:05:24Z

I think #218 is a different issue from #191. #218 is for WETH.allowance() and #191 is for WETH.totalSupply().

#2 - auditor0517

2022-08-15T08:07:55Z

I see GalloDaSballo said that #218 should be High with the similar reason of #191.

Findings Information

🌟 Selected for report: WatchPug

Also found by: Lambda, Tutturu, catchup, p4st13r4

Labels

bug
duplicate
3 (High Risk)

Awards

427.9102 USDC - $427.91

2649.5985 CANTO - $427.91

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/Note.sol#L13

Vulnerability details

Impact

Affected code:

The function _mint_to_Accountant() is supposed to be called after contract initialization, so that the accountant is immediately set and all the tokens are mint to them. However, this function completely lacks any access control (it’s just external) so an attacker can monitor the mempool and frontrun the transaction in order to become accountant and own all the Note tokens

Tools Used

Editor

The function should have a guard that regulates access control

#0 - tkkwon1998

2022-06-22T19:46:51Z

Duplicate of #173

#1 - GalloDaSballo

2022-08-12T00:34:01Z

Dup of #173

Findings Information

🌟 Selected for report: p4st13r4

Also found by: 0x52, Tutturu

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

264.1421 USDC - $264.14

1635.5547 CANTO - $264.14

External Links

Lines of code

https://github.com/Plex-Engineer/lending-market/blob/ab31a612be354e252d72faead63d86b844172761/contracts/CNote.sol#L14

Vulnerability details

Impact

Affected code:

The function _setAccountantContract() is supposed to be called after contract initialization, so that the accountant is immediately set. However, this function completely lacks any access control (it’s just public) so an attacker can monitor the mempool and frontrun the transaction in order to become both accountant and admin

Tools Used

Editor

The function should:

  1. have a guard that regulates access control
  2. not set the admin too, which is dangerous and out of scope

#0 - GalloDaSballo

2022-08-04T17:32:25Z

Frontrunnable Initializer without POC (is impact having to re-deploy?)

Pretty confident will downgrade

#1 - GalloDaSballo

2022-08-12T00:32:54Z

The warden has shown how, due to front-running, anyone can become the accountant, with the information I have I think the worst case scenario is a re-deploy.

Because the setter could have been written in a better way, but because the realistic consequence is a re-deploy I think Medium Severity to be more appropriate

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