CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-81525

CVE-2026-81525: Cross-Tenant Database Retargeting via Dot and Null Injection in MongoDB PHP Driver

Alon Barad
Alon Barad
Software Engineer

Sep 9, 2026·7 min read·73 visits

Executive Summary (TL;DR)

Improper input validation in MongoDB's PHP libraries allows attackers to inject dot characters and null bytes into database and collection name parameters, silently retargeting database queries and writes to administrative or system collections.

A high-severity namespace injection vulnerability in both the MongoDB Client Library for PHP (mongodb/mongodb) and the native PHP C Extension (ext-mongodb) allows unauthenticated remote attackers to bypass logical database separation and execute database commands inside unauthorized storage compartments via dot (".") and null byte ("\0") injection.

Vulnerability Overview

The MongoDB Client Library for PHP (mongodb/mongodb) and the underlying native PHP C Extension (ext-mongodb) are vulnerable to database and collection namespace injection. The flaw arises from an architectural pattern where fully qualified namespace strings are built by joining database and collection names with a period delimiter. When applications dynamically construct these names using untrusted inputs, they expose a highly sensitive interface to manipulation.

The vulnerability stems from the improper neutralization of special structural characters within these identifier inputs. Specifically, the software fails to reject period (.) characters in database names and null bytes (\0) in both database and collection names. This oversight allows remote users to alter the logical boundaries of database operations.

By injecting these characters, attackers can break out of their designated tenant databases and access administrative or restricted system namespaces. This vulnerability represents a class of injection that bypasses logical access controls, threatening data confidentiality and integrity across multi-tenant deployments.

Root Cause Analysis

MongoDB uses fully qualified namespace strings of the format databaseName.collectionName to direct read and write operations. The period character acts as a structural separator between the database component and the collection component. If an application accepts a database name containing a period character, the server parses the string using the first period as the delimiter. This shifts the target database and collection boundaries, allowing dot injection attacks.

In addition to dot injection, a severe binary-to-string representation mismatch exists between the PHP engine and the native C extension. PHP handles strings as length-prefixed, binary-safe structures that can natively contain null bytes (\0) without indicating string termination. Conversely, the underlying C library, libmongoc, relies on standard null-terminated C-style strings.

When a PHP string containing a null byte is passed to the C layer, the C library stops parsing at the first null byte. This causes string truncation, dropping the remainder of the namespace. An attacker can construct a string that passes user-land validation checks in PHP but is truncated in the C driver, silently redirecting operations to unauthorized databases.

Code Analysis

The vulnerability in the PHP userland library was addressed by introducing strict validation within the Database and Collection class constructors. The patch introduces a centralized validation helper, create_namespace(), to enforce structural rules before names are combined.

// File: src/functions.php - Centered validation helper
function create_namespace(string $databaseName, string $collectionName): string
{
    if ($databaseName === '' || str_contains($databaseName, '.') || str_contains($databaseName, "\0")) {
        throw new InvalidArgumentException('$databaseName is invalid: ' . $databaseName);
    }
 
    if ($collectionName === '' || str_contains($collectionName, "\0")) {
        throw new InvalidArgumentException('$collectionName is invalid: ' . $collectionName);
    }
 
    return $databaseName . '.' . $collectionName;
}

Prior to this fix, the constructors in Collection.php only verified that the length of the database and collection names was greater than zero. This allowed arbitrary characters, including dots and null bytes, to propagate down to the native driver.

// File: src/Collection.php - Updated validation check
public function __construct(private Manager $manager, private string $databaseName, private string $collectionName, array $options = [])
{
    if (strlen($databaseName) < 1 || str_contains($databaseName, '.') || str_contains($databaseName, "\0")) {
         throw new InvalidArgumentException('$databaseName is invalid: ' . $databaseName);
    }
 
    if (strlen($collectionName) < 1 || str_contains($collectionName, "\0")) {
         throw new InvalidArgumentException('$collectionName is invalid: ' . $collectionName);
    }
}

In the C extension layer (ext-mongodb), safety checks were added using memchr() to guarantee validation even when developers bypass the PHP library. The C function phongo_validate_dbname() now checks for the presence of null bytes and dots using the explicit length of the Zend string.

/* Rejects database name with NUL or period */
bool phongo_validate_dbname(const char* db, size_t db_len)
{
	if (db == NULL) {
		return true;
	}
 
	if (memchr(db, '\0', db_len) != NULL) {
		phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s", "Invalid database name provided: database names may not contain a null byte");
		return false;
	}
 
	if (memchr(db, '.', db_len) != NULL) {
		phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s: %s", "Invalid database name provided: database names may not contain a '.' character", db);
		return false;
	}
 
	return true;
}

Exploitation Methodology

Exploiting this vulnerability requires an application to use untrusted user input to select or build the database or collection names. This pattern is commonly found in multi-tenant SaaS applications where tenant IDs are used directly to partition databases dynamically. An attacker must have network access to the application interface that processes these database-backed requests.

In a dot injection scenario, the attacker supplies a payload containing a dot character in a parameter intended to define the database name. For example, supplying admin.system as the database name causes the combined namespace to become admin.system.collectionName. The MongoDB server interprets admin as the database name and system.collectionName as the target collection, bypassing tenant database constraints.

In a null byte truncation scenario, the attacker injects a null character into the database name parameter, such as admin\x00tenant_db. PHP validates the full string length, but when passed to the C driver, the namespace string is truncated to admin. Any subsequent write or query commands are executed within the context of the administrative database, leading to privilege escalation.

Impact Assessment

