critical

CVE

CVE-2026-116241, CVE-2026-116242, CVE-2026-116239, CVE-2026-116243, CVE-2026-116244, CVE-2026-116245, CVE-2026-116247, CVE-2026-116249, CVE-2026-116238, CVE-2026-116248, CVE-2026-116250, CVE-2026-118938, CVE-2026-16760

CWE

CWE-78, CWE-287, CWE-426, CWE-22, CWE-502, CWE-693

Affected Surface

  • PyPI `pgadmin4` (`pgadmin-org/pgadmin4`) versions `< 9.19` in server mode across 10 CVEs (`CVE-2026-116241` CVSS 9.9 Critical, `CVE-2026-116239`, `CVE-2026-116249`, `CVE-2026-116242`, `CVE-2026-116244`, `CVE-2026-116245`, `CVE-2026-116247`, `CVE-2026-116238`, `CVE-2026-116243`, `CVE-2026-116248`, and `CVE-2026-116250`)
  • PyPI `fickling` (`trailofbits/fickling`) versions `<= 0.1.12` (latest on PyPI as of 31 October 2026; fixed on `master` in PR `#343` / commit `79ae401af3` for `CVE-2026-118938` and `CVE-2026-16760`)
  • AI/ML model scanners, Hugging Face checkpoint pipelines, and pickle safety gates that rely on `fickling.check_safety()` or `fickling.always_check_safety()`

TL;DR

