Skip to content

fix(image): the shipped team server could not be built, and could not run - #7

Merged
BenjiTrapp merged 1 commit into
mainfrom
fix/shipped-image
Nov 17, 2026
Merged

BenjiTrapp merged 1 commit into
mainfrom
fix/shipped-image

Conversation

@BenjiTrapp

Copy link
Copy Markdown
Owner

Asked which of the ParrotOS tools in the C2 image were reachable, I tried to build software/c2/Dockerfile. It failed, and kept failing, seven times. Nothing in this repository had ever built it.

This is separate from #6 and touches none of its files.

Four defects break every architecture, today

# Defect Why nobody saw it
1 python:3.12-slim moved to Debian 13, where freerdp2-x11 does not exist No version pinned, no build in CI
4 ln -s fails when pip install -e . succeeds and installs its own console script The step could only pass when pip failed, and 2>/dev/null hid which happened
5 Image copied three flat files; server.py imports software.c2.* Built green, died at import: No module named 'software'
6 Entrypoint printed [✓] NetExec installed for an absent tool || echo 'installed', plus a hardcoded Tools list

Defect 5 is the serious one: the shipped team server could not start, on any architecture. Fixing 1–4 would not have been enough.

Two are arm64 only, and always were

arc4 publishes manylinux x86_64 wheels and no Linux aarch64 one, so pip compiles it there and needs Python.h — python3-dev is now installed. NetExec's aardwolf needs a Rust toolchain; carrying cargo in a slim image for one optional tool is the wrong trade, so that install is allowed to fail and the banner then reports NetExec as missing. On amd64 everything resolves from wheels, which is why development never hit either.

The seventh is mine

Once the image copied the package instead of three loose files, the entrypoint's python3 /opt/raccoon-c2/server.py pointed at a path that no longer existed. The banner printed perfectly and the container exited. It now runs -m software.c2.server, which is what the CI step runs too, so the two cannot drift apart.

What proves it

  • docker build -f software/c2/Dockerfile . → exit 0
  • docker run --entrypoint python3 … -m software.c2.server --help → exit 0
  • The shipped form, no bind mount, own entrypoint: container Up, /api/agents → HTTP 200, beacon port → HTTP 200
  • With lsassy deliberately uninstalled, the banner reads [ ] Lsassy not installed and the Tools line drops it
  • 3452 tests green

The CI job builds and starts

A separate workflow (shipped-image.yml, not ci.yml, to avoid colliding with #6). The second step is the whole point: defect 5 built green, so a job that stopped at the build would have reported success over an image that cannot run. The tool inventory is reported, not asserted — which tools resolve depends on the architecture, and a job demanding nxc would be permanently red on arm64.

Three of the fifteen tests exist because of my own mistakes here

A COPY path left pointing at the old context (the build died at step 17 while my twelve tests were green — they checked that the package is copied, not that the rest still resolved), the entrypoint launching a file that had moved, and a hardcoded green tick left beside three version lookups that can return "not installed".

A test told me to delete an open security finding, and it was wrong

_nothing_is_pinned in test_docs ended with re.search(r"NetExec\s*$", image) — meaning "its git ref carries no tag", but checking that the word ends a line. My continuation backslash defeated the probe, and the suite reported the finding as fixed. Following it would have deleted a live finding from the docs because I added a backslash. The probe now asks whether the three source builds pull a moving ref.

AGENT.md says plainly that pinning the Debian release does not fix the pinning finding: it was pinned because the base had already moved. The six pip packages and three git branches are still unpinned.

… run

Asked which of the ParrotOS tools were reachable, I tried to build
`software/c2/Dockerfile` for what appears to be the first time on a
machine other than the one it was written on. It failed seven ways.

Four of them break every architecture, today:

  - `python:3.12-slim` had moved from Debian 12 to Debian 13, where
    `freerdp2-x11` no longer exists. The build died at step 3 of 20 for
    anyone who cloned this repository. The base now names its Debian
    release.
  - `ln -s` into /usr/local/bin fought the console script that
    `pip install -e .` installs at the same path, so the RelayKing step
    could only succeed when pip had FAILED -- and the `2>/dev/null` on
    the pip call hid which branch had run. Now `ln -sf`.
  - The image copied three flat files while server.py imports
    `software.c2.listeners` and `software.c2.stagers`, so it built
    cleanly and then died with "No module named 'software'". The
    shipped team server could not start at all. It now copies the
    package, from a context of the repository root -- which the agent
    image has always used.
  - The entrypoint reported absent tools as present:
    `$(nxc --version 2>/dev/null || echo 'installed')` printed the word
    "installed" under a green tick, and the Tools summary was a fixed
    string that named `nxc` whatever the image held. Both are now built
    from what is actually on PATH.

Two are arm64 only, and had been there from the start: `arc4` publishes
no Linux aarch64 wheel and needs Python.h to compile (python3-dev is
now installed), and NetExec's `aardwolf` needs a Rust toolchain that a
slim image should not carry. That install is allowed to fail; the
banner then says NetExec is not installed, because it is not.

The seventh I made while fixing the fifth: once the package was copied
instead of three loose files, the entrypoint's
`python3 /opt/raccoon-c2/server.py` pointed at a path that no longer
existed. The banner printed perfectly and the container died. It now
runs the module, which is also what CI runs, so the two cannot drift.

`server.py` additionally looks up `xfreerdp` or `xfreerdp3` rather than
assuming the freerdp2 name, so the next base move is a one-line change
and not an RDP button that fails in an operator's hands.

Fifteen source-level tests assert the properties whose absence produced
each defect, and a workflow builds the image AND starts the server in
it. The second half is the point: defect 5 built green. Three of those
tests exist because of mistakes I made in this change -- a COPY path
left pointing at the old context, the entrypoint launching a file that
had moved, and a hardcoded tick left beside three version lookups that
can return "not installed".

`_nothing_is_pinned` in test_docs read `NetExec\s*$` as "its git ref
carries no tag". A continuation backslash defeated that probe and the
suite declared an open security finding fixed; it now asks whether the
three source builds pull a moving ref. README and AGENT.md are
corrected, and AGENT.md says plainly that pinning the Debian release
does not fix the pinning finding -- it was pinned because the base had
already moved.
@BenjiTrapp
BenjiTrapp merged commit be3fa90 into main Nov 17, 2026
2 checks passed
@BenjiTrapp
BenjiTrapp deleted the fix/shipped-image branch November 17, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant