Skip to content

Security fixes for 1.4.1 - #1163

Merged
davidlehn merged 19 commits into
mainfrom
release-1.4.1
Oct 27, 2026
Merged

davidlehn merged 19 commits into
mainfrom
release-1.4.1

Conversation

@davidlehn

Copy link
Copy Markdown
Member
  • Security fixes for node-forge 1.4.1, one or two commits per fix.
  • The advisories will be published after the release. Details are in CHANGELOG.md.
  • CVEs have been requested and will be added to advisories and the changelog when available.
Advisory Severity Area
GHSA-2g46-22mc-6gwp (CVE-2026-85393) HIGH RSA PKCS#1 v1.5 signature forgery (nested DigestAlgorithm)
GHSA-6qrw-m8cv-hcxf HIGH RSA PKCS#1 v1.5 signature forgery (non-canonical DigestInfo)
GHSA-rhr8-3pm8-cq29 HIGH ASN.1 BIT STRING decoding resource exhaustion
GHSA-7wch-p9px-956x HIGH PEM decoding ReDoS
GHSA-hqq3-7jhf-c5jx HIGH TLS record processing stack overflow
GHSA-8hrf-8g6f-7xwp HIGH TLS crash on interleaved handshake fragments
GHSA-jc66-7q78-782g HIGH PKCS#12 MAC bypass with iteration count 0
GHSA-5x38-2vff-x55p HIGH x509 basicConstraints bypass via deprecated OIDs
GHSA-h46v-rmh6-fq4f MODERATE x509 pathLenConstraint bypass
GHSA-5cwg-6vw7-rj6p MODERATE AES-GCM authentication bypass with invalid tag length
GHSA-525v-9gp9-w22h MODERATE TLS client crash without a server certificate
GHSA-6wvx-3r32-xmcg MODERATE Prototype pollution via Set-Cookie in forge.http
GHSA-4487-j8r4-4g2f LOW x509 CA store modified by chain verification
GHSA-h6cr-wjv9-3cpp LOW BigInteger.modInverse() hang with negative inputs
GHSA-9wg5-mj3p-v49q LOW Certificate signature verified with the issuer's scheme
GHSA-2vgq-wchc-25w7 LOW Incomplete PKCS#7 padding validation (CBC/ECB)
GHSA-4642-5mcj-2rqw LOW ASN.1 OID first arc truncation

Also: TLS heartbeat requests before the handshake are ignored (no advisory).

