Security

Node.js Security Fixes for DNS Truncation and TLS Hostname Bypasses

By Nikhil Bhangale··6 min read

A practical guide to the October 21, 2026 Node.js security updates (22.23.4, 24.22.1, and 26.12.1), covering NUL-byte DNS truncation, noncanonical IPv4 TLS bypasses, safe TypeScript URL validation, and runtime checks.

Node.js Security Fixes for DNS Truncation and TLS Hostname Bypasses

Suppose your Node.js backend lets customers register outbound webhook URLs, import remote avatars, or trigger OAuth discovery callbacks. Before dispatching the HTTPS request, your code validates that the hostname ends with .partner.example or is not an internal IP like 127.0.0.1. That defense looks solid in a pull request until a crafted payload introduces an embedded NUL byte or an octal IPv4 literal, splitting what your JavaScript validator sees from what the C-level DNS resolver or TLS hostname verifier actually connects to.

On October 21, 2026, the Node.js project released Node.js 22.23.4, 24.22.1, and 26.12.1 across the 22.x, 24.x, and 26.x release lines to close three dangerous hostname and IP canonicalization flaws. Writing on October 26, five days after the official Node.js security release, here is how these bugs break naive SSRF and TLS checks, how to harden outbound URL validation in TypeScript, and how to confirm every live PM2, systemd, and Docker process runs the patched binary.

Breakdown of the October 21 DNS and TLS Fixes

Outbound security controls depend on strict agreement across three layers: application allowlist/blocklist logic, operating-system or c-ares DNS resolution, and X.509 TLS certificate verification. Whenever two layers normalize a hostname differently, attackers slip requests into unauthorized hosts or spoof identities:

CVE IDNode.js SubsystemTechnical Root CauseReal-World Exploit ImpactPatched Versions
CVE-2026-105482node:dns (resolve*, reverse)NUL byte (\x00) truncates C-style strings inside the underlying resolverString allowlist bypass (evil.org\x00.allowed.org resolves evil.org)22.23.4, 24.22.1, 26.12.1
CVE-2026-105483node:tls identity checkMishandling of Unicode fullwidth digits inside IPv4 host stringsTLS hostname verification bypass on non-ASCII digit sequences22.23.4, 24.22.1, 26.12.1
CVE-2026-106069node:tls IPv4 literalsNoncanonical IPv4 literals using leading zeroes (octal notation)Mismatch between IP policy checks and TLS certificate validation22.23.4, 24.22.1, 26.12.1

Do not count on browser UI forms to prevent these inputs. Malformed host strings enter Node services directly via JSON API bodies, stored database webhook records, X-Forwarded-* headers, and federated metadata endpoints.

Why Naive String Allowlists Fail and How to Canonicalize Safely

Look at how easily string inspection breaks before canonicalization. In JavaScript, "attacker.example\u0000.partner.example".endsWith(".partner.example") evaluates to true because V8 strings are length-prefixed UTF-16 arrays rather than NUL-terminated buffers. If an unpatched service hands that raw string to dns.resolve4(), the C binding stops reading at \0 and resolves attacker.example instead. Likewise, checking host !== "127.0.0.1" or host !== "169.254.169.254" fails completely against leading-zero octal forms like 0177.0.0.1, integer IPv4 notation (2130706433), or IPv4-mapped IPv6 literals ([::ffff:127.0.0.1]).

Upgrading to Node.js 22.23.4, 24.22.1, or 26.12.1 patches node:dns and node:tls at the runtime level. Even on a patched runtime, outbound webhook and URL-fetcher code should canonicalize destinations once at the trust boundary with the WHATWG URL parser, reject control characters and non-ASCII tricks, verify resolved IPs against reserved CIDR blocks, and pin the validated IP on the HTTPS agent to block DNS rebinding:

typescript
import dns from "node:dns/promises";
import https from "node:https";
import net from "node:net";

function isPrivateOrReservedIp(ip: string): boolean {
  const clean = ip.toLowerCase().replace(/^::ffff:/, "");
  if (net.isIPv4(clean)) {
    const [a, b] = clean.split(".").map(Number);
    return (
      a === 0 ||
      a === 10 ||
      a === 127 ||
      (a === 169 && b === 254) ||
      (a === 172 && b >= 16 && b <= 31) ||
      (a === 192 && b === 168) ||
      (a === 100 && b >= 64 && b <= 127) ||
      a >= 224
    );
  }
  if (net.isIPv6(clean)) {
    return (
      clean === "::" ||
      clean === "::1" ||
      clean.startsWith("fc") ||
      clean.startsWith("fd") ||
      clean.startsWith("fe80:")
    );
  }
  return true;
}

