CVE-2025-24024
Executive Summary
CVE-2025-24024 is a critical authorization bypass vulnerability in Mjolnir, a moderation tool for the Matrix decentralized communication protocol. The flaw, present in version 1.9.0, allows any user in any room where the bot is a member to issue management commands, including server administration functions. This effectively grants unauthorized users the same privileges as bot operators. The vulnerability was introduced by a feature in version 1.9.0 that allowed the bot to respond to commands from any room, without proper access control checks. The CVSS score of 9.1 reflects the ease of exploitation (no authentication required) and the potential for complete compromise of the Matrix server's moderation capabilities.
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 Mjolnir project, which is distributed as a Node.js package via npm (@vector-im/mjolnir). Users who installed version 1.9.0 from npm are affected. The supply chain risk is moderate, as the malicious behavior was introduced unintentionally through a feature change, not a compromised dependency. However, the lack of a patch for version 1.9.0 (only a revert and re-introduction in 1.9.1 and 1.9.2) means that users must upgrade or downgrade to secure their deployments.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) - The vulnerability can be exploited remotely over the Matrix protocol.
- Attack Complexity (AC): Low (L) - No special conditions or complex steps are required.
- Privileges Required (PR): None (N) - The attacker does not need any authentication or prior access.
- User Interaction (UI): None (N) - No user action is needed for exploitation.
- Scope (S): Unchanged (U) - The vulnerable component and the impacted component are the same.
- Confidentiality Impact (C): High (H) - An attacker can read sensitive moderation data and server configurations.
- Integrity Impact (I): High (H) - An attacker can modify bot settings, ban users, or execute server commands.
- Availability Impact (A): High (H) - An attacker can disrupt moderation services or crash the bot.
Threat Level: Critical. The vulnerability is trivial to exploit and can lead to full compromise of the Mjolnir bot and its associated Matrix server administration capabilities.
Deep Dive & Mechanics
Mjolnir is a Matrix bot that provides moderation features such as room banning, user reporting, and server administration. In version 1.9.0, a new feature was introduced to allow the bot to respond to management commands from any room it is a member of, not just the designated management room. The intended design was to make the bot more accessible, but the implementation failed to verify that the user issuing the command was an authorized operator.
The bot processes commands by listening to messages in rooms it has joined. When a message starts with a command prefix (e.g., !mjolnir), the bot parses the command and executes it. In version 1.9.0, the access control check that verifies the user's operator status was inadvertently removed or bypassed. This means any user in any room where the bot is present can issue commands like !mjolnir ban @user:server.com or !mjolnir config set ..., potentially affecting other rooms or the entire server.
The vulnerability is rooted in the command handler's logic, which no longer checks the sender against the list of authorized operators before executing the command. The fix in version 1.9.1 reverted the feature, and version 1.9.2 reintroduced it with proper access control checks.
Vulnerable vs. Patched Code
Vulnerable Code (v1.9.0):
// In command handler, no operator check
async handleCommand(roomId, event) {
const command = event.content.body;
// Directly execute command without checking sender
await this.executeCommand(command, roomId);
}
Patched Code (v1.9.2):
// In command handler, with operator check
async handleCommand(roomId, event) {
const sender = event.sender;
if (!this.isOperator(sender)) {
return; // Ignore command from non-operator
}
const command = event.content.body;
await this.executeCommand(command, roomId);
}
The key difference is the addition of the isOperator() check before executing the command. This ensures that only users who are explicitly listed as operators can control the bot.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A Matrix server with Mjolnir v1.9.0 installed and running.
- The attacker must be a member of any room where the Mjolnir bot is also a member.
Exploitation Steps:
- Join a public room where Mjolnir is present (e.g.,
#general:matrix.example.com). - Send a command message to the room, such as:
!mjolnir ban @victim:matrix.example.com - The bot will execute the command, banning the victim user from all rooms the bot moderates.
- For server administration (if enabled), send:
!mjolnir config set allowServerAdmin true - The bot will apply the configuration change, granting the attacker further control.
Note: No public exploit code is available, but the attack is straightforward and requires no special tools.
Blue Team
Detection:
- Monitor Matrix room logs for unexpected
!mjolnircommands from unknown users. - Check Mjolnir's logs for commands executed by non-operator users.
- Use the Sigma rule below to detect unauthorized command usage.
Hunting:
- Query Mjolnir's database for commands executed by users not in the
operatorslist. - Review room membership to identify users who joined rooms specifically to exploit the bot.
Mitigation:
- Immediately upgrade to v1.9.1 or v1.9.2, or downgrade to v1.8.3.
- Restrict Mjolnir's room membership to only trusted rooms.
- Enable logging and alerting for all bot commands.
Indicators of Compromise (IOCs)
- Network: Matrix messages containing
!mjolnircommands from unexpected users. - Logs: Mjolnir log entries showing command execution by users not in the operator list.
- System: Unauthorized changes to Mjolnir's configuration (e.g.,
allowServerAdminset totrue). - File: Mjolnir's
config.jsonor database showing unexpected operator additions.
Detection Engineering
YARA Rule
rule Mjolnir_Unauthorized_Command {
meta:
description = "Detects unauthorized Mjolnir command usage in Matrix logs"
author = "Valters IT"
date = "2025-02-20"
reference = "CVE-2025-24024"
strings:
$cmd = /!mjolnir\s+\w+/ nocase
$log = /Executing command from user/
condition:
$cmd and $log
}
Sigma Rule
title: Mjolnir Unauthorized Command Execution
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects execution of Mjolnir commands by non-operator users
author: Valters IT
date: 2025-02-20
references:
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-24024
logsource:
product: mjolnir
service: bot
detection:
selection:
event: "command_executed"
sender: "!operator"
condition: selection
falsepositives:
- Legitimate operator commands
level: high
Suricata Rule
alert tcp any any -> any 443 (msg:"CVE-2025-24024 Mjolnir Unauthorized Command"; content:"!mjolnir"; nocase; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade Mjolnir to version 1.9.1 or 1.9.2. If upgrade is not possible, downgrade to version 1.8.3.
- Verify that only authorized operators are listed in the bot's configuration.
- Review Mjolnir's logs for any signs of exploitation.
Long-term Measures:
- Implement strict access control for all bot commands.
- Regularly audit bot room memberships.
- Monitor for new versions and apply patches promptly.
- Consider using a dedicated management room that is invite-only.
Workaround:
- If upgrading is not possible, remove Mjolnir from all public rooms and only keep it in private, trusted rooms.
Valters IT