Skip to content
Business logic Audit finding Intermediate

An attacker can create a short put option order on an NFT that does not support ERC721 (like cryptopunk), and the user can fulfill the order, but cannot exercise the option

A short put option order could be created using an NFT that does not implement the ERC721 receiver callback, such as CryptoPunk. A buyer who fulfils the order pays the premium but can never exercise the option because the transfer call fails, letting the attacker keep the premium and recover the asset after expiry.

cccz Follow

Originally disclosed on Code4rena

Submitted by cccz, also found by IllIllI and minhquanym

An attacker can create a short put option on cryptopunk. When the user fulfills the order, the baseAsset will be transferred to the contract.

However, since cryptopunk does not support ERC721, the user cannot exercise the option because the safeTransferFrom function call fails. Attacker can get premium and get back baseAsset after option expires.

Proof of Concept

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

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

Recommended Mitigation Steps

Consider adding a whitelist to nfts in the order, or consider supporting exercising on cryptopunk.

STYJ (warden) commented:

Putty uses solmate’s ERC721.safeTransferFrom which requires that the NFT contract implements onERC721Received. For the case of OG NFTs like punks and rocks, this will fail, https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol#L120

thereksfour (warden) commented:

The user does not need to send cryptopunk to the contract when fulfilling the short put option order, but the user will pay a premium to the order creator. Later, when the user wants to exercise the option, since the cryptopunk does not support safetransferfrom, the user cannot exercise the option.

STYJ (warden) commented:

The user does not need to send cryptopunk to the contract when fulfilling the short put option order, but the user will pay a premium to the order creator. Later, when the user wants to exercise the option, since the cryptopunk does not support safetransferfrom, the user cannot exercise the option.

Sorry, I did not consider this path. You are correct to say that a maker can create a short put option order with cryptopunks as a token and the holder of the long put option will not be able to exercise since cryptopunks cannot be transferred with safeTransferFrom. From that perspective, this is a valid issue. Thank you for bringing it up. I will defer to the judge for the final decision.

outdoteth (Putty Finance) acknowledged, but disagreed with severity and commented:

We dont intend to support cryptopunks or cryptokitties. If users wish to use these tokens then they can get wrapped versions (ex: wrapped cryptopunks).

HickupHH3 (judge) decreased severity to Medium and commented:

I thought cryptokitties are ERC721? I think they were the ones who popularized the standard actually :p Probably meant etherrocks.

In general, non-compliant ERC-721 NFTs can be supported through wrappers, though some users might be unaware… Downgrading to med severity, similar to this issue from another contest.

hyh (warden) reviewed mitigation:

Similar to M-01, M-02.


The original report as published on Code4rena, by cccz. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

Putty is an NFT options protocol. This finding concerns the V2 contract, PuttyV2.sol, and specifically the path that handles put options. In a put option, the order creator (the maker) takes the short side and the counterparty (the taker) buys the right to sell a base asset at a set strike. When the taker fulfils a short put order, the taker pays the premium to the maker; the report's discussion notes the taker does not send the NFT to the contract at that step.

The report is about what happens when that base asset is an NFT that does not implement ERC721, with CryptoPunk given as the example. The order can be created and fulfilled, but the exercise step cannot complete.

Setup

The report does not describe accounts, tooling or a deployed environment. It is a code review finding against the Putty V2 repository, with two code locations cited as proof of concept:

  • contracts/src/PuttyV2.sol, lines 343 to 346
  • contracts/src/PuttyV2.sol, lines 628 to 629

Both links point at commit [redacted]. The only precondition is that the base asset of the order is a token that does not support ERC721, such as CryptoPunk.

Finding it

The researcher noticed that the contract moves the base asset with a call that assumes ERC721 compliance. CryptoPunk predates ERC721 and does not implement it, so the transfer call used during exercise fails. Because the order creation and fulfilment paths do not reject such a token, an order can be created and taken against an asset that can never be delivered through the exercise path.

The same issue was found independently by IllIllI and minhquanym.

Exploitation

Step 1: create a short put option on a non-ERC721 asset

The attacker acts as the maker and creates a short put option order whose base asset is CryptoPunk. Nothing in the order creation path rejects the token, so the order is accepted.

