Skip to content

encoded-command-download fires critical on piping a loopback service into an interpreter #38

Closed

Description

@blitzcrieg1

Found by dogfooding, within minutes of starting a clean trail.

This fires encoded-command-download at critical:

curl -s -m 10 http://127.0.0.1:8000/api/v1/audit/status | python -c "import sys, json; ..."

The shape is exactly what the rule is looking for and the rule is right to look
for it: fetch content over the network, pipe it straight into an interpreter.
curl | bash against a remote host is a genuine and common initial-access
pattern.

But the host here is 127.0.0.1, the service is Agentmetry's own API, and the
payload is its status JSON being pretty-printed. Nothing was downloaded in any
meaningful sense and nothing untrusted was executed.

Why this matters more than a single noisy hit

Piping a local service's output into an interpreter is routine for the exact
people this product is aimed at. Anyone running a dev server, querying a local
database, or scripting against their own API will trip this several times a day.
A critical that fires several times a day on normal work does not stay a
critical for long: it becomes the alert people filter out, and the rule stops
protecting them against the case it was written for.

The aws_secret_key comment in the DLP manifest already records this lesson
from the other direction. A bare 40-char pattern matched every git commit SHA,
so git checkout <sha> became a critical finding, and in block mode a denied
tool call. Same failure, different rule.

Suggested fix

Have the pipe_to_shell trait, or the rule consuming it, treat a loopback
destination differently from a remote one.

  • Loopback covers more than one spelling: 127.0.0.0/8, ::1, localhost, and
    in practice 0.0.0.0 when a developer curls their own bound service.
  • Downgrade rather than suppress. A local pipe-to-interpreter is still worth
    recording; it is just not a critical. Dropping it entirely would blind the
    rule to an attacker who stages a payload on a local port first, which is a
    real technique.
  • The severity split belongs where the URL is still visible. By detection time
    the command may only exist as a hash, so this likely wants to happen in the
    hook alongside the other trait classification.

Please add corpus cases

Both halves, in apps/orchestrator/tests/fixtures/detection_corpus/:

  • a benign session that curls a loopback service into an interpreter and must
    not fire
  • an attack session that pipes a remote host into a shell and must fire

The second matters as much as the first. A fix that quietly stops the rule
firing at all would pass a benign-only test and leave the product worse than
before. This is the pairing corpus.yaml exists for.

Related: #25 and #36 on corpus coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    detection-rulegood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions