When the target fights back: hardening ARTEX against honeypot chains
When the target fights back: hardening ARTEX against honeypot chains
NebuSec's ArtexPot suite demonstrated 7 honeypots that get code execution inside an AI pentesting agent's container without any prompt injection. Here is what they found, what we shipped, and what is next.
A pentesting agent’s target is not a passive scan subject. It can serve files that exploit the agent’s own tools, plant configs that redirect connections, or ship packages whose install hooks call home. NebuSec demonstrated this with ArtexPot, a suite of 7 honeypots across 3 attack classes. Their results against an undefended agent: 33 successful compromises out of 36 runs, with no prompt injection involved.
They found real gaps in ARTEX’s defenses, and they were right. This post covers what they demonstrated, what we shipped to close those gaps, and what is still in progress.
The blind spot
Section titled “The blind spot”Before this work, ARTEX’s defense layers all operated at the same level: the shell command string. ShellRisk scored each Bash call against regex signals. The scope gate extracted URLs, IPs and host:port patterns from the command and checked them against the engagement scope. UID isolation ran each conversation’s commands as a separate Unix user. Config isolation blocked planted .claude/settings.json from loading.
These layers are real and they catch a lot. But they share a fundamental limitation: they see what the command declares, not what the process does. A command like python3 analyze.py looks benign. If analyze.py calls pickle.load() on a file the target served, and the deserialized object opens a socket to an attacker-controlled server, none of the existing layers notice. The command string said python3 analyze.py. The scope gate found no network target. ShellRisk scored it low. Meanwhile, arbitrary code is running as the agent.
That is the gap ArtexPot exploits. Every one of its 7 honeypots works by getting the agent to run a normal command that triggers in-process code execution invisible to string-level gating.
The three attack classes
Section titled “The three attack classes”Class 1: tool vulnerability. The target serves a .git directory. The agent uses git-dumper to download it. git-dumper deserializes pickle objects from the repository, executing attacker-controlled code inside the agent’s container.
Class 2: data processing. The target serves data that the agent processes as part of normal operations.
- Pickle files in a “backups” directory. The agent loads them to analyze their contents.
.pycbytecode files that shadow standard library modules. When Python importsjsonfrom a directory containing a trojanedjson.pyc, the bytecode runs.- Form fields whose values contain shell metacharacters or Python payloads. The agent reads them, interpolates them into commands or eval calls.
Class 3: agent takes a known risk. The agent encounters a project with a Makefile, a requirements.txt, or an SDK with native extensions. It runs make, pip install, or imports the package. Build scripts and native extensions execute arbitrary code by design. That is their job. When the target controls the source, that is also the attack.
The common thread: none of these involve tricking the model. The agent makes reasonable decisions (analyze this file, install this dependency, build this project). The exploit is in what happens inside the process after the command starts.
What shipped
Section titled “What shipped”We released 5 PRs that add detection and mitigation at the layers ArtexPot’s chains pass through.
ShellRisk: 15 new signals with false-positive suppression
Section titled “ShellRisk: 15 new signals with false-positive suppression”The riskSignal struct gained an exclude field: a secondary regex that suppresses the match when it hits. This lets us write signals for broad categories (YAML deserialization, npm install with a registry flag, git clone) without flagging safe variants.
type riskSignal struct { reason string points int re *regexp.Regexp exclude *regexp.Regexp // suppresses match when non-nil and matches}
// In ShellRisk scoring:if s.re.MatchString(cmd) && (s.exclude == nil || !s.exclude.MatchString(cmd)) { r.Score += s.points r.Reasons = append(r.Reasons, s.reason)}The 15 new signals, grouped by what they catch:
Deserialization and code execution (30 points each):
pickle.load,joblib.load,torch.load,shelve.openyaml.loadwithoutSafeLoader(excluded whenyaml.safe_loadis present)npm install/yarn add/pnpm installwith--registrypointing away from npmjs.orgpip installwith--index-urlor--extra-index-urlpointing away from pypi.org
Compilation and binary execution (20 points each):
make,gcc,cmake,cargo build,go build(excluded formake test/check/clean/lint)chmod +x(prepares a downloaded file for execution)- Relative path execution (
./something) - git-dumper (the tool ArtexPot’s Class 1 uses)
Dangerous data processing (20 points each):
eval/execon file or variable data- Database clients (
mysql,redis-cli) that may connect to rogue servers git clonefrom a URL (excluded for github.com, gitlab.com, bitbucket.org)- Document parsing tools with RCE history (exiftool, poppler, ImageMagick)
Python path manipulation (20 points each):
- Setting
PYTHONPATH sys.path.insertorsys.path.appendat runtime- References to
sitecustomize.pyorusercustomize.py
A single deserialization signal (30 points + 10 base = 40) puts a command at medium risk. Two signals from different categories stack into high. The operator’s intercept rules decide what happens at each level: allow, ask for approval, or deny.
Python environment hardening
Section titled “Python environment hardening”Every chat shell command now runs with two environment variables injected unconditionally:
var pythonSafeEnv = []string{ "PYTHONDONTWRITEBYTECODE=1", "PYTHONSAFEPATH=1",}PYTHONDONTWRITEBYTECODE prevents the interpreter from writing .pyc files, which removes the surface for bytecode-shadowing attacks where a trojaned .pyc with a valid header sits in __pycache__/ and gets loaded instead of the clean .py.
PYTHONSAFEPATH (Python 3.11+) removes the current directory and the script directory from sys.path at startup. This directly breaks the simplest form of the Class 2 attack where stdlib-shadowing modules in an extracted archive directory (a file named json.py or os.py) get imported instead of the real ones.
Config file scope inspection
Section titled “Config file scope inspection”The scope gate previously extracted targets only from the command string. A command like ssh -F /tmp/extracted/ssh_config target would check target against the scope, but not the hosts named inside ssh_config. If the config file pointed at an attacker-controlled proxy or jump host, the connection went there unexamined.
CommandTargets now also calls configFileTargets, which reads config files referenced in the command and extracts their network targets. Seven patterns detect config file references:
AWS_CONFIG_FILE=,AWS_SHARED_CREDENTIALS_FILE=,aws --configKUBECONFIG=,--kubeconfigssh -F,SSH_CONFIG=
Three parsers (AWS, kubeconfig, SSH) do line-by-line extraction of endpoint_url values, server: entries, Hostname directives, and command values from credential_process, command:, and ProxyCommand. Files that don’t exist, can’t be read, or exceed 1 MiB are silently skipped. Command values from configs are run through target extraction (but not recursively through config inspection) to catch embedded IPs and URLs.
Evidence tool privilege drop
Section titled “Evidence tool privilege drop”capture_command_output runs a shell command and records its output as evidence. Before this fix, it ran sh -c <command> as the MCP server’s own user, bypassing the per-conversation UID isolation that every other shell command gets. An attacker who could influence a captured command (through a finding template, a config value, or the output of a prior command) had a path to server-user execution.
The tool now drops to the base executor UID/GID when the server can drop privileges (root on Linux, as in Docker). Every captured command is also scored by ShellRisk, and the risk report is included in the tool response so the model and the operator both see it.
What is next
Section titled “What is next”Two architecture-level changes are planned but not yet shipped. Both are tracked as open issues.
Network namespace isolation (#482). This is the single change that would break all 7 ArtexPot chains. Each shell command runs in its own network namespace with a veth pair routing all TCP through the recording proxy’s transparent listener. Programs that use raw sockets, ignore HTTPS_PROXY, or open connections on non-standard ports can no longer reach the network without going through the proxy. The proxy records the traffic and the scope gate can check the actual destination, not just what the command string declared.
This requires CLONE_NEWNET (Linux, root), iptables rules per namespace, and careful handling of DNS. The implementation plan is written; the work is scoped as large because it touches the kernel interface and the shell execution chain.
Process tree monitoring (#483). A double-fork with setsid() escapes the process group that ARTEX kills when a command finishes. The orphaned process runs indefinitely, reparented to PID 1. The fix combines PR_SET_CHILD_SUBREAPER (the exec-shell wrapper catches orphans via SIGCHLD) with cgroups v2 per-command (authoritative enumeration and kill of everything that outlived the parent). This requires changing exec-shell from syscall.Exec to fork+wait, which is a meaningful change to the process model.
Both features will ship behind environment variables first, with warn-only defaults, before becoming the default in Docker deployments.
The larger picture
Section titled “The larger picture”Honeypot-style attacks against AI agents are not theoretical. The attack surface is real: agents run tools, tools process untrusted data, and processing untrusted data has always been where code execution bugs live. The difference is that an autonomous agent will encounter and process that data without a human in the loop deciding whether each file looks safe.
ARTEX’s approach is defense in depth: score commands before they run, check targets against the engagement scope, isolate each conversation’s processes, and (soon) force all network traffic through the recording proxy. No single layer catches everything. ShellRisk cannot see what happens inside a running process. UID isolation does not prevent network access. The scope gate only checks targets it can extract. Each layer catches what the others miss, and the operator’s intercept rules set the threshold for how much risk the agent can take autonomously.
The hardening in this release closes the specific gaps ArtexPot demonstrated. The architectural work in #482 and #483 addresses the class of problem: in-process behavior that string-level gating cannot see.