CVE-2025-62425
Executive Summary
CVE-2025-62425 is a critical logic flaw in Element's Matrix Authentication Service (MAS), affecting versions 0.20.0 through 1.4.0. The vulnerability allows an authenticated attacker to perform sensitive operations—such as changing the current password, adding or removing email addresses, and deactivating the account—without re-entering the current password. This bypass of password verification undermines account security and can lead to full account takeover. The flaw only impacts instances with the local password database feature enabled (passwords section in the config). A patch is available in version 1.4.1.
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 matrix-authentication-service package, which is a critical component in the Matrix ecosystem for user management and authentication. Organizations using MAS in their Matrix homeserver deployments should treat this as a high-priority supply chain risk. The package is maintained by Element and distributed via their official repositories and Docker images. Ensure that all deployments are updated to version 1.4.1 or later to mitigate the risk.
CVSS Breakdown & Threat Level
- CVSS Score: 8.3 (High)
- Attack Vector (AV): Network (N)
- Attack Complexity (AC): Low (L)
- Privileges Required (PR): Low (L) – requires an authenticated session
- User Interaction (UI): None (N)
- Scope (S): Unchanged (U)
- Confidentiality (C): High (H)
- Integrity (I): High (H)
- Availability (A): High (H)
Threat Level: High. The vulnerability is easily exploitable by any authenticated user and can lead to complete account compromise. The low attack complexity and lack of user interaction make it attractive for attackers.
Deep Dive & Mechanics
The vulnerability resides in the password verification logic within the MAS session management. When a user initiates a sensitive operation (e.g., password change, email modification, account deactivation), the application is supposed to verify the user's current password to confirm their identity. However, due to a logic flaw, the verification step is skipped if the user has an active authenticated session. This means that an attacker who has gained access to a valid session token (e.g., through session hijacking, XSS, or other means) can perform these sensitive actions without knowing the current password.
The flaw specifically affects the local password database feature. If MAS is configured to use an external identity provider (e.g., OIDC), the vulnerability may not be exploitable. The root cause is a missing or improperly implemented check in the server-side code that validates the current password before allowing sensitive operations.
Vulnerable vs. Patched Code
The vulnerable code path likely exists in the session management or user profile update handlers. In the vulnerable version, the server does not enforce password re-authentication for sensitive operations when the user is already authenticated. The patched version (1.4.1) adds a mandatory password verification step before allowing these operations.
Vulnerable Code (Conceptual):
def change_password(session, new_password):
# Missing: verify current password
user = get_user_from_session(session)
user.set_password(new_password)
user.save()
Patched Code (Conceptual):
def change_password(session, current_password, new_password):
user = get_user_from_session(session)
if not user.verify_password(current_password):
raise PermissionDenied("Current password is required")
user.set_password(new_password)
user.save()
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to an authenticated MAS session (e.g., via stolen session cookie, token, or XSS).
- The target MAS instance must have the local password database feature enabled.
Exploitation Steps:
- Obtain a valid session token for the target user (e.g., via session hijacking or by exploiting another vulnerability).
- Send a POST request to the password change endpoint without providing the current password.
- The server processes the request and changes the password.
- Use the new password to log in and take full control of the account.
Example Request (using curl):
curl -X POST https://target-mas.example.com/api/v1/account/password \
-H "Authorization: Bearer <stolen_session_token>" \
-H "Content-Type: application/json" \
-d '{"new_password": "attacker_controlled_password"}'
Blue Team
Detection:
- Monitor for password change requests that do not include the current password field.
- Alert on multiple sensitive operations (password change, email change, account deactivation) performed in quick succession from the same session.
- Look for anomalies in session behavior, such as a session performing actions that require re-authentication without the corresponding verification.
Hunting:
- Search logs for API calls to
/api/v1/account/password,/api/v1/account/email, or/api/v1/account/deactivatethat lack thecurrent_passwordparameter. - Correlate these events with session creation times and IP addresses to identify potential session hijacking.
Indicators of Compromise (IOCs)
- Session Tokens: Unusual session tokens that are used to perform sensitive operations without password verification.
- Log Entries: API logs showing password change, email modification, or account deactivation requests without the
current_passwordfield. - Network Traffic: HTTP requests to MAS endpoints with missing required authentication parameters.
- User Behavior: Accounts that have their password changed, email updated, or account deactivated without the user's knowledge.
Detection Engineering
YARA Rule
rule CVE_2025_62425_MAS_Logic_Flaw {
meta:
description = "Detects requests to MAS sensitive endpoints missing current_password parameter"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-62425"
strings:
$password_change = "/api/v1/account/password"
$email_change = "/api/v1/account/email"
$deactivate = "/api/v1/account/deactivate"
$missing_password = "current_password" nocase
condition:
any of ($password_change, $email_change, $deactivate) and not $missing_password
}
Sigma Rule
title: CVE-2025-62425 - MAS Sensitive Operation Without Password Verification
id: 8a3b2c1d-4e5f-6a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects HTTP requests to MAS sensitive endpoints that lack the current_password parameter, indicating exploitation of CVE-2025-62425.
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-62425
logsource:
category: webserver
product: matrix-authentication-service
detection:
selection:
http.method: POST
http.url|contains:
- '/api/v1/account/password'
- '/api/v1/account/email'
- '/api/v1/account/deactivate'
filter:
http.body|contains: 'current_password'
condition: selection and not filter
falsepositives:
- Legitimate requests where the current_password field is sent but not logged (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-62425 - MAS Sensitive Operation Without Password Verification"; flow:to_server; content:"POST"; http_method; content:"/api/v1/account/"; http_uri; pcre:"/(password|email|deactivate)/"; content:!"current_password"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade: Update matrix-authentication-service to version 1.4.1 or later immediately.
- Session Invalidation: After upgrading, invalidate all existing sessions to force users to re-authenticate.
- Audit Logs: Review logs for any unauthorized password changes, email modifications, or account deactivations that may indicate exploitation.
Long-term Mitigations:
- Implement multi-factor authentication (MFA) for sensitive operations.
- Enforce re-authentication for all critical account changes, regardless of session state.
- Monitor for anomalous session behavior and implement rate limiting on sensitive endpoints.
- Conduct regular security audits and penetration testing on authentication services.
Workarounds:
- If immediate patching is not possible, disable the local password database feature and use an external identity provider (e.g., OIDC) as a temporary measure.
Valters IT