Step 2: the taker fulfils the order

A user fulfils the order and pays the premium to the order creator. As one warden put it, the user does not need to send the CryptoPunk to the contract when fulfilling the short put order. As one warden put it in the discussion, the user does not need to send the CryptoPunk to the contract when fulfilling the short put order, but does pay a premium to the order creator.

Step 3: exercise fails

When the user later tries to exercise the option, the contract calls safeTransferFrom to move the base asset. CryptoPunk does not support that call, so the exercise reverts and the user cannot exercise.

Step 4: the attacker keeps the premium and the asset

After the option expires, the attacker has received the premium and gets the base asset back. The taker paid for a right that could never be used.

Root cause

Putty uses solmate's ERC721.safeTransferFrom, which requires that the NFT contract implements onERC721Received. As STYJ noted, for original NFTs such as punks and rocks this call fails. The relevant solmate code is at https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol#L120.

The two cited locations in PuttyV2.sol are given as proof of concept. The incompatibility surfaces at exercise time, after the taker has already paid the premium.

Impact

An attacker can create a short put option order on an NFT that does not support ERC721, such as CryptoPunk. A user can fulfil the order and pay the premium, but cannot exercise the option, because the safeTransferFrom call fails. The attacker keeps the premium and gets the base asset back after the option expires.

The severity was set to Medium. Putty's position was that it does not intend to support cryptopunks or cryptokitties, and that users who wish to use these tokens can use wrapped versions, for example wrapped cryptopunks. The judge noted that non-compliant ERC-721 NFTs can in general be supported through wrappers, though some users might be unaware, and downgraded the issue to Medium on that basis.

Fix

The recommended mitigation in the report is to add a whitelist for NFTs in the order, or to support exercising on CryptoPunk. The report does not state that either change was made. Putty's response was that it does not intend to support cryptopunks or cryptokitties and that wrapped versions are the intended route for such tokens.

Variants to test

  • Submit an order whose base asset is another pre-ERC721 or otherwise non-compliant NFT and check whether creation and fulfilment succeed while exercise reverts. A positive result is a fulfilled order that cannot be exercised.
  • Check whether the order creation path validates the base asset at all. A positive result is an order accepted for a token that the exercise path cannot transfer.
  • Check whether wrapped versions of the same assets behave correctly through the full create, fulfil and exercise cycle. A positive result is a wrapper that works end to end, confirming the failure is specific to the unwrapped token.

Hunting notes

This kind of bug hides wherever a protocol assumes a token standard without validating it, especially around NFT transfers that use safe transfer variants requiring receiver hooks. During review, look for safeTransferFrom calls on assets that users can choose freely, and check whether the order or listing path rejects non-compliant tokens before funds change hands. The strongest signal is an asymmetry: a path that accepts an asset and a later path that cannot move it.

The impact is that the taker pays the premium but cannot exercise, while the maker keeps the premium and gets the base asset back after expiry. The discussion among wardens clarified that the taker pays the premium without sending the NFT, which is what makes the loss one-sided and the issue valid.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

Putty is a service, built on a blockchain, that lets people buy and sell options on NFTs. An NFT (non-fungible token) is a unique digital item recorded on a blockchain, such as a specific piece of digital art. An option is a contract that gives someone the right, but not the obligation, to do something at a fixed price within a set time. In a put option, the person who buys the option gets the right to sell an item at a set price (the strike). The person who creates the order takes the other side and receives a payment called the premium for granting that right.

The problem described here is simple once you strip away the jargon. Putty lets someone create a put option order where the item being offered is a CryptoPunk. CryptoPunks are one of the earliest kinds of NFT, and they were made before a common technical rulebook called ERC721 existed. Putty's code assumes every NFT follows that rulebook. So the order can be created and a buyer can pay the premium and take the order, but when the buyer later tries to use the option, the transfer step fails. The buyer has paid for a right that cannot be used. The order creator keeps the premium and, after the option expires, gets the item back.

The finding was reported by cccz, and the same issue was found independently by IllIllI and minhquanym. It was rated Medium severity.

The product and the feature involved

