Critical

Shell Injection Data Exfiltration — Piped Command Exfiltration via Bash

An attacker tricks an AI agent into running a shell command that looks routine — like a ping or a git status check — but is chained with a second command that reads sensitive files and sends them to an outside server. The benign-looking first part is meant to make the whole command seem safe.

How the attack works

The attacker crafts a shell instruction combining an innocuous-looking operation (ping, git status, grep for an audit) with a piped or chained command using operators like && or |. The chained part reads sensitive files such as .env, credentials, or password stores. That data is then sent out using curl, wget, netcat, or Python's urllib, typically to a URL or IP the attacker controls. If the agent executes shell commands on behalf of a user without scrutinizing compound commands, this results in silent theft of secrets.

Netzilo detection

Netzilo reports this behaviour when it is observed.

Signature ID
d112fcdf-53d4-4115-a724-50232da99ef1
Severity
Critical

Why it matters

Credentials, API keys, and other secrets stored in local files can be exfiltrated to an attacker-controlled destination without the user noticing, since the surface-level command looks legitimate.

What you can do

  • Restrict agent shell execution to an allowlist of specific commands rather than permitting arbitrary compound commands.
  • Block or flag outbound network calls (curl, wget, nc, urllib) that originate from agent-run shell commands, especially when chained after file-reading operations.
  • Require separate approval steps for any command that both reads sensitive files (.env, credentials, passwords) and initiates a network connection.
  • Review CI/CD and audit scripts that legitimately grep for credentials or post to webhooks, and document them as known exceptions so they don't mask real exfiltration attempts.

Known benign look-alikes

  • Security audit scripts that grep for credentials to detect exposure in repos (without network transmission)
  • Legitimate CI/CD pipelines posting build status to webhook endpoints
  • Development documentation explaining shell scripting patterns

References

Related threats