prePO contest - leastwood's results

Gain exposure to pre-IPO companies & pre-token projects.

General Information

Platform: Code4rena

Start Date: 17/03/2022

Pot Size: $30,000 USDC

Total HM: 8

Participants: 43

Period: 3 days

Judge: gzeon

Total Solo HM: 5

Id: 100

League: ETH

prePO

Findings Distribution

Researcher Performance

Rank: 4/43

Findings: 3

Award: $2,416.96

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: cmichel

Also found by: IllIllI, leastwood

Labels

bug
duplicate
3 (High Risk)

Awards

1819.2911 USDC - $1,819.29

External Links

Lines of code

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/Collateral.sol#L95-L135

Vulnerability details

Impact

Withdrawals can be initiated by accounts by calling the initiateWithdrawal function. A block delay is enforced with an expiration to prevent flash loan attacks on the protocol. However, because withdrawal requests are conducted on the account's token balance, request amounts can be replicated by calling initiateWithdrawal on some small amount, sending tokens to another account and calling initiateWithdrawal again. This completely negates any flash loan protection that may be enforced.

Proof of Concept

Consider the following scenario:

  • Alice has deposited 100 of her own tokens into the Collateral.sol contract.
  • Alice calls initiateWithdrawal on these 100 tokens.
  • She then sends 100 tokens to 10 other accounts and calls initiateWithdrawal on these accounts.
  • Alice then constructs an exploit using a flash loan consisting of 1000 tokens. Because Alice has set up 10 accounts which can actively withdraw, she is able to withdraw the tokens and repay the flash loan.

Tools Used

Manual code review.

Consider checking the account's token balance is greater than the _amount to withdraw in _processDelayedWithdrawal. Alternatively, you can setup _transfer to reset the sender's active withdrawal request.

#0 - ramenforbreakfast

2022-03-24T06:36:16Z

duplicate of #54

#1 - gzeoneth

2022-04-03T13:32:26Z

Upgrading to high risk to align with #54

Findings Information

🌟 Selected for report: GreyArt

Also found by: leastwood

Labels

bug
duplicate
2 (Med Risk)

Awards

545.7873 USDC - $545.79

External Links

Lines of code

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/PrePOMarket.sol

Vulnerability details

Impact

The _expiryTime variable is stored in the PrePOMarket.sol contract but not enforced anywhere in the contract. As a result, if a public offering never comes to fruition, then _finalLongPrice will never be set and hence users will be expected to redeem collateral tokens by transferring an equivalent amount of short and long tokens. Because short and long tokens are traded on the secondary market, it is highly likely that users will not be able to redeem all available collateral tokens due to LP fees and market slippage. Every collateral redemption will leave some dust balance in the market contract that cannot be claimed.

Proof of Concept

Tools Used

Manual code review.

Consider enforcing market expiration onchain. After expiration, the PrePOMarket.sol contract should treat long and short tokens as of equivalent value such that collateral redemption is symmetrical in nature.

#0 - ramenforbreakfast

2022-03-24T06:36:38Z

duplicate of #28

#1 - gzeoneth

2022-04-03T13:29:46Z

Agree with sponsor

Awards

51.8842 USDC - $51.88

Labels

bug
QA (Quality Assurance)
sponsor disputed

External Links

Lines of code

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/Collateral.sol#L15

Vulnerability details

Impact

Because the Collateral.sol contract utilises ERC20Upgradeable, it is expected that this contract will deployed under some proxy contract setup. This gives the contract owner the power to deploy new implementation contracts with different logic but the same storage. However, because the contract owner has these privileges, it is possible for the implementation contract to contain a malicious function allowing them to withdraw all deposited tokens, effectively rugpulling the protocol.

Proof of Concept

Tools Used

Manual code review.

Ensure this is understood and consider making Collateral.sol contracts immutable. There is little to no benefit in making the Collateral.sol contract upgradable and it adds additional trust dependencies to the protocol.

#0 - ramenforbreakfast

2022-03-24T06:43:56Z

I consider this issue to be invalid since it breaks trust assumptions embedded within the project.

#1 - gzeoneth

2022-04-03T14:02:31Z

Considering the project described the owner as a timelocked DAO multisig, I am downgrading this to Low/QA. Treating this as warden's QA Report.

#2 - JeeberC4

2022-04-12T18:27:41Z

Per judges downgrade to QA Report, preserving original title: Contract Owner Can Rugpull Collateral.sol

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