Escher contest - 0xhacksmithh'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: 118/119

Findings: 1

Award: $0.61

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

0.6136 USDC - $0.61

Labels

bug
2 (Med Risk)
satisfactory
edited-by-warden
duplicate-99

External Links

Lines of code

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

Vulnerability details

Impact

User may lose his fund(eth) as contract file(LPDA.sol) trying to send remaining eth via transfer()

Proof of Concept

After buying Buyer can withdraw his remaining fund via refund function, but refund function using transfer() for refunding eth, where transfer() and send() functions forward a fixed amount of 2300 gas. As well here return value of transfer also not checked, if transfer of eth failed, user balance on state variable get updated and eth remain stucked in this contract(LPDA.sol) for whole time.

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.

function refund() public { Receipt memory r = receipts[msg.sender]; uint80 price = uint80(getPrice()) * r.amount; uint80 owed = r.balance - price; require(owed > 0, "NOTHING TO REFUND"); receipts[msg.sender].balance = price; payable(msg.sender).transfer(owed);

Tools Used

Manual review

call() should be used instead of transfer() on an address payable

#0 - c4-judge

2022-12-10T00:31:13Z

berndartmueller marked the issue as duplicate of #99

#1 - c4-judge

2023-01-03T12:49:06Z

berndartmueller marked the issue as satisfactory

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