/

CVE-2026-17349

Severity:

CRITICAL RISK

(9.6)

Credential Exposure via Server Cloning (CWE-522) in pgAdmin

CVE-2026-17349

Analyzed

Vulnerability type

Category:

Credential Management / Session Isolation

CWE:

CWE-522, CWE-639

Impact:

Unauthorized Use of Stored Credentials and Privilege Escalation

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A flaw in pgAdmin 4's Workspaces adhoc connect feature caused cloned server definitions to inherit another user's ownership and stored database credentials.

When a non-owner triggered an adhoc connection against a shared server, pgAdmin persisted a new server entry owned by the caller but populated with the original user's passwords, enabling unauthorized reuse of those credentials.

Affected context

This vulnerability occurs in pgAdmin 4 Workspaces environments that use the adhoc connect server endpoint (/misc/workspace/adhoc_connect_server) introduced in version 9.0.

It manifests when users can see or interact with shared server definitions belonging to other users (commonly administrators) and initiate adhoc connections against them.

The issue arises before any database connection succeeds and is tied to how server rows are cloned and persisted in the pgAdmin metadata database, not to the underlying PostgreSQL instances themselves.

Exploit preconditions

  • Attack surface: Web-based pgAdmin 4 interface or API where Workspaces and shared servers are enabled.
  • Required access: Authenticated pgAdmin user account with visibility into another user's shared server entry.
  • Trigger point: Initiating an adhoc connect operation against a server owned by another user via /misc/workspace/adhoc_connect_server.
  • Why exploitation is possible:
  • The clone operation performs a near-identical copy of the server record, including ownership fields and credential fields.
  • The cloned record is persisted with mismatched ownership and intact stored credentials before any validation or sanitization step.
  • The application subsequently uses the inherited stored password fields when the non-owner opens and uses the cloned server, effectively running with another user's database identity.

Why this happens

The underlying bug class centers on improper credential management and broken authorization around object ownership, mapping primarily to CWE-522: Insufficiently Protected Credentials and secondarily to CWE-639: Authorization Bypass Through User-Controlled Key.

The server cloning logic (Server.clone()) copies all columns from the source row—including user_id, shared, shared_username, and sensitive credential fields such as password, save_password, and tunnel_password—without re-binding them to the caller or clearing secrets.

As a result, the metadata record for the cloned server becomes a cross-tenant container for another user's stored credentials, but is accessible and operable by the non-owner, effectively bypassing the intended isolation between users' configurations and secrets.

Potential impact

  • Non-owner users may gain use of another user's stored database password and tunnel password.
  • Attackers could leverage inherited credentials to access PostgreSQL databases with another user's privilege level, including administrative roles.
  • Cross-tenant data access within pgAdmin-managed environments can occur, leading to unauthorized viewing or modification of database contents.
  • Compromised pgAdmin accounts may become a launchpad for further lateral movement inside the database infrastructure.
  • Persistence of leaked-credential server records can extend the window of exposure even if the original shared server is removed or modified.

General mitigation guidance

Effective mitigation focuses on separating user ownership from shared metadata and strictly controlling where credentials can flow:

  • Rebind any cloned or derived configuration objects to the initiating user by default, updating user_id and related ownership fields during creation.
  • Avoid copying stored credential fields when cloning server definitions; instead, initialize them as empty or private to the caller and require fresh credential entry.
  • Enforce a clear boundary between shared metadata (e.g., connection parameters) and per-user secret material (e.g., passwords, SSH tunnel credentials), ensuring secrets are never shared implicitly.
  • Implement server-side checks to validate that any server record being persisted or updated is owned by the current user and does not carry forward another user's credential fields.
  • Limit or disable persistent storage of shared credentials where feasible, preferring ephemeral or session-bound secrets tied to the requesting user.

How teams detect issues like this

Detection can be organized around both code-level and operational signals:

  • Static analysis and code review:
  • Flag patterns where entire database rows are cloned or copied wholesale, especially for objects that contain ownership and credential fields.
  • Highlight functions that copy or persist fields such as user_id, shared, password, save_password, or tunnel_password without explicit re-mapping or sanitization.
  • Review server cloning and workspace-related code paths for missing ownership re-assignment and credential clearing logic.
  • Configuration and policy checks:
  • Enforce policies that disallow shared storage of credentials across users, using automated schema or ORM-level rules to prevent credentials from being copied between tenants.
  • Monitor for database rows in the pgAdmin metadata store where credential fields are non-empty on records that appear to have been derived from shared servers.
  • Runtime monitoring:
  • Audit pgAdmin metadata changes, particularly creation of new server entries shortly after adhoc connect operations, and check for unusual combinations of ownership and shared flags.
  • Use logging or SIEM correlation to detect instances where non-owner users are repeatedly connecting through server entries originally associated with administrative accounts.

Sources

SourceLink
github.comgithub.com/pgadmin-org/pgadmin4/commit/64a9cdbd6a240a962144f84418beaf9e66419779
github.comgithub.com/pgadmin-org/pgadmin4/commit/a7e74a6ed685bc34e1f77a8b6a94d00fa3dff815
github.comgithub.com/pgadmin-org/pgadmin4/issues/10200

Frequently asked

questions

Exploitation is constrained to environments where pgAdmin 4 Workspaces are in use and users can see or interact with shared server definitions owned by others.

Any authenticated user with access to such shared servers could trigger the flaw, but it does not provide unauthenticated or cross-instance access by itself.

An attacker must have a valid pgAdmin user account and the ability to initiate an adhoc connect operation against a server that another user (typically an administrator) has shared.

They do not need direct access to the underlying database credentials, as the cloning flaw causes pgAdmin to reuse the stored secrets on their behalf.

The most robust fix is to decouple cloning from credential reuse and enforce strict ownership semantics:

always reassign ownership fields to the calling user, clear or reinitialize credential fields on cloned records, and treat secrets as per-user, non-shareable data that cannot be copied across tenants.

Design multi-tenant features so that any object containing secrets or identity-bound fields is created fresh per user and never copied wholesale from another user's record.

Apply defense-in-depth through code review checklists, automated tests that assert per-user ownership of newly persisted objects, and policies that prohibit shared credentials and cross-tenant cloning of sensitive fields.

Find out what's already
exploitable in your codebase.