A critical flaw in the Netkit Telnet server, tracked as CVE-2026-141380, lets a remote, unauthenticated attacker get a root shell on affected Linux systems without ever seeing a password prompt. Security researcher Liad Levy disclosed it on the OSS-Security mailing list on December 2, 2026. It carries a CVSS 3.1 base score of 9.8 and affects Netkit-based telnetd packages shipped by Debian, Ubuntu, and Kali Linux, along with Gentoo’s net-misc/netkit-telnetd. The root cause isn’t a stray buffer overflow or a new logic error. It’s a Debian patch from 2015 that relaxed environment-variable validation in the Telnet option-negotiation handler, and that relaxation has sat in the package ever since. Levy confirmed passwordless root access end-to-end on Debian 13 “Trixie,” Ubuntu 25.04 and 25.10, and Kali Linux Rolling, plus a separate root-level path on Gentoo’s shipped xinetd configuration. This is laboratory-confirmed exploitation, not attacks observed in the wild, but the mechanics are fully public and the affected code has run in production for over a decade. **How Telnet’s environment-variable negotiation works** ------------------------------------------------------- Telnet, defined in RFC 854 and extended by RFC 1572 for the NEW-ENVIRON option, lets a client and server negotiate environment variables during session setup. The client can send variables marked as “VAR” (well-known names drawn from a standard set) or “USERVAR” (user-defined names the client picks freely). Netkit’s telnetd, derived from the historical BSD telnet daemon, keeps a hard-coded whitelist of variable names it will accept from the client. The function `envvarok()` checks the client-supplied name against that short list; anything that fails gets discarded instead of passed into the daemon’s environment. The whitelist works in principle: it stops a malicious client from injecting `LD_PRELOAD`, `IFS`, or `ENV` into the environment the daemon eventually hands to the login process. The weakness is in how that whitelist interacts with the client-controlled USERVAR flag. **The 2015 Debian patch that broke the whitelist** -------------------------------------------------- Debian introduced the patch at the center of this CVE in March 2015 to close bug #237268. The complaint was mundane: a Solaris Telnet client sent non-standard variables as USERVAR, while Netkit’s own client marked them as VAR, so the server’s whitelist rejected the Solaris client’s variables. The maintainer’s fix let the server accept anything the client flagged as user-defined, compiled behind the `ACCEPT_USERVAR` macro. The code change in `telnetd/state.c` turned the acceptance check into `if (envvarok(varp) || is_uservar) setenv(...)`. That `|| is_uservar` clause means any variable the client tags as USERVAR skips the `envvarok()` whitelist entirely, because the client alone controls that flag. The patch didn’t just widen the whitelist. It handed the client a way around it. **From environment poisoning to a root shell** ---------------------------------------------- During Telnet’s option negotiation, before any user identity exists, the attacker’s client sends a NEW-ENVIRON suboption with variables marked USERVAR. Because of the relaxed check, the daemon calls `setenv()` on each one. By the time it forks the login child process with `startslave()`, that child inherits the poisoned environment, and the setuid-root `telnetlogin` wrapper forwards it to `/bin/login` unchanged, checking only `TERM` and `REMOTEHOST`. The attacker now controls arbitrary environment variables in the process about to authenticate the session. Which variable turns that into code execution depends on how the target is configured. **Path one: LD_PRELOAD, when telnetd runs as root.** Legacy inetd entries, systemd units without a `User=` directive, and Gentoo’s shipped xinetd configuration all run the daemon with root privileges. With no privilege transition in the exec chain, the dynamic loader never sets `AT_SECURE` on the login process, so glibc honors `LD_PRELOAD`. An attacker injects `LD_PRELOAD=/path/to/attacker.so` during negotiation, and when `/bin/login` runs, the loader maps that shared object in and runs its constructor as root before any authentication prompt appears. This requires the attacker to already have a file-write primitive on the host, so it’s a chaining attack: an arbitrary file upload, a path-traversal write, a zip-slip extraction, or anything that drops user-controlled files into `/tmp` or `/dev/shm` can feed straight into this. **Path two: CREDENTIALS_DIRECTORY, even when telnetd runs unprivileged.** This is the more interesting one, because it works in Debian’s default setup, where the setuid-root `telnetlogin` wrapper does set `AT_SECURE`, which strips `LD_*` variables and closes path one. But glibc’s secure-execution filtering doesn’t touch `CREDENTIALS_DIRECTORY`, and `/bin/login` from util-linux 2.40 and later reads it as a systemd-style credentials directory. If that directory contains a file called `login.noauth` with the three bytes “yes,” util-linux login skips PAM authentication entirely. Since `telnetlogin` calls `setuid(0)` and telnetd’s `start_login()` passes the client-supplied `USER` variable straight to `/bin/login`, an attacker who injects `USER=root` alongside a writable `CREDENTIALS_DIRECTORY` gets login running as root with authentication skipped. Levy confirmed this exact chain on Debian 13 Trixie with util-linux login 2.41.5 and the distribution’s default non-root inetd entry, and reproduced it on Ubuntu 25.04, 25.10, and Kali Linux Rolling. The file-write requirement here is trivial because a three-byte text file beats a compiled shared object. ![CVE-2026-141380](https://i0.wp.com/thecybersecguru.com/wp-content/uploads/2026/12/1796276101032.jpg?resize=960%2C540&ssl=1)CVE-2026-141380 **Which systems are actually affected** --------------------------------------- Three variables decide exposure: which Telnet daemon is installed, whether it was built with `ACCEPT_USERVAR`, and which login implementation and version the host runs. **📬 Stay Ahead of Cyber Threats** --------------------------------- Get the latest cybersecurity news, critical vulnerabilities, threat intelligence, tutorials, and exclusive giveaways delivered straight to your inbox. No spam. Unsubscribe anytime. - Debian’s telnet and telnetd-ssl packages at version 0.17-42 and earlier carry the vulnerable build. - Debian 13 Trixie, Ubuntu 25.04, Ubuntu 25.10, and Kali Rolling are confirmed vulnerable to the full passwordless root chain. - Debian 11 Bullseye accepts the injected variables, but its util-linux 2.36 predates the `CREDENTIALS_DIRECTORY` / `login.noauth` feature, so only path one applies, and only if the daemon runs as root. - Gentoo’s net-misc/netkit-telnetd carries Debian’s patch, and its default xinetd configuration runs as root, so path one applies directly. - Amazon Linux 2, Amazon Linux 2023, and Amazon Linux 2027 Preview are not affected, since they don’t ship the vulnerable Netkit build. Distribution version numbers alone won’t tell you whether you’re exposed. Check the installed package, the `ACCEPT_USERVAR` build flag, the daemon’s privilege level, and the util-linux login version on each host. **How to fix it** ----------------- Disable Telnet and use SSH wherever possible. That removes the attack surface instead of trying to filter around it. Where Telnet has to stay, restrict it at the network layer to trusted management hosts and confirm port 23 isn’t reachable from untrusted networks. That won’t fix the vulnerability, but it shrinks who can reach it. For hosts that must keep the Netkit package, Levy’s disclosure proposes three code-level fixes: revert the `|| is_uservar` clause so USERVAR no longer bypasses `envvarok()`; drop the `ACCEPT_USERVAR` build flag and restore whitelist-only behavior; or make `telnetlogin` enforce its own strict whitelist on what it forwards to `/bin/login`. None of these is a released upstream patch yet, so watch your distribution’s security advisories for one that names CVE-2026-141380 specifically. Don’t confuse this with CVE-2026-28372 in GNU Inetutils telnetd. A fix for that issue doesn’t touch Netkit’s code path; the two implementations handle environment variables differently. One hypothesis worth ruling out: because inetd forks a fresh `in.telnetd` process per connection, an injected environment doesn’t persist past the attacker’s own session. A payload that assumes something like `HOME=/.bash_profile` or `PROMPT_COMMAND` will only run after the attacker is already root on that connection. This is a pre-authentication code-execution and auth-bypass primitive chained to a file-write foothold, not a way to poison environments across sessions. **The takeaway** ---------------- The Netkit whitelist never stopped every form of environment injection, but it did block the specific variables that enable loader-level code execution. A 2015 patch meant to fix Solaris client compatibility turned that whitelist from a hard boundary into something the client could switch off with a single flag, and it survived eleven years of distribution releases because almost nobody thought they were still running Telnet. Debian 13, Ubuntu 25.04 and 25.10, Kali Rolling, and Gentoo are current releases, not forgotten embedded boxes. If you run Netkit-based telnetd anywhere, inventory it now, check the build flag and privilege level, and verify your util-linux login version before assuming this doesn’t apply to you.