Closed Bug 2026089 (CVE-2026-6772) Opened 7 months ago Closed 6 months ago

Heap Buffer Overflow in NSS TLS Extension Handling

Categories

(NSS :: Libraries, defect, P1)

Tracking

(nss+ 3.123, firefox-esr115150+ fixed, firefox-esr140150+ fixed, firefox149 wontfix, firefox150+ fixed, firefox151+ fixed)

RESOLVED FIXED
Tracking Status
nss + 3.123
firefox-esr115 150+ fixed
firefox-esr140 150+ fixed
firefox149 --- wontfix
firefox150 + fixed
firefox151 + fixed

People

(Reporter: sandeep, Assigned: djackson)

References

(Blocks 1 open bug)

Details

(5 keywords, Whiteboard: [adv-main150+][adv-esr115.35+][adv-esr140.10+])

Attachments

(1 file, 2 external files, 1 obsolete file)

14.55 KB, application/x-zip-compressed
Details
Attached file findings.zip —

Hi,

We're writing from Trail of Bits, a security research firm. We found
a security issue in NSS and have prepared a patch. The finding is
rated Medium. Details are below.

FINDINGS

NSS records negotiated TLS extensions by appending extension ids into
sslSocket.xtnData.negotiated[] (a fixed-size array) using
xtnData->negotiated[xtnData->numNegotiated++] in multiple extension
handlers. These writes have no bounds check and do not de-duplicate
entries. A TLS peer that drives a handshake into recording more than
SSL_MAX_EXTENSIONS negotiated extensions triggers a heap buffer
overflow write (2 bytes per appended extension id).

The provided PoC demonstrates this in TLS 1.3 while processing a server
CertificateRequest that negotiates certificate compression. This occurs
pre-authentication during the TLS handshake; the PoC path requires
certificate compression to be enabled by the application.

REPRODUCTION

Build fuzzers:
python3 infra/helper.py build_fuzzers --clean --sanitizer address nss /path/to/nss

Run the PoC:
python3 infra/helper.py reproduce nss tls-client-no_fuzzer_mode poc.bin

Apply the patch and rebuild:
patch -p1 < patch.diff
python3 infra/helper.py build_fuzzers --clean --sanitizer address nss /path/to/nss
python3 infra/helper.py reproduce nss tls-client-no_fuzzer_mode poc.bin

ATTACHMENTS

We have attached a zip containing:

  • Full technical details of each finding
  • Reproduction steps and proof-of-concept where applicable
  • Candidate patch(es) with regression tests

BACKGROUND

Anthropic is conducting research into the use of large language models
for automated vulnerability discovery in open source software. As part
of that work, Anthropic used Claude to scan a set of widely used open
source projects for security issues. Anthropic then engaged Trail of
Bits to independently triage, manually validate, and develop patches
for the findings. Each issue in this report has been reviewed and
confirmed by human security researchers at Trail of Bits.

NEXT STEPS

We are disclosing under Anthropic's coordinated vulnerability
disclosure policy: https://www.anthropic.com/coordinated-vulnerability-disclosure

Our disclosure timeline is 90 days from the date of
this email, with a 14-day extension available if needed.

We'd like to work with your maintainers to get these issues fixed. We
are happy to submit PRs or coordinate with your preferred process. Let
us know if there's a specific security contact you'd like us to work
with.

Thanks for your work on NSS.

— Trail of Bits, in collaboration with Anthropic

I'm unable to reproduce with the example PoC. Can you confirm that the described issue reproduces reliably for you?

Similarly, much of the report looks plausible, but doesn't provide enough information to reconstruct how the bug is triggered.

Flags: needinfo?(sseehra)
Assignee: nobody → djackson
Severity: -- → S2
Priority: -- → P1

Ok, I was able to rediscover the issue by crafting some different hypotheses and asking Claude to write a test case. The problem is that when PostHandshakeAuth is enabled, each new CertificateRequest with an extension increments the counter, eventually leading to a heap buffer overflow.

Thankfully, this is off by default in Firefox and can only be enabled via the pref security.tls.enable_post_handshake_auth. In NSS it's also off by default, but can be enabled via the option SSL_ENABLE_POST_HANDSHAKE_AUTH.

Flags: needinfo?(sseehra)
Attached file (secure) —
Attached file (secure) (obsolete) —

These patches are going to need a little more work, but demonstrate the issue via some new tests and fix it.

Dennis: what does the oss-fuzz keyword mean here? This wasn't found by it

Flags: behind-pref+
Whiteboard: [nss-nofx]
Duplicate of this bug: 2027370
Duplicate of this bug: 2027326
Duplicate of this bug: 2026946

I'm going to mark this sec-moderate;

  • It clobbers memory, although not in a very controllable way
  • It does so in the parent process in Firefox
  • It's not enabled unless users have flipped an obscure pref in about:config
  • Some external sites do advise users flip the pref, but we don't expose it via enterprise policy.

This report did not correctly identify the issue, the root cause or how to reproduce it. The report in bug 2026946 did correctly identify how to trigger the issue but not why or how. The reports in bug 2027326 and bug 2027370 are high quality and describe the issue in full.

Whiteboard: [nss-nofx]
Flags: sec-bounty-
Flags: sec-bounty-
Status: NEW → ASSIGNED
Blocks: 2031033
Blocks: 2031034
Blocks: 2031176
Blocks: 2031343

Comment on attachment 9557923 [details]
(secure)

Revision D289765 was moved to bug 2031343. Setting attachment 9557923 [details] to obsolete.

Attachment #9557923 - Attachment is obsolete: true

Pushed by jschanck@mozilla.com:
https://hg.mozilla.org/projects/nss/rev/5ccfed7b6219
Clarify extension negotiation mechanism for TLS Handshakes r=#nss-reviewers

Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Pushed by jschanck@mozilla.com: https://hg.mozilla.org/projects/nss/rev/961f1a40f5e7 Clarify extension negotiation mechanism for TLS Handshakes r=#nss-reviewers
Pushed by jschanck@mozilla.com: https://hg.mozilla.org/projects/nss/rev/49daef8233e9 Clarify extension negotiation mechanism for TLS Handshakes r=#nss-reviewers
Attached file (secure) —
Pushed by jschanck@mozilla.com: https://hg.mozilla.org/projects/nss/rev/16b078cfa675 Clarify extension negotiation mechanism for TLS Handshakes (NSS 3.90.5). r=#nss-reviewers
QA Whiteboard: [sec] [uplift] [qa-triage-done-c151/b150]

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

Whiteboard: [adv-main150+]
Whiteboard: [adv-main150+] → [adv-main150+][adv-esr115.35+]
Whiteboard: [adv-main150+][adv-esr115.35+] → [adv-main150+][adv-esr115.35+][adv-esr140.10+]
Alias: CVE-2026-6772
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: