From 82c91409fd054a2e7eb602578eb88b865c76ec45 Mon Sep 17 00:00:00 2001 From: AhmetArif0 <147827411+AhmetArif0@users.noreply.github.com> Date: Mon, 25 May 2026 23:34:46 +0300 Subject: [PATCH 1/2] fix(security): extend /proc read block to smaps, smaps_rollup, numa_maps, mem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/tools/test_file_read_guards.py | 10 +++++++++- tools/file_tools.py | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/tools/test_file_read_guards.py b/tests/tools/test_file_read_guards.py index 3a8e2a0c1abf4..ad12dc78a2ffa 100644 --- a/tests/tools/test_file_read_guards.py +++ b/tests/tools/test_file_read_guards.py @@ -93,7 +93,7 @@ def test_proc_fd_other_not_blocked(self): self.assertFalse(_is_blocked_device_path("/proc/self/fd/3")) def test_proc_sensitive_pseudo_files_blocked(self): - """environ/cmdline/maps under /proc/ must be blocked (issue #4427).""" + """environ/cmdline/maps (and maps variants) under /proc/ must be blocked (issue #4427).""" for path in ( "/proc/self/environ", "/proc/12345/environ", @@ -101,6 +101,14 @@ def test_proc_sensitive_pseudo_files_blocked(self): "/proc/99/cmdline", "/proc/self/maps", "/proc/1/maps", + "/proc/self/smaps", + "/proc/12345/smaps", + "/proc/self/smaps_rollup", + "/proc/99/smaps_rollup", + "/proc/self/numa_maps", + "/proc/1/numa_maps", + "/proc/self/mem", + "/proc/12345/mem", ): self.assertTrue(_is_blocked_device(path), f"{path} should be blocked") diff --git a/tools/file_tools.py b/tools/file_tools.py index e138fe6e5374d..b85ab9726de7d 100644 --- a/tools/file_tools.py +++ b/tools/file_tools.py @@ -362,10 +362,13 @@ def _is_blocked_device_path(path: str) -> bool: ("/fd/0", "/fd/1", "/fd/2") ): return True - # /proc/*/environ, /proc/*/cmdline, /proc/*/maps can leak secrets, - # command-line args, and memory layout from the host process (issue #4427) + # /proc/*/environ, /proc/*/cmdline, /proc/*/maps (and the maps variants + # smaps, smaps_rollup, numa_maps) can leak secrets, command-line args, and + # memory layout (ASLR bypass) from the host process (issue #4427). + # /proc/*/mem exposes raw process memory; block it as defense-in-depth even + # though it requires address knowledge to exploit usefully. if normalized.startswith("/proc/") and normalized.endswith( - ("/environ", "/cmdline", "/maps") + ("/environ", "/cmdline", "/maps", "/smaps", "/smaps_rollup", "/numa_maps", "/mem") ): return True return False From eafec5e31bbc5069d70c06f688a09d50039ae7e2 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 1 Jul 2026 02:14:14 -0700 Subject: [PATCH 2/2] fix(security): block /proc/*/auxv and /proc/*/pagemap read leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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//task// alias form (endswith catches both). Follow-up on #32238, closes #34430. --- tests/tools/test_file_read_guards.py | 15 +++++++++++++++ tools/file_tools.py | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/tools/test_file_read_guards.py b/tests/tools/test_file_read_guards.py index ad12dc78a2ffa..861ebc4936f22 100644 --- a/tests/tools/test_file_read_guards.py +++ b/tests/tools/test_file_read_guards.py @@ -109,6 +109,21 @@ def test_proc_sensitive_pseudo_files_blocked(self): "/proc/1/numa_maps", "/proc/self/mem", "/proc/12345/mem", + "/proc/self/auxv", + "/proc/1/auxv", + "/proc/self/pagemap", + "/proc/99/pagemap", + ): + self.assertTrue(_is_blocked_device(path), f"{path} should be blocked") + + def test_proc_task_thread_sensitive_files_blocked(self): + """Per-thread /proc//task// aliases leak the same data.""" + for path in ( + "/proc/self/task/1234/maps", + "/proc/self/task/1234/smaps", + "/proc/self/task/1234/auxv", + "/proc/self/task/1234/pagemap", + "/proc/self/task/1234/environ", ): self.assertTrue(_is_blocked_device(path), f"{path} should be blocked") diff --git a/tools/file_tools.py b/tools/file_tools.py index b85ab9726de7d..7bf51aa900734 100644 --- a/tools/file_tools.py +++ b/tools/file_tools.py @@ -367,8 +367,22 @@ def _is_blocked_device_path(path: str) -> bool: # memory layout (ASLR bypass) from the host process (issue #4427). # /proc/*/mem exposes raw process memory; block it as defense-in-depth even # though it requires address knowledge to exploit usefully. + # /proc/*/auxv leaks AT_RANDOM (stack canary seed) plus AT_BASE/AT_PHDR + # load addresses — an ASLR oracle on par with maps. /proc/*/pagemap exposes + # virtual->physical translation. Both are blocked alongside the maps family. + # endswith matches both /proc//X and /proc//task//X. if normalized.startswith("/proc/") and normalized.endswith( - ("/environ", "/cmdline", "/maps", "/smaps", "/smaps_rollup", "/numa_maps", "/mem") + ( + "/environ", + "/cmdline", + "/maps", + "/smaps", + "/smaps_rollup", + "/numa_maps", + "/mem", + "/auxv", + "/pagemap", + ) ): return True return False