summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Fuhrmannek2014-10-16 15:08:59 +0200
committerBen Fuhrmannek2014-10-16 15:08:59 +0200
commitc4467269c3d5bf4cba72dadf846e229e4bc5c0c7 (patch)
treed3696caedda0ffef0143a80cf3e70c459147b255 /tests
parent82e8d0eb03fb3bd88062e99065f990b26fb9fc8b (diff)
parent49a4321cec080d61ff112aaf27f55257e62402f9 (diff)
Merge branch 'ifilter'
Diffstat (limited to 'tests')
-rw-r--r--tests/filter/input_filter_request_array_index_blacklist.phpt53
-rw-r--r--tests/filter/input_filter_request_array_index_whitelist.phpt51
-rw-r--r--tests/filter/post_fileupload_array_index_blacklist.phpt41
-rw-r--r--tests/filter/post_fileupload_array_index_whitelist.phpt41
4 files changed, 186 insertions, 0 deletions
diff --git a/tests/filter/input_filter_request_array_index_blacklist.phpt b/tests/filter/input_filter_request_array_index_blacklist.phpt
new file mode 100644
index 0000000..01d551f
--- /dev/null
+++ b/tests/filter/input_filter_request_array_index_blacklist.phpt
@@ -0,0 +1,53 @@
1--TEST--
2suhosin input filter (suhosin.request.array_index_blacklist)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=511
7suhosin.log.script=0
8suhosin.request.array_index_blacklist="=ABC%{}\\$;"
9--SKIPIF--
10<?php include('skipif.inc'); ?>
11--COOKIE--
12var1[aaa]=1;var2[bbB]=1;var3[ccc][ccC]=1
13--GET--
14var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1
15--POST--
16var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1
17--FILE--
18<?php
19var_dump(ini_get("suhosin.request.array_index_blacklist"));
20var_dump($_GET);
21var_dump($_POST);
22var_dump($_COOKIE);
23?>
24--EXPECTF--
25string(10) "=ABC%{}\$;"
26array(1) {
27 ["var1"]=>
28 array(1) {
29 ["aaa"]=>
30 string(1) "1"
31 }
32}
33array(1) {
34 ["var1"]=>
35 array(1) {
36 ["aaa"]=>
37 string(1) "1"
38 }
39}
40array(1) {
41 ["var1"]=>
42 array(1) {
43 ["aaa"]=>
44 string(1) "1"
45 }
46}
47ALERT - array index contains blacklisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s')
48ALERT - array index contains blacklisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s')
49ALERT - array index contains blacklisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s')
50ALERT - array index contains blacklisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s')
51ALERT - array index contains blacklisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s')
52ALERT - array index contains blacklisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s')
53ALERT - dropped 6 request variables - (2 in GET, 2 in POST, 2 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')
diff --git a/tests/filter/input_filter_request_array_index_whitelist.phpt b/tests/filter/input_filter_request_array_index_whitelist.phpt
new file mode 100644
index 0000000..8e63a36
--- /dev/null
+++ b/tests/filter/input_filter_request_array_index_whitelist.phpt
@@ -0,0 +1,51 @@
1--TEST--
2suhosin input filter (suhosin.request.array_index_whitelist)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8suhosin.request.array_index_whitelist=abcdefghijklmnopqrstuvwxyz
9--SKIPIF--
10<?php include('skipif.inc'); ?>
11--COOKIE--
12var1[aaa]=1;var2[bbB]=1;var3[ccc][ccC]=1
13--GET--
14var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1
15--POST--
16var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1
17--FILE--
18<?php
19var_dump($_GET);
20var_dump($_POST);
21var_dump($_COOKIE);
22?>
23--EXPECTF--
24array(1) {
25 ["var1"]=>
26 array(1) {
27 ["aaa"]=>
28 string(1) "1"
29 }
30}
31array(1) {
32 ["var1"]=>
33 array(1) {
34 ["aaa"]=>
35 string(1) "1"
36 }
37}
38array(1) {
39 ["var1"]=>
40 array(1) {
41 ["aaa"]=>
42 string(1) "1"
43 }
44}
45ALERT - array index contains not whitelisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s')
46ALERT - array index contains not whitelisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s')
47ALERT - array index contains not whitelisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s')
48ALERT - array index contains not whitelisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s')
49ALERT - array index contains not whitelisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s')
50ALERT - array index contains not whitelisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s')
51ALERT - dropped 6 request variables - (2 in GET, 2 in POST, 2 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')
diff --git a/tests/filter/post_fileupload_array_index_blacklist.phpt b/tests/filter/post_fileupload_array_index_blacklist.phpt
new file mode 100644
index 0000000..f0e003b
--- /dev/null
+++ b/tests/filter/post_fileupload_array_index_blacklist.phpt
@@ -0,0 +1,41 @@
1--TEST--
2suhosin file upload filter (array index whitelist)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8file_uploads=1
9suhosin.request.array_index_blacklist=ABC
10--SKIPIF--
11<?php include('skipif.inc'); ?>
12--COOKIE--
13--GET--
14--POST_RAW--
15Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
16-----------------------------20896060251896012921717172737
17Content-Disposition: form-data; name="fn[foo][bar]"
18
19ok
20-----------------------------20896060251896012921717172737
21Content-Disposition: form-data; name="fn[foo][BAR]"
22
23bad
24-----------------------------20896060251896012921717172737--
25--FILE--
26<?php
27var_dump($_POST);
28?>
29--EXPECTF--
30array(1) {
31 ["fn"]=>
32 array(1) {
33 ["foo"]=>
34 array(1) {
35 ["bar"]=>
36 string(2) "ok"
37 }
38 }
39}
40ALERT - array index contains blacklisted characters - dropped variable 'fn[foo][BAR]' (attacker 'REMOTE_ADDR not set', file '%s')
41ALERT - dropped 1 request variables - (0 in GET, 1 in POST, 0 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')
diff --git a/tests/filter/post_fileupload_array_index_whitelist.phpt b/tests/filter/post_fileupload_array_index_whitelist.phpt
new file mode 100644
index 0000000..f2fe8c8
--- /dev/null
+++ b/tests/filter/post_fileupload_array_index_whitelist.phpt
@@ -0,0 +1,41 @@
1--TEST--
2suhosin file upload filter (array index whitelist)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8file_uploads=1
9suhosin.request.array_index_whitelist=abcdefghijklmnopqrstuvwxyz
10--SKIPIF--
11<?php include('skipif.inc'); ?>
12--COOKIE--
13--GET--
14--POST_RAW--
15Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
16-----------------------------20896060251896012921717172737
17Content-Disposition: form-data; name="fn[foo][bar]"
18
19ok
20-----------------------------20896060251896012921717172737
21Content-Disposition: form-data; name="fn[foo][BAR]"
22
23bad
24-----------------------------20896060251896012921717172737--
25--FILE--
26<?php
27var_dump($_POST);
28?>
29--EXPECTF--
30array(1) {
31 ["fn"]=>
32 array(1) {
33 ["foo"]=>
34 array(1) {
35 ["bar"]=>
36 string(2) "ok"
37 }
38 }
39}
40ALERT - array index contains not whitelisted characters - dropped variable 'fn[foo][BAR]' (attacker 'REMOTE_ADDR not set', file '%s')
41ALERT - dropped 1 request variables - (0 in GET, 1 in POST, 0 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')