Putty contest - chatch'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: 99/133

Findings: 1

Award: $41.89

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

Labels

bug
duplicate
2 (Med Risk)
disagree with severity

Awards

41.8933 USDC - $41.89

External Links

Lines of code

https://github.com/code-423n4/2022-06-putty/blob/1ddbec4a5242e0160da832cb46b2b3cdbb49a8af/contracts/src/PuttyV2.sol#L324 https://github.com/code-423n4/2022-06-putty/blob/1ddbec4a5242e0160da832cb46b2b3cdbb49a8af/contracts/src/PuttyV2.sol#L344

Vulnerability details

Impact

Avoid premium payment on long call or long put. Avoid strike payment on short put.

Proof of Concept

NOTE: this would not be possible if the order was created using the official DApp which has a drop down selector that restricts the base asset ("base token" in the dapp) to the official DAI or WETH tokens.

However for users interacting with the protocol by some other means - a different dapp or an API this would be possible if the maker could convince the taker they are using DAI for example, but actually provide some other fake DAI token as Order.baseAsset.

Premium is transferred from maker to taker for longs here: https://github.com/code-423n4/2022-06-putty/blob/1ddbec4a5242e0160da832cb46b2b3cdbb49a8af/contracts/src/PuttyV2.sol#L324 Strike is transferred from maker to contract for short puts here: https://github.com/code-423n4/2022-06-putty/blob/1ddbec4a5242e0160da832cb46b2b3cdbb49a8af/contracts/src/PuttyV2.sol#L344

However no validation is done on the baseAsset except to check that it is an address with bytecode: require(order.baseAsset.code.length > 0, "baseAsset is not contract");.

Tools Used

Manual analysis.

Maintain a Whitelist of allowed baseAssets in the PuttyV2 contract.

Replace the check order.baseAsset.code.length > 0 with something like baseAssetWhitelist[order.baseAsset] == true.

This would mitigate this issue by ensuring the baseAsset is a known and verified token.

The initial whitelist would contain the addresses for the tokens listed in the DApp UI - DAI and WETH.

#0 - GalloDaSballo

2022-07-05T01:28:22Z

Orders can be created with any token, why would the counterparty agree to be paid in a fake token?

#1 - outdoteth

2022-07-07T13:35:15Z

Duplicate: Setting malicious or invalid erc721Assets, erc20Assets or floorTokens prevents the option from being exercised: https://github.com/code-423n4/2022-06-putty-findings/issues/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