CVE-2026-12046

pgAdmin 4: Unauthenticated pickle deserialization in SQL Editor close / update_connection routes enables remote code execution

Published Jun 18, 2026 CVSS 4.0 · 9.5 Critical EPSS < 1% KEV · Not listed
Description
Two state-mutating endpoints in pgAdmin 4's SQL Editor blueprint -- DELETE /sqleditor/close/<trans_id> and POST /sqleditor/initialize/sqleditor/update_connection/<sgid>/<sid>/<did> -- were the only routes in the module missing the @pga_login_required decorator. Both reach a pickle.loads sink on session['gridData'][<trans_id>]['command_obj']: the close endpoint via close_sqleditor_session(), and update_sqleditor_connection via check_transaction_status(). In server mode these endpoints were reachable without any authenticated pgAdmin session.

The defect is a missing-authentication-on-critical-function (CWE-306) wrapper around a deserialization-of-untrusted-data sink (CWE-502). Exploiting it for remote code execution requires the attacker to also forge a server-side session file whose gridData entry contains a malicious pickle payload, which in turn requires both (a) knowledge of pgAdmin's Flask SECRET_KEY (no chain to leak it is described here -- the attacker must already possess it) and (b) write access to pgAdmin's sessions/ directory on the host. Neither precondition is granted by this defect on its own. When those preconditions are met from another channel (misconfigured deployment, prior compromise, leaked configuration), the missing auth gate is the final hop that turns an existing partial compromise into unauthenticated code execution in the pgAdmin process -- and, by extension, on the host under whatever account runs pgAdmin.

Fix is a one-line @pga_login_required decorator on each of the two endpoints, matching the convention used by every other route in the module. The is_authenticated / MFA chain now runs before the trans_id is dereferenced, so an unauthenticated request is rejected before reaching the deserialization path.

The defect is server-mode only. In DESKTOP mode pgAdmin's before_request hook re-authenticates DESKTOP_USER on every request, so no endpoint can be exercised in an unauthenticated state and no auth decorator (or its absence) is meaningful. The accompanying regression test mirrors the attacker's path -- harvests an X-pgA-CSRFToken from GET /login and replays it against both endpoints -- and self-skips outside server mode for that reason; it is wired into the existing server-mode CI workflow alongside the data-isolation tests.

This issue affects pgAdmin 4: from 6.9 before 9.16.

Analysis

AI-generated

Technical impact

The vulnerability is a missing authentication guard on two pgAdmin 4 SQL editor endpoints, allowing an attacker to reach a pickle deserialization sink without being logged in. Because the deserialization occurs on data stored in the session, the attacker needs a pre‑crafted session file with a malicious pickle payload and also must know the pgAdmin Flask SECRET_KEY and have write permission to the sessions/ directory on the host. When those preconditions are met, the flaw permits arbitrary code execution in the pgAdmin process and, consequently, on the underlying host system. This weakness is classified as a missing‑auth‑on‑critical‑function with insecure deserialization (CWE‑306, CWE‑502).

Affected Systems

Affected systems are pgAdmin 4 deployments running in server mode with versions 6.9 through 9.15 inclusive. The vulnerability does not affect Desktop mode, where authentication is enforced on every request.

Risk and Exploitability

Risk assessment: The CVSS score is 9.5, indicating critical severity, and the flaw is not listed in the CISA KEV catalog. The EPSS score is unavailable, but because the weakness requires additional preconditions—SECRET_KEY exposure and write access to the sessions directory—exploitation likelihood remains limited to scenarios where the attacker already has those capabilities or the system is misconfigured. Nevertheless, once those conditions exist, the missing authentication gate turns a partial compromise into full remote code execution.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the latest pgAdmin 4 release (version 9.16 or newer) which adds the @pga_login_required decorator to the vulnerable endpoints.
  • If the latest version cannot be applied immediately, run pgAdmin strictly in DESKTOP mode or restrict access to server‑mode endpoints with network controls and ensure that the sessions/ directory is not writable by untrusted users.
  • Secure the Flask SECRET_KEY by storing it in a protected location, rotating it regularly, and limiting its exposure; remove any publicly accessible copies of the key from the host.

Generated by OpenCVE AI on June 19, 2026 at 01:51 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Pgadmin
Pgadmin pgadmin 4
Vendors & Products Pgadmin
Pgadmin pgadmin 4
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Two state-mutating endpoints in pgAdmin 4's SQL Editor blueprint -- DELETE /sqleditor/close/<trans_id> and POST /sqleditor/initialize/sqleditor/update_connection/<sgid>/<sid>/<did> -- were the only routes in the module missing the @pga_login_required decorator. Both reach a pickle.loads sink on session['gridData'][<trans_id>]['command_obj']: the close endpoint via close_sqleditor_session(), and update_sqleditor_connection via check_transaction_status(). In server mode these endpoints were reachable without any authenticated pgAdmin session. The defect is a missing-authentication-on-critical-function (CWE-306) wrapper around a deserialization-of-untrusted-data sink (CWE-502). Exploiting it for remote code execution requires the attacker to also forge a server-side session file whose gridData entry contains a malicious pickle payload, which in turn requires both (a) knowledge of pgAdmin's Flask SECRET_KEY (no chain to leak it is described here -- the attacker must already possess it) and (b) write access to pgAdmin's sessions/ directory on the host. Neither precondition is granted by this defect on its own. When those preconditions are met from another channel (misconfigured deployment, prior compromise, leaked configuration), the missing auth gate is the final hop that turns an existing partial compromise into unauthenticated code execution in the pgAdmin process -- and, by extension, on the host under whatever account runs pgAdmin. Fix is a one-line @pga_login_required decorator on each of the two endpoints, matching the convention used by every other route in the module. The is_authenticated / MFA chain now runs before the trans_id is dereferenced, so an unauthenticated request is rejected before reaching the deserialization path. The defect is server-mode only. In DESKTOP mode pgAdmin's before_request hook re-authenticates DESKTOP_USER on every request, so no endpoint can be exercised in an unauthenticated state and no auth decorator (or its absence) is meaningful. The accompanying regression test mirrors the attacker's path -- harvests an X-pgA-CSRFToken from GET /login and replays it against both endpoints -- and self-skips outside server mode for that reason; it is wired into the existing server-mode CI workflow alongside the data-isolation tests. This issue affects pgAdmin 4: from 6.9 before 9.16.
Title pgAdmin 4: Unauthenticated pickle deserialization in SQL Editor close / update_connection routes enables remote code execution
Weaknesses CWE-306
CWE-502
References
Metrics cvssV3_1

{'score': 9, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.5, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H'}

Weaknesses
  • CWE-306

    Missing Authentication for Critical Function

  • CWE-502

    Deserialization of Untrusted Data

Sources

Status
PUBLISHED
Assigner
PostgreSQL
Published
Updated
Jun 23, 2026, 3:55 AM
Reserved
Jun 11, 2026, 8:40 PM
Status
Analyzed
Published
Jun 19, 2026, 12:16 AM
Modified
Oct 25, 2026, 11:10 PM
Severity
Important
Public date
Jun 18, 2026, 11:37 PM