Skip to content

Hardened hostname handling against Node.js October 2026 security release - #34

Open
Gera-G-Guiles wants to merge 2 commits into
totaljs:mainfrom
totaljs-es:main
Open

Gera-G-Guiles wants to merge 2 commits into
totaljs:mainfrom
totaljs-es:main

Conversation

@Gera-G-Guiles

Copy link
Copy Markdown
Contributor

No description provided.

Node.js published security releases on 2026-10-21 (22.23.4, 24.22.1, 26.12.1).
Several of the fixed issues depend on how a hostname is written before it
reaches the DNS resolver or the TLS identity check. Total.js cannot require
a specific Node.js version, so the framework now normalizes and validates
hostnames itself, whatever Node.js version the user runs.

Related advisories:
- CVE-2026-105482 (high): dns.resolve*() truncates names at a NUL byte, so
  "attacker.example\0.trusted.example" can pass a hostname validation and then
  resolve a different name.
- CVE-2026-105483 (high), CVE-2026-106069 (high), CVE-2026-106072 (medium):
  tls.checkServerIdentity() mishandles IPv4 literals written with non-ASCII
  digits, leading zeros (octal vs decimal) or non-canonical forms
  (0x7f.0.0.1, 127.1, 2130706433), so a certificate can match a different
  address than the one the OS connects to.

Changes:
- utils.js: added U.validhost(host). It accepts plain hostnames and canonical
  IP literals only and rejects NUL bytes, non-ASCII characters and
  non-canonical IPv4 forms.
- utils.js: added U.tohost(host). It converts the host to its canonical ASCII
  form with url.domainToASCII (punycode for international names, dotted IPv4
  for numeric forms) and returns an empty string when the host is invalid.
  Valid input keeps working: only the written form is normalized.
- utils.js: U.resolve() (used by REQUEST) rejects invalid hostnames before
  resolving. parseURI() already normalizes URLs, so this is defense in depth.
- utils.js: U.connect() normalizes opt.host and returns an "Invalid hostname"
  error instead of connecting when the host is not valid.
- mail.js: the SMTP server is normalized with U.tohost() on a copy of the
  options (the user's object is not modified). Invalid values return
  "Invalid SMTP server hostname." instead of reaching the socket.

Not covered by the framework (fixed only by updating Node.js):
- CVE-2026-105481 (medium): unsolicited data on a reused keep-alive socket.
- The Brotli decoder issue (CVE-2026-111497) does not apply, the framework
  only decompresses gzip and deflate.

The WebSocket client and the HTTPS proxy take their hosts from parseURI(), so
they already receive normalized values.
Documents the hostname normalization and validation (U.validhost, U.tohost, U.resolve, U.connect, SMTP server) and the Node.js CVEs it covers (CVE-2026-105482, CVE-2026-105483, CVE-2026-106069, CVE-2026-106072). Notes that CVE-2026-105481 is fixed only by updating Node.js and that CVE-2026-111497 does not affect the framework.
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.

1 participant