← Lab /Security & privacy

AI-generated scripts used in a Linux espionage campaign against government entities

The attackers leveraged large language models to automatically generate malicious payloads for a government-targeted Linux espionage campaign.

Security & privacy Unit 42 15 Oct 2026 Attack Real-world evidence

Published as “AI-Powered Espionage Campaign Targets Government Linux Infrastructure”

Why it matters

AI can accelerate malicious payload development, so defenders should monitor for AI-style code artifacts and harden Linux web-server configurations.

Summary

Unit 42 observed a multi-month campaign (Oct 2025-Apr 2026) against government Linux servers that used AI-generated PHP and shell scripts, custom web shells, and a Go-based RAT called SysGoRAT. The writeup cites conversational comments in the code as evidence of LLM assistance and details persistence via auto_prepend_file hijacking, credential harvesting, and in-memory reverse shells. Defensive products (Cortex XDR) detected attempts to disable endpoint protection and log tampering, showing that the malicious activity was largely mitigated in practice.

What they found 4

  1. Scripts contain AI-style conversational comments indicating LLM assistance

    “multiple scripts contained conversational, step-by-step reasoning notes. These notes explained the code’s logic to the operator who provided the initial instructions.”

  2. SysGoRAT establishes C2 over WebSocket with a hard-coded IP address

    “The malware established a command and control (C2) connection over WebSocket to wss://<addr>/ws. This WebSocket address defaults to a hardcoded IP address 104.194.158[.]65:443, which the malware operator can modify via a command-line parameter at execution.”

  3. Persistence achieved by modifying PHP auto_prepend_file across configurations

    “To achieve persistence, the attackers modified the auto_prepend_file value across all PHP configurations under the directories /etc/php/ and /opt/plesk/php/.”

  4. Endpoint-protection termination attempts were blocked by Cortex XDR

    “These attempts were successfully detected and mitigated by Cortex XDR, with telemetry confirming that endpoint protections were not suppressed.”

Caveats 3

  • suggesting that the code was either generated using large language models (LLMs) or executed by an automated AI agent.
  • Attribution to a specific nation-state or cybercrime group is not determined.
  • The presence of AI-generated comments is inferred, not definitively proven.

What’s new here 4

  • Identification of AI-generated malicious scripts with developer-style comments
  • Discovery of a custom cross-platform Go RAT (SysGoRAT) using WebSocket C2
  • Use of PHP auto_prepend_file hijacking for persistent web-shell deployment
  • Documented anti-forensic techniques including log deletion and endpoint-protection disabling attempts