Popcorn contest - Ada's results

A multi-chain regenerative yield-optimizing protocol.

General Information

Platform: Code4rena

Start Date: 31/01/2023

Pot Size: $90,500 USDC

Total HM: 47

Participants: 169

Period: 7 days

Judge: LSDan

Total Solo HM: 9

Id: 211

League: ETH

Popcorn

Findings Distribution

Researcher Performance

Rank: 67/169

Findings: 1

Award: $122.61

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: ustas

Also found by: 0xRobocop, Ada, bin2chen, georgits, gjaldon, hashminer0725, ktg, mert_eren, okkothejawa, pwnforce

Labels

bug
3 (High Risk)
satisfactory
sponsor confirmed
upgraded by judge
edited-by-warden
duplicate-45

Awards

122.6059 USDC - $122.61

External Links

Lines of code

https://github.com/code-423n4/2023-01-popcorn/blob/d95fc31449c260901811196d617366d6352258cd/src/vault/VaultController.sol#L666-L670

Vulnerability details

Impact

The function _verifyCreatorOrOwner(address vault) internal returns (VaultMetadata memory metadata) {} is used to verify that the caller is the creator of the vault or owner of VaultController (admin rights). However, the if statement logic mistakenly used || instead of using &&, which leads to the verification always reverts.

These functions listed below were affected.

function addStakingRewardsTokens(address[] memory vaults, bytes[] memory rewardTokenData) public {} function pauseAdapters(address[] calldata vaults) external {} function pauseVaults(address[] calldata vaults) external {} function unpauseAdapters(address[] calldata vaults) external {} function unpauseVaults(address[] calldata vaults) external {}

Proof of Concept

Set the msg.sender to creator, the if statement is true (0 || 1 = 1) the verification reverts. Set the msg.sender to owner, the if statement is true (1 || 0 = 1) the verification reverts. Set the msg.sender to a random address, the if statement is true (1 || 1 = 1) the verification reverts.

Tools Used

Manual review.

Change the if statement to the following code.

if(msg.sender != metadata.creator && msg.sender != owner) revert NotSubmitterNorOwner(msg.sender);

#0 - c4-judge

2023-02-16T07:24:42Z

dmvt marked the issue as duplicate of #45

#1 - c4-sponsor

2023-02-18T12:08:30Z

RedVeil marked the issue as sponsor confirmed

#2 - c4-judge

2023-02-23T00:17:37Z

dmvt marked the issue as satisfactory

#3 - c4-judge

2023-02-23T01:06:57Z

dmvt changed the severity to 3 (High Risk)

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