Summary
Candy Machine Set Collection During Mint Missing Check
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
Impact
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-9V25-R5Q2-2P6W? GHSA-9V25-R5Q2-2P6W is a medium-severity security vulnerability in mpl-candy-machine (rust), affecting versions = 4.5.0. It is fixed in 4.5.1.
- Which versions of mpl-candy-machine are affected by GHSA-9V25-R5Q2-2P6W? mpl-candy-machine (rust) versions = 4.5.0 is affected.
- Is there a fix for GHSA-9V25-R5Q2-2P6W? Yes. GHSA-9V25-R5Q2-2P6W is fixed in 4.5.1. Upgrade to this version or later.
- Is GHSA-9V25-R5Q2-2P6W exploitable, and should I be worried? Whether GHSA-9V25-R5Q2-2P6W is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-9V25-R5Q2-2P6W is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-9V25-R5Q2-2P6W? Upgrade
mpl-candy-machineto 4.5.1 or later.