Hunting the exploits in the Cardano NFT ecosystem

Introduction

As smart contract capabilities arrived to Cardano, developers started working on the first decentralized applications on our beloved blockchain. Cardano’s eUTxO model is novel, and a different type of thinking needs to be put into the design of smart contracts. A few attack vectors are well known to developers with a deep understanding of the eUTxO model but are not known to newcomers and are easy to miss for them. As we have years of experience building on Cardano, we were able to identify three similar exploits that appeared across multiple NFT marketplaces.

How exploitable NFT marketplaces work

What flow should we expect while interacting with a smart contract that lets users list and buy NFTs for a fixed price set by sellers?

Double satisfaction

The problem is not in ordinary transactions assembled by marketplaces themselves. Instead, the problem is that anyone can assemble a transaction with arbitrary inputs and outputs and submit it. If such a transaction validates, inputs get spent, and outputs are created.

The exploit returns

After some time passed, we decided to review all the contracts we could find again. As most of the marketplaces unpublished their code after the first exploit, we were only able to find one — Martify.

The exploit returns once again

Some time passed, and we thought there was no general NFT marketplace with an open-source contract left to check. Then we noticed that epoch.art marketplace published their contract.

Epoch.art exploit

This allows the attacker to buy multiple NFTs and only pay for one if purchased NFTs are from the same seller and are listed for the same price. We found multiple “exploitable groups” of NFTs listed for the same price by the same seller worth thousands of ADA. We contacted epoch.art and let them know about this exploit. After some talking, the contract’s author understood how the exploit works. We advised them to hide the contract from their GitHub until the fix is done and users have time to relist their assets to a new contract. The fix is trivial and it should take just 1 day to prepare it. Epoch.art paid us a bounty of 500 ADA and 2 Mutant NFTs. When we asked epoch.art when they will announce the exploit, they said 2–3 days. This time limit passed and no announcement has been made. Instead, they told us that they decided to add new features into the contract alongside the fix and that it will take them 2 weeks. We found it irresponsible of them, but we did let them do it. We were waiting for them to finish the new contract for some time. After 3 weeks, it still wasn’t ready. When we asked them what was happening they said that they are working on it. We told them that we give them 5 days to push the trivial fix and then we will push the announcement if they don’t do that. So, this is our announcement. As the Cardano community is one of the most transparent ones out there, we believe that this is the right thing to do. All users that have multiple NFTs listed for the same price on epoch.art are affected and should delist their assets as soon as possible.

Conclusion

The Cardano smart contract space is still evolving and needs time so these simple exploits will be well known among developers. We found an exploit in most live dApps with public smart contracts. However, the biggest exploit, the Minswap one, has been found by our partners from WingRiders DEX. Our partners from WingRiders DEX helped us review our smart contracts too, to make sure they are safe. As we want to help the community grow and make the life of new developers easier and the lives of users calmer, we are open-sourcing our instant-buy smart contract and thus becoming a truly decentralized marketplace, unlike the ones with closed-source contracts.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
JAM ON BREAD

JAM ON BREAD

🌌 Safe | Fast | Decentralized | Enjoyable Cardano NFT Marketplace. ⚙️ Powered by @VacuumLabs ⚙️ Launching NOW 🚀