Back to Blog
CVE Advisory

CVE-2026-24061: Telnetd Authentication Bypass → Unauthenticated Root Access

A critical flaw in GNU Inetutils’ telnetd (CVE-2026-24061) allows unauthenticated attackers to inject malicious input during Telnet negotiation and gain immediate root access, making affected exposed TCP/23 service a high-risk compromise point.

KT

KleoSEC Team

February 6, 2026·2 min read

Legacy remote services continue to introduce modern security risk.

CVE-2026-24061 is a critical authentication bypass in the Telnet daemon distributed with GNU Inetutils. A remote attacker can obtain a root shell without credentials simply by connecting to a vulnerable Telnet service and supplying crafted environment data during session setup.

  • No exploit chain.
  • No memory corruption.
  • No brute force.

CAUTION

If Telnet (TCP/23) is reachable, compromise can be immediate.

Quick Facts

FieldValue
CVE2026-24061
TypeAuthentication bypass
Attack vectorNetwork
AuthenticationNone
ImpactRoot access
SeverityCritical
AffectedGNU Inetutils telnetd ≤ 2.7

Root Cause Overview

Telnet supports the NEW_ENVIRON option, which allows the client to send environment variables such as USER, TERM, and HOST. In vulnerable versions of telnetd, these values were trusted and passed directly into the system login program. Because /usr/bin/login supports flags like:

bash
-f <user> (skip authentication)

an attacker could send:

bash
USER=-f root

which results in immediate root access. This is an argument injection vulnerability, not memory corruption, caused by unsafe input handling.

Vulnerable Code (Before Patch)

c
case 'U': return getenv("USER") ? xstrdup(getenv("USER")) : xstrdup("");

No validation was performed. Any client-controlled value reached the login process.

Upstream Fixes (From Actual Commits)

Fix 1 - Reject malicious usernames

c
case 'U': - return getenv ("USER") ? xstrdup (getenv ("USER")) : xstrdup (""); + { + /* Ignore user names starting with '-' or containing shell metachars */ + char const *u = getenv ("USER"); + return xstrdup ((u && *u != '-' + && !strcspn (u, "\t\n !\"#$&'()*;<>?[\\]^`{|}~")) + ? u : ""); + }

This change blocks:

  • usernames starting with "-"
  • shell/control characters
  • option injection such as "-f root"

Fix 2 - Centralized sanitization for all variables

c
static char * sanitize (const char *u) { if (u && *u != '-' && !strcspn (u, "\t\n !\"#$&'()*;<>?[\\]^`{|}~")) return u; else return ""; }

Applied everywhere:

c
[...] - return xstrdup (remote_hostname); + return xstrdup (sanitize (remote_hostname)); [...] - return xstrdup (local_hostname); + return xstrdup (sanitize (local_hostname)); [...] - return xstrdup (line); + return xstrdup (sanitize (line)); [...] - return terminaltype ? xstrdup (terminaltype) : NULL; + return terminaltype ? xstrdup (sanitize (terminaltype)) : NULL; [...]

This ensures all Telnet-supplied values are sanitized before use, closing the entire injection class.

Detection Guide

  • Scan for exposed Telnet services:
bash
nmap -p 23 -sV <target>
  • Check installation:
bash
dpkg -l | grep inetutils rpm -qa | grep inetutils
  • Verify version:
bash
inetutils-telnetd --version

IMPORTANT

If version is <= 2.7, the system is vulnerable.

  • Check running service:
bash
ss -lntp | grep :23 systemctl status telnetd telnet.socket
  • Search logs:
bash
grep telnet /var/log/auth.log last | grep root journalctl -u telnetd

Remediation

  • Patch immediately:
bash
apt install --only-upgrade inetutils-telnetd

or

bash
dnf update inetutils
  • Disable Telnet:
bash
systemctl disable --now telnetd telnet.socket
  • Block the port:
bash
ufw deny 23/tcp
  • Replace Telnet with SSH for secure encrypted access.

Key Takeaway

CVE-2026-24061 is a classic legacy trust failure:

  • Untrusted environment data became login arguments, leading to root access.
  • If Telnet exists in your environment, it should be patched or removed immediately.

Sources

OffSec advisory - https://www.offsec.com/blog/cve-2026-24061/

SafeBreach root cause analysis - https://www.safebreach.com/blog/safebreach-labs-root-cause-analysis-and-poc-exploit-for-cve-2026-24061/

Upstream fixes:

NVD - https://nvd.nist.gov/vuln/detail/CVE-2026-24061

CVE Details - https://www.cvedetails.com/cve/CVE-2026-24061

KT

Written by

KleoSEC Team

More Articles

SECURITY ASSESSMENT

Need a Security Audit?

Our team specializes in securing vibe-coded applications before launch.

Get Security Assessment