VYPR
Unrated severityNVD Advisory· Published May 13, 2024· Updated Nov 4, 2025

Authentication Bypass when using using older password hashes

CVE-2024-34340

Description

Cacti provides an operational monitoring and fault management framework. Prior to version 1.2.27, Cacti calls compat_password_hash when users set their password. compat_password_hash use password_hash if there is it, else use md5. When verifying password, it calls compat_password_verify. In compat_password_verify, password_verify is called if there is it, else use md5. password_verify and password_hash are supported on PHP < 5.5.0, following PHP manual. The vulnerability is in compat_password_verify. Md5-hashed user input is compared with correct password in database by $md5 == $hash. It is a loose comparison, not ===. It is a type juggling vulnerability. Version 1.2.27 contains a patch for the issue.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

13

Patches

Vulnerability mechanics

Root cause

"Loose comparison (`==` instead of `===`) in `compat_password_verify` allows PHP type juggling when comparing an MD5 hash of user input against the stored password hash."

Attack vector

An attacker can bypass authentication by supplying a password whose MD5 hash starts with `0e` followed by digits (a "magic hash"). PHP's loose comparison (`==`) interprets both the computed hash and the stored hash as numeric zero when they both match the `0e...` pattern, causing the comparison to return `true` regardless of the actual password [ref_id=1]. The attacker only needs network access to the Cacti login page and a stored password hash that also begins with `0e` (e.g., the default `admin` or `guest` accounts) [ref_id=1]. No valid credentials are required.

Affected code

The vulnerable function is `compat_password_verify` in Cacti's authentication code [ref_id=1]. The critical line is `return ($md5 == $hash);` where the MD5 hash of user-supplied input is loosely compared against the stored password hash from the database [ref_id=1].

What the fix does

Version 1.2.27 patches the issue by changing the loose comparison `$md5 == $hash` to a strict comparison `$md5 === $hash` in `compat_password_verify` [ref_id=1]. This prevents PHP type juggling because strict comparison checks both value and type, so a string hash starting with `0e` will not be treated as numeric zero. The patch also ensures that `password_verify` (which uses bcrypt/argon2) is preferred when available, falling back to MD5 only on PHP < 5.5.0, but even in that fallback path the strict comparison closes the magic-hash bypass.

Preconditions

  • configThe target Cacti instance must be running PHP < 5.5.0 (or the password_verify function must be unavailable) so that the MD5 fallback path in compat_password_verify is used.
  • inputThe stored password hash for the target user must begin with '0e' followed by digits (e.g., the default admin or guest accounts).
  • networkNetwork access to the Cacti login page is required.

Reproduction

An attacker can log in as `admin` by entering the password `240610708` (whose MD5 hash is `0e462097431906509019562988736854`) because the stored admin password hash `0e052539892259114859640052326948` also starts with `0e`, and PHP's loose comparison treats both as zero [ref_id=1].

Generated on May 26, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

0

No linked articles in our index yet.