//nefariousplan

CVE-2025-60876: BusyBox wget Stalled On `/foo bar`. GNU wget Has Had The Fix Since 2017.

vendor

patterns

cve

proof of concept

CVE-2025-60876 is an HTTP request-line injection in BusyBox wget: a URL containing a raw CR or LF in the path splits the request line and injects a header, because wget substitutes the path into "GET %s HTTP/1.1\r\n" verbatim. GNU wget closed the same class under CVE-2017-6508 in March 2017. The class was reported against BusyBox wget on the busybox mailing list on August 28, 2025. Two patches were proposed. Neither merged. Both reject every URL byte at or below 0x20 with bb_error_msg_and_die, which closes the injection and also rejects a literal space, so wget 'http://example.org/foo bar' errors instead of sending. Alpine has held its backport on that regression. The third patch arrived on June 12, 2026, from a commercial Long-Term-Support vendor; it percent-encodes the path and rejects controls only in the host, which is the architectural fix GNU wget shipped nine years earlier in the same applet name.

The path goes into a format string

networking/wget.c at lines 1222 through 1232 of BusyBox 1.37.0:

/* Send HTTP request */
if (use_proxy) {
    SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n",
        target.protocol, target.host,
        target.path);
} else {
    SENDFMT(sfp, "%s /%s HTTP/1.1\r\n",
        (option_mask32 & WGET_OPT_POST) ? "POST" : "GET",
        target.path);
}

target.path is xstrdup'd from the URL by parse_url() and is otherwise unmodified. target.host is the URL authority component, also taken verbatim. There is no encoder, no filter, no call to sanitize_string() between parse_url() and SENDFMT. Whatever bytes the URL carries are the bytes wget puts on the wire.

The proof is one URL and one socket. Run the BusyBox wget against http://127.0.0.1:19001/x\r\nEvil: injected with a local listener that captures the raw bytes. The listener's transcript:

REQUEST-LINE: b'GET /x'
HEADER: b'Evil: injected HTTP/1.1'
HEADER: b'Host: 127.0.0.1:19001'
HEADER: b'User-Agent: Wget'
HEADER: b'Connection: close'

The CRLF in target.path ended the request line where wget intended to put HTTP/1.1. The next line on the wire, the bytes Evil: injected HTTP/1.1, parsed as a real header. Every subsequent header wget wrote followed the attacker's header rather than the request line.

With http_proxy set, the host injects the same way. http://h\r\nPInjected: 1/p against a proxy listener:

REQUEST-LINE: b'GET http://h'
HEADER: b'PInjected: 1/p HTTP/1.1'
HEADER: b'Host: h'
HEADER: b'PInjected: 1'

The host went into both the absolute-form request-target on line 1225 and the Host: header that follows on line 1234. Two injections per request, from a single CRLF in the URL authority.

Two patches, neither merged, both stalled on /foo bar

Takeuchi Yuma's report and patch landed on the BusyBox mailing list on August 28, 2025 at 07:17 UTC. Subject: [PATCH] (1) wget: fix HTTP request-target header injection and FTP control-path IAC handling; (2) vi: sanitize status/file messages. Three fixes in one submission. The wget patch added a die_on_bad_http_bytes() helper that walked the URL and called bb_error_msg_and_die on the first unsafe byte.

Radoslav Kolev (SUSE) submitted v2 on November 21, 2025 at 09:21 UTC. Subject: [PATCH v2 1/1] wget: don't allow control characters or spaces in the URL. Same approach. The check, in parse_url:

for (s = src_url; *s; s++) {
    if ((unsigned char)*s <= ' ')
        bb_error_msg_and_die("Unencoded control character found in the URL!");
}

Reviewed-by: Emmanuel Deloget.

The condition is <= ' ', which is <= 0x20. It catches the bug. CR is 0x0D, LF is 0x0A, both below 0x20. It also catches 0x20 itself, the literal ASCII space. A URL like http://example.org/foo bar, which BusyBox 1.37.0 sends with a literal space in the request line and which running deployments use to fetch files with spaces in the name, now dies with "Unencoded control character found in the URL!" before any bytes leave the process.

Alpine tracked the regression as work item 17872 and held the backport. The patch had been reviewed. The thread agreed it closed the injection. It also broke a use case that was working in production. Neither v1 nor v2 has been merged to busybox mainline at commit 244c0a0 (Denys Vlasenko, May 14, 2026), which is the head of master as of this writing. The bug is still live in the version Alpine ships, and in every other downstream pulling 1.37.0 unmodified.

GNU wget closed this class in March 2017

CVE-2017-6508. NVD published 2017-03-07. The description:

"CRLF injection vulnerability in the url_parse function in url.c in Wget through 1.19.1 allows remote attackers to inject arbitrary HTTP headers via CRLF sequences in the host subcomponent of a URL."

GNU's fix, commit 4d729e32 against url.c, did two things. It rejected control characters in the URL host, because a hostname cannot legitimately carry them and percent-encoding is not defined for the authority component per RFC 3986. It percent-encoded control characters and space in the path before substituting the path into the request-line format. curl, written by a different team in a different decade, has handled URL bytes the same way for as long as anyone has cared to check.

That fix is the prior art for this class. It has been on the GNU Savannah wget.git shelf for nine years. BusyBox wget and GNU wget share an applet name and a basic use case and nothing else: separate codebases, separate maintainers, separate test suites. The class did not propagate to the fix. The first two BusyBox patches did not adopt the GNU approach. Both wrote a blanket-reject filter from scratch and shipped it to the list with the same regression baked in.

The third patch arrived ten months later from a commercial vendor

On June 12, 2026, Hayden Barnes of HeroDevs, signed off as [email protected], posted [PATCH v3] on the same thread. HeroDevs is a commercial Long-Term-Support vendor; their business is selling backports and patches for open-source software whose upstream maintainers have either stopped touching it or, as in this case, cannot agree on the fix. The cover letter credits Takeuchi and Kolev for the original analysis and Emmanuel Deloget and Walter Harms for the v2 review, and then implements the GNU wget shape instead:

static char *percent_encode_target(const char *path)
{
    const char *hex = "0123456789ABCDEF";
    const unsigned char *s = (const unsigned char *)path;
    char *buf, *d;

    d = buf = xmalloc(strlen(path) * 3 + 1);
    while (*s) {
        unsigned char c = *s++;
        if (c <= ' ' || c == 0x7f) {
            *d++ = '%';
            *d++ = hex[c >> 4];
            *d++ = hex[c & 0xf];
        } else {
            *d++ = c;
        }
    }
    *d = '\0';
    return buf;
}

The host is rejected at send time:

const unsigned char *hp = (const unsigned char *)target.host;
while (*hp) {
    if (*hp <= ' ' || *hp == 0x7f)
        bb_simple_error_msg_and_die("bad character in URL host");
    hp++;
}

The send block calls the encoder for the path and writes the rejected host as-is. /foo bar becomes /foo%20bar on the wire. /foo%20bar stays /foo%20bar, because the existing % is not in the encoder's set, so an already-encoded path is not double-encoded. A URL with CRLF in the host dies with "bad character in URL host" before any bytes go out. The bloat-o-meter delta on aarch64 defconfig is 185 bytes total, one helper added, no symbols removed.

The patch is 61 lines, one file, one new helper. The architectural choice it makes, encode the path and reject the host, is documented in the GNU wget 2017 commit message and the curl source tree. The two patches that did not merge picked a different architectural choice, reject everything, and produced a regression that downstream maintainers could not accept. The patch that did the same thing GNU wget did, ten months after the report, came from a vendor whose business model is being the third party who writes the patch the maintainers and the reporters did not.

The patch closes the request-target. The FTP control channel is the same primitive.

networking/wget.c at lines 907 through 911 of BusyBox 1.37.0:

//TODO: needs ftp-escaping 0xff and '\n' bytes here.
//Or disallow '\n' altogether via sanitize_string() in parse_url().
//But 0xff's are possible in valid utf8 filenames.
    if (ftpcmd("RETR ", target->path, sfp) > 150)
        bb_error_msg_and_die("bad response to %s: %s", "RETR", G.wget_buf);

The comment is three lines and names both the bug class and a fix candidate. target->path is the same field the HTTP path comes from, and it lands in the same kind of format-string substitution that ftpcmd() uses to build a control-channel command:

fprintf(fp, "%s%s\r\n", s1, s2);

A raw \n in target->path ends the FTP control line and writes the next bytes as a new command. The injection class is identical to the HTTP request-line case. The fix candidate the comment suggests, "disallow \n altogether via sanitize_string() in parse_url()," would also have closed the HTTP case.

The comment was added on February 12, 2018 in commit 3459024bf, titled "wget: more thorough sanitization of other side's data," by Denys Vlasenko. Eight years and four months ago. The same commit added a sanitize_string() for HTTP response data ("we balk at any control chars in other side's messages") and decided the request-side path was a separate problem.

Takeuchi's August 2025 submission included an FTP fix in the same patch as the HTTP fix. The v2 thread narrowed scope to HTTP. The v3 cover letter explicitly excludes FTP: "the FTP control channel (ftpcmd sends target->path and the user/password raw, an upstream-acknowledged TODO) is a separate injection class, not part of CVE-2025-60876, and is not addressed here. It should be tracked separately." The CVE record names the HTTP path. The TODO names the FTP path. The TODO names the user and password fields by extension, because ftpcmd("USER ", target->user ?: "anonymous", sfp) and ftpcmd("PASS ", pass, sfp) write those into the control channel verbatim on lines 851 and 855.

The substrate is a pattern, not an instance

BusyBox wget's URL handling treats every component, the path, the host, the user, the password, as a byte string with no per-byte semantics. The bytes are parsed into struct fields in parse_url() and from there are interpolated into wire-format format strings in three places: the HTTP request line (lines 1225, 1229), the HTTP Host: header (line 1234), and the FTP control channel (lines 851, 855, 865, 910). The injection-class instances live wherever a wire format uses a delimiter the URL component is allowed to carry.

This is a design-debt-driver. The component's architecture is the substrate; each CVE is one wire-format incarnation. CVE-2025-60876 names the HTTP request-target. The FTP control channel is the next incarnation, and the upstream-acknowledged TODO on line 907 has been the spec for that next CVE since 2018. The fix the v3 patch ships closes the request-target. The substrate keeps producing.

It is also a todo-that-shipped in the most literal sense the pattern admits: the comment names the fix, "disallow \n altogether via sanitize_string() in parse_url()," and the code shipped without it for eight years and four months. The first two CVE-2025-60876 patches each added their own sanitize-on-the-URL filter. The third moved the filter to the request-target write site and left FTP untouched. The TODO is still in the source.

GNU wget is not a design-debt-driver for this class because it closed the substrate in 2017. CVE-2017-6508 was the last CRLF-in-URL CVE GNU wget got. The fix made the path encoder and the host filter properties of url_parse, not of individual call sites. BusyBox wget writes target.path into four different wire-format strings. Each one is an independent decision about what to encode.

The disclosure dynamic the v3 patch admits

The first two patches were correct about the injection and wrong about the regression. The third was correct about both and arrived from a commercial Long-Term-Support vendor whose business is supplying the third patch. The CVE record describes the HTTP request-target. The mainline busybox source at 244c0a0 still ships the unfixed code. The FTP control channel is the next CVE in this substrate, and the TODO that names it is dated February 12, 2018.

PoC: sirredbeard/CVE-2025-60876.

GNU wget closed this class in 2017. BusyBox wget could not, because the fix it tried to write broke /foo bar.