/

CVE-2026-63120

Severity:

HIGH RISK

(8.4)

Path Traversal (CWE-22) in pghoard Backup Restore Tool

CVE-2026-63120

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write and Potential Host Code Execution

Severity:

HIGH RISK

(8.4)

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 path traversal vulnerability in pghoard restore processing allows crafted backup metadata to escape the intended PostgreSQL data directory. An attacker who can write to the configured backup object storage may cause arbitrary files or directories to be created when an administrator performs a restore, potentially enabling host compromise.

A path traversal vulnerability in pghoard restore processing allows crafted backup metadata to escape the intended PostgreSQL data directory. An attacker who can write to the configured backup object storage may cause arbitrary files or directories to be created when an administrator performs a restore, potentially enabling host compromise.

Affected context

The issue occurs in pghoard deployments that restore PostgreSQL backups from attacker-influenced object storage, including S3, GCS, or Azure-compatible services. It becomes risky when backup manifests are processed without fully canonicalizing and restricting paths to the designated PostgreSQL data directory, allowing restore operations to affect other locations on the host.

The issue occurs in pghoard deployments that restore PostgreSQL backups from attacker-influenced object storage, including S3, GCS, or Azure-compatible services. It becomes risky when backup manifests are processed without fully canonicalizing and restricting paths to the designated PostgreSQL data directory, allowing restore operations to affect other locations on the host.

Exploit preconditions

  • Attack surface: pghoard backup object storage and restore processing
  • Required access: Write access to the object storage location used for backup data
  • Trigger point: A database administrator or automated process performs a base-backup restore
  • Why exploitation is possible: Restore paths derived from malicious backup metadata may contain traversal components that resolve outside the permitted PostgreSQL data directory
  • Attack surface: pghoard backup object storage and restore processing
  • Required access: Write access to the object storage location used for backup data
  • Trigger point: A database administrator or automated process performs a base-backup restore
  • Why exploitation is possible: Restore paths derived from malicious backup metadata may contain traversal components that resolve outside the permitted PostgreSQL data directory

Why this happens

The underlying bug is incomplete path validation during archive or backup restoration. Path components supplied through backup manifests are trusted without consistently resolving the final path and verifying that it remains beneath the configured pgdata directory.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The insecure pattern allows attacker-controlled relative paths to influence filesystem writes outside the intended storage boundary.

The underlying bug is incomplete path validation during archive or backup restoration. Path components supplied through backup manifests are trusted without consistently resolving the final path and verifying that it remains beneath the configured pgdata directory.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The insecure pattern allows attacker-controlled relative paths to influence filesystem writes outside the intended storage boundary.

Potential impact

  • Arbitrary files may be written on the host running the restore operation
  • Unexpected directories may be created outside the PostgreSQL data directory
  • Persistence mechanisms or configuration files could be modified
  • The PostgreSQL service or restore environment could be compromised
  • Host-level code execution may occur if a written file is later executed or loaded
  • Backup integrity and database availability could be affected
  • Arbitrary files may be written on the host running the restore operation
  • Unexpected directories may be created outside the PostgreSQL data directory
  • Persistence mechanisms or configuration files could be modified
  • The PostgreSQL service or restore environment could be compromised
  • Host-level code execution may occur if a written file is later executed or loaded
  • Backup integrity and database availability could be affected

General mitigation guidance

Mitigation typically focuses on enforcing a strict filesystem boundary for every restore operation.

Common defensive patterns include:

  • Canonicalizing and normalizing each restored path before file access
  • Rejecting absolute paths, traversal components, and paths that resolve outside the approved directory
  • Applying the same boundary checks to directory creation, temporary files, links, and renamed files
  • Treating backup object storage as untrusted input and restricting write permissions
  • Using isolated restore environments with least-privilege service accounts
  • Separating restore credentials and storage namespaces from production backup writers
  • Applying filesystem, container, and operating-system controls that limit the restore process to required locations

Mitigation typically focuses on enforcing a strict filesystem boundary for every restore operation.

Common defensive patterns include:

  • Canonicalizing and normalizing each restored path before file access
  • Rejecting absolute paths, traversal components, and paths that resolve outside the approved directory
  • Applying the same boundary checks to directory creation, temporary files, links, and renamed files
  • Treating backup object storage as untrusted input and restricting write permissions
  • Using isolated restore environments with least-privilege service accounts
  • Separating restore credentials and storage namespaces from production backup writers
  • Applying filesystem, container, and operating-system controls that limit the restore process to required locations

How teams detect issues like this

Detection can combine source review, runtime monitoring, and storage policy controls:

  • Use static analysis rules for filesystem operations that concatenate untrusted paths without canonicalization and containment checks.
  • Review restore code for validation performed before writes, directory creation, renames, and symbolic-link handling.
  • Monitor restore processes for writes outside the expected PostgreSQL data directory.
  • Alert on unexpected changes to sensitive system directories and scheduled-task locations.
  • Enforce object-storage policies that limit who can create or modify backup objects and record manifest changes.
  • Use automated security review tools to identify traversal-prone path handling and missing boundary checks.

Detection can combine source review, runtime monitoring, and storage policy controls:

  • Use static analysis rules for filesystem operations that concatenate untrusted paths without canonicalization and containment checks.
  • Review restore code for validation performed before writes, directory creation, renames, and symbolic-link handling.
  • Monitor restore processes for writes outside the expected PostgreSQL data directory.
  • Alert on unexpected changes to sensitive system directories and scheduled-task locations.
  • Enforce object-storage policies that limit who can create or modify backup objects and record manifest changes.
  • Use automated security review tools to identify traversal-prone path handling and missing boundary checks.

Sources

SourceLink
github.comgithub.com/Aiven-Open/pghoard/releases/tag/2.7.2
github.comgithub.com/Aiven-Open/pghoard/security/advisories/GHSA-rh99-q79h-vvx3

Frequently asked

questions

It can be triggered remotely in deployments where an attacker can write backup objects and a restore operation later processes those objects. It is not generally exploitable through the restore command alone without influence over the backup data.

The key prerequisite is write access to the object-storage location or backup namespace consumed by pghoard. The attacker may not need direct access to the restore host if an authorized administrator or automated workflow performs the restore.

Treat all backup metadata as untrusted, canonicalize restore paths, and enforce that every resolved path remains within the designated PostgreSQL data directory before any filesystem operation.

Use least-privilege storage and restore identities, isolate restore environments, apply strict object-storage write policies, and continuously monitor restore activity and filesystem changes.

It can be triggered remotely in deployments where an attacker can write backup objects and a restore operation later processes those objects. It is not generally exploitable through the restore command alone without influence over the backup data.

The key prerequisite is write access to the object-storage location or backup namespace consumed by pghoard. The attacker may not need direct access to the restore host if an authorized administrator or automated workflow performs the restore.

Treat all backup metadata as untrusted, canonicalize restore paths, and enforce that every resolved path remains within the designated PostgreSQL data directory before any filesystem operation.

Use least-privilege storage and restore identities, isolate restore environments, apply strict object-storage write policies, and continuously monitor restore activity and filesystem changes.

Find out what's already
exploitable in your codebase.