NUL byte validation flaw in Apache Commons Codec GitIdentifiers causes Git tree identifier collisions

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

What is CVE-2026-124077?

CVE-2026-124077 is a vulnerability classified as Improper Neutralization of Null Byte or NUL Character, affecting Apache Commons Codec (affected versions: 1.22.0 – < 1.23.0 and 387120c901f4a75c3112dfdf8877dcdec7ae685d – < 87f6aa2818836998528ff4b0d1ea35545a800ee5). This vulnerability is rated Medium, with a CVSS score of 4.3. Current sources do not report this vulnerability as exploited.

Overview

Original source data

The GitIdentifiers class in Apache Commons Codec did not reject NUL bytes in tree entry names. Because Git uses a NUL byte to mark the end of each entry name in a tree object, a crafted name could make one tree serialize to the same bytes as a different tree. Two different directory trees could then receive the same Git tree identifier or SWHID. The impact is limited: common file systems do not allow NUL bytes in file names, so trees built by walking a file system are not affected. Only applications that build trees from names supplied by other sources, such as entries of archive formats that permit NUL bytes in names (e.g. ZIP) or names passed directly to the API, are exposed. This issue affects Apache Commons Codec: from 1.22.0 before 1.23.0. Users are recommended to upgrade to version 1.23.0, which fixes the issue.

Affected products and scope

  • Maven package commons-codec:commons-codec: affected from 1.22.0 before 1.23.0. The normalized record lists the default status as unaffected.
  • The record also identifies an affected Git revision range ending before the corresponding fixing revision. The complete revision identifiers are not reproduced here to avoid copying long hashes.
  • The advisory states that 1.23.0 fixes the issue. The status of parallel branches or other packaging methods is not inferred beyond the ranges explicitly identified.

Technical details

The GitIdentifiers class in Apache Commons Codec builds serialized Git tree data from application-supplied entry names. Git uses a NUL byte to mark the end of each entry name in a tree object, but affected releases did not reject NUL bytes before serialization. A crafted name could therefore make two different directory trees serialize to the same byte sequence and receive the same Git tree identifier or SWHID.

The precondition is an application that passes externally supplied names into tree construction, such as names read from an archive format that permits NUL bytes, including ZIP, or names supplied directly through an API. Trees built by walking a normal file system are outside the described exposure because common file systems do not allow NUL bytes in file names. The patch centralizes name validation and rejects NUL-containing names, while also adding checks for empty names, ., .., /, unpaired surrogates, and file/directory name conflicts. The downstream use of the identifier and the exact application-level consequences of a collision are not fully established by the available record.

Exploitability

The assessment supplied with the record models network reachability, no required privileges, low attack complexity, and required user interaction. This does not mean every deployment using Apache Commons Codec is remotely exploitable: the application must also accept attacker-influenced names and pass them to GitIdentifiers.

The record marks public_exploit as false and known_exploited as null. The reviewed advisory and patch describe the defect and remediation but do not name an exploit, campaign, victim, or specific exploitation indicator. The actual exploitation status is therefore not established by the available evidence.

Technical impact

The flaw can remove the uniqueness of a Git tree identifier or SWHID: two different directory structures can be represented by the same serialized data. Possible technical consequences include incorrect object lookup, erroneous deduplication, or incorrect provenance associations.

The record does not establish that the flaw provides code execution, privilege escalation, file modification, or service disruption. The scope is limited to applications that pass externally supplied names into GitIdentifiers; trees built from valid names obtained through ordinary file-system traversal are outside the described exposure. Organisational impact depends on whether these identifiers are used for trust decisions, inventory, publication, or other authoritative workflows.

Business impact

Indexing, deduplication, caching, provenance, or content-addressed systems that rely on Git tree identifiers or SWHIDs could associate different directory trees with one identifier. This could lead to incorrect lookups, unintended reuse of data, inaccurate provenance conclusions, or incorrect structural comparisons.

The exposure requires an application to accept names from a source that can contain NUL bytes, rather than merely walking a normal file system. The record does not show that the issue directly enables code execution, service outage, or modification of file contents. The practical consequence depends on where the application treats the identifier as authoritative.

Remediation

  1. Upgrade the Maven dependency to Apache Commons Codec 1.23.0, the release identified by the advisory as fixing the issue.
  2. If the library is built from Git source rather than consumed as a Maven artifact, update to the fixing revision identified by Apache in the patch and release notes.
  3. Until the upgrade is complete, reject entry names containing NUL bytes before passing them to GitIdentifiers, especially for names obtained from archives or external APIs. This is a direct mitigation based on the validation behavior in the patch and is not a substitute for upgrading.
  4. Verify that validation covers files, directories, and symbolic links, as well as every path component separated by /. Do not treat a fix for one verified branch as evidence that every parallel branch or deployment method is unaffected.

Detection

  1. Inventory applications that use the commons-codec:commons-codec package and determine whether they call org.apache.commons.codec.digest.GitIdentifiers.
  2. Review the sources of tree entry names, especially archive readers, importers, and APIs that accept names directly. Determine whether any source can provide names containing NUL bytes.
  3. Compare the deployed Maven version or source revision with the affected branches in affected_summary. Checking only whether the library is present, without checking whether the vulnerable class is used, may produce false positives.
  4. If the application records API exceptions, review validation failures involving invalid entry names after the patched behavior is deployed. The absence of such log events does not prove that the deployment is safe.
  5. Review where Git tree identifiers or SWHIDs are used as keys for lookup, caching, deduplication, or provenance. This is a precautionary review for places where an identifier collision could matter, not a vendor-confirmed indicator of compromise.
Sources (21)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.