CVE-2026-49354All versions Incorrect Comparison
NVD
Vulnerability Summary
Summary InvoicePlane retains a legacy authentication code path for user accounts created before version 1.2.0. These accounts have a NULL `user_psalt` field, triggering a comparison of `md5($attacker_password) == $stored_md5_hash` using PHP's loose equality operator (`==`). When both the stored hash and the hash of the attacker-supplied password are "magic hashes" (values beginning with `0e` followed only by digits), PHP interprets both as scientific notation (0 * 10^N = 0) and the comparison evaluates to `true`. This allows an unauthenticated attacker to authenticate as any legacy account whose stored MD5 password hash is a magic hash, without knowing the real password. --- Affected File `application/modules/sessions/models/Mdl_sessions.php`, lines 40-66 ```php if ( ! $user->user_psalt) { if (md5($password) == $user->user_password) { // vulnerable: loose == comparison $salt = $this->crypt->salt(); $hash = $this->crypt->generate_password($password, $salt); // ... migrate to bcrypt ... } else { return false; } } ``` --- Preconditions 1. The target user account was created before InvoicePlane v1.2.0 (or `user_psalt` was set to NULL manually/via DB migration issue). 2. The stored `user_password` value is a PHP MD5 magic hash - an MD5 digest that begins with `0e` and is followed only by decimal digits (e.g., `0e462097431906509019562988736854`). 3. The attacker knows the target user's email address. Legacy accounts remain vulnerable until the legitimate user logs in at least once (which triggers bcrypt migration). Installations upgraded from versions before v1.2.0 carry these accounts forward indefinitely. --- Root Cause PHP's loose `==` operator performs type coercion. Strings matching the pattern `/^0e[0-9]+$/` are treated as floating-point numbers in scientific notation (0e... = 0.0). Therefore: ``` "0e462097431906509019562988736854" == "0e830400451993494058024219903391" => 0.0 == 0.0 => true ``` Known MD5 magic hash pairs (non-exhaustive): | Plaintext | MD5 | |--------------|--------------------------------------| | 240610708 | 0e462097431906509019562988736854 | | QNKCDZO | 0e830400451993494058024219903391 | | aabg74hADG | 0e562069494539715680862987505429 | | aabC9RqS | 0e041022518165728065344349536299 | --- Proof of Concept Environment: Docker (PHP 8.1-apache, MySQL 8.0), InvoicePlane latest main (commit f7bd1ed), http://localhost:9109 Step 1: Create legacy account in database ```sql INSERT INTO ip_users ( user_name, user_email, user_password, user_psalt, user_type, user_active ) VALUES ( 'LegacyUser', 'legacy@test.local', '0e462097431906509019562988736854', -- md5('240610708') NULL, -- NULL psalt = legacy account 1, 1 ); ``` Step 2: Authenticate using a different plaintext whose MD5 is also a magic hash ``` POST /sessions/login HTTP/1.1 Host: localhost:9109 _ip_csrf=<token>&email=legacy%40test.local&password=QNKCDZO&btn_login=1 ``` md5('QNKCDZO') = `0e830400451993494058024219903391` PHP evaluates: `"0e830400451993494058024219903391" == "0e462097431906509019562988736854"` => `true` Step 3: Result HTTP 302 redirect to `/dashboard` - authenticated as the legacy admin account. Confirmed live: Request to `POST /sessions/login` with `password=QNKCDZO` for the legacy account redirected to `http://localhost:9109/dashboard`, confirming full authentication bypass. Evidence: `screenshots/001_md5_type_juggling_evidence.html` --- Impact An unauthenticated remote attacker can gain full access to any InvoicePlane account (including admin accounts) that: - Was created before v1.2.0 and has never logged in since the upgrade, AND - Has a stored MD5 password hash that is a PHP magic hash (0e...) Approximately 1 in 10^31 random passwords produce a magic-hash MD5, but the set of known magic hashes is growing and publicly documented. An attacker targeting a specific user with a known stored hash can precompute whether it is a magic hash from the hash value alone (no password cracking required). On successful bypass the attacker obtains a fully authenticated admin session, which allows: - Full data exfiltration (clients, invoices, financial records) - Creating or modifying invoices - Accessing user credentials and email settings - Remote code execution if SMTP is misconfigured (via email template manipulation) --- Remediation Replace the loose `==` comparison with strict `===`: ```php // Before (vulnerable): if (md5($password) == $user->user_password) { // After (safe): if (hash_equals($user->user_password, md5($password))) { ``` `hash_equals()` performs a constant-time, byte-for-byte comparison and does not trigger PHP type coercion. Additionally, the entire MD5 legacy path should be deprecated: any account with `user_psalt = NULL` should be forced to reset their password rather than allowing MD5 authentication at all.
CVSS v3.1 Base Metrics — Score 8.1
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HAttack VectorNetwork
Attack ComplexityHigh
Privileges RequiredNone
User InteractionNone
ScopeUnchanged
ConfidentialityHigh
IntegrityHigh
AvailabilityHigh
Affected & Patched Versions
- All versions
- 1.7.2
What to do
Prioritize this fix. Exploit code is public, so attacks can follow quickly.
- Check whether you run All versions and which version.
- Update to a patched version listed above, then confirm the new version.
- Review logs and exposed services for signs of earlier compromise.
Timeline
- Sep 28, 2026Published
- Sep 28, 2026Record last modified
Score, severity and exploitation changes are tracked from the day Watchtower started logging them.
Get notified about new All versions CVEsYou are reading CVE-2026-49354. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alertsExternal References
Data last checked: Nov 25, 2026 14:00 UTC