summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/default.rules34
1 files changed, 29 insertions, 5 deletions
diff --git a/config/default.rules b/config/default.rules
index 817e62f..81c4072 100644
--- a/config/default.rules
+++ b/config/default.rules
@@ -36,8 +36,13 @@ sp.xxe_protection.enable();
36sp.cookie.name("PHPSESSID").samesite("lax"); 36sp.cookie.name("PHPSESSID").samesite("lax");
37 37
38# Harden the `chmod` function (0777 (oct = 511, 0666 = 438) 38# Harden the `chmod` function (0777 (oct = 511, 0666 = 438)
39sp.disable_function.function("chmod").param("mode").value("438").drop(); 39@condition PHP_VERSION_ID < 80000;
40sp.disable_function.function("chmod").param("mode").value("511").drop(); 40 sp.disable_function.function("chmod").param("mode").value("438").drop();
41 sp.disable_function.function("chmod").param("mode").value("511").drop();
42@condition PHP_VERSION_ID >= 80000;
43 sp.disable_function.function("chmod").param("permissions").value("438").drop();
44 sp.disable_function.function("chmod").param("permissions").value("511").drop();
45@end_condition;
41 46
42# Prevent various `mail`-related vulnerabilities 47# Prevent various `mail`-related vulnerabilities
43@condition PHP_VERSION_ID < 80300; 48@condition PHP_VERSION_ID < 80300;
@@ -47,8 +52,13 @@ sp.disable_function.function("mail").param("additional_params").value_r("\\-").d
47@end_condition; 52@end_condition;
48 53
49# Since it's now burned, me might as well mitigate it publicly 54# Since it's now burned, me might as well mitigate it publicly
50sp.disable_function.function("putenv").param("setting").value_r("LD_").drop(); 55@condition PHP_VERSION_ID < 80000;
51sp.disable_function.function("putenv").param("setting").value("PATH").drop(); 56 sp.disable_function.function("putenv").param("setting").value_r("LD_").drop();
57 sp.disable_function.function("putenv").param("setting").value("PATH").drop();
58@condition PHP_VERSION_ID >= 80000;
59 sp.disable_function.function("putenv").param("assignment").value_r("LD_").drop();
60 sp.disable_function.function("putenv").param("assignment").value("PATH").drop();
61@end_condition;
52 62
53# This one was burned in Nov 2019 - https://gist.github.com/LoadLow/90b60bd5535d6c3927bb24d5f9955b80 63# This one was burned in Nov 2019 - https://gist.github.com/LoadLow/90b60bd5535d6c3927bb24d5f9955b80
54sp.disable_function.function("putenv").param("setting").value_r("GCONV_").drop(); 64sp.disable_function.function("putenv").param("setting").value_r("GCONV_").drop();
@@ -62,7 +72,11 @@ sp.disable_function.function("extract").pos("1").value("0").drop();
62# Since we have no way of matching on two parameters at the same time, we're 72# Since we have no way of matching on two parameters at the same time, we're
63# blocking calls to open_basedir altogether: nobody is using it via ini_set anyway. 73# blocking calls to open_basedir altogether: nobody is using it via ini_set anyway.
64# Moreover, there are non-public bypasses that are also using this vector ;) 74# Moreover, there are non-public bypasses that are also using this vector ;)
65sp.disable_function.function("ini_set").param("varname").value_r("open_basedir").drop(); 75@condition PHP_VERSION_ID < 80000;
76 sp.disable_function.function("ini_set").param("varname").value_r("open_basedir").drop()
77@condition PHP_VERSION_ID >= 80000;
78 sp.disable_function.function("ini_set").param("option").value_r("open_basedir").drop()
79@end_condition;
66 80
67# Prevent various `include`-related vulnerabilities 81# Prevent various `include`-related vulnerabilities
68sp.disable_function.function("require_once").value_r("\.(inc|phtml|php)$").allow(); 82sp.disable_function.function("require_once").value_r("\.(inc|phtml|php)$").allow();
@@ -80,6 +94,16 @@ sp.disable_function.function("shell_exec").pos("0").value_r("[$|;&`\\n\\(\\)\\\\
80sp.disable_function.function("exec").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop(); 94sp.disable_function.function("exec").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
81sp.disable_function.function("proc_open").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop(); 95sp.disable_function.function("proc_open").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
82 96
97# Prevent `system`-related injections
98sp.disable_function.function("system").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
99@condition PHP_VERSION_ID < 80000;
100 sp.disable_function.function("shell_exec").pos("0").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
101@condition PHP_VERSION_ID >= 80000;
102 sp.disable_function.function("shell_exec").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
103@end_condition;
104sp.disable_function.function("exec").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
105sp.disable_function.function("proc_open").param("command").value_r("[$|;&`\\n\\(\\)\\\\]").drop();
106
83# Prevent runtime modification of interesting things 107# Prevent runtime modification of interesting things
84@condition PHP_VERSION_ID < 80000; 108@condition PHP_VERSION_ID < 80000;
85sp.disable_function.function("ini_set").param("varname").value("assert.active").drop(); 109sp.disable_function.function("ini_set").param("varname").value("assert.active").drop();