summaryrefslogtreecommitdiff
path: root/tests/executor
diff options
context:
space:
mode:
authorBen Fuhrmannek2015-02-06 22:38:35 +0100
committerBen Fuhrmannek2015-02-06 22:38:35 +0100
commit3741554097cc73f03a9a6a4fa4d65dc01c120bd8 (patch)
tree93938c3a27b8b9d40818f652c30fccfee3b3180e /tests/executor
parent4085730874e1d88bb5b675633a171ae20989e45a (diff)
tests for eval white/blacklist + include white/blacklist
Diffstat (limited to 'tests/executor')
-rw-r--r--tests/executor/eval_blacklist.phpt18
-rw-r--r--tests/executor/eval_blacklist_printf.phpt16
-rw-r--r--tests/executor/eval_blacklist_printf_function_exists.phpt23
-rw-r--r--tests/executor/eval_whitelist_absmax.phpt16
-rw-r--r--tests/executor/eval_whitelist_call_user_func.phpt15
-rw-r--r--tests/executor/function_whitelist_absmax.phpt (renamed from tests/executor/function_whiletist_absmax.phpt)0
6 files changed, 88 insertions, 0 deletions
diff --git a/tests/executor/eval_blacklist.phpt b/tests/executor/eval_blacklist.phpt
new file mode 100644
index 0000000..586bebc
--- /dev/null
+++ b/tests/executor/eval_blacklist.phpt
@@ -0,0 +1,18 @@
1--TEST--
2Testing: suhosin.executor.eval.blacklist=max
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.disable_eval=0
8suhosin.executor.eval.blacklist=max
9--FILE--
10<?php
11 eval('abs(1);
12 max(1,2);
13 abs(1);');
14?>
15--EXPECTF--
16ALERT - function within eval blacklist called: max() (attacker 'REMOTE_ADDR not set', file '%s', line 4)
17
18Warning: max() has been disabled for security reasons in %s : eval()'d code on line 2
diff --git a/tests/executor/eval_blacklist_printf.phpt b/tests/executor/eval_blacklist_printf.phpt
new file mode 100644
index 0000000..596036e
--- /dev/null
+++ b/tests/executor/eval_blacklist_printf.phpt
@@ -0,0 +1,16 @@
1--TEST--
2Testing: suhosin.executor.eval.blacklist=printf via call_user_func
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.disable_eval=0
8suhosin.executor.eval.blacklist=printf
9--FILE--
10<?php
11 eval('call_user_func("printf", "hello\n");');
12?>
13--EXPECTF--
14ALERT - function within eval blacklist called: printf() (attacker 'REMOTE_ADDR not set', file '%s : eval()'d code', line 1)
15
16Warning: printf() has been disabled for security reasons in %s : eval()'d code on line 1
diff --git a/tests/executor/eval_blacklist_printf_function_exists.phpt b/tests/executor/eval_blacklist_printf_function_exists.phpt
new file mode 100644
index 0000000..d9b842c
--- /dev/null
+++ b/tests/executor/eval_blacklist_printf_function_exists.phpt
@@ -0,0 +1,23 @@
1--TEST--
2Testing: suhosin.executor.eval.blacklist=printf with function_exists()
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.disable_eval=0
8suhosin.executor.eval.blacklist=printf,max
9--FILE--
10<?php
11 eval('var_dump(function_exists("abs"));');
12 eval('var_dump(function_exists("max"));');
13 eval('var_dump(function_exists("ord"));');
14 eval('var_dump(function_exists("printf"));');
15 eval('var_dump(function_exists("chr"));');
16?>
17--EXPECTF--
18bool(true)
19bool(false)
20bool(true)
21bool(false)
22bool(true)
23
diff --git a/tests/executor/eval_whitelist_absmax.phpt b/tests/executor/eval_whitelist_absmax.phpt
new file mode 100644
index 0000000..fff7345
--- /dev/null
+++ b/tests/executor/eval_whitelist_absmax.phpt
@@ -0,0 +1,16 @@
1--TEST--
2Testing: suhosin.executor.eval.whitelist=abs,max
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.disable_eval=0
8suhosin.executor.eval.whitelist=abs,max
9--FILE--
10<?php
11 eval('abs(1);
12 max(1,2);
13 abs(1);');
14?>
15--EXPECTF--
16
diff --git a/tests/executor/eval_whitelist_call_user_func.phpt b/tests/executor/eval_whitelist_call_user_func.phpt
new file mode 100644
index 0000000..6f09b50
--- /dev/null
+++ b/tests/executor/eval_whitelist_call_user_func.phpt
@@ -0,0 +1,15 @@
1--TEST--
2Testing: suhosin.executor.eval.whitelist=printf via call_user_func
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.eval.whitelist=call_user_func
8--FILE--
9<?php
10 eval('call_user_func("printf", "hello\n");');
11?>
12--EXPECTF--
13ALERT - function outside of eval whitelist called: printf() (attacker 'REMOTE_ADDR not set', file '%s : eval()'d code', line 1)
14
15Warning: printf() has been disabled for security reasons in %s : eval()'d code on line 1
diff --git a/tests/executor/function_whiletist_absmax.phpt b/tests/executor/function_whitelist_absmax.phpt
index f240e69..f240e69 100644
--- a/tests/executor/function_whiletist_absmax.phpt
+++ b/tests/executor/function_whitelist_absmax.phpt