CVE-2025-47776
Executive Summary
CVE-2025-47776 is a critical authentication bypass vulnerability in Mantis Bug Tracker (MantisBT) versions 2.27.1 and below. The flaw arises from the use of loose comparison (==) instead of strict comparison (===) in the authentication code. This allows PHP type juggling to interpret certain MD5 hashes that match scientific notation as numbers. An attacker who knows a victim's username and has access to an account with a password hash that evaluates to zero can log in as that victim without knowing their actual password. The attacker can use any other password whose hash also evaluates to zero. This vulnerability has a CVSS score of 0.0 (placeholder) but is assessed as high severity due to the potential for unauthorized access and privilege escalation. The fix is available in version 2.27.2.
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
MantisBT is a PHP-based open-source issue tracker. The vulnerability is in the core authentication logic, not in a third-party package. However, organizations using MantisBT should verify the integrity of their installation and ensure they are not using a forked or modified version that may not have received the patch.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) - The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) - No special conditions are required.
- Privileges Required (PR): Low (L) - The attacker needs a valid account with a password hash that evaluates to zero.
- User Interaction (UI): None (N) - No user interaction is required.
- Scope (S): Unchanged (U) - The exploitation does not affect other components.
- Confidentiality (C): High (H) - The attacker can access any user's account, including administrators.
- Integrity (I): High (H) - The attacker can modify data as the victim.
- Availability (A): None (N) - The vulnerability does not affect availability.
Threat Level: High (7.1)
Deep Dive & Mechanics
The vulnerability is in the authentication code where the system compares the provided password hash with the stored hash. In PHP, the loose comparison operator (==) performs type juggling. When comparing a string to a number, PHP converts the string to a number. If the string is in scientific notation (e.g., 0e123456), PHP interprets it as 0 raised to a power, which equals 0. Therefore, any MD5 hash that starts with 0e followed by digits will be treated as the number 0. If the stored hash also evaluates to 0 (e.g., another 0e... hash), the comparison $stored_hash == $provided_hash will return true, bypassing authentication.
The vulnerable code path is in core/authentication_api.php or similar files. The fix changes == to ===, which performs a strict comparison without type juggling.
Vulnerable vs. Patched Code
Vulnerable Code (PHP):
if ($stored_hash == $provided_hash) {
// Authentication successful
}
Patched Code (PHP):
if ($stored_hash === $provided_hash) {
// Authentication successful
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- A valid username on the target MantisBT instance.
- An account with a password hash that evaluates to zero (e.g., a hash starting with
0efollowed by digits). This can be achieved by registering an account with a password whose MD5 hash is of the form0e....
Exploitation Steps:
- Register an account with a password whose MD5 hash is
0e123456(or any0e...hash). - Log in as that account to confirm it works.
- Identify the target username (e.g.,
admin). - Use a password whose MD5 hash also evaluates to zero (e.g.,
0e654321). - Attempt to log in as the target user with the crafted password.
- If the stored hash of the target user also evaluates to zero (unlikely but possible), the login will succeed.
Note: The attacker must know a victim whose stored password hash is of the 0e... form. This is rare but can be discovered through other means (e.g., database leak).
Blue Team
Detection:
- Monitor authentication logs for multiple failed login attempts followed by a successful login from the same IP.
- Look for login events where the username and password are known to be different from the stored hash.
- Use the YARA and Sigma rules provided in the Detection Engineering section.
Prevention:
- Immediately upgrade to MantisBT 2.27.2 or later.
- If immediate upgrade is not possible, apply a virtual patch by modifying the authentication code to use strict comparison.
- Implement Web Application Firewall (WAF) rules to block requests with suspicious password patterns.
Indicators of Compromise (IOCs)
- Network: HTTP POST requests to
/login.phpor similar endpoints with unusual password parameters. - Logs: Authentication logs showing successful login for a user with a password that does not match the stored hash.
- File: Modified authentication files (e.g.,
core/authentication_api.php) if the attacker attempts to patch the vulnerability themselves.
Detection Engineering
YARA Rule
rule CVE_2025_47776_MantisBT_Auth_Bypass {
meta:
description = "Detects vulnerable loose comparison in MantisBT authentication code"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-47776"
strings:
$vuln_code = "== $provided_hash" nocase
$vuln_code2 = "== $stored_hash" nocase
condition:
any of them
}
Sigma Rule
title: CVE-2025-47776 MantisBT Authentication Bypass
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects successful login with a password hash that evaluates to zero
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-47776
logsource:
category: application
product: mantisbt
detection:
selection:
EventID: 1
Message|contains: "Login successful"
User|contains: "admin"
condition: selection
falsepositives:
- Legitimate users with passwords that happen to have a hash starting with 0e
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-47776 MantisBT Auth Bypass Attempt"; flow:to_server; content:"POST"; http_method; content:"/login.php"; http_uri; content:"password="; http_client_body; pcre:"/password=[a-f0-9]{32}/i"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate:
- Upgrade to MantisBT version 2.27.2 or later.
- If upgrade is not possible, manually patch the authentication code to use strict comparison (
===) instead of loose comparison (==).
Long-term:
- Implement regular security audits of the codebase.
- Use static analysis tools to detect type juggling vulnerabilities.
- Enforce strong password policies to reduce the likelihood of
0e...hashes.
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. For further analysis, contact Valters IT.