CVE-2025-32029: @apeleghq/asn1 der Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-p4qw-7j9g-5h53
CWE-835 CWE-1335
Published
Advisory Summary

CVE-2025-32029 is a MODERATE denial of service vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting @apeleghq/asn1 der libraries in the npm ecosystem. The issue involves ts-asn1-der has incorrect der encoding of numbers leading to denial of service and incorrect value representation. Remediation is available by upgrading affected packages to version 1.0.4.

CVE-2025-32029 at a Glance

CVE Identifier CVE-2025-32029
GHSA Identifier GHSA-p4qw-7j9g-5h53
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product @apeleghq/asn1 der
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-32029

To remediate this vulnerability, upgrade all affected @apeleghq/asn1 der dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@apeleghq/asn1-der fixed: 1.0.4
npm install @apeleghq/asn1-der@1.0.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @apeleghq/asn1-der

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-32029, inspect your project dependencies using npm:

npm ls @apeleghq/asn1-der

Analyze the terminal output to locate any version of @apeleghq/asn1 der in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.4), your application is affected.

Note: The npm ls @apeleghq/asn1-der command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In @apeleghq/asn1 der, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Incorrect `number` DER encoding can lead to denial on service for absolute values in the range `2**31` -- `2**32 - 1`. The arithmetic in the `numBitLen` didn't take into account that values in this range could result in a negative result upon applying the `>>` operator, leading to an infinite loop. In addition, `number` encoding had a few other issues that resulted it in it not encoding values correctly. ### Patches The issue is patched in version `1.0.4`. Users are recommended to upgrade as soon as possible. ### Workarounds If upgrading is not an option, the issue can be mitigated by validating inputs to `Asn1Integer` to ensure that they are not smaller than `-2**31 + 1` and no larger than `2**31 - 1`. Although `Asn1Integer` supports `bigint` inputs, some additional implementation issues make using `bigint` as a mitigation inviable, as it will result in incorrect values. If upgrading is not an option and range checks are impractical or undesirable, input to `Asn1Integer` can be provided as a buffer to be used directly. Note that this requires computing the correct DER encoding externally. ### References N/A

CVE-2025-32029 Affected @apeleghq/asn1 der Versions

1 component(s)
Fixed Versions:
1.0.4
Product / Package Ecosystem Affected Versions Fixed Version
@apeleghq/asn1-der
npm
< 1.0.4
1.0.4

References

Frequently Asked Questions

What is CVE-2025-32029?
CVE-2025-32029 is a security vulnerability in @apeleghq/asn1 der involving ts-asn1-der has Incorrect DER Encoding of Numbers Leading to Denial of Service and Incorrect Value Representation under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which @apeleghq/asn1 der versions are affected?
Affected versions include releases prior to 1.0.4 across affected packages: @apeleghq/asn1-der.
What version fixes CVE-2025-32029?
Upgrading to 1.0.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @apeleghq/asn1-der affected?
Yes, @apeleghq/asn1-der is affected in releases prior to 1.0.4. Upgrade your dependency to 1.0.4 or later.
What CWE is associated with CVE-2025-32029?
CVE-2025-32029 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check npm dependencies for CVE-2025-32029?
Run the dependency tree command: 'npm ls @apeleghq/asn1-der'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p4qw-7j9g-5h53",
  "modified" : "2025-04-08T17:49:39Z",
  "published" : "2025-04-07T21:11:19Z",
  "aliases" : [ "CVE-2025-32029" ],
  "summary" : "ts-asn1-der has Incorrect DER Encoding of Numbers Leading to Denial of Service and Incorrect Value Representation",
  "details" : "### Impact\n\nIncorrect `number` DER encoding can lead to denial on service for absolute values in the range `2**31` -- `2**32 - 1`. The arithmetic in the `numBitLen` didn't take into account that values in this range could result in a negative result upon applying the `>>` operator, leading to an infinite loop.\n\nIn addition, `number` encoding had a few other issues that resulted it in it not encoding values correctly.\n\n### Patches\n\nThe issue is patched in version `1.0.4`. Users are recommended to upgrade as soon as possible.\n\n### Workarounds\n\nIf upgrading is not an option, the issue can be mitigated by validating inputs to `Asn1Integer` to ensure that they are not smaller than `-2**31 + 1` and no larger than `2**31 - 1`. Although `Asn1Integer` supports `bigint` inputs, some additional implementation issues make using `bigint` as a mitigation inviable, as it will result in incorrect values.\n\nIf upgrading is not an option and range checks are impractical or undesirable, input to `Asn1Integer` can be provided as a buffer to be used directly. Note that this requires computing the correct DER encoding externally.\n\n### References\n\nN/A",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@apeleghq/asn1-der"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ApelegHQ/ts-asn1-der/security/advisories/GHSA-p4qw-7j9g-5h53"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-32029"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ApelegHQ/ts-asn1-der/commit/b2bc9032cbe19755d234a27d79e47a7e52993af8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ApelegHQ/ts-asn1-der"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1335", "CWE-835" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-07T21:11:19Z",
    "nvd_published_at" : "2025-04-07T21:15:42Z"
  }
}