CVE-2024-53504
📋 TL;DR
A SQL injection vulnerability in Siyuan 3.1.11 allows attackers to execute arbitrary SQL commands via the notebook parameter in the /searchHistory endpoint. This affects all users running vulnerable versions of Siyuan note-taking software, potentially compromising database integrity and confidentiality.
💻 Affected Systems
- Siyuan
📦 What is this software?
Siyuan by B3log
⚠️ Risk & Real-World Impact
Worst Case
Complete database compromise including data theft, data manipulation, privilege escalation, and potential remote code execution if database functions allow it.
Likely Case
Unauthorized data access, data exfiltration, and potential authentication bypass through database manipulation.
If Mitigated
Limited impact with proper input validation, parameterized queries, and database permissions restricting dangerous operations.
🎯 Exploit Status
SQL injection vulnerabilities are well-understood and easily weaponized. The GitHub issues demonstrate the vulnerability exists.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Check latest Siyuan releases after 3.1.11
Vendor Advisory: https://github.com/siyuan-note/siyuan/issues/13058
Restart Required: Yes
Instructions:
1. Backup your Siyuan data and configuration
2. Download the latest Siyuan version from official sources
3. Stop the Siyuan service
4. Install the updated version
5. Restart the Siyuan service
6. Verify the fix by testing the /searchHistory endpoint
🔧 Temporary Workarounds
Input Validation Filter
allImplement strict input validation for the notebook parameter to reject suspicious characters
Not applicable - requires code changes
WAF Rule
allDeploy web application firewall rules to block SQL injection patterns in /searchHistory requests
WAF-specific configuration required
🧯 If You Can't Patch
- Restrict network access to Siyuan instances using firewalls or network segmentation
- Implement database permissions to limit the impact of successful SQL injection
🔍 How to Verify
Check if Vulnerable:
Test the /searchHistory endpoint with SQL injection payloads in the notebook parameter and observe database errors or unexpected behavior.
Check Version:
Check Siyuan version in application settings or via the web interface
Verify Fix Applied:
After patching, test the same SQL injection payloads and verify they are properly sanitized or rejected.
📡 Detection & Monitoring
Log Indicators:
- Unusual SQL error messages in application logs
- Multiple failed search attempts with suspicious parameters
- Unexpected database queries from application user
Network Indicators:
- HTTP requests to /searchHistory containing SQL keywords or special characters
- Unusual traffic patterns to the search endpoint
SIEM Query:
source="siyuan.log" AND ("sql" OR "syntax" OR "error") AND "/searchHistory"