Skip to content

fix(security): extend /proc read block to smaps, smaps_rollup, numa_maps, mem - #32238

Closed
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/proc-smaps-block
Closed

fix(security): extend /proc read block to smaps, smaps_rollup, numa_maps, mem#32238
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/proc-smaps-block

Conversation

@AhmetArif0

Copy link
Copy Markdown
Contributor

Summary

PR #4609 blocked read_file access to /proc/*/maps to prevent ASLR
layout leakage, but the endswith("/maps") check does not catch three
closely-related paths that expose the same information:

Path What it leaks Blocked before this PR?
/proc/*/smaps Full memory map with addresses (superset of maps)
/proc/*/smaps_rollup Aggregated memory layout with addresses
/proc/*/numa_maps Memory map with NUMA annotations
/proc/*/mem Raw process memory (defence-in-depth)

Root cause

# tools/file_tools.py  _is_blocked_device_path()
if normalized.startswith("/proc/") and normalized.endswith(
    ("/environ", "/cmdline", "/maps")   # "/smaps" ends in "smaps", not "/maps"
):

"/proc/self/smaps".endswith("/maps")False. An agent could call
read_file("/proc/self/smaps") and recover all virtual-address ranges
that the maps block was intended to prevent.

Fix

Extend the endswith tuple to cover all four variants. No behaviour
change for the already-blocked paths; cpuinfo, meminfo, uptime,
version remain accessible.

Test plan

  • test_proc_sensitive_pseudo_files_blocked extended with 8 new
    assertions covering smaps, smaps_rollup, numa_maps, and mem
    for both /proc/self/ and /proc/<pid>/ forms
  • test_proc_legitimate_files_not_blocked unchanged — top-level
    /proc files stay accessible
  • 39/39 tests passed (tests/tools/test_file_read_guards.py)
  • ruff check clean

Partially addresses #4427.

…aps, mem

PR NousResearch#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 NousResearch#4427.
@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) labels May 25, 2026
teknium1 added a commit that referenced this pull request May 29, 2026
Follow-up to the cherry-pick of @AhmetArif0's #32238. auxv is the
glaring miss alongside maps/smaps — it exposes AT_RANDOM (stack canary)
and AT_BASE/AT_PHDR (program/interpreter load addresses), which is a
direct ASLR oracle on par with /proc/*/maps.

pagemap exposes virtual→physical address translations on systems that
expose it to userspace (depends on CAP_SYS_ADMIN / kernel config) — same
address-leak class.

Adds both to the same endswith tuple and to the existing parametrized
test, keeping the fragile-suffix pattern consistent with the rest of the
guard. A regex/set refactor across all /proc leak vectors (pagemap,
syscall, stack, wchan, kallsyms) is worth a follow-up but out of scope
for closing this immediate gap.
teknium1 added a commit that referenced this pull request Jul 1, 2026
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.
@teknium1

teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Merged via #56219 — your commit landed on main as 64e6b98 with your authorship preserved, plus a follow-up extending the block to /proc//auxv and /proc//pagemap. Thanks for the fix!

waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
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 NousResearch#32238, closes NousResearch#34430.
Jasper6439 pushed a commit to Jasper6439/hermes-agent that referenced this pull request Jul 5, 2026
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 NousResearch#32238, closes NousResearch#34430.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
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 NousResearch#32238, closes NousResearch#34430.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
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 NousResearch#32238, closes NousResearch#34430.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
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 NousResearch#32238, closes NousResearch#34430.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
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 NousResearch#32238, closes NousResearch#34430.
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 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