Azure Cosmos for PostgreSQL Flaw Allowed RCE via Configuration Injection

Summary
Varonis Threat Labs found that Azure Cosmos for PostgreSQL’s management API validation could be bypassed with control characters to inject PostgreSQL settings and enable potential RCE via archive_command. Microsoft confirmed the issue and fixed it in summer 2025.
Key points
- The flaw let an actor with sufficient Azure management API privileges modify PostgreSQL configuration values.
- Researchers found that a form-feed character and double newline could bypass validation and inject a new configuration entry.
- The archive_command parameter could be abused to run operating-system commands on the database server.
- Researchers did not test whether the flaw enabled privilege escalation within or across tenants.
- Microsoft tested and confirmed the issue as an important RCE and released a fix in summer 2025; customers were told no further action was required.
- The article recommends least privilege, phishing-resistant MFA, audit-log monitoring, and private endpoints to reduce risk.
Article Details
- Attack Vectors
- A user with sufficient Azure management API privileges could exploit insufficient validation of PostgreSQL configuration values to inject a new configuration entry. The researchers used a form-feed character before a single quote and a double newline to bypass validation.
- The injected `archive_command` setting could run operating-system commands on the database server. Microsoft confirmed the RCE, but the researchers did not perform code-execution testing after Microsoft denied their request.
- Defensive Notes
- Microsoft released a fix in summer 2025; the article says customers using Azure Cosmos DB for PostgreSQL need take no further action.
- Apply least privilege to Entra ID roles, management-plane access, database roles, and application accounts; regularly review privileged assignments.
- Require phishing-resistant MFA and Conditional Access for critical infrastructure access.
- Enable PostgreSQL and Azure audit logs, forward them to a SIEM, and monitor for unexpected configuration changes, suspicious SQL commands, and newly created users or roles.
- Use federated authentication where possible, and place managed databases behind private endpoints with access restricted to approved networks, workloads, or identities.
MITRE ATT&CK
T1202 · Indirect Command ExecutionThe article identifies `archive_command` as a way to run operating-system commands on the database server through the PostgreSQL configuration mechanism.T1565.001 · Stored Data ManipulationThe article maps the ability to modify PostgreSQL configuration through the Azure management API and inject a new parameter to this technique.
Vendors
Products
Azure Cosmos for PostgreSQLVaronis Threat Labs found an Azure Cosmos for PostgreSQL flaw that let attackers bypass server-side validation and inject arbitrary PostgreSQL configuration values through the Azure management API, leading to remotePostgreSQLVaronis Threat Labs found an Azure Cosmos for PostgreSQL flaw that let attackers bypass server-side validation and inject arbitrary PostgreSQL configuration values through the Azure management API, leading to remote
