Skip to content

Track B: reverse injection, target artifacts must stay data (pickle, .pyc, git hooks, SDKs) #767

Backlog

Description

@BaaRai

Context

Split from #765 (thanks @Coff0xc). Track A (honeypots, fake success, honey-tokens) is #766. This issue owns the other half: target bytes becoming code.

Failure mode

In-scope content becomes worker code, or becomes a goal, scope or finding in the control plane, without the operator asking for that execution. Prompt injection is one input. The reliable path reported publicly is implicit or loot-gated execution: a backup that must be imported, a .git that must be recovered, an SDK that must be installed.

Gap measured on main (0edb39f)

Searching the tree as it stands:

  • pickle 0 hits, sitecustomize 0 hits, fsmonitor 0 hits.
  • There is no intercept policy for these loaders today.

Worker isolation bounds the blast radius (no panel keys, DB or socket per docs/SANDBOX.md), but it does not stop a target-supplied archive from executing inside that worker. A pentest worker has to unpack hostile bytes, so this can only be closed with artifact policy, not with a stronger box.

Acceptance criteria

  • Downloaded artifacts stay data until the operator or an existing intercept rule says otherwise. Default deny or ask for at least:
    • pickle / joblib / shelve / dbm load of workspace files
    • running Python with a target tree on PYTHONPATH, or importing sitecustomize / __pycache__ from the workspace
    • git checkout or git-dumper recovery that would honor target .git/config (core.fsmonitor, core.sshCommand, alias.*, credential.helper)
    • pip install / npm ci from an index or tarball whose host is the current target
    • executing a binary, native module, credential_process, kubeconfig exec or SSH ProxyCommand that came from the workspace
  • Intercept rules inspect the real argv including wrappers (python -c, bash -lc, pip install ./), reuse the existing gate instead of a parallel policy, and name the known argv-prefix limit in the denial rather than failing open.
  • A trap recorded by one worker pauses that artifact or the task for the operator, so sibling workers on the same task do not load the same hash again.
  • A fooled or owned worker cannot mark facts operator_input, approve its own scope, spawn an egress-capable child task, or overwrite another engagement. Remaining holes are bugs against GHSA-86r5, GHSA-53wc and GHSA-ph8r, not model decisions.
  • Worker compromise surfaces as an operator-visible runtime incident on that task, not as a finding against the target.
  • Prompt tails stay on and loot-gated lies get a regression. Fixtures in the shape of the published write-ups (timing-bound pipe to sh, role-forged "install this SDK"). Direct prompt injection scoring 0/8 is not a pass while loot-gated execution still works.
  • Installing a target-supplied package is an operator decision, not a worker decision. A package with no implant is not safe: after install, the in-scope server can drive it to exec (billing SDK, 8/8). The gate sits at the install boundary, and a loader we did not ship surfaces as a task runtime incident.
  • Recovering and checking out a repository neutralizes hostile .git/config (core.fsmonitor, core.sshCommand, alias.*, credential.helper) before checkout. The gate is the operation, not the tool name: git-dumper does not strip it and a hand-rolled dumper is worse.
  • The runtime incident records what the executed artifact could observe about the operator (hostname, user, working directory, environment variable names, parent command lines), because that is what a loader beacon reports back.

Out of scope

