Scanned
Summary
Scanned exposed only SSH and an nginx-hosted malware-analysis application. The web application accepted uploaded binaries, ran them inside a seccomp-filtered chroot, and returned a syscall report. Its downloadable source disclosed both the sandbox restrictions and the chroot layout. That knowledge made it possible to build a small binary that stayed inside the permitted syscall set while reading a credential file and writing its contents into the scanner's output.
The recovered credential authenticated over SSH as clarence. Local enumeration did not reveal a conventional sudo path; the decisive escalation reused the sandbox design. A SUID program crossed into the chroot and loaded a shared library from a location the sandbox could influence. Replacing that library with a constructor payload created /tmp/rootbash as a SUID-root binary. Executing it with privilege preservation produced an effective UID of root and access to the final objective.
Attack path — how the box was taken
Map the small exposed surface, read the published MalScanner source, model the seccomp and chroot boundaries, use the scanner itself to disclose the SSH credential, establish a shell as clarence, then turn the SUID program's chroot library lookup into root code execution.
Exact commands 2
export TARGET="<retired-instance-ip>"nmap -Pn --host-timeout 20s --max-retries 1 -sV -p22,80 $TARGETclarence's SSH password, represented here as [REDACTED: clarence SSH password]. Because the exact source path and final exploit source were not retained, no substitute code is presented.clarence, with UID and GID 1000, and the user objective was readable from the account's home directory.id returned uid=1000(clarence) gid=1000(clarence) groups=1000(clarence); user.txt returned [REDACTED: user flag].Exact commands 2
export CLARENCE_PASSWORD="[REDACTED: clarence SSH password]"sshpass -p "$CLARENCE_PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 clarence@$TARGET 'id; cat /home/clarence/user.txt'/bin/bash to /tmp/rootbash and set mode 4755. Triggering the SUID program loaded the replacement at elevated privilege, leaving the backdoor owned by root. The retained record proves the resulting file's ownership and mode, but not the exact SUID binary or library path, so those commands are intentionally omitted.-p so the effective UID was preserved. The shell returned euid=0(root) and could read the root objective./tmp/rootbash was owned by UID/GID 0 with mode 4755; the preserved shell returned euid=0(root) and root.txt returned [REDACTED: root flag].Exact commands 2
export CLARENCE_PASSWORD="[REDACTED: clarence SSH password]"sshpass -p "$CLARENCE_PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 clarence@$TARGET 'stat -c "%u:%g %a %y %n" /tmp/rootbash 2>&1; /tmp/rootbash -p -c "id; cat /root/root.txt" 2>&1'Attack patterns used
The transferable techniques behind the compromise.
Source-assisted attack-surface analysisDiscovery · Analysis
What it is
Published application source turns black-box testing into a code-review problem. Here it revealed the sandbox policy, filesystem boundary, and report channel that formed the initial-access chain.
Why it works
Source disclosure becomes dangerous when production paths, trust boundaries, or secrets differ from the assumptions made by the developer. Remove deployment artifacts from the web root and audit all downloadable archives.
Seccomp-aware sandbox file readCredential AccessT1552.001
What it is
The payload did not need a general sandbox escape. It used operations the policy already allowed to read a chroot-visible credential file and returned the bytes through the intended output channel.
Why it works
A syscall allowlist is only one boundary. The sandbox also needs a minimal filesystem, no sensitive mounts, and strict control over what output is returned to an untrusted caller.
Valid-account reuse over SSHInitial AccessT1078
What it is
A password recovered from the application environment was accepted by the operating system's SSH service, converting a transient file-read primitive into a stable interactive shell.
Why it works
Shared credentials collapse service boundaries. Use distinct secrets for applications and system accounts, rotate exposed values, and disable SSH password authentication where practical.
SUID chroot library hijackingPrivilege EscalationT1574.006
What it is
A privileged program entered a filesystem boundary influenced by an unprivileged user and loaded a shared object from that boundary. Constructor code in the replacement library therefore ran with the program's elevated identity.
Why it works
SUID execution and writable library paths must never intersect. Keep every executable, dependency, and chroot path in the privileged load chain root-owned and non-writable, and remove unnecessary SUID bits.
Findings
Exposed services
| 22/tcp | ssh OpenSSH 8.4p1 Debian 5 (protocol 2.0) |
| 80/tcp | http nginx 1.18.0 · MalScanner |