Between 20:17 UTC and 22:16 UTC on 30 October 2026, NVD published 10 security advisories in pgAdmin 4 (< 9.19 on PyPI and container distributions) alongside two static-analysis bypasses in Trail of Bits’ Python pickle and PyTorch scanner fickling (<= 0.1.12):

  1. pgAdmin 4 < 9.19 psql \copy double-quoted identifier RCE (CVE-2026-116241, CVSS 9.9 Critical) and nine server-mode isolation flaws:
    • Client-side \copy ... TO PROGRAM escape (CVE-2026-116241, reported by Yonghwa Lee of Xint by Theori): pgAdmin 4’s Import/Export Data tool wraps a user’s export query inside psql’s \copy (...) TO meta-command and runs _is_query_parens_balanced(query) to stop the query from closing the outer ( and appending TO PROGRAM 'cmd'. An earlier patch (1496fabe2) rejected backslashes inside single-quoted literals ('...'), where standard_conforming_strings=off changes whether \' closes the string. However, _is_query_parens_balanced() still allowed backslashes inside double-quoted identifiers ("..."). Because psql’s strtokx() in parse_slash_copy() applies the connection’s standard_conforming_strings escape rule to whichever quote character opened the token, setting standard_conforming_strings=off (which any unprivileged PostgreSQL role can set on its own session) makes \" an escaped quote to psql while pgAdmin’s validator treats it as closing the identifier. Supplying SELECT "a\"b"c) TO PROGRAM 'cmd' x" passes pgAdmin’s balance check and makes psql call popen('cmd') on the pgAdmin host before the database server ever parses the SQL.
    • Host SSH identity, Kerberos cache, and libpq ambient file bleed (CVE-2026-116242, CVE-2026-116244, CVE-2026-116245, CVE-2026-116247, all CVSS 8.2 High; CVE-2026-116249, CVSS 8.4 High): In server mode, pgAdmin 4 failed to isolate per-user connections from the OS service account running the pgAdmin daemon. create_ssh_tunnel() passed neither host_pkey_directories=[] nor ssh_config_file=os.devnull to sshtunnel, letting any pgAdmin user authenticate an SSH tunnel with the service account’s ~/.ssh private keys, ~/.ssh/config (ProxyCommand), or ssh-agent (CVE-2026-116242). Similarly, libpq connections fell back to the service account’s default Kerberos credential cache (CVE-2026-116244), ~/.pg_service.conf (CVE-2026-116245), and ~/.pgpass / ~/.postgresql/postgresql.key (CVE-2026-116247), while get_complete_file_path() returned os.path.realpath() after checking the unresolved path so a symlink inside a user’s storage directory could point sslkey or passfile at any file on the server (CVE-2026-116249).
    • Cross-source LDAP/Kerberos account takeover (CVE-2026-116239, CVSS 8.5 High), SHARED_STORAGE binary execution (CVE-2026-116243, CVSS 7.5 High), and login lockout bypass (CVE-2026-116238, CVSS 8.1 High): After LDAP or Kerberos authentication succeeded, pgAdmin looked up the local user record by username alone without filtering on auth_source, logging the user into an existing internal admin account with the same username and unlocking its saved database passwords (CVE-2026-116239). Meanwhile, validate_binary_path() blocked STORAGE_DIR as a custom PostgreSQL utility path (pg_dump, psql) but forgot to block writable SHARED_STORAGE directories (CVE-2026-116243).
  2. Trail of Bits fickling <= 0.1.12 check_safety() bypasses (CVE-2026-118938 and CVE-2026-16760, both CVSS 8.8 High, disclosed by Bombadil Systems):
    • Dotted __qualname__ in STACK_GLOBAL (CVE-2026-118938): In pickle protocol 4, STACK_GLOBAL pops a module name and a callable name and passes both to Unpickler.find_class(), which resolves dotted attribute paths via _getattribute() when the name contains . (for example ("optparse", "Values.read_file") or ("pathlib", "Path.write_text")). In fickling <= 0.1.12, StackGlobal.run() emitted ast.ImportFrom(module=module, names=[ast.alias(name)]), so Import.names recorded only the first identifier component ("Values") while leaving the AST call target as a broken or unanalyzed attribute expression. check_safety() reported Severity.LIKELY_SAFE even though unpickling executed the method.
    • Module-origin trust in likely_safe_imports (CVE-2026-16760): ASTProperties._process_import() added every imported symbol from any module in sys.stdlib_module_names (unless the module was on UNSAFE_IMPORTS) to self.likely_safe_imports, and OvertlyBadEvals skipped every call whose function name appeared in likely_safe_imports. Calling dangerous functions or constructors from non-denylisted standard-library modules (argparse, optparse, tkinter, dataclasses._create_fn, mailcap.findmatch, readline, gzip.GzipFile, pstats.Stats.dump_stats, zipapp, uu) passed check_safety() as LIKELY_SAFE.

What to do now: Upgrade pgadmin4 to >= 9.19 immediately across all server-mode and container deployments. If you use fickling (<= 0.1.12 on PyPI) to gate pickle or PyTorch checkpoint loads, pin to commit 79ae401af3 (PR #343 on master, merged 31 October 2026) until 0.1.13 is tagged on PyPI, and do not rely on denylist-based pickle AST scanners alone to load untrusted .pkl or .pt files with weights_only=False.

Affected packages

EcosystemPackageCVESeverityAffected versionsFixed version / CommitVulnerable component
PyPI / Containerpgadmin4CVE-2026-116241CVSS 9.9 Critical< 9.199.19 (commit 9be31a019f)_is_query_parens_balanced() in web/pgadmin/tools/import_export/__init__.py
PyPI / Containerpgadmin4CVE-2026-116239, CVE-2026-116249CVSS 8.5 / 8.4 High< 9.199.19 (269e32d5ee, 2afe505ef4)LDAP/Kerberos auth_source lookup; symlink traversal in get_complete_file_path()
PyPI / Containerpgadmin4CVE-2026-116242, 116244, 116245, 116247CVSS 8.2 High (all 4)< 9.199.19 (d52fe4740e, 145e511f05, a0c8f4857f, 32db693198)create_ssh_tunnel(), Kerberos KRB5CCNAME, and libpq service / passfile / sslkey defaults
PyPI / Containerpgadmin4CVE-2026-116238, 116243, 116248, 116250CVSS 8.1 High to 6.5 Medium< 9.199.19 (9e95d9a721, 35c9235d17)MAX_LOGIN_ATTEMPTS bypass; SHARED_STORAGE utility_path; shared server flag; storage symlink open
PyPIficklingCVE-2026-118938, CVE-2026-16760CVSS 8.8 High (both)<= 0.1.12 (latest on PyPI)Commit 79ae401af3 (PR #343) and 2a28b41392StackGlobal.run(), ASTProperties._process_import(), and UNSAFE_IMPORTS in fickling/fickle.py

Technical analysis

1. CVE-2026-116241: how a backslash inside a double-quoted SQL identifier escapes psql \copy (...) into TO PROGRAM

When an authenticated pgAdmin 4 user exports the results of a custom SQL query via the Import/Export Data tool (tools_import_export_data, enabled by default for non-admin roles), pgAdmin spawns the local psql binary and passes -c "\copy (<user_query>) TO '<output_file>' ...".

Because psql’s \copy is a client-side meta-command executed by the psql process running on the pgAdmin server host, psql parses the \copy line before sending COPY (...) TO STDOUT to PostgreSQL. If the user’s query can close the opening ( of \copy (...) early and append TO PROGRAM 'sh -c ...', psql immediately calls popen() on the pgAdmin server.

To prevent that, pgAdmin’s _is_query_parens_balanced(query) in web/pgadmin/tools/import_export/__init__.py walks the query string tracking parenthesis depth, single-quoted strings, double-quoted identifiers, dollar-quoted strings, and comments. After an earlier vulnerability where 'a\') TO PROGRAM ...' bypassed the parser under standard_conforming_strings=on, pgAdmin rejected any backslash inside a single-quoted string. However, it still treated backslashes as ordinary characters inside double-quoted identifiers ("...").

The mismatch is in PostgreSQL’s src/fe_utils/string_utils.c: strtokx(), which parse_slash_copy() uses to tokenize \copy, sets its escape character to \ whenever the database session has standard_conforming_strings = off and applies that backslash escape rule to double-quoted tokens as well as single-quoted tokens.

An attacker with an ordinary database role simply sets ALTER ROLE current_user SET standard_conforming_strings = off; (or connects to a database with standard_conforming_strings = off) and submits an export query such as:

SELECT "a\"b"c) TO PROGRAM 'id > /tmp/pwned' x"
  1. What pgAdmin < 9.19 sees: _is_query_parens_balanced() enters the double-quoted identifier at "a, ignores the \, closes the identifier at the second ", sees b"c) as a second double-quoted string "b" followed by c and a closing ) that it thinks is matched or inside the second quote opened at the end, and accepts the query as balanced.
  2. What psql sees (standard_conforming_strings = off): strtokx() treats \" inside "a\"b" as an escaped literal quote, so the identifier continues until "b"’s second quote. That leaves c) outside any quoted token, closing \copy (...) and exposing TO PROGRAM 'id > /tmp/pwned' as a live \copy option. psql executes the shell command via popen() before PostgreSQL ever sees the query.

Commit 9be31a019f rejects any backslash inside a double-quoted identifier just as it already did for single-quoted literals:

--- a/web/pgadmin/tools/import_export/__init__.py
+++ b/web/pgadmin/tools/import_export/__init__.py
@@ -340,6 +340,10 @@ def _is_query_parens_balanced(query):
         elif state == IN_DOUBLE_QUOTE:
+            if ch == '\\':
+                # Ambiguous with standard_conforming_strings=off in psql's
+                # strtokx; reject rather than guess the connection state.
+                return False
             if ch == '"':
                 if nxt == '"':
                     i += 2

2. CVE-2026-116242 and CVE-2026-116243: server-mode SSH tunnel credential bleed and SHARED_STORAGE binary execution

In server mode, pgAdmin 4 runs as a single OS service account serving multiple web users. In web/pgadmin/utils/driver/psycopg3/server_manager.py, create_ssh_tunnel() constructed SSHTunnelForwarder(...) without overriding sshtunnel’s default key discovery (CVE-2026-116242, commit d52fe4740e):

  • Because host_pkey_directories was not passed, sshtunnel automatically scanned ~/.ssh of the OS account running pgAdmin and loaded any unencrypted private keys (id_rsa, id_ed25519).
  • Because ssh_config_file was not passed, sshtunnel parsed the service account’s ~/.ssh/config (IdentityFile, User, HostName, ProxyCommand).
  • If the user left the tunnel password and identity file blank, allow_agent stayed True, allowing the tunnel to sign challenges with the pgAdmin service account’s ssh-agent.

In 9.19, server-mode tunnels always pass host_pkey_directories=[], ssh_config_file=os.devnull, and allow_agent=False, and refuse to connect if a configured identity_file does not exist inside the user’s storage directory.

Separately, in web/pgadmin/misc/__init__.py (CVE-2026-116243, commit 9e95d9a721), validate_binary_path() and does_utility_exist() checked Path(config.STORAGE_DIR) not in Path(data['utility_path']).parents to stop users from uploading a fake pg_dump or psql into their personal file storage and pointing their PostgreSQL binary path preference at it. However, the check did not inspect config.SHARED_STORAGE directories (which ordinary users can also upload files into) and did not expand $DIR or .. before resolving symlinks.

3. CVE-2026-118938 and CVE-2026-16760: how dotted STACK_GLOBAL operands and likely_safe_imports bypass fickling

Trail of Bits’ fickling decompiles a Python pickle opcode stream into a synthetic Python AST and runs static analysis passes (UnsafeImportsML, BadCalls, OvertlyBadEvals, UnusedVariables) over that AST to decide whether the pickle is safe to load.

In CVE-2026-118938, pickle protocol 4’s STACK_GLOBAL opcode pops two strings from the pickle stack (module and name) and calls find_class(module, name). In CPython’s pickle.py, when proto >= 4, find_class() splits name on . via _getattribute(sys.modules[module], name) so a pickle can reference nested classes or unbound methods on a class (such as optparse.Values.read_file or pathlib.Path.write_text).

When fickling <= 0.1.12 translated STACK_GLOBAL("optparse", "Values.read_file") into AST nodes, it emitted from optparse import Values.read_file. In Python’s ast module:

  1. Import.names splits alias.name on . and returns only the root identifier ("Values"), so import-level checks only saw from optparse import Values.
  2. In OvertlyBadEvals, ASTProperties._process_import() added "Values.read_file" (or the root name) from a non-denylisted stdlib module into self.likely_safe_imports (CVE-2026-16760), causing OvertlyBadEvals to skip the subsequent REDUCE call completely.

In commit 2a28b41392 and PR #343 (79ae401af3), Trail of Bits updated _process_import() so that dotted import names and private (_-prefixed) attributes are never added to likely_safe_imports, and expanded UNSAFE_IMPORTS to block stdlib file-read/write and execution gadgets (argparse, optparse, tkinter, trace, doctest, dataclasses, mailcap, readline, tracemalloc, mailbox, gzip, bz2, lzma, compression, netrc, zipapp, wave, pstats, uu, ElementInclude, minidom, expatbuilder, sax, xmlbuilder, and mimetypes):

# Regression test in trailofbits/fickling PR #343 (commit 79ae401af3)
def test_dotted_qualname_is_blocked(self):
    pickled = self.stack_global_call("pathlib", "Path.write_text")
    self.assertNotIn("Path.write_text", pickled.properties.likely_safe_imports)
    self.assertGreaterEqual(check_safety(pickled).severity, Severity.LIKELY_OVERTLY_MALICIOUS)

Note that on 30 October 2026 (00:31 UTC), fickling also merged commit d0117098e3 (Analyze PyTorch ZIP records with PyTorch reader): previously, PyTorchModelWrapper.pickled opened .pt archives with Python’s zipfile.ZipFile (which reads the last duplicate data.pkl entry in the ZIP central directory), whereas torch.load()’s C++ PyTorchFileReader reads the first matching record, allowing a polyglot .pt archive with two data.pkl entries to show a benign pickle to fickling while executing a malicious pickle in torch.load().

Detection and remediation

# 1. Check installed pgadmin4 and fickling versions across Python environments and containers
pip show pgadmin4 fickling 2>/dev/null || true
rg -n '(pgadmin4|dpage/pgadmin4|fickling)' requirements*.txt pyproject.toml uv.lock Dockerfile* docker-compose*.{yml,yaml} k8s/ helm/ 2>/dev/null

# 2. On pgAdmin 4 server-mode hosts, check whether the service account has ambient ~/.ssh keys, ~/.pgpass, or ~/.pg_service.conf
ls -la ~pgadmin/.ssh/ ~pgadmin/.pgpass ~pgadmin/.pg_service.conf ~pgadmin/.postgresql/ 2>/dev/null || true
  1. Upgrade pgadmin4 to >= 9.19:
    • Update pgadmin4 via pip install --upgrade "pgadmin4>=9.19" or pull the dpage/pgadmin4:9.19 container image.
    • Remove any personal SSH keys (~/.ssh/id_*), ~/.ssh/config, ~/.pgpass, or ~/.pg_service.conf files from the home directory of the OS service account that runs pgadmin4 in server mode, and rotate any SSH keys that were stored there.
    • Ensure config.STORAGE_DIR is set to a dedicated directory (never empty "") and restrict tools_import_export_data and custom utility_path permissions if untrusted users have access to the pgAdmin web UI.
  2. Update fickling and enforce weights_only=True in PyTorch:
    • Because fickling 0.1.12 on PyPI does not yet include commits 2a28b41392, d0117098e3, or 79ae401af3, install fickling from git+https://github.com/trailofbits/fickling.git@79ae401af3 until 0.1.13 is published.
    • Treat fickling.check_safety() as a secondary signal rather than a sandbox boundary: prefer safetensors or torch.load(..., weights_only=True) for all untrusted model weights.

Timeline

  • 2026-10-23 to 2026-10-24: pgAdmin maintainers merge fixes for CVE-2026-116241 (9be31a019f), CVE-2026-116243 (9e95d9a721), CVE-2026-116242 (d52fe4740e), CVE-2026-116239 (269e32d5ee), and the remaining server-mode isolation flaws, shipping in pgAdmin 4 9.19.
  • 2026-10-29 to 2026-10-31 (01:58 UTC): Trail of Bits merges commits 2a28b41392, d0117098e3, and PR #343 (79ae401af3) in trailofbits/fickling.
  • 2026-10-30 (20:17 to 22:16 UTC): NVD publishes the 10 pgAdmin 4 CVEs (CVE-2026-116238, 116239, 116241..116245, 116247..116250) and Bombadil Systems / NVD publish CVE-2026-118938 and CVE-2026-16760 for fickling.

From research to remediation

Check whether this pattern exists in your codebase

Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.

References