/

CVE-2026-45615

Severity:

HIGH RISK

(8.2)

Out-of-Bounds Read / Input Validation Error in asn1c-Generat

CVE-2026-45615

Deferred

Vulnerability type

Category:

Out-of-Bounds Read / Input Validation Error

CWE:

CWE-20, CWE-125, CWE-130

Impact:

Denial of Service and Data Integrity/Logic Corruption via Out-of-Bounds Read

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

asn1c 1.4 and earlier generate OER decoding code for variable-length, non-negative INTEGER types that can perform a 1-byte heap out-of-bounds read when processing a malicious zero-length payload.

When exposed to untrusted network inputs, this flaw can be triggered remotely to cause denial of service or incorrect integer interpretation, potentially impacting protocol state and security decisions in downstream applications.

Affected context

This issue affects applications that:

  • Use mouse07410/asn1c version 1.4 or earlier to generate OER decoders
  • Define variable-length, non-negative INTEGER types in ASN.1 specifications
  • Deploy the generated decoders (e.g., INTEGER_oer.c skeleton) to parse untrusted or semi-trusted inputs

Commonly impacted environments include protocol stacks for V2X communications, 5G telecom signaling, security protocols, and certificate-processing components that rely on OER-encoded ASN.1 messages. The vulnerability manifests when the decoder encounters a specially crafted, zero-length OER payload for an affected INTEGER field.

Exploit preconditions

  • Attack surface: Any endpoint, service, or library that uses asn1c-generated OER INTEGER decoders on untrusted data paths (e.g., network protocols, file formats, certificate chains).
  • Required access: Ability to supply or influence OER-encoded ASN.1 payloads reaching the vulnerable decoder (typically remote network access or control over encoded files/inputs).
  • Trigger point: Parsing a variable-length, non-negative INTEGER field where the encoded length is maliciously set to zero bytes.
  • Why exploitation is possible: The generated OER decoder logic for INTEGER fails to validate that at least one byte of data is available before accessing the Most Significant Bit (MSB). As a result, it dereferences memory just past the allocated buffer, leading to a fixed 1-byte heap out-of-bounds read, which can destabilize the process or corrupt interpretation of decoded values.

Why this happens

The underlying defect is a missing bounds check in the asn1c-generated OER decoder for variable-length, non-negative INTEGER types.

When decoding, the skeleton code assumes that the encoded INTEGER has at least one byte and immediately reads from the last byte to inspect the MSB, without validating that the buffer actually contains any data when the encoded length is zero.

This pattern directly maps to:

  • CWE-125: Out-of-Bounds Read, because the decoder reads beyond the valid range of the heap buffer.
  • CWE-20: Improper Input Validation, as the encoded length and payload are not validated against protocol expectations before being used.
  • CWE-130: Improper Handling of Length Parameter Inconsistency, because the length metadata can specify a state (zero-length) that is incompatible with the subsequent access pattern.

Conceptually, the bug arises from trusting length fields in encoded data and using them to guide reads without enforcing minimal structural constraints (e.g., "INTEGER must have at least one octet").

Potential impact

  • Remote denial of service (DoS) through process crashes when the heap out-of-bounds read touches unmapped or protected memory.
  • Subtle data integrity issues if the out-of-bounds read returns stable but unintended data, leading to incorrect decoded integer values.
  • Protocol state desynchronization or poisoning when downstream logic relies on corrupted integer fields (e.g., message lengths, IDs, counters, or flags).
  • Logic bypass in security or access-control decisions that use decoded integers, potentially weakening authentication, authorization, or rate-limiting mechanisms.
  • Increased difficulty of debugging and incident response due to transient and non-deterministic failures tied to heap layout.

General mitigation guidance

Effective mitigation centers on strengthening input validation and enforcing strict bounds checking in decoder logic:

  • Ensure that generated or hand-written OER decoders validate encoded lengths before reading any payload, including explicit checks that variable-length INTEGERs have at least one byte.
  • Introduce defensive checks at the ASN.1 type layer so that structural invariants (e.g., "non-negative INTEGER must have at least one octet") are enforced prior to any bit-level inspection.
  • Apply a general coding pattern where length fields from untrusted data are treated as untrusted metadata and validated against type constraints and buffer sizes before use.
  • Consider wrapping generated decoders with validation shims that verify message structure, field presence, and length consistency before passing buffers to low-level decoding routines.
  • Use memory-safe coding practices where feasible (e.g., encapsulating buffer access in helper functions that assert bounds, or integrating safe abstractions for buffer manipulation).
  • Run decoder code with least-privilege process isolation so that a crash or protocol misinterpretation cannot trivially compromise the broader system.

How teams detect issues like this

Detection typically involves a mix of static inspection, dynamic testing, and policy enforcement:

  • Static analysis: Configure code-scanning tools to flag buffer accesses that depend on unvalidated length fields, especially in generated files such as INTEGER_oer.c. Look for patterns where a buffer pointer is dereferenced after a length check that allows zero without special handling.
  • Code review: During review of ASN.1/OER handling code (including generated skeletons), verify that each decode path enforces minimum length constraints for INTEGER and other variable-length types before reading individual bytes or bits.
  • Fuzzing: Apply coverage-guided fuzzing to OER decoders with a focus on integer fields, length fields, and boundary conditions. Fuzzers are particularly effective at discovering off-by-one and zero-length handling issues.
  • Runtime hardening: Enable memory safety diagnostics such as ASan, Valgrind, or similar tools in test environments to detect out-of-bounds reads in decoding routines.
  • Secure coding policies: Establish policies that prohibit direct indexing into decode buffers based solely on untrusted length fields, and require explicit checks for zero-length or truncated payloads.

Sources

SourceLink
github.comgithub.com/mouse07410/asn1c/security/advisories/GHSA-wxx8-76rw-96j2

Frequently asked

questions

Yes. In typical deployments, attackers can exploit this remotely by sending specially crafted OER-encoded ASN.1 messages to services that use asn1c-generated decoders for variable-length, non-negative INTEGER fields.

The attacker only needs the ability to supply or influence the encoded input processed by the vulnerable decoder. This often means network access to a protocol endpoint or control over files or messages that are parsed with the affected code.

The safest pattern is to enforce strict bounds and structural checks before any buffer access: ensure the encoded length is consistent with the type's requirements (including non-zero where required), verify that the buffer actually contains the claimed number of bytes, and centralize these validations so that no decode path can bypass them.

Preventive strategies include adopting a defensive design for parsers (treating all external input as hostile), integrating static analysis and fuzzing into the development pipeline, reviewing generated code for unsafe assumptions about lengths and buffer contents, and preferring memory-safe abstractions or languages where parsing complexity is high.

Find out what's already
exploitable in your codebase.