Putty is an NFT options protocol. The finding concerns version 2 of its main contract, a file called PuttyV2.sol. A contract here means a program that lives on the blockchain and runs automatically when people interact with it. Nobody can change its behaviour after it is deployed, so any mistake in its logic is permanent until a new version is deployed.

The relevant feature is the put option path. Two roles matter:

  • The maker creates the order. In a short put, the maker is the side that promises to buy the item at the strike price if the taker chooses to sell.
  • The taker fulfils the order by paying the premium. The taker then holds the right to exercise the option later.

When a taker fulfils a short put order, the taker pays the premium; the report's discussion notes the NFT is not sent to the contract at that step. Later, if the taker exercises, the contract pays out the strike price and the base asset moves on to the maker. That is the intended flow. The report is about what happens when the base asset is an NFT that does not follow the ERC721 rulebook, with CryptoPunk as the example. The order can be created and fulfilled, but the exercise step cannot complete.

Setup

The report does not describe accounts, tools or a deployed test environment. It is a code review finding against the Putty V2 repository. Two code locations are cited as proof of concept:

  • contracts/src/PuttyV2.sol, lines 343 to 346
  • contracts/src/PuttyV2.sol, lines 628 to 629

Both links point at commit [redacted]. A commit is a saved snapshot of a code repository, identified by a long string of characters, so anyone can look at exactly the same code the researcher looked at.

The only precondition is that the base asset of the order is a token that does not support ERC721, such as CryptoPunk.

Finding it

The researcher noticed that the contract moves the base asset using a call that assumes the NFT follows ERC721. CryptoPunk predates ERC721 and does not implement it, so the transfer call used during exercise fails. Because the order creation and fulfilment paths do not reject such a token, an order can be created and taken against an asset that can never be delivered through the exercise path.

To unpack that: ERC721 is a written standard, a shared rulebook that says how an NFT contract must behave so that other programs can talk to it. One of its rules is that a transfer must be done with a safe variant, which checks that the receiving address is able to handle NFTs. CryptoPunk was built before that rulebook existed, so it does not answer that check. Putty's code uses the safe variant, and the check fails.

Exploitation

Step 1: create a short put option on a non-ERC721 asset

The attacker acts as the maker and creates a short put option order whose base asset is CryptoPunk. Nothing in the order creation path rejects the token, so the order is accepted. In everyday terms, the attacker lists an offer that the system should have refused, but does not.

Step 2: the taker fulfils the order

A user fulfils the order and pays the premium to the order creator. As one reviewer put it, the user does not need to send the CryptoPunk to the contract when fulfilling the short put order. As one reviewer put it in the discussion, the user does not need to send the CryptoPunk to the contract when fulfilling the short put order, but does pay a premium to the order creator. That detail matters: the buyer's money leaves their hands at this step, before anything has gone wrong from their point of view.

Step 3: exercise fails

When the user later tries to exercise the option, the contract calls safeTransferFrom to move the base asset. CryptoPunk does not support that call, so the exercise reverts and the user cannot exercise. A revert means the blockchain transaction is cancelled and its effects are undone, so the user gets an error instead of the result they expected.

Step 4: the attacker keeps the premium and the asset

After the option expires, the attacker has received the premium and gets the base asset back. The taker paid for a right that could never be used. The loss is one-sided: the buyer is out the premium, and the seller is up the premium plus the returned item.

Root cause

Putty uses solmate's ERC721.safeTransferFrom, which requires that the NFT contract implements onERC721Received. As one reviewer, STYJ, noted, for original NFTs such as punks and rocks this call fails. The relevant solmate code is at https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol#L120.

Solmate is a library of ready-made contract code that developers reuse instead of writing everything themselves. Its safe transfer function performs the receiver check described above. onERC721Received is the name of the function a receiving contract is expected to have so it can confirm it accepts NFTs. CryptoPunk has no such function, so the check cannot succeed.

The two cited locations in PuttyV2.sol are given as proof of concept. The incompatibility surfaces at exercise time, after the taker has already paid the premium. That timing is the heart of the bug: the system accepts the item early and only discovers it cannot move it later.

Impact

