Reality Cards contest - maplesyrup's results

The world's first 'outcome ownership' prediction market.

General Information

Platform: Code4rena

Start Date: 10/06/2021

Pot Size: $45,000 USDC

Total HM: 21

Participants: 12

Period: 7 days

Judge: LSDan

Total Solo HM: 13

Id: 13

League: ETH

Reality Cards

Findings Distribution

Researcher Performance

Rank: 7/12

Findings: 3

Award: $1,428.56

🌟 Selected for report: 2

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: gpersoon

Also found by: maplesyrup, pauliax

Labels

bug
duplicate
2 (Med Risk)

Awards

351.5826 USDC - $351.58

External Links

Handle

maplesyrup

Vulnerability details

Impact

2 - Medium Risk

  • Possible accidental loss of funds or information due to code manipulation or bad side effects of not properly outlining a payable function

Proof of Concept

When running the analyzer code, the following functions were found in RCNftHubL2.sol to possibly lock funds due to it being a payable function with no withdraw function associated.


Contract locking ether found:

Contract RCNftHubL2

(contracts/nfthubs/RCNftHubL2.sol line(s)#15-239) has payable functions:

NativeMetaTransaction.executeMetaTransaction(address,bytes,bytes32,bytes32,uint8)

(contracts/lib/NativeMetaTransaction.sol line(s)#31-67)

But does not have a function to withdraw the ether

According to Slither analyzer detector documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether)

Possible functions that receive funds with the payable attribute must have a withdraw function to secure that funds can be sent out from the function or remove payable attribute.

Although the function may not receive funds directly, there should be a withdraw function added to ensure that information needed from the function can be withdrawn safely or do not include payable attribute.

Console Output (Slither log):

INFO:Detectors: Contract locking ether found: Contract RCNftHubL2 (contracts/nfthubs/RCNftHubL2.sol#15-239) has payable functions: - NativeMetaTransaction.executeMetaTransaction(address,bytes,bytes32,bytes32,uint8) (contracts/lib/NativeMetaTransaction.sol#31-67) But does not have a function to withdraw the ether Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether

Tools Used

Solidity Compiler 0.8.4 Hardhat v2.3.3 Slither v0.8.0

Compiled, Tested, Deployed contracts on a local hardhat network.

Ran Slither-analyzer for further detecting and testing.

(Worked best under python venv)

  1. Clone Project Repository
  2. Run Project against Hardhat network; compile and run default test on contracts.
  3. Installed slither analyzer: https://github.com/crytic/slither
  4. Ran [$ slither .] against RCNftHubL2.sol and all contracts to verify results

#0 - Splidge

2021-06-15T14:50:22Z

Duplicate of #43

#1 - dmvt

2021-07-11T10:57:54Z

duplicate of #31

Findings Information

🌟 Selected for report: maplesyrup

Also found by: heiho1

Labels

bug
2 (Med Risk)
sponsor disputed
disagree with severity

Awards

585.971 USDC - $585.97

External Links

Handle

maplesyrup

Vulnerability details

Impact

2 - Medium Risk - Possible loss or lock of funds found in a function in the contract

Proof of Concept

When running the analyzer code, the following functions were found in RCOrderbook.sol to possibly lock funds due to it being a payable function with no withdraw function associated.


Contract locking ether found:

// contracts/RCOrderbook.sol // line(s) 15-876

Contract RCOrderbook

has payable functions:

// contracts/lib/NativeMetaTransaction.sol // line(s) 31-67

NativeMetaTransaction.executeMetaTransaction(address,bytes,bytes32,bytes32,uint8)

But does not have a function to withdraw the funds

According to Slither analyzer detector documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether)

Possible functions that receive funds with the payable attribute must have a withdraw function to secure that funds can be sent out from the function or remove payable attribute.

Although the function may not receive funds directly, there should be a withdraw function added to ensure that information needed from the function can be withdrawn safely or do not include payable attribute.

Console Output (Slither log):

INFO:Detectors: Contract locking ether found: Contract RCOrderbook (contracts/RCOrderbook.sol#15-876) has payable functions: - NativeMetaTransaction.executeMetaTransaction(address,bytes,bytes32,bytes32,uint8) (contracts/lib/NativeMetaTransaction.sol#31-67) But does not have a function to withdraw the ether Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether

Tools Used

Solidity Compiler 0.8.4 Hardhat v2.3.3 Slither v0.8.0

Compiled, Tested, Deployed contracts on a local hardhat network.

Ran Slither-analyzer for further detecting and testing.

(Worked best under python venv)

  1. Clone Project Repository
  2. Run Project against Hardhat network; compile and run default test on contracts.
  3. Installed slither analyzer: https://github.com/crytic/slither
  4. Ran [$ slither .] against RCOrderbook.sol and all contracts to verify results

#0 - Splidge

2021-06-15T09:14:14Z

I initially confirmed this because we aren't using the native currency on Matic/Polygon. However I think this should be disputed mainly because this function is used to call other functions which might be payable, although I admit currently we don't have payable functions, we might add them in the future. This library is used across all our contracts, had we put a payable function in the Treasury for instance, would this be considered a flaw to have this same library imported into the Orderbook?

#1 - Splidge

2021-06-15T14:51:35Z

Note that the duplicate issue #51 was submitted by the same user.

#2 - dmvt

2021-07-10T15:07:25Z

Agree with the sponsor's explanation, but the issue exists regardless. Adding a way to retrieve locked funds would mitigate the issue.

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