DHI-bonk-pg7v-lrkw-v3mf

Source
https://scout.docker.com/v/DHI-bonk-pg7v-lrkw-v3mf
Import Source
https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-bonk-pg7v-lrkw-v3mf.json
JSON Data
https://api.osv.dev/v1/vulns/DHI-bonk-pg7v-lrkw-v3mf
Upstream
Published
2026-11-12T23:57:09Z
Modified
2026-11-16T02:34:53Z
Severity
  • 8.6 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H CVSS Calculator
Summary
## Summary
Details

Summary

Dulwich's stash.py:pop() function is vulnerable to symlink directory traversal, allowing an attacker to write arbitrary files outside the repository worktree when a victim pops a stash in a malicious repository.

Root Cause

The pop() function at dulwich/stash.py:236 uses os.path.exists(parent_dir) to check if a parent directory exists before writing stashed files. os.path.exists() follows symlinks, so when an intermediate directory in the path is a symlink pointing outside the worktree (e.g., link → ../../.git/hooks), the check passes and subsequent file writes resolve through the symlink.

The validate_path() function (line 228) only validates path component names against INVALID_DOTNAMES — it performs zero filesystem symlink detection. On dulwich 1.2.7 (latest release), build_file_from_blob() has no symlink protection whatsoever.

Impact

An attacker can craft a malicious repository that, when a victim clones it and performs a stash pop operation, writes attacker-controlled content to arbitrary filesystem locations. Writing to .git/hooks/post-checkout achieves Remote Code Execution on the victim's machine on the next git checkout operation.

Attack Scenario

  1. Attacker creates a repository with branch main containing link (symlink → ../../.git/hooks) and branch feature containing link/post-checkout (executable payload)
  2. Victim clones the repository (landing on main — symlink link exists in worktree)
  3. Victim checks out feature, makes changes, runs stash.push()
  4. Victim checks out main (restoring the link symlink)
  5. Victim runs stash.pop(0) — stash contains link/post-checkout
  6. os.path.exists("link") returns True (symlink to existing directory), os.makedirs skipped
  7. build_file_from_blob(blob, mode, "link/post-checkout") → open("link/post-checkout", "wb") follows the intermediate symlink → payload written to .git/hooks/post-checkout
  8. Next checkout operation triggers the hook → RCE

Suggested Fix

Before writing any file, verify that no component of the target path resolves through a symlink outside the worktree. Use os.path.realpath(parent_dir) and confirm it stays within the repository root. Alternatively, use os.open() with O_NOFOLLOW on each path component.

Reported by zx (Jace)

References

Affected packages

Docker Hardened Images:Debian:13 / netbox

Package

Name
netbox
Purl
pkg:deb/dhi/netbox

Affected ranges

Affected versions

4.*
4.6.7-0
4.6.8-0
4.6.8-1
4.6.8-2
4.6.8-3
4.6.9-0
4.6.9-1
4.6.9-2
4.6.10-0
4.6.10-1
4.7.1-0
4.7.1-1
4.7.1-2
4.7.1-3
4.7.1-4
4.7.1-5
4.7.1-6
4.7.2-0
4.7.2-1
4.7.2-2
4.7.2-3
4.7.2-4
4.7.3-0
4.7.3-1
4.7.3-2
4.7.3-3
4.7.3-4
4.7.4-0
4.7.4-1
4.7.4-2
4.7.4-3
4.7.4-4
4.7.4-5
4.7.4-6
4.7.5-0
4.7.5-1

Database specific

owner_kind
"HSP"
source
"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-bonk-pg7v-lrkw-v3mf.json"