Repository navigation
Security fixes for 1.4.1 - #1163
Merged
Merged
Conversation
- [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 Report❌ Patch coverage is
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
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
basicConstraintsbypass via deprecated OIDspathLenConstraintbypassSet-Cookieinforge.httpBigInteger.modInverse()hang with negative inputsAlso: 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.