Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🦀 crates.io
Not in CISA KEV

GHSA-9v25-r5q2-2p6w mpl-candy-machine

Fix: metaplex-foundation/metaplex-program-library@e6b3aff

GHSA-9v25-r5q2-2p6w is a security vulnerability in mpl-candy-machine. A fix is available for mpl-candy-machine — see the affected versions and patch details below.

Candy Machine Set Collection During Mint Missing Check

Published
Dec 12, 2022
Updated
Dec 12, 2022
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Dec 12, 2022 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
🦀mpl-candy-machine

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.

Description

A problem with Candy Machine V2 allow minting NFTs to an arbitrary collection due to a missing check.

Here is a description of the exploit: Details: Here is the tx/ix to exploit: Transaction: Ix 1: candy_machine v2, mint_nft, passing in empty metadata -1 Ix 2: custom handler, 0 cpi A --> token_metadata create_metadata_account, creates NFT cpi B --> candy_machine v2, set_collection_during_mint Ix 1 passes our first check for empty metadata, but eventually will hit a bot tax and return Ok. We do have a CPI check in this function but even if we hit that or moved it to the top, it returns Ok as a bot tax and still enables the issue. Ix 2, cpi A is Ok and mints an arbitrary NFT. Ix 2, cpi B checks the previous instruction using index_relative_to_current-1. This turns out to be Ix 1 which was Ok, so then your newly minted arbitrary NFT is successfully added to the collection. Conclusion: Candy machine could be out of NFTs and it still works. If the CM is closed, (we think?) it doesn't get to the check. The fix needs to be in set_collection_during_mint that current program ID id candy_machine_v2. It checks previous program ID but doesn't check current.

NOTE: THIS DOES NOT AFFECT Cmv3

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🦀crates.iompl-candy-machine4.5.0&&< 4.5.14.5.1cargo update -p mpl-candy-machine --precise 4.5.1

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mpl-candy-machine, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update mpl-candy-machine to 4.5.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-9v25-r5q2-2p6w is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-9v25-r5q2-2p6w can be triaged on real exposure rather than presence alone.

Tailored to GHSA-9v25-r5q2-2p6w. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

A problem with Candy Machine V2 allow minting NFTs to an arbitrary collection due to a missing check. Here is a description of the exploit: Details: Here is the tx/ix to exploit: Transaction: Ix 1: candy_machine v2, mint_nft, passing in empty metadata -1 Ix 2: custom handler, 0 cpi A --> token_metadata create_metadata_account, creates NFT cpi B --> candy_machine v2, set_collection_during_mint Ix 1 passes our first check for empty metadata, but eventually will hit a bot tax and return Ok. We do have a CPI check in this function but even if we hit that or moved it to the top, it returns Ok
O3 Security · Impact-Aware SCA

Is GHSA-9v25-r5q2-2p6w in your dependencies?

O3 Security finds GHSA-9v25-r5q2-2p6w across crates.io dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-9v25-r5q2-2p6w: mpl-candy-machine | O3 Security