]> granicus.if.org Git - procps-ng/commit
sysctl: Check path is under /proc/sys
authorCraig Small <csmall@dropbear.xyz>
Tue, 20 Jul 2021 12:36:15 +0000 (22:36 +1000)
committerCraig Small <csmall@dropbear.xyz>
Tue, 20 Jul 2021 12:36:15 +0000 (22:36 +1000)
commitf25d462166f80b844d33dad3e4c06088c809a426
tree51930f090f005c433e13607c0c28a3d5897d6691
parent05a720fdbaebea92a95cb7868406736a45034e7f
sysctl: Check path is under /proc/sys

sysctl would try to read/write any path you gave it either on
the command line or configuration file. It would append /proc/sys
on the path but not check for any sneaky path traversal with ../

This commit means it first resolves all paths using realpath(3)
and then checks the path starts with "/proc/sys/"

At first I thought this might be a non-issue, but perhaps someone
could put a file into the sysctl configuration path and.. do
something? Anyway its a 8-line fix and makes things more correct.

References:
 #179

Signed-off-by: Craig Small <csmall@dropbear.xyz>
NEWS
sysctl.c