Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

The project used vulnerable node-forge <=1.3.1, exposing ASN.1 DER parsing to unbounded recursion DoS.

How the feature works? / How did you fix the issue?

  • Override node-forge to patched 1.3.2 to block ASN.1 recursion-based stack exhaustion.
  • Updated lockfile to resolve selfsigned’s node-forge dependency to 1.3.2.
"overrides": {
  "nth-check": "^2.1.1",
  "node-forge": "1.3.2"
}

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request
Original prompt

This section details on the original issue you should resolve

<issue_title>Refactor: node-forge has ASN.1 Unbounded Recursion</issue_title>
<issue_description>### Summary

An Uncontrolled Recursion (CWE-674) vulnerability in node-forge versions 1.3.1 and below enables remote, unauthenticated attackers to craft deep ASN.1 structures that trigger unbounded recursive parsing. This leads to a Denial-of-Service (DoS) via stack exhaustion when parsing untrusted DER inputs.

Details

An ASN.1 Denial of Service (Dos) vulnerability exists in the node-forge asn1.fromDer function within forge/lib/asn1.js. The ASN.1 DER parser implementation (_fromDer) recurses for every constructed ASN.1 value (SEQUENCE, SET, etc.) and lacks a guard limiting recursion depth. An attacker can craft a small DER blob containing a very large nesting depth of constructed TLVs which causes the Node.js V8 engine to exhaust its call stack and throw RangeError: Maximum call stack size exceeded, crashing or incapacitating the process handling the parse. This is a remote, low-cost Denial-of-Service against applications that parse untrusted ASN.1 objects.

Impact

This vulnerability enables an unauthenticated attacker to reliably crash a server or client using node-forge for TLS connections or certificate parsing.

This vulnerability impacts the ans1.fromDer function in node-forge before patched version 1.3.2.

Any downstream application using this component is impacted. These components may be leveraged by downstream applications in ways that enable full compromise of availability.

Solution
Update node-forge package to latest version
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor node-forge to address ASN.1 unbounded recursion vulnerability Refactor node-forge to address ASN.1 unbounded recursion vulnerability Jan 24, 2026
Copilot AI requested a review from AlexeyGirin January 24, 2026 14:29
@AlexeyGirin AlexeyGirin marked this pull request as ready for review January 24, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: node-forge has ASN.1 Unbounded Recursion

2 participants