CVE-2026-145347: repmgr OS command injection through node record values in pg_basebackup and pg_rewind commands
repmgr 4.0.0 through 5.5.1 is affected by an OS command injection vulnerability (CWE-78) in the pgbasebackup and pgrewind 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 pgbasebackup 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 pgrewind 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 5.5.2
Event History
Frequently Asked Questions
Which deployments gain a meaningful new attack path from this issue?
Deployments where a non-superuser repmgr database user can modify node records are exposed to privilege escalation onto the operating system account running repmgr, usually postgres. Deployments using a superuser as the repmgr database user gain no new capability because that user can already execute OS commands.
What must an attacker be able to do to exploit it?
The attacker needs credentials for a non-superuser repmgr database user and must be able to write a crafted record to the repmgr.nodes table. Exploitation is triggered when a standby clone uses the crafted upstream repluser value, or when a forced rewind rejoin uses the crafted primary conninfo value.
Which operational workflows can trigger the injected command?
Standby cloning can trigger injection through the upstream node record's repluser value. Node rejoin with --force-rewind, including repmgr standby switchover --force-rewind, can trigger injection through the primary node record's conninfo value.
How can I remediate this issue?
Upgrade to repmgr 5.5.2, which fixes the issue. The affected versions are 4.0.0 through 5.5.1.