Error-Based & Time-Based SQL Injection in 'keyword' Parameter of admin-search.php Allowing Full Database Access in Revive Adserver v6.0.0
The admin-search.php page in Revive Adserver passes the 'keyword' GET parameter into several database queries without sanitisation, allowing SQL injection. An authenticated attacker could extract, modify or delete database contents.
- Triaged in 11 hours
- Fixed in 18 hours
- Disclosed after 39 hours
==Cricetinae==
#Summary:
A critical SQL Injection vulnerability has been identified in Revive Adserver's administrative search functionality, specifically in the admin-search.php file. The vulnerability exists in the handling of the keyword GET parameter, which is passed to multiple database queries without proper sanitization or parameterization.
The vulnerability stems from the use of the phpAds_registerGlobalUnslashed() function to register user input variables, including keyword, without proper escaping:
phpAds_registerGlobalUnslashed('keyword', 'client', 'campaign', 'banner', 'zone', 'affiliate', 'compact');
Subsequently, this user-controlled input is passed directly to several database query functions:
$rsClients = $dalClients->getClientByKeyword($keyword, $agencyId);
$rsCampaigns = $dalCampaigns->getCampaignAndClientByKeyword($keyword, $agencyId);
$rsBanners = $dalBanners->getBannerByKeyword($keyword, $agencyId);
$rsAffiliates = $dalAffiliates->getAffiliateByKeyword($keyword, $agencyId);
$rsZones = $dalZones->getZoneByKeyword($keyword, $agencyId);
Without examining the implementation of these functions, it's evident they do not properly sanitize the keyword parameter before incorporating it into SQL queries, resulting in SQL Injection.
Technical Analysis
Testing with SQLMap confirmed two distinct SQL Injection vulnerabilities:
1.Error-based injection using MySQL's EXTRACTVALUE function:
Payload: keyword=FUZZ') AND EXTRACTVALUE(8429,CONCAT(0x5c,0x716a7a6a71,(SELECT (ELT(8429=8429,1))),0x7178787871))-- Nqvq&compact=t
- Time-based blind injection using MySQL's SLEEP function:
Payload: keyword=FUZZ') AND (SELECT 3790 FROM (SELECT(SLEEP(5)))yGYJ)-- YFDA&compact=t
#Steps To Reproduce:
- open
burp suiteAnd open the built-in browser with it - Go to the following request:
http://localhost/www/admin/admin-search.php?keyword=FUZZ&compact=t - Capture the request using Burp Suite
- Save the request to a text file using
nano testsql.txt - Run the following command:
sqlmap -r testsql.txt --dbs
- ==You will see the database being extracted==
#Supporting Material/References:
PoC Video
https://portswigger.net/web-security/sql-injection https://owasp.org/www-community/attacks/SQL_Injection https://www.imperva.com/learn/application-security/sql-injection-sqli/ https://www.cloudflare.com/learning/security/threats/sql-injection/ https://www.acunetix.com/websitesecurity/sql-injection/
Impact
This vulnerability allows an authenticated attacker to:
- Extract sensitive information from the database
- Modify or delete database contents
- Potentially execute privileged commands on the database server
- Possibly escalate to a more severe attack vector through data exfiltration
The SQLMap test successfully identified the database name and confirmed the ability to execute arbitrary SQL queries through the vulnerable parameter. Root Cause
The root cause is improper input validation and the absence of prepared statements or parameterized queries. The application directly incorporates user-controlled input into SQL queries without adequate sanitization or escaping mechanisms.
This is a fundamental code flaw in the Revive Adserver source code and not a result of misconfiguration.
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 registers the 'keyword' parameter unslashed and passes it directly into multiple database query functions without parameterisation or escaping.
Impact
An authenticated attacker could extract sensitive information, modify or delete database contents, and potentially execute privileged commands on the database server.
What the attacker needed
Authenticated admin access; access to admin-search.php
How it was found
- Open Burp Suite and its built-in browser.
- Navigate to the admin-search.php URL with a keyword parameter and compact=t.
- Capture the request in Burp Suite.
- Save the captured request to a text file.
- Run sqlmap against the saved request with the --dbs option.
- Observe the database being extracted.
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.
SQL injection is when user input is inserted into a database command without being cleaned, so an attacker can change the command. Here the search box on an admin page takes the keyword and puts it straight into database queries, letting a logged-in admin run their own database commands.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.