Repository navigation
fix(image): the shipped team server could not be built, and could not run - #7
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
python:3.12-slimmoved to Debian 13, wherefreerdp2-x11does not existln -sfails whenpip install -e .succeeds and installs its own console script2>/dev/nullhid which happenedserver.pyimportssoftware.c2.*No module named 'software'[✓] NetExec installedfor an absent tool|| echo 'installed', plus a hardcoded Tools listDefect 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
arc4publishes manylinux x86_64 wheels and no Linux aarch64 one, so pip compiles it there and needsPython.h—python3-devis now installed. NetExec'saardwolfneeds 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.pypointed 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 0docker run --entrypoint python3 … -m software.c2.server --help→ exit 0Up,/api/agents→ HTTP 200, beacon port → HTTP 200lsassydeliberately uninstalled, the banner reads[ ] Lsassy not installedand the Tools line drops itThe CI job builds and starts
A separate workflow (
shipped-image.yml, notci.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 demandingnxcwould 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_pinnedintest_docsended withre.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.mdsays 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.