pgAdmin 4: OS command injection in Import/Export query export via psql metacommand breakout
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-7816
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 4 Nov 2026, 20:29 UTC · Revision 1
Source evidence
pgAdmin 4: OS command injection in Import/Export query export via psql metacommand breakout
core-osv · Original sourcePublished 11 May 2026, 14:35 UTC
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.
osv:CVE-2026-7816
Complete source record
{
"id": "6f76752fc39c475027b83e8f243c5816db9dae0e7f6a6989e608016ab3404d6b",
"url": "https://osv.dev/vulnerability/CVE-2026-7816",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "pgAdmin 4: OS command injection in Import/Export query export via psql metacommand breakout",
"summary": "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.",
"evidence": "osv:CVE-2026-7816",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2026-7816",
"aliases": [
"CVE-2026-7816",
"GHSA-j74f-g7vx-fh4x",
"PYSEC-2026-2870"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "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"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/pgadmin-org/pgadmin4",
"type": "GIT",
"events": [
{
"introduced": "7c74b7cdb764d54ba7f42e0644b3f1d3ee7c786f"
},
{
"fixed": "86a8b165abbefd62e78fd43edcd66c0d09649442"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "9.4"
},
{
"fixed": "9.15"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StandardRange"
},
{
"cpe": "cpe:2.3:a:pgadmin:pgadmin_4:*:*:*:*:*:postgresql:*:*",
"range": [
{
"introduced": "9.4"
},
{
"fixed": "9.15"
}
],
"source": "CPE_RANGE"
}
]
}
}
],
"versions": [
"REL-9_14",
"REL-9_13",
"REL-9_12",
"REL-9_11",
"REL-9_10",
"REL-9_9",
"REL-9_8",
"REL-9_7",
"REL-9_6",
"REL-9_5",
"REL-9_4"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-7816.json"
}
}
],
"modified": "2026-10-28T02:30:39.227354787Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/7xxx/CVE-2026-7816.json",
"https://nvd.nist.gov/vuln/detail/CVE-2026-7816",
"https://github.com/pgadmin-org/pgadmin4/issues/9899",
"https://github.com/pgadmin-org/pgadmin4"
],
"provider_metadata": {
"cna_assigner": "PostgreSQL",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/7xxx/CVE-2026-7816.json"
}
},
"related_cves": [
{
"value": "CVE-2026-7816",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 506688,
"published_at": "2026-05-11T14:35:50.827+00:00"
}