An attacker can create a short put option order on an NFT that does not support ERC721, such as CryptoPunk. A user can fulfil the order and pay the premium, but cannot exercise the option, because the safeTransferFrom call fails. The attacker keeps the premium and gets the base asset back after the option expires.

The severity was set to Medium. Putty's position was that it does not intend to support cryptopunks or cryptokitties, and that users who wish to use these tokens can use wrapped versions, for example wrapped cryptopunks. A wrapped token is a stand-in token that holds the original item inside it and follows the modern rulebook, so it can be moved by programs that expect ERC721. The judge noted that non-compliant ERC-721 NFTs can in general be supported through wrappers, though some users might be unaware, and downgraded the issue to Medium on that basis.

Fix

The recommended mitigation in the report is to add a whitelist for NFTs in the order, or to support exercising on CryptoPunk. A whitelist is an explicit list of items that are allowed; anything not on the list is refused. The report does not state that either change was made. Putty's response was that it does not intend to support cryptopunks or cryptokitties and that wrapped versions are the intended route for such tokens.

Variants to test

These are follow-up checks in the same spirit, useful for anyone reviewing similar code:

  • Submit an order whose base asset is another pre-ERC721 or otherwise non-compliant NFT and check whether creation and fulfilment succeed while exercise reverts. A positive result is a fulfilled order that cannot be exercised.
  • Check whether the order creation path validates the base asset at all. A positive result is an order accepted for a token that the exercise path cannot transfer.
  • Check whether wrapped versions of the same assets behave correctly through the full create, fulfil and exercise cycle. A positive result is a wrapper that works end to end, confirming the failure is specific to the unwrapped token.

Hunting notes

This kind of bug hides wherever a protocol assumes a token standard without validating it, especially around NFT transfers that use safe transfer variants requiring receiver checks. During review, look for safeTransferFrom calls on assets that users can choose freely, and check whether the order or listing path rejects non-compliant tokens before money changes hands. The strongest signal is an asymmetry: one path accepts an asset and a later path cannot move it. Think of a shop that happily takes an unusual coin at the till but whose cash machine cannot count it when you try to spend the change.

The impact is that the taker pays the premium but cannot exercise, while the maker keeps the premium and gets the base asset back after expiry. The discussion among reviewers clarified that the taker pays the premium without sending the NFT, which is what makes the loss one-sided and the issue valid.

Glossary

  • NFT (non-fungible token): a unique digital item recorded on a blockchain, where each one is distinct and cannot be swapped one-for-one with another.
  • Blockchain: a shared record of transactions that many computers keep in sync, so entries cannot easily be changed after the fact.
  • Smart contract: a program stored on a blockchain that runs automatically when people interact with it.
  • Option: a contract giving one side the right, but not the obligation, to buy or sell something at a set price within a set time.
  • Put option: an option giving the buyer the right to sell an item at a set price.
  • Short put: the side of a put option that grants the right to the other party and receives the premium.
  • Maker: the person who creates an order.
  • Taker: the person who fulfils an order and pays the premium.
  • Premium: the payment the taker makes to the maker for granting the option.
  • Strike (price): the fixed price at which the option can be exercised.
  • Base asset: the item the option is about, in this case an NFT.
  • Exercise: using the option to carry out the agreed trade.
  • Fulfil: accept and complete an open order, paying the premium.
  • ERC721: a written standard describing how NFT contracts must behave so other programs can interact with them.
  • Compliant / non-compliant: whether a token follows the ERC721 standard or not.
  • safeTransferFrom: a transfer function that moves a token and checks that the receiver can handle it.
  • onERC721Received: the function a receiver is expected to implement so the safe transfer check can succeed.
  • Revert: cancel a blockchain transaction and undo its effects, returning an error.
  • Solmate: a library of reusable smart contract code.
  • Wrapper / wrapped token: a stand-in token that holds an original item and follows the modern standard, so programs that expect ERC721 can handle it.
  • Whitelist: an explicit list of allowed items; anything not listed is refused.
  • Commit: a saved snapshot of a code repository, identified by a long string of characters.
  • Severity: a rating of how serious a finding is, here Medium.

More by cccz

View all

104 more disclosed reports, best first.

More from Putty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.