Critical

Webshell Pattern in Agent-Written or Executed Code

This rule flags webshell code appearing in files that an AI agent writes or in the content it passes through tool calls. A webshell is a small script an attacker plants on a server so they can run commands remotely through a web request, giving them a persistent backdoor.

How the attack works

An attacker gets an AI coding or automation agent to generate, write, or execute code containing a webshell pattern — for example PHP that runs eval() or assert() on attacker-supplied input, obfuscated PHP decoder blocks, known webshell family code strings, Python code that turns a request parameter into an exec() call, or JSP/ASPX code that runs OS commands. This could happen through a malicious prompt, a poisoned instruction the agent picks up from a document or repo, or a compromised skill/tool the agent calls. Once the code lands on a server and is reachable over the web, the attacker sends further HTTP requests to it to run arbitrary commands. The rule catches the moment the webshell code is written or executed, not the later remote-command stage.

Netzilo detection

Netzilo can block this behaviour when it is observed.

Signature ID
88b9c0d1-e2f3-4a45-6789-b0c1d2e3f4a5
Severity
Critical

Why it matters

If the written code actually reaches a live, internet-facing server, the attacker gains a persistent remote command-execution backdoor, which can lead to full server compromise, data theft, or lateral movement.

What you can do

  • Review any flagged file or tool-call output manually before trusting or deploying it — do not assume it is a false positive from research activity without checking.
  • Restrict agents that can write files to production or web-accessible directories; require human review before code reaches a deployable path.
  • Scan directories agents can write to for known webshell signatures on a schedule, independent of the agent's own activity.
  • Limit which tools/skills an agent can invoke without approval, especially ones that write files or execute code with network exposure.

Known benign look-alikes

  • Security research labs writing webshell detection test fixtures

Related threats