Skip to content

fix(security): extend /proc read block to maps siblings + auxv + pagemap - #56219

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-d1627802
Jul 1, 2026
Merged

fix(security): extend /proc read block to maps siblings + auxv + pagemap#56219
teknium1 merged 2 commits into
mainfrom
hermes/hermes-d1627802

Conversation

@teknium1

@teknium1 teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

read_file now blocks six more /proc/* pseudo-files that leaked the same ASLR layout /proc/*/maps was hidden to protect (PR #4609). Previously _is_blocked_device_path() only matched endswith(("/environ", "/cmdline", "/maps")), so every sibling below slipped through.

Path Leak Was blocked?
/proc/*/smaps Superset of maps: full VMA list + addresses
/proc/*/smaps_rollup Aggregated VMA addresses
/proc/*/numa_maps VMA dump + NUMA annotations
/proc/*/mem Raw RW process memory
/proc/*/auxv AT_RANDOM canary seed + AT_BASE/AT_PHDR load addrs
/proc/*/pagemap Virtual→physical translation

read_file("/proc/self/smaps") or /proc/self/auxv recovered the exact address layout #4609 set out to hide.

Changes

  • tools/file_tools.py: extend the endswith tuple in _is_blocked_device_path() to cover smaps / smaps_rollup / numa_maps / mem (@AhmetArif0's commit) plus auxv / pagemap. endswith matches both /proc/<pid>/X and the per-thread /proc/<pid>/task/<tid>/X alias.
  • tests/tools/test_file_read_guards.py: regression assertions for all six new paths + a new test for the /proc/<pid>/task/<tid>/* thread-alias form.

Same suffix-tuple pattern as #4609. A regex/set refactor across the full /proc leak surface (stack, syscall, wchan, kallsyms, …) is a worthwhile follow-up but out of scope for closing this immediate gap.

Validation

Before After
/proc/self/{smaps,smaps_rollup,numa_maps,mem,auxv,pagemap} readable blocked
/proc/self/task/<tid>/{maps,auxv,pagemap,…} readable blocked
/proc/{cpuinfo,meminfo,version,uptime,status} readable readable (no false positive)
  • tests/tools/test_file_read_guards.py: 43/43 pass.
  • E2E with real imports against a temp HERMES_HOME: all 10 sensitive paths refused at both the _is_blocked_device guard and the read_file surface; all 5 legit /proc paths still readable.

Salvage of #32238 (@AhmetArif0, commit cherry-picked with authorship preserved). Closes #34430, closes #32238.

Infographic

proc-read-guard-hardened

AhmetArif0 and others added 2 commits July 1, 2026 02:14
…aps, mem

PR #4609 blocked /proc/*/maps to prevent ASLR layout leakage, but the
endswith("/maps") check does not match /proc/*/smaps or
/proc/*/smaps_rollup — both expose the same virtual-address layout and
bypass the guard.  /proc/*/numa_maps carries the same data with NUMA
annotations and is equally bypassed.  /proc/*/mem (raw process memory)
is added as defence-in-depth; it requires address knowledge to exploit
but is blocked for consistency.

Extends the endswith tuple in _is_blocked_device_path() to cover all
four variants and adds regression assertions for all new paths to
test_proc_sensitive_pseudo_files_blocked.

Partially addresses #4427.
auxv leaks AT_RANDOM (stack canary seed) + AT_BASE/AT_PHDR load
addresses — an ASLR oracle on par with maps. pagemap exposes
virtual->physical translation. Both slipped through the endswith
tuple alongside the maps family covered by the salvaged commit.

Adds regression coverage for auxv/pagemap and for the per-thread
/proc/<pid>/task/<tid>/<file> alias form (endswith catches both).

Follow-up on #32238, closes #34430.
@alt-glitch alt-glitch added type/security Security vulnerability or hardening P2 Medium — degraded but workaround exists tool/file File tools (read, write, patch, search) sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data labels Jul 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.
Core-maintainer version of the /proc read-block extension (same fix as the open community PR #34430; both build on #32238 / #4609). Related, not a duplicate — the community PR #34430 can be closed in favor of this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data tool/file File tools (read, write, patch, search) type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants