Putty contest - 0xDjango's results

An order-book based american options market for NFTs and ERC20s.

General Information

Platform: Code4rena

Start Date: 29/06/2022

Pot Size: $50,000 USDC

Total HM: 20

Participants: 133

Period: 5 days

Judge: hickuphh3

Total Solo HM: 1

Id: 142

League: ETH

Putty

Findings Distribution

Researcher Performance

Rank: 51/133

Findings: 3

Award: $88.59

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

5.5216 USDC - $5.52

Labels

bug
duplicate
2 (Med Risk)

External Links

Lines of code

https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L359-L361

Vulnerability details

Impact

If the baseAsset is not WETH and the taker mistakenly sends ETH, this value will be lost. Given the checks performed in the if above this else clause, it seems natural that the contract should check that msg.value == 0.

Tools Used

Manual review.

In the case where the baseAsset is not WETH, add the following require statement to the else block.

} else { require(msg.value == 0), ERC20(order.baseAsset).safeTransferFrom(msg.sender, address(this), order.strike); }

#0 - outdoteth

2022-07-06T19:27:54Z

Duplicate: Native ETH can be lost if it’s not utilised in exercise and fillOrder: https://github.com/code-423n4/2022-06-putty-findings/issues/226

QA Report

[L-01] Remove payable modifiers

While the payable modifier may save a miniscule amount of gas, functions that are not intended to receive ETH should revert if msg.value is sent.

[L-02] Timecheck should be inclusive

Given that the fillOrder() and exercise() have non-inclusive time checks, withdraw() should include the expiration time. Otherwise, there will be a gap.

https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L481

[L-03] Use safeTransfer()

Using transfer() on the WETH contract is pretty safe, but it's still worth using safeTransfer() consistently throughout the contract.

[L-04] Code vs comment conflict

The order of filling and cancelling the orders occurs differently in the code than in the comment.

https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L562-L563

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