Behavior changes that could affect existing data are marked NOTE in the
changelog (one level of ASN.1 BIT STRING decoding; AES-GCM tag length
validation; strict PKCS#7 unpadding).

Includes work from public PRs #1148, #1159, #1160, #1161 and #1162. Thank
you to everyone who reported these issues; credits are in the changelog and
advisories.

davidlehn and others added 19 commits October 27, 2026 03:25
- [rsa] Require a canonical DER DigestInfo in RSASSA PKCS#1 v1.5 signature
  verification by re-encoding the expected DigestInfo and comparing bytes,
  as in RFC 8017 8.2.2. Rejects extra DigestAlgorithm elements, NULL
  parameters with content, non-minimal lengths, and non-canonical OIDs.
- Address GHSA-2g46-22mc-6gwp (CVE-2026-85393):
  - GHSA-2g46-22mc-6gwp
- Address GHSA-6qrw-m8cv-hcxf:
  - GHSA-6qrw-m8cv-hcxf
- Based on work in PRs #1159 (@matthewscottconroy), #1160 (@shaswata56),
  #1161 (@nitrog7), and #1162 (@RoastFried-RF).
- Add PoC from PR #1160.
- Add tests for canonical and non-canonical DigestInfo encodings, and for
  every supported digest algorithm with and without NULL parameters.

Co-authored-by: Matthew Conroy <matthew.conroy@ibm.com>
Co-authored-by: Shaswata Das <shaswata56@gmail.com>
- [asn1] Apply the `fromDer()` `maxDepth` recursion limit when decoding
  ASN.1 from BIT STRING contents. Contents that would exceed the limit are
  kept as an undecoded BIT STRING value.
- Address GHSA-rhr8-3pm8-cq29:
  - GHSA-rhr8-3pm8-cq29
- Add tests.
- [asn1] Only decode one level of BIT STRING contents in `fromDer()`.
  BIT STRINGs inside decoded BIT STRING contents are kept as undecoded
  BIT STRING values. Nested decoding kept a full copy of the decoded
  contents at each level, using memory quadratic in the nesting depth.
- Address GHSA-rhr8-3pm8-cq29 (BIT STRING decoding resource exhaustion):
  - GHSA-rhr8-3pm8-cq29
- Update tests.
- [pem] Find PEM messages and parse encapsulated headers in linear time.
  Messages are matched as before, except that a BEGIN line's label is the
  shortest one followed by `-----` (RFC 7468 labels can't contain `--`).
- Address GHSA-7wch-p9px-956x:
  - GHSA-7wch-p9px-956x
- Add submitted PoC.
- Add tests.
- [asn1] Reject OIDs whose first arc isn't 0, 1 or 2, or whose second arc
  is over 39 under 0 or 1, in `asn1.oidToDer()`. These encoded the same
  as a different OID.
- [asn1] Encode and decode a multi-byte first OID subidentifier (e.g.
  `2.999`) in base 128. From PR #1148 by @spokodev.
- Address GHSA-4642-5mcj-2rqw:
  - GHSA-4642-5mcj-2rqw
- Add tests.
- [tls] Process received TLS records in a loop instead of recursively, so
  the number of records in one `process()` call no longer affects stack
  depth.
- Address GHSA-hqq3-7jhf-c5jx:
  - GHSA-hqq3-7jhf-c5jx
- Add tests.
- [tls] Stop processing a record that interrupts a fragmented handshake
  message after failing the connection with an `unexpected_message`
  alert, instead of throwing a `TypeError`.
- Address GHSA-8hrf-8g6f-7xwp:
  - GHSA-8hrf-8g6f-7xwp
- Add tests.
- [tls] Fail the TLS client handshake with an `insufficient_security`
  alert when the server sends no certificate, even if the `verify`
  callback accepts it, since the RSA key exchange needs the server
  certificate. The check read `c.serverCertificate` instead of
  `c.session.serverCertificate` and never ran.
- Address GHSA-525v-9gp9-w22h:
  - GHSA-525v-9gp9-w22h
- Add tests.
- [pkcs12] Reject PKCS#12 MAC iteration counts less than one.
- [pbe] Reject iteration counts less than one in the PKCS#12 key
  derivation function `pbe.generatePkcs12Key()` (also
  `pkcs12.generateKey()`), used for PKCS#12 MACs and PKCS#12
  password-based encryption.
- Address GHSA-jc66-7q78-782g:
  - GHSA-jc66-7q78-782g
- Add submitted PoC.
- Add tests.

Co-authored-by: Thai <thai@calif.io>
- [x509] Use only the RFC 5280 `basicConstraints` OID (`2.5.29.19`) in
  certificate chain verification, not the deprecated OIDs that are also
  parsed as `basicConstraints`.
- Address GHSA-5x38-2vff-x55p:
  - GHSA-5x38-2vff-x55p
- Add submitted PoC.
- Add tests.
- [x509] Enforce `basicConstraints` `pathLenConstraint` in chain
  verification for CA certificates without a `keyUsage` extension.
- Based on the fix in PR #1142 (eddieran).
- Address GHSA-h46v-rmh6-fq4f:
  - GHSA-h46v-rmh6-fq4f
- Add submitted PoC.
- Add tests.

Co-authored-by: ran <edding.suree@gmail.com>
- [x509] Verify a certificate's signature with the padding scheme and
  parameters of its own signature algorithm, using the issuer's public
  key. PKCS#1 v1.5 certificates issued by an RSASSA-PSS certificate, and
  the reverse, failed verification before.
- Address GHSA-9wg5-mj3p-v49q:
  - GHSA-9wg5-mj3p-v49q
- Based on the fix suggested by Brian Lee (Georgia Tech SSLab, Team
  Atlanta).
- Add tests.

Co-authored-by: Brian Lee <hibrian827@gatech.edu>
- [cipher] Validate the GCM `tagLength` option. Only the tag lengths
  defined by NIST SP 800-38D (128, 120, 112, 104, 96, 64, and 32 bits)
  are allowed; numeric strings such as `'128'` are still accepted. A
  `null` or `undefined` `tagLength` uses the default of 128 bits.
- Address GHSA-5cwg-6vw7-rj6p:
  - GHSA-5cwg-6vw7-rj6p
- Add tests.
- [cipher] Require valid PKCS#7 padding when decrypting in CBC and ECB
  mode: a count from 1 to the block size, and every padding byte equal to
  the count. Data with other padding (ANSI X.923, ISO 10126, XML
  Encryption) now fails; set `decipher.mode.unpad = false` to remove it in
  application code.
- Address GHSA-2vgq-wchc-25w7:
  - GHSA-2vgq-wchc-25w7
- Based on the fix suggested by Brian Lee (Georgia Tech SSLab, Team
  Atlanta).
- Add tests, including Wycheproof AES-CBC-PKCS5 vectors.

Co-authored-by: Brian Lee <hibrian827@gatech.edu>
- [http] Only use own properties of the cookie store, and ignore cookies
  named `__proto__` or with the path `__proto__`. A malicious server
  could add properties to `Object.prototype` and `Object`, or delete
  `Object.prototype` properties with an empty cookie value.
- Address GHSA-6wvx-3r32-xmcg:
  - GHSA-6wvx-3r32-xmcg
- Add tests.
- [x509] Do not modify the CA store's list of certificates with the same
  subject when trying each of them as the issuer in
  `pki.verifyCertificateChain()`.
- Address GHSA-4487-j8r4-4g2f:
  - GHSA-4487-j8r4-4g2f
- Add tests.
- [jsbn] Fix `BigInteger.modInverse` to also exit early with zero when
  the target object value or the modulus is negative, completing the
  1.4.0 fix that only checked for zero.
- Address GHSA-h6cr-wjv9-3cpp:
  - GHSA-h6cr-wjv9-3cpp
- Incomplete fix of GHSA-5m6q-g25r-mvwx:
  - GHSA-5m6q-g25r-mvwx
- Add tests.
- [tls] Ignore heartbeat requests received before the first handshake is
  complete, instead of answering them. Previously, unauthenticated peers
  could make a connection create and send a heartbeat response for every
  request before the handshake, at a significant CPU cost per request.
- Add tests.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.82353% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.49%. Comparing base (7232404) to head (a5f30dd).

Files with missing lines Patch % Lines
lib/cipherModes.js 93.75% 1 Missing ⚠️
lib/pem.js 98.86% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1163      +/-   ##
==========================================
- Coverage   80.25%   79.49%   -0.77%     
==========================================
  Files          42       43       +1     
  Lines        9597    10231     +634     
==========================================
+ Hits         7702     8133     +431     
- Misses       1895     2098     +203     
Files with missing lines Coverage Δ
lib/asn1.js 74.35% <100.00%> (+0.66%) ⬆️
lib/cipher.js 94.73% <ø> (+2.63%) ⬆️
lib/http.js 39.80% <100.00%> (ø)
lib/jsbn.js 78.62% <100.00%> (+0.26%) ⬆️
lib/pbe.js 80.21% <100.00%> (+0.10%) ⬆️
lib/pkcs12.js 76.87% <100.00%> (+0.84%) ⬆️
lib/rsa.js 79.77% <100.00%> (+1.69%) ⬆️
lib/tls.js 81.45% <100.00%> (+7.01%) ⬆️
lib/x509.js 84.13% <100.00%> (+0.68%) ⬆️
lib/cipherModes.js 97.22% <93.75%> (+1.16%) ⬆️
... and 1 more

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7232404...a5f30dd. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@davidlehn
davidlehn merged commit 4c1c3e3 into main Oct 27, 2026
13 checks passed
@davidlehn
davidlehn deleted the release-1.4.1 branch October 27, 2026 04:39
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.

2 participants