# CVE-2026-7816: pgAdmin 4: OS command injection in Import/Export query export via psql metacommand breakout

- Severity: High 8.7 (CVSS:4.0, scored by PostgreSQL) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.44%, higher than 74% of CVEs (2026-12-01)
- Published: 2026-05-11T14:35:50.827Z
- Modified: 2026-10-26T18:10:00.173Z
- Also known as: GHSA-j74f-g7vx-fh4x, PYSEC-2026-2870
- Weaknesses: CWE-78, CWE-89
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: PostgreSQL

## Description

OS command injection (CWE-78) vulnerability in pgAdmin 4 Import/Export query export.

User-supplied input was interpolated directly into a psql \copy metacommand template without sanitization. An authenticated user could inject ") TO PROGRAM 'cmd'" to break out of the \copy (...) context and achieve arbitrary command execution on the pgAdmin server, or ") TO '/path'" for arbitrary file write. Additional fields (format, on_error, log_verbosity) were also raw-interpolated and exploitable.

Fix adds a parens-balance parser modeled on psql's strtokx tokenizer, allow-lists format/on_error/log_verbosity, rejects null bytes in the query, and tightens type and gating checks.

This issue affects pgAdmin 4: before 9.15.

(As written by CVE List.)

## Affected

- pgadmin.org pgAdmin 4: from 9.4 before 9.15
- pgadmin4 (PyPI): before 9.15
- pgadmin pgadmin_4: from 9.4 before 9.15

## Every score

- PostgreSQL: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- PostgreSQL: CVSS:4.0 8.7 High `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`
- GitHub: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:4.0 High `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`
- PyPA Advisory Database: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- PyPA Advisory Database: 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`

## References

- <https://github.com/pgadmin-org/pgadmin4/issues/9899> (issue-tracking, patch, vendor-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-7816> (advisory)
- <https://github.com/pgadmin-org/pgadmin4/commit/13badc62c> (web)
- <https://github.com/pgadmin-org/pgadmin4> (package)
- <https://pypi.org/project/pgadmin4> (package)
- <https://github.com/advisories/GHSA-j74f-g7vx-fh4x> (advisory)

## Sources

- CVE List: [CVE-2026-7816](https://www.cve.org/CVERecord?id=CVE-2026-7816), CVE Terms of Use, modified 2026-05-26
- GitHub Advisory Database: [GHSA-j74f-g7vx-fh4x](https://github.com/advisories/GHSA-j74f-g7vx-fh4x), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-7816](https://nvd.nist.gov/vuln/detail/CVE-2026-7816), Public domain, modified 2026-10-26
- PyPA Advisory Database: [PYSEC-2026-2870](https://osv.dev/vulnerability/PYSEC-2026-2870), CC-BY-4.0, modified 2026-07-13

---

Page: https://cve.day/CVE-2026-7816 · Whole record: https://cve.day/CVE-2026-7816.json · Rebuilt by cve.day 2026-11-25T22:59:21.206Z
