Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-24061 — Proof-of-concept exploit for CVE-2026-24061, a telnetd authentication bypass via argument injection in the USER environment variable, allowing unauthenticated root shell access. | Kitploit
Tools/GitHubGitHub/przemytn/cve-2026-24061
Vulnerability AnalysisExploitationWeb SecurityNetwork SecurityPenetration TestingAuthentication
GitHubprzemytn/cve-2026-24061

CVE-2026-24061

Proof-of-concept exploit for CVE-2026-24061, a telnetd authentication bypass via argument injection in the USER environment variable, allowing unauthenticated root shell access.

View Repository
5 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-24061 - telnetd auth bypass

What it's about

Argument injection in telnetd from GNU InetUtils. Versions 1.9.3 to 2.7. CVSS 9.8. On the CISA KEV list since 26.01.2026, meaning it's actively exploited in the wild.

The whole trick is that telnetd takes the value of the USER environment variable from the client via NEW-ENVIRON (RFC 1572) and pastes it without any validation straight into the login(1) invocation. If the client sends USER="-f root", telnetd will run:

root@kitploit:~
/usr/bin/login -p -h <host> -f root

The -f flag in login means "log this user in without a password". Root shell, zero authentication.

Mechanism

In telnetd/telnetd.c there's a template for the login invocation:

root@kitploit:~
char *login_invocation = PATH_LOGIN " -p -h %h %?u{-f %u}{%U}";

%u is the user from telnet authentication (trusted). %U is the raw value of the USER env var from the client (untrusted). When authentication is not active, %U is used.

Variable expansion lives in telnetd/utility.c, function _var_short_name:

root@kitploit:~
case 'U':
    return getenv("USER") ? xstrdup(getenv("USER")) : xstrdup("");

Zero filtering. Whatever the client sends in USER goes straight to the login command line. Not only -f root works; theoretically any argument that login accepts can be injected.

The bug was introduced in an upstream safe-guard commit from 2015-03-19 (fa3245ac). Ironically, that commit was supposed to fix USER variable handling. Debian had a patch for this in 2019 (0028-telnetd-Scrub-USER-from-environment.patch), but during the CVE-2020-10188 fix in Debian 10 the patch got lost and the bug came back. So Debian 10+, Ubuntu and derivatives are also vulnerable.

How the PoC works

main.py is a minimal telnet client that:

  1. connects to port 23
  2. accepts NEW-ENVIRON in negotiation, WONT for the rest of the options
  3. responds to the SEND request with IAC SB NEW_ENVIRON IS VAR "USER" VALUE "-f root" IAC SE
  4. telnetd fires up login -f root, you get a shell
  5. from then on it works like an interactive session, filtering IAC and ANSI escapes from the output
root@kitploit:~
client                                server
  |--- tcp connect ------------------->|
  |<-- IAC DO NEW_ENVIRON -------------|
  |--- IAC WILL NEW_ENVIRON ---------->|
  |<-- IAC SB NEW_ENVIRON SEND --------|
  |--- SB NEW_ENVIRON IS              |
  |    VAR "USER" VALUE "-f root"      |
  |    IAC SE ------------------------>|
  |    [telnetd: login -p -h x -f root]|
  |<-- root@host:~# ------------------|

Usage

root@kitploit:~
python3 main.py <host>
python3 main.py <host> -p <port>

Ctrl+C ends the session.

What not to do

Don't try this on systems that don't have inetutils-telnetd. The telnetd package from netkit is different code and is not vulnerable to this specific bug. If you connect and get a normal login prompt instead of a shell, either the server already has the patch or it's not inetutils telnetd.

Don't change the payload to -f <other_user> expecting it to work on every system. login(1) from some distributions has additional restrictions on -f. On standard Debian/Ubuntu -f root works without a problem.

Affected versions

softwareversions
GNU InetUtils1.9.3 - 2.7
Debian 10+inetutils-telnetd (until patch)
Debian 11fixed in 2:2.0-1+deb11u3
Ubuntuinetutils-telnetd (until patch)

Patch

The official fix adds a sanitize() function that rejects values starting with - or containing shell metacharacters. Applied to all variables in the expansion, not just USER.

root@kitploit:~
static char *
sanitize (const char *u)
{
  if (u && *u != '-' && !u[strcspn(u, "\t\n !\"#$&'()*;<=>?[\\^`{|}~")])
    return u;
  else
    return "";
}
  • fd702c0 - USER patch
  • ccba9f7 - sanitization of all variables
Download Tool