export async function buildSafeWebhookTarget(rawInput: string, allowedDomain?: string) {
  // 1. Reject ASCII control characters (including NUL \x00) and non-ASCII codepoints
  if (/[\u0000-\u001f\u007f-\uffff]/.test(rawInput)) {
    throw new Error("URL rejected: contains control characters or non-ASCII codepoints");
  }

  // 2. Parse once via WHATWG URL to normalize host casing and IPv4 representations
  const url = new URL(rawInput);
  if (url.protocol !== "https:") {
    throw new Error("URL rejected: only https:// destinations are allowed");
  }

  const host = url.hostname;
  if (!host || net.isIP(host) !== 0) {
    throw new Error("URL rejected: direct IP literals are disallowed for webhooks");
  }

  if (allowedDomain && host !== allowedDomain && !host.endsWith(`.${allowedDomain}`)) {
    throw new Error(`Hostname ${host} is outside permitted domain ${allowedDomain}`);
  }

  // 3. Resolve A/AAAA records and block loopback, RFC1918, carrier-NAT, and metadata IPs
  const answers = await dns.lookup(host, { all: true, verbatim: true });
  if (answers.length === 0 || answers.some((rec) => isPrivateOrReservedIp(rec.address))) {
    throw new Error(`Hostname ${host} resolved to a private or reserved network range`);
  }

  // 4. Pin the checked IP into https.Agent while keeping TLS SNI & cert checks active
  const target = answers[0];
  const agent = new https.Agent({
    lookup: (_hostname, _options, callback) => {
      callback(null, target.address, target.family);
    },
  });

  return { canonicalUrl: url.toString(), agent };
}

Passing url.toString() alongside that agent guarantees that your domain policy check, DNS lookup, TCP socket destination, and TLS servername SNI verification all operate on the exact same canonical hostname without ever setting rejectUnauthorized: false.

Verifying Live Node Binaries Across PM2, systemd, and Containers

Just like the unlinked-binary pitfall I highlighted in the October 2026 critical PHP RCE patching guide, updating Node on disk does not mean your live HTTP workers picked it up. PM2 catches teams off guard constantly: when you install 22.23.4 via nvm, fnm, or apt/dnf and run pm2 restart all, PM2's resident daemon frequently respawns cluster children using the older Node interpreter path cached when the daemon first started weeks earlier.

Verify the actual executable running inside every live node PID across your Linux servers:

bash · terminal
# 1. Print PID, live binary version, resolved /proc/<pid>/exe path, and command line
for pid in $(pgrep -x node); do
  exe=$(sudo readlink -f "/proc/${pid}/exe" 2>/dev/null || echo "deleted-or-unreadable")
  ver=$("${exe%% (deleted)}" -v 2>/dev/null || echo "stale-deleted-inode")
  cmd=$(tr '\0' ' ' < "/proc/${pid}/cmdline" | cut -c1-65)
  printf "PID %-8s %-12s %-36s %s\n" "$pid" "$ver" "$exe" "$cmd"
done

# 2. Refresh PM2's in-memory daemon to pick up the upgraded Node binary cleanly
pm2 update
pm2 reload all --update-env

# 3. Restart systemd-managed Node units and verify MainPID executable
sudo systemctl restart nextjs-frontend.service
systemctl show -p MainPID --value nextjs-frontend.service | xargs -I{} sudo readlink -f /proc/{}/exe

# 4. Check embedded Node versions inside all running Docker containers
for cid in $(docker ps -q); do
  cname=$(docker inspect --format '{{.Name}}' "$cid")
  nver=$(docker exec "$cid" node -v 2>/dev/null || echo "no-node")
  printf "%-32s %s\n" "$cname" "$nver"
done

If /proc/<pid>/exe ends with (deleted), that daemon is still running the pre-patch binary in RAM and needs a service restart. Pin updated base images (node:22.23.4-bookworm-slim, node:24.22.1-alpine, or node:26.12.1-bookworm-slim) inside your CI pipeline and verify process.version in your post-deploy health check, following the smoke-test pattern from zero-downtime deployments for Laravel and Node.js. Finally, cross-check the Node.js release schedule and migrate any stray 20.x or odd-numbered runtimes onto an actively patched LTS line.

Sources

Consult the full upstream advisory alongside this guide to review bundled dependency fixes and platform-specific build notes included in the October 21 release.

#Node.js#Security#DNS#TLS#CVE
← Back to all posts

Related Articles

Browse all articles →
Security11 min read

PHP Nov 2026 Critical RCEs: Patch 8.5.13 & 8.4.28 Now

The PHP Foundation released 8.5.13, 8.4.28, 8.3.37, and 8.2.36 on November 19, 2026 fixing 18 security flaws including CVSS 9.2 PHP-FPM smuggling and session upload RCEs. Here is my Linux sysadmin audit, hot mitigation, and multi-PHP patch playbook.

Read article →
Security9 min read

Fixing Linux Kernel NoisyTCP (CVE-2026-99288) Fast

Disclosed in November 2026, CVE-2026-99288 (NoisyTCP) lets unauthenticated remote TCP packets crash multi-queue Linux servers via a decade-old SYN-cookie lookup race. Here is how to audit your exposure, mitigate safely without breaking SYN flood defenses, and patch cleanly.

Read article →
Security12 min read

Hosting Security in 2026: Lessons from Hostinger's LiteSpeed Zero-Day and Mittwald's MCP Server Breach

Explore the 2026 Hostinger and Mittwald security incidents, shared hosting vulnerabilities, MCP server risks, and essential security practices for hosting providers.

Read article →
Chat on WhatsApp