CVE-2024-53504

9.8 CRITICAL

📋 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

Products:
  • Siyuan
Versions: 3.1.11 and potentially earlier versions
Operating Systems: All platforms running Siyuan
Default Config Vulnerable: ⚠️ Yes
Notes: All deployments using the vulnerable version are affected regardless of configuration.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: HIGH - The /searchHistory endpoint is typically accessible to users, making internet-facing instances particularly vulnerable.
🏢 Internal Only: HIGH - Even internal deployments are vulnerable to insider threats or compromised internal accounts.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

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

all

Implement strict input validation for the notebook parameter to reject suspicious characters

Not applicable - requires code changes

WAF Rule

all

Deploy 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"

🔗 References

📤 Share & Export