Golom contest - 0xsolstars's results

An NFT marketplace that offers the lowest industry fee, a publicly available order-book along with analytical tools.

General Information

Platform: Code4rena

Start Date: 26/07/2022

Pot Size: $75,000 USDC

Total HM: 29

Participants: 179

Period: 6 days

Judge: LSDan

Total Solo HM: 6

Id: 148

League: ETH

Golom

Findings Distribution

Researcher Performance

Rank: 145/179

Findings: 2

Award: $35.17

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-07-golom/blob/7bbb55fca61e6bae29e57133c1e45806cbb17aa4/contracts/core/GolomTrader.sol#L154

Vulnerability details

Impact

In order to pay fees to distributors, takers, makers, governance, and the exchange, the GolomTrader contract executes payment via a payable(payAddress).transfer(payAmt). See https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/ for more details. This is a core function that is called several times in the GolomTrader contract.

Proof of Concept

The payment of Ether to the intended parties may fail in the following cases:

  1. The smart contract receiving funds fails to implement the payable fallback function
  2. The fallback function receiving funds uses more than 2300 gas units

This is a common code4rena issue. See

https://github.com/code-423n4/2022-01-openleverage-findings/issues/75 https://github.com/code-423n4/2021-10-tally-findings/issues/20 https://github.com/code-423n4/2021-04-meebits-findings/issues/45 https://github.com/code-423n4/2021-08-notional-findings/issues/38

Tools Used

Manual Analysis

Use call() instead of transfer() without a hardcoded gas limits. Also be sure to follow the checks-effects-interactions pattern and implement reentrancy guards for reentrancy protection (which I believe is already implemented).

#0 - KenzoAgada

2022-08-03T14:02:48Z

Duplicate of #343

Overall, the protocol engineers and designers appear to have thought out the protocol design and implementation in great depth. However, in general, the test coverage of the protocol could improve by a lot. There are contracts that do not have any associated tests (VoteEscrowDelegation, VoteEscrowCore). There is also commented code in the codebase that does not appear to be serving any purpose.


There is no validation being done on toTokenId in the following function. I was not able to verify if there was a directly exploitable mechanism here that could result in the loss of funds or protocol leakage.

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/vote-escrow/VoteEscrowDelegation.sol#L71


erecover returns an empty address (0x0) when the signature is invalid. It is generally considered good practice to validate on the 0x0 address such as require(signaturesigner) != address(0). Would recommend appending the 0 address check onto the current require.

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L177


The if statement in the following code block does not appear to ever get hit due to the require statement and can thus be removed.

https://github.com/code-423n4/2022-07-golom/blob/7bbb55fca61e6bae29e57133c1e45806cbb17aa4/contracts/core/GolomTrader.sol#L177-L178


The VoteEscrowDelegation.specs.ts is an empty file.


Would recommend more helpful user messaging in the following line https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L217.


Inconsistent error messaging. In fillAsk() there is an appropriate error message whereas in fillBid() and fillCriteriaBid() there is no error message.

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L349 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L295 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L226

fillAsk() contains error messaging, fillBid() and fillCriteriaBid() do not. https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L227 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L296 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L350


remove code or add relevant test cases.

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/test/GolomTrader.specs.ts#L645 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/test/GolomTrader.specs.ts#L678 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/test/RewardDistributor.specs.ts#L132-L144 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/test/RewardDistributor.specs.ts#L364-L368

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