
Proof of Concept exploit for the Joomla 3.7.0 com_fields SQL injection vulnerability (CVE-2017-8917), demonstrating detection, enumeration, and data extraction in a CTF-friendly workflow.
This repository contains a simple, CTF-friendly proof of concept (PoC) for the Joomla
com_fields SQL injection vulnerability (CVE-2017-8917). The goal is to keep the workflow
lightweight while still showing the full exploitation flow: detection, enumeration, and
data extraction.
Vulnerability: SQL injection in Joomla's com_fields component.
Root cause: The list[fullordering] parameter is not properly sanitized, allowing SQL
to be injected into the generated query. When crafted with an error-based payload (e.g.,
UpdateXML), the SQL result can be surfaced in the response, enabling data extraction.
How it is exploited (high level):
index.php?option=com_fields&view=fields&layout=modal with
the list[fullordering] parameter set to a malicious payload.UpdateXML) to force the database to echo results.<title> tag) and extract the injected output.Below are the most critical components.
parse_args()Parses CLI arguments into a simple args object with host and debug. The script
assumes HTTP on port 80 and builds the base URL from --host.
run_exploit()run_exploit() is the main orchestration function:
requests.Session() so cookies and headers persist.request_title(): Sends a request and extracts the <title> value. The PoC uses
error-based SQLi to leak data into that tag, so this is the data extraction core.build_params(): Creates the vulnerable request parameters with the injected SQL.sql_list() and dump_table() automate enumeration
and chunked extraction._fetch_token()The CSRF token is extracted from the Joomla login page. While some scenarios may not require it, many Joomla routes still enforce CSRF checks. Including it:
wrap_payload() and encode_sql_string()These helpers generate the actual injection payload:
wrap_payload() wraps a raw query in UpdateXML(...) to force error-based output.encode_sql_string() converts strings to CHAR(...) expressions to avoid quoting issues._dump_table())Rows are concatenated with a separator and fetched in substrings to avoid truncation. This keeps the output consistent even when row values are long.
python main.py --host <TARGET_IP>
Optional debug output:
python main.py --host <TARGET_IP> --debug
└─$ python exploit.py --host <TARGET>
]LLLLLLmmmmmLLLLLL[
]LLLLLLLLLLLLLLLLL[
]LLLLLLLLLLLLLLLLL[
]LLLLLLLLLLLLLLLLL[
]LLLLLLLLLLLLLLLLL[
ms. ]LLLLLLLLLLLLLLLLL[ ,m
]LLLLs. ]LLLLLLLL~+LLLLLLL[ _gLLLL
LLLLL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LLLLLLLLLLLLLLs ]LLLLLLLLLLLLLLLLLLLLLLLLLL`
'LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 'YL ]LLLLLLLLLLLLLLLLLLLLLLLLf
'LLLLLLLLLLLLLLLLLLLLLLLLLLLf`! f ,LLLLLLLLLLLLLLLLLLLLLLLL!
'LLLLLLLLLLLLLLLLLLLLLLLLL[ LmmLLLLLLLLLLLLLLLLLLLLLLLL`
LLLLLLLLLLLLLLLLLf LLLLi t LLLLLLL LLLLLLLLLLLLLLLLL!
'LLLLLLLLLLLLLf LLLL[ '*LLLLLLL 'LLLLLLLLLLLLL[
!LLLLLLLLLf` LLLLLs 'YLLLLL ~LLLLLLLLLL
LLLLLLf~ LLLLLLLs LLLLL ~LLLLLL`
'LLL~ LLLLLLLLLm iLLLLL ~LLL~
~` LLLLLLLL[LLmLLLLLL '`
LLLLLL`d[ LLLLLLLL
LLLLLLdL[ LLLLLLLL
LLLLLLLLLLLLLLLLLL Juergen Jakubowski
LLLLLLLLLLLLLLLLLL
LLLLLLLLLLLLLLLLLL [email protected]
EXPLOIT BY ztrxwzy.
INSPIRED BY THE POC FROM Baptiste Contreras.
[888] Target : http://10.66.187.202:80/index.php
[888] CSRF token : 3ec54b1b32b5dc2dd8186537821b8dc1
[888] http://10.66.187.202:80/index.php is vulnerable to SQLi
[888] Database version detected : 5.5.64-MariaDB
[888] Current database : joomla
[888] Tables in database joomla
MIT License Copyright (c) 2025 Jesús Caldera
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.