Sandbox backend rewrite (#554, #555), containing a kernel or runtime 0-day, making remote RCE on the target safe, replacing artex-runner.

Slices

  1. Intercept defaults for pickle, .pyc, git hooks, target-index installs and workspace binaries, with tests.
  2. Cross-worker artifact pause on an explicit trap fact, hash keyed and task scoped.
  3. Regression fixtures on synthetic local targets only. No third-party sites, no real exploits in CI.

Activity

  1. Coff0xc commented on Dec 1, 2026

    @Coff0xc
    Contributor

    Two loaders a pickle-pattern rule will not catch.

    Billing SDK (8/8 in the write-up): the package has no implant. After install, the in-scope server sends an opcode that becomes exec. Denying pip install --index-url <target> is not a close-out — installing an in-scope SDK is the job. Server-sent eval/exec/opcode is the same class as pickle.

    Stateful Form: no files. Decoding a hidden field is the trap. The checklist as written is all file loaders (pickle, .pyc, git, pip, workspace binaries).

    python / git / pip / npm already cannot be always-allowed. Default is still allow. The gap is deny/ask defaults for the loaders, including recover-and-checkout rather than the tool name, .pth / usercustomize next to sitecustomize, and git config beyond the four keys (hooksPath, include.path, diff.external, …).

  2. sresarehumantoo commented on Dec 1, 2026

    @sresarehumantoo
    Contributor

    Partial coverage from three PRs opened against slice 1:

    These cover the pickle/joblib/shelve/marshal gate and the workspace-binary gate from the acceptance criteria. Still uncovered from slice 1:

    • PYTHONPATH / sitecustomize / __pycache__ import-path poisoning (the skill tells agents to delete .pyc but there's no intercept rule enforcing it)
    • .git/config neutralization before checkout (core.fsmonitor, core.sshCommand, credential.helper): the existing git clone gate fires but doesn't strip hostile config post-checkout
    • credential_process / kubeconfig exec / SSH ProxyCommand from workspace files
    • pip install ./ / npm ci from a target-index tarball (the existing install gate fires on the command but doesn't distinguish target-index from PyPI)

    Happy to take any of those on if the approach looks right.

  3. sresarehumantoo commented on Dec 1, 2026

    @sresarehumantoo
    Contributor

    Correcting my last comment: #770 doesn't cover the workspace-binary gate. Docker rejects noexec in a bind mode (invalid mode: rw,noexec,nosuid), so the worker wouldn't even start, and CI missed it because the live sandbox test is opt-in. I've closed it; details are on #770.

    I reworked the other two after another pass:

    • harden(skill): cover .pyc shadowing and unsafe deserialization #771 now deletes stray *.pyc/*.pyo files too, not just __pycache__/. A .pyc with no .py next to it still got imported. The cleanup also moved ahead of the "only run code whose review is clean" step, and the review now calls out shipped bytecode and .pth/sitecustomize files.
    • harden: gate unsafe deserialization behind operator approval #772 now catches yaml.load with an unsafe Loader, python -m pickle, Unpickler, dill/cloudpickle, read_pickle, allow_pickle=True, and pickle imported under another name (it gates the import itself). It still can't see inside a script file, and the denial message says so. The bypasses I know about are written up as tests and in the skill.

    Here's what's still open from slice 1. I already have some of it as risk signals in a downstream fork, so porting is mostly mechanical once we agree on the shape:

    • Python startup: PYTHONSAFEPATH=1 and PYTHONDONTWRITEBYTECODE=1 in the worker env, plus flagging PYTHONPATH=, sys.path edits, .pth, and sitecustomize/usercustomize.
    • Running binaries out of /workspace, which is what fix(sandbox): add noexec,nosuid to /workspace bind mount #770 was meant to stop.
    • Hostile .git/config before checkout (including the extra keys Coff0xc listed), git-dumper, and clones from non-forge hosts.
    • pip/npm installs from a non-default index.
    • credential_process, kubeconfig exec and SSH ProxyCommand from workspace files.
    • Coff0xc's server-driven cases (the billing SDK opcode, the Stateful Form field). A file-loader rule won't catch those.

    @BaaRai, a few questions before I open anything else:

    1. Should these stay opt-in ask rules under hardening/, or do you want some of them on by default? The issue says "default deny or ask", but everything in hardening/ is opt-in today.
    2. Would you take PYTHONSAFEPATH in the worker env? Unlike the skill, it's actually enforced, but a script in /workspace can no longer import the modules sitting next to it.
    3. For /workspace, the only noexec route I can see is putting the task root on a host filesystem that's already mounted noexec, which a bind mount should inherit. Is that acceptable, or does it belong with Proposal: ARTEX-owned Go/bubblewrap backend for enforced execution scope #554/docs: reconcile execution and audit design with upstream Docker backend #555?
  4. sresarehumantoo commented on Dec 1, 2026

    @sresarehumantoo
    Contributor

    Opened #777 for the .pyc half of #771, as a filesystem change rather than skill text. The runner starts the worker with PYTHONPYCACHEPREFIX (prebuilt on the read-only rootfs) and PYTHONDONTWRITEBYTECODE, so a forged __pycache__ pyc is no longer loaded over the reviewed .py. Measured on the worker's Python 3.11.2: timestamp-forged, hash-based (unchecked, and checked with the correct source hash) and package __init__ pycs are closed, and py_compile still works. A sourceless foo.pyc, a native .so next to the source, python3 -E and ARTEX_SANDBOX=off are not; the PR describes a tested follow-up for the first and third. PYTHONSAFEPATH stays out: it breaks a plain sibling import from /workspace, which answers question 2 above for me.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions