CVE-2026-145347 in repmgr
Summary
by MITRE • 12/05/2026
repmgr 4.0.0 through 5.5.1 is affected by an OS command injection vulnerability (CWE-78) in the pg_basebackup and pg_rewind commands it builds. During repmgr standby clone, the replication user name (repluser) from the upstream node's record in the repmgr.nodes table is inserted into the pg_basebackup command line without escaping. During repmgr node rejoin with --force-rewind, including the rejoin step of repmgr standby switchover --force-rewind, the primary node's connection string (conninfo) is inserted into the pg_rewind command line without escaping. repmgr runs both commands through the shell. An attacker with the credentials of a non-superuser repmgr database user can write a crafted node record and run OS commands, as the operating system user that runs repmgr (usually postgres), on the node being cloned or rejoined. Deployments whose repmgr database user is a superuser gain no new capability, because a superuser can already run OS commands. The issue is fixed in repmgr 5.5.2.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 12/05/2026
The vulnerability identified as CWE-78 represents an operating system command injection flaw within the repmgr utility, specifically affecting versions ranging from 4.0.0 through 5.5.1. This security defect arises because repmgr constructs shell commands for critical database replication operations without properly sanitizing user-supplied input. The core of the issue lies in how the tool handles dynamic parameters during standby cloning and node rejoining processes, allowing an attacker to inject arbitrary operating system commands that are executed with the privileges of the process owner.
In the context of a standby clone operation, repmgr utilizes the pg_basebackup utility to create a physical copy of the primary database for replication purposes. The tool retrieves the replication username, referred to as repluser, from the upstream node's record stored in the repmgr.nodes table. This value is directly interpolated into the command line string passed to pg_basebackup without any escaping or validation mechanisms. Similarly, during a node rejoin operation triggered by the --force-rewind flag, which includes scenarios such as a forced switchover using standby mode, repmgr constructs a command for pg_rewind. In this instance, the primary node's connection string, known as conninfo, is extracted from configuration data and inserted directly into the shell command without sanitization. Both of these commands are subsequently executed via the system shell interface rather than through direct binary invocation with argument arrays, which significantly increases the attack surface for injection attacks.
The operational impact of this vulnerability is severe because it allows privilege escalation within the context of the database server's host operating system. An attacker who possesses valid credentials for a non-superuser repmgr database account can craft malicious entries in the repmgr.nodes table or manipulate connection parameters to include shell metacharacters and command sequences. When repmgr processes these crafted inputs, it executes them as if they were legitimate replication commands. Consequently, an authenticated but unprivileged attacker gains the ability to execute arbitrary operating system commands on the node being cloned or rejoined. The execution context is typically that of the postgres user, which often holds significant privileges on the database server, potentially leading to full host compromise depending on the specific deployment configuration and file permissions.
It is important to note that this vulnerability does not provide new capabilities if the repmgr database user account itself has superuser privileges within PostgreSQL. A superuser in PostgreSQL already possesses extensive powers, including the ability to execute operating system commands through various extension mechanisms or direct server functions. Therefore, the severity of this specific injection flaw is primarily relevant for deployments where the repmgr administrative user operates with limited permissions, relying on the principle of least privilege. In such environments, the inability to distinguish between legitimate replication parameters and malicious payloads allows a lower-privileged attacker to bypass intended access controls and achieve code execution at the operating system level.
To mitigate this risk, organizations must upgrade their repmgr installations to version 5.5.2 or later, where the issue has been resolved by implementing proper input escaping and validation for both the replication user name and connection strings before they are passed to shell commands. Additionally, administrators should review their deployment architectures to ensure that the database account used by repmgr does not hold superuser privileges unless absolutely necessary, thereby limiting the potential blast radius of any future vulnerabilities. Monitoring logs for unusual command execution patterns or unexpected changes in node records can also provide early detection indicators for exploitation attempts targeting this class of injection flaws.