Escher contest - karanctf's results

A decentralized curated marketplace for editioned artwork.

General Information

Platform: Code4rena

Start Date: 06/12/2022

Pot Size: $36,500 USDC

Total HM: 16

Participants: 119

Period: 3 days

Judge: berndartmueller

Total Solo HM: 2

Id: 189

League: ETH

Escher

Findings Distribution

Researcher Performance

Rank: 81/119

Findings: 2

Award: $29.42

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/OpenEdition.sol#L92 https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/FixedPrice.sol#L109 https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/LPDA.sol#L85 https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/LPDA.sol#L86 https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/LPDA.sol#L105

Vulnerability details

Vulnerability Detail

The transfer() and send() functions forward a fixed amount of 2300 gas. Historically, it has often been recommended to use these functions for value transfers to guard against reentrancy attacks. However, the gas cost of EVM instructions may change significantly during hard forks which may break already deployed contract systems that make fixed assumptions about gas costs. For example. EIP 1884 broke several existing smart contracts due to a cost increase of the SLOAD instruction.

Impact

The use of the deprecated transfer() function for an address will inevitably make the transaction fail when:

  • The claimer smart contract does not implement a payable function.
  • The claimer smart contract does implement a payable fallback which uses more than 2300 gas unit.
  • The claimer smart contract implements a payable fallback function that needs less than 2300 gas units but is called through proxy, raising the call's gas usage above 2300.
  • Additionally, using higher than 2300 gas might be mandatory for some multisig wallets.

Recommendation

Use call() instead of transfer(), but be sure to respect the CEI pattern and/or add re-entrancy guards, as several hacks already happened in the past due to this recommendation not being fully understood.

More info on;
https://swcregistry.io/docs/SWC-134

#0 - c4-judge

2022-12-10T00:29:33Z

berndartmueller marked the issue as duplicate of #99

#1 - c4-judge

2023-01-03T12:45:22Z

berndartmueller marked the issue as satisfactory

Findings Information

🌟 Selected for report: ladboy233

Also found by: 0x1f8b, Matin, UniversalCrypto, gzeon, karanctf, minhquanym, obront, rvierdiiev, seyni, slvDev, yixxas

Labels

bug
2 (Med Risk)
partial-50
duplicate-369

Awards

28.8137 USDC - $28.81

External Links

Lines of code

https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/LPDA.sol#L101

Vulnerability details

Summary

Unsafe typecast on from uint256 to uint80 in refund() funciton in LPDA.sol

Impact

There is a risk of overflow or underflow if the uint256 value is too large or too small to be represented by a uint80 type. This could result in unpredictable behavior or vulnerabilities in the contract.

  uint80 price = uint80(getPrice()) * r.amount;
    

In above expression it calls getPrice() which returns uint256.

Recommendation

Use SafeCast library in OpenZeppelin which is a utility library that provides safe and reliable methods for casting between different numeric types in Solidity.

#0 - c4-judge

2022-12-10T17:11:09Z

berndartmueller marked the issue as duplicate of #369

#1 - c4-judge

2023-01-03T13:52:21Z

berndartmueller marked the issue as partial-50

#2 - c4-judge

2023-01-03T13:52:46Z

berndartmueller marked the issue as satisfactory

#3 - c4-judge

2023-01-03T13:52:57Z

berndartmueller marked the issue as partial-50

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