The severity of CVE-2026-81525 is categorized as High, with a CVSS v3.1 score of 8.1 and a CVSS v4.0 score of 8.6. The primary impact is the collapse of logical access boundaries between different database tenants. Attackers can leverage this bypass to read, write, or delete documents belonging to other users or the platform itself.

A major consequence is unauthorized administrative database access. An attacker who can write to arbitrary namespaces can target internal system collections like system.users or system.views. In standard MongoDB deployments, writing to these collections can result in full database takeover and persistent privilege escalation.

Additionally, this vulnerability does not require authentication beyond the basic access needed to reach the vulnerable endpoint. If an unauthenticated public endpoint dynamically routes data to collections based on request headers or query variables, the vulnerability is fully exploitable by external actors.

Remediation & Defenses

The most effective remediation is upgrading the MongoDB PHP Client Library and the PHP C Extension to the patched versions. Applications running on the 1.x branch must upgrade the userland library to version 1.21.4 or higher, and the native extension to version 1.21.6 or higher. Teams running the 2.x branch must upgrade both components to version 2.4.1.

If immediate package upgrades are not possible, temporary input filtering must be applied in the application layer. All user inputs that influence database or collection identifiers must be rigorously sanitized. A strict allowlist approach should be used, rejecting any input containing dots, null bytes, or non-alphanumeric characters.

// Temporary verification helper
function secure_validate_db_identifier(string $input): bool
{
    if (str_contains($input, "\0") || str_contains($input, ".")) {
        return false;
    }
    return (bool) preg_match('/^[a-zA-Z0-9_-]+$/D', $input);
}

In addition to code-level changes, organizations should audit database user privileges. Ensuring that application database credentials adhere to the principle of least privilege limits the potential damage of a namespace injection attack. For example, restricting the user's scope so they cannot access the admin database minimizes the impact of a successful injection attempt.

Official Patches

MongoDBPHP Library name validation fix
MongoDBC Extension binary-safe validation patch

Fix Analysis (3)

Technical Appendix

CVSS Score
8.6/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
EPSS Probability
0.27%
Top 81% most exploited

Affected Systems

MongoDB Client Library for PHP (mongodb/mongodb)MongoDB PHP C Extension (ext-mongodb)

Affected Versions Detail

Product
Affected Versions
Fixed Version
mongodb/mongodb
MongoDB
< 1.21.41.21.4
mongodb/mongodb
MongoDB
>= 2.0.0, < 2.4.12.4.1
ext-mongodb
MongoDB
< 1.21.61.21.6
ext-mongodb
MongoDB
>= 2.0.0, < 2.4.12.4.1
AttributeDetail
CWE IDCWE-943: Improper Neutralization of Special Elements in Data Query Logic
Attack VectorNetwork (AV:N)
CVSS v4.0 Score8.6 (High)
EPSS Score0.00273 (19.38th Percentile)
ImpactLogical Security Boundary Bypass / Multi-Tenant Retargeting
Exploit StatusProof-of-Concept (PoC) Released
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-943
Improper Neutralization of Special Elements in Data Query Logic

The software constructs a query or namespace using user input, but fails to neutralize or incorrectly neutralizes special elements that can modify the query logic.

Known Exploits & Detection

MongoDB JiraJira ticket tracking namespace validation issues and PoC behavior.

Vulnerability Timeline

Vulnerability published and advisory issued by MongoDB
2026-08-27
Patched versions released for PHP Library and PHP C Driver
2026-08-27

References & Sources

  • [1]MongoDB JIRA PHPLIB-1927
  • [2]MongoDB PHP Library 1.21.4 Release
  • [3]MongoDB PHP Library 2.4.1 Release
  • [4]MongoDB PHP Driver 1.21.6 Release
  • [5]MongoDB PHP Driver 2.4.1 Release

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•15 minutes ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
1 views•10 min read
•about 1 hour ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
4 views•9 min read
•about 2 hours ago•GHSA-QX75-2P3R-PWM5
7.7

CVE-2026-55622: Cross-Project Instance Copy Authorization Bypass in Canonical LXD and LXC Incus

CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.

Amit Schendel
Amit Schendel
3 views•11 min read
•about 3 hours ago•GHSA-7MR3-28H5-M5VX
7.7

GHSA-7mr3-28h5-m5vx: Authorization Bypass and Cross-Project Volume Copy in Canonical LXD

An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.

Alon Barad
Alon Barad
3 views•10 min read
•about 4 hours ago•GHSA-47W9-6R3F-938G
9.9

GHSA-47w9-6r3f-938g: Authorization Bypass and Host Root Command Execution in Canonical LXD and Incus

A missing authorization and configuration validation vulnerability in Canonical LXD and LXC Incus allows authenticated users within restricted projects to bypass project security boundaries. By smuggling prohibited low-level configuration directives (such as raw.lxc or raw.qemu) inside instance snapshots or backup archives, an attacker can restore these configurations within a restricted project and execute arbitrary commands with root privileges on the underlying host operating system.

Alon Barad
Alon Barad
4 views•11 min read
•about 5 hours ago•GHSA-JPF8-86F3-WP38
9.9

CVE-2026-48752: Arbitrary Host File Read and Write via Templates Symlink in Canonical LXD and Incus

A symbolic link traversal vulnerability (CWE-59) in Canonical LXD and Linux Containers Incus allows an authenticated user with image import permissions to read and write arbitrary files on the host filesystem. During image archive unpacking, the daemon fails to reject top-level symbolic links for the instance `templates` directory. Subsequent requests to the instance template API endpoints follow this symbolic link outside the instance storage directory with root privileges, enabling complete host compromise.

Amit Schendel
Amit Schendel
4 views•10 min read