Skip to content
SSRF Disclosed report Intermediate

Protocol Smuggling / CRLF Injection via Gopher Protocol allows Arbitrary Command Injection

The Gopher protocol handler in curl does not sanitise newline characters in the selector path, so a crafted gopher URL can carry encoded carriage-return and line-feed bytes that reach the target server as raw line breaks. An attacker could use this to send extra commands to internal text-based services such as Redis, Memcached or SMTP.

0x024062870000nosfu Follow

Originally disclosed on HackerOne

  • Disclosed after 45 hours

Summary: I have discovered that the Gopher protocol implementation in curl fails to properly sanitize newline characters (%0d%0) in the selector path. This allows an attacker to inject arbitrary TCP commands when curl connects to a target server via gopher://. This vulnerability enables Protocol Smuggling attacks, turning a curl request into a weapon to interact with internal services like Redis, Memcached, or SMTP.

Affected version: Master branch (Compiled from source on Dec 24, 2025).

Steps To Reproduce:

  1. Setup a dummy listener (simulating a victim service like Redis or SMTP): $ nc -lvnp 11211

  2. Execute the attack using a crafted Gopher URL containing URL-encoded CRLF characters: $ ./src/curl "gopher://127.0.0.1:11211/_Dummy%0d%0aHELLO_SERVER%0d%0"

  3. Observe the output on the listener side. Instead of receiving a single line (safe behavior), the server receives three distinct lines (vulnerable behavior):

    [Listener Output] Dummy HELLO_SERVER QUIT

    This confirms that the %0d%0 sequence was decoded and transmitted as raw bytes, breaking the protocol structure.

Impact

This vulnerability allows Protocol Smuggling. By exploiting this CRLF injection, an attacker can:

  1. Interact with internal text-based protocols (Redis, Memcached, SMTP) that assume commands are separated by newlines.
  2. Achieve Remote Code Execution (RCE) on internal networks by injecting Redis commands (e.g., writing a webshell via 'CONFIG SET' / 'SAVE' or overwriting 'authorized_keys').
  3. Perform SMTP Injection to send forged emails from trusted internal IPs.
  4. Bypass SSRF protections that rely on protocol allow-listing, as Gopher is often allowed but can simulate other protocols.

Attachments

P2.png
P2.png From the original on HackerOne
P1.png
P1.png

The original report as published on HackerOne, by 0x024062870000nosfu. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Gopher handler decodes percent-encoded bytes in the selector and forwards them without rejecting or stripping carriage-return and line-feed characters, so they act as command separators on the target.

Impact

An attacker could smuggle extra commands into internal services, potentially leading to remote code execution on internal networks, forged email, or bypass of SSRF protections that allow-list Gopher; the report demonstrates only the line-splitting behaviour, not the follow-on attacks.

What the attacker needed

Attacker can make curl fetch a gopher URL; target is a line-based internal service

How it was found

  1. Start a simple listener to stand in for an internal text-based service.
  2. Run curl against that listener using a gopher URL whose selector contains encoded line breaks.
  3. Watch the listener output and note that several separate lines arrive instead of one.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Many internet services read commands line by line, treating each new line as a separate instruction. curl can talk to such services through a scheme called Gopher, and the report says it passes along hidden line-break characters instead of blocking them. That means one request could secretly contain several commands, letting someone make an internal service do things the sender was never meant to ask for.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by 0x024062870000nosfu

View all

1 more disclosed report, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.