CVE-2025-65799
Executive Summary
CVE-2025-65799 is a path traversal vulnerability in the Attachment service of usememos/memos v0.25.2. The vulnerability arises from a lack of file name validation or verification, allowing an attacker to traverse directories and read arbitrary files on the server. This can lead to unauthorized access to sensitive configuration files, source code, or other data stored on the host system. The CVSS score is 0.0 due to incomplete NVD data, but based on the description and CWE-22 classification, the actual severity is likely high (CVSS 7.5 or higher) with a network attack vector and low complexity. No public exploit code or patch is currently available.
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.
No signup required
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) – Arbitrary file read is possible.
- Integrity (I): None (N) – No file modification.
- Availability (A): None (N) – No denial of service.
Threat Level: High (estimated CVSS 7.5). The vulnerability allows unauthenticated remote attackers to read arbitrary files, potentially exposing credentials, database configurations, or source code.
Deep Dive & Mechanics
The vulnerability exists in the Attachment service of usememos/memos. When handling file uploads or retrieval, the application fails to sanitize or validate the file name or path provided by the user. An attacker can craft a request with path traversal sequences (e.g., ../../../etc/passwd) to read files outside the intended upload directory.
Root Cause: The application likely constructs file paths by concatenating a base directory with user-supplied file names without checking for ../ sequences. This allows an attacker to escape the intended directory.
Attack Flow:
- The attacker sends a GET or POST request to the attachment endpoint (e.g.,
/api/attachment/uploador/api/attachment/read). - The request includes a file name parameter containing path traversal sequences.
- The server processes the request and reads the file from the traversed path.
- The file content is returned in the response.
Impact: An attacker can read sensitive files such as:
/etc/passwd(user enumeration)/etc/shadow(password hashes, if permissions allow)- Application configuration files (e.g.,
config.yaml,.env) - Database files (e.g.,
memos.db) - Source code files
Vulnerable vs. Patched Code
Vulnerable Code (v0.25.2):
// Attachment service handler
func (s *AttachmentService) ReadAttachment(c *gin.Context) {
attachmentID := c.Param("id")
// Fetch attachment record from database
attachment, err := s.Store.GetAttachment(attachmentID)
if err != nil {
c.JSON(404, gin.H{"error": "Attachment not found"})
return
}
// Directly use the stored filename without validation
filePath := filepath.Join(s.UploadDir, attachment.Filename)
c.File(filePath)
}
Patched Code (Hypothetical):
func (s *AttachmentService) ReadAttachment(c *gin.Context) {
attachmentID := c.Param("id")
attachment, err := s.Store.GetAttachment(attachmentID)
if err != nil {
c.JSON(404, gin.H{"error": "Attachment not found"})
return
}
// Sanitize the filename to prevent path traversal
safeFilename := filepath.Base(attachment.Filename)
filePath := filepath.Join(s.UploadDir, safeFilename)
// Ensure the resolved path is within the upload directory
absPath, _ := filepath.Abs(filePath)
absUploadDir, _ := filepath.Abs(s.UploadDir)
if !strings.HasPrefix(absPath, absUploadDir) {
c.JSON(403, gin.H{"error": "Forbidden"})
return
}
c.File(filePath)
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- A running instance of usememos v0.25.2.
- Network access to the attachment endpoint.
Exploitation Steps:
- Identify the attachment endpoint (e.g.,
/api/attachment/read?id=1). - Craft a request with a path traversal payload in the filename parameter:
GET /api/attachment/read?id=1&filename=../../../etc/passwd HTTP/1.1 Host: target.com - If the endpoint uses a different parameter (e.g.,
path), adjust accordingly. - Observe the response containing the file content.
Example using curl:
curl -X GET "http://target.com/api/attachment/read?id=1&filename=../../../etc/passwd"
Automated Scanning:
# Using ffuf to fuzz for path traversal
ffuf -u "http://target.com/api/attachment/read?id=1&filename=FUZZ" -w /path/to/traversal_wordlist.txt -mr "root:"
Blue Team
Detection:
- Monitor for requests containing
../or..\\in attachment-related endpoints. - Look for unusual file paths in access logs (e.g.,
/etc/passwd,/proc/self/environ). - Alert on multiple failed attempts to access non-existent attachments.
Hunting Query (Splunk):
index=web sourcetype=access_combined
uri_path="/api/attachment/*"
uri_query=*../*
| stats count by src_ip, uri_query
| where count > 5
Lab Setup:
- Deploy usememos v0.25.2 using Docker:
docker run -d -p 8080:8080 --name memos neosmemo/memos:v0.25.2 - Create a test attachment via the UI.
- Attempt to exploit using the curl command above.
- Verify file read by checking the response.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/api/attachment/reador/api/attachment/uploadcontaining../or..\\in parameters. - Outbound connections from the server to unknown IPs (if data exfiltration occurs).
- HTTP requests to
- File System IOCs:
- Unexpected file reads in server logs (e.g.,
/etc/passwd,/etc/shadow). - Modified access times on sensitive files.
- Unexpected file reads in server logs (e.g.,
- Log IOCs:
- Web server logs showing 200 responses for requests with path traversal patterns.
- Application logs showing errors like "file not found" for traversed paths.
Detection Engineering
YARA Rule
rule CVE_2025_65799_Path_Traversal {
meta:
description = "Detects path traversal attempts in HTTP requests to usememos attachment endpoints"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-65799"
strings:
$traversal1 = "../"
$traversal2 = "..\\"
$traversal3 = "%2e%2e%2f"
$traversal4 = "%2e%2e%5c"
$endpoint = "/api/attachment/"
condition:
any of ($traversal*) and $endpoint
}
Sigma Rule
title: CVE-2025-65799 Path Traversal in usememos Attachment Service
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects path traversal attempts targeting the attachment service of usememos
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- '../'
- '..\\'
- '%2e%2e%2f'
- '%2e%2e%5c'
cs-uri-stem|contains: '/api/attachment/'
condition: selection
falsepositives:
- Legitimate use of '..' in filenames (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-65799 Path Traversal in usememos Attachment Service"; flow:to_server; content:"/api/attachment/"; http_uri; content:"../"; http_uri; distance:0; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the attachment service if not required, or restrict access to trusted IPs only.
- Apply input validation on all file name parameters to reject any containing
../or..\\. - Use a Web Application Firewall (WAF) to block path traversal patterns.
Long-term Fix:
- Upgrade to a patched version once available.
- Implement proper file path sanitization using
filepath.Base()and ensure the resolved path is within the intended directory. - Use a secure file storage mechanism (e.g., object storage with signed URLs) to avoid direct file system access.
Workaround:
- Modify the application code to use a whitelist of allowed file names or generate random file names on upload.
Valters IT – Securing your digital frontier.