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.
Written by
KleoSEC Team
Published
February 6, 2026
Reading time
2 min read
KleoSEC Team
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
| Field | Value |
|---|---|
| CVE | 2026-24061 |
| Type | Authentication bypass |
| Attack vector | Network |
| Authentication | None |
| Impact | Root access |
| Severity | Critical |
| Affected | GNU 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:
-f <user> (skip authentication)an attacker could send:
USER=-f rootwhich results in immediate root access. This is an argument injection vulnerability, not memory corruption, caused by unsafe input handling.
Vulnerable Code (Before Patch)
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
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
static char *
sanitize (const char *u)
{
if (u && *u != '-'
&& !strcspn (u, "\t\n !\"#$&'()*;<>?[\\]^`{|}~"))
return u;
else
return "";
}Applied everywhere:
[...]
- 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:
nmap -p 23 -sV <target>- Check installation:
dpkg -l | grep inetutils
rpm -qa | grep inetutils- Verify version:
inetutils-telnetd --versionIMPORTANT
If version is <= 2.7, the system is vulnerable.
- Check running service:
ss -lntp | grep :23
systemctl status telnetd telnet.socket- Search logs:
grep telnet /var/log/auth.log
last | grep root
journalctl -u telnetdRemediation
- Patch immediately:
apt install --only-upgrade inetutils-telnetdor
dnf update inetutils- Disable Telnet:
systemctl disable --now telnetd telnet.socket- Block the port:
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:
- https://codeberg.org/inetutils/inetutils/commit/fd702c02497b2f398e739e3119bed0b23dd7aa7b
- https://codeberg.org/inetutils/inetutils/commit/ccba9f748aa8d50a38d7748e2e60362edd6a32cc
NVD - https://nvd.nist.gov/vuln/detail/CVE-2026-24061
CVE Details - https://www.cvedetails.com/cve/CVE-2026-24061
Written by
KleoSEC Team
SECURITY ASSESSMENT
Need a Security Audit?
Our team specializes in securing vibe-coded applications before launch.
Get Security Assessment