Putty contest - auditor0517'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: 24/133

Findings: 3

Award: $727.39

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: zishansami

Also found by: 0x52, 0xsanson, auditor0517, berndartmueller, csanuragjain, zzzitron

Labels

bug
duplicate
3 (High Risk)

Awards

583.9233 USDC - $583.92

External Links

Lines of code

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

Vulnerability details

Impact

Inconsistent charging admin fee for PuttyV2.exercise() and PuttyV2.withdraw(). In exercise(), it doesn't charge admin fee at all, but in withdraw() it charges the fee even when a user receives back his strike amount after order expiration.

Proof of Concept

I've contacted out.eth with this issue and he said fee must be applied if the order was exercised properly. So in exercise(), we should add a logic to take fee here. And in withdraw(), we shouldn't take a fee when an order isn't exercised here.

Tools Used

Manual Review

uint256 feeAmount = (order.strike * fee) / 1000; if(feeAmount != 0) { ERC20(order.baseAsset).safeTransfer(owner(), feeAmount); } ERC20(order.baseAsset).safeTransfer(msg.sender, order.strike - feeAmount);
uint256 feeAmount = isExercised ? ((order.strike * fee) / 1000) : 0; if (feeAmount != 0) { ERC20(order.baseAsset).safeTransfer(owner(), feeAmount); } ERC20(order.baseAsset).safeTransfer(msg.sender, order.strike - feeAmount);

#0 - outdoteth

2022-07-06T18:24:46Z

Duplicate: Fees are only applied on puts if they are expired: https://github.com/code-423n4/2022-06-putty-findings/issues/269

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#L337-L339 https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L359-L361 https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L435-L437

Vulnerability details

Impact

If baseAsset is not WETH and a user calls PuttyV2.fillOrder() or PuttyV2.exercise() with ETH, the ETH will be locked in the contract and he can't receive it back.

Proof of Concept

This is the link to the same issue.

Tools Used

Manual Review

Recommend checking msg.value == 0 when baseAsset is not WETH.

} else { require(msg.value == 0, "lost ETH"); ERC20(order.baseAsset).safeTransferFrom(msg.sender, order.maker, order.premium); }

#0 - rotcivegaf

2022-07-04T23:36:48Z

Duplicate of #226

#1 - outdoteth

2022-07-06T19:26:36Z

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

Findings Information

🌟 Selected for report: berndartmueller

Also found by: IllIllI, Lambda, TrungOre, auditor0517, hansfriese, sashik_eth, shenwilly

Labels

bug
duplicate
2 (Med Risk)

Awards

137.9519 USDC - $137.95

External Links

Lines of code

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

Vulnerability details

Impact

A user might fail to withdraw his funds and asset. Such a scenario would happen when the strike amount is small.

Proof of Concept

Some ERC20 tokens don't allow to transfer 0 amount like this example. And in the below formula, feeAmount might be zero when order.strike is small.

feeAmount = (order.strike * fee) / 1000;

So in this case, a user can't withdraw his funds and assets forever.

Tools Used

Manual Review

Recommend checking feeAmount is not zero before transfer.

#0 - outdoteth

2022-07-07T12:49:12Z

Duplicate: withdraw() can be DOS’d for baseAsset ERC20s that prevent 0 transfers if the calculated feeAmount is 0 due to rounding: https://github.com/code-423n4/2022-06-putty-findings/issues/283

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