diff options
| author | Ben Fuhrmannek | 2014-09-25 17:24:39 +0200 |
|---|---|---|
| committer | Ben Fuhrmannek | 2014-09-25 17:24:39 +0200 |
| commit | 594c8df58c6f7f9b9610c7f0fd11da08a532de98 (patch) | |
| tree | 7f1286f40af4133aa01035ec9303e1a9aabccd2e /tests | |
| parent | 8f2433d78347b2f1542e95652fa74d38346fb6ec (diff) | |
array index whitelist/blacklist
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/filter/input_filter_request_array_index_blacklist.phpt | 53 | ||||
| -rw-r--r-- | tests/filter/input_filter_request_array_index_whitelist.phpt | 51 |
2 files changed, 104 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-- | ||
| 2 | suhosin input filter (suhosin.request.array_index_blacklist) | ||
| 3 | --INI-- | ||
| 4 | suhosin.log.syslog=0 | ||
| 5 | suhosin.log.sapi=0 | ||
| 6 | suhosin.log.stdout=511 | ||
| 7 | suhosin.log.script=0 | ||
| 8 | suhosin.request.array_index_blacklist="=ABC%{}\\$;" | ||
| 9 | --SKIPIF-- | ||
| 10 | <?php include('skipif.inc'); ?> | ||
| 11 | --COOKIE-- | ||
| 12 | var1[aaa]=1;var2[bbB]=1;var3[ccc][ccC]=1 | ||
| 13 | --GET-- | ||
| 14 | var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1 | ||
| 15 | --POST-- | ||
| 16 | var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1 | ||
| 17 | --FILE-- | ||
| 18 | <?php | ||
| 19 | var_dump(ini_get("suhosin.request.array_index_blacklist")); | ||
| 20 | var_dump($_GET); | ||
| 21 | var_dump($_POST); | ||
| 22 | var_dump($_COOKIE); | ||
| 23 | ?> | ||
| 24 | --EXPECTF-- | ||
| 25 | string(10) "=ABC%{}\$;" | ||
| 26 | array(1) { | ||
| 27 | ["var1"]=> | ||
| 28 | array(1) { | ||
| 29 | ["aaa"]=> | ||
| 30 | string(1) "1" | ||
| 31 | } | ||
| 32 | } | ||
| 33 | array(1) { | ||
| 34 | ["var1"]=> | ||
| 35 | array(1) { | ||
| 36 | ["aaa"]=> | ||
| 37 | string(1) "1" | ||
| 38 | } | ||
| 39 | } | ||
| 40 | array(1) { | ||
| 41 | ["var1"]=> | ||
| 42 | array(1) { | ||
| 43 | ["aaa"]=> | ||
| 44 | string(1) "1" | ||
| 45 | } | ||
| 46 | } | ||
| 47 | ALERT - array index contains blacklisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 48 | ALERT - array index contains blacklisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 49 | ALERT - array index contains blacklisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 50 | ALERT - array index contains blacklisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 51 | ALERT - array index contains blacklisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 52 | ALERT - array index contains blacklisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 53 | ALERT - 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-- | ||
| 2 | suhosin input filter (suhosin.request.array_index_whitelist) | ||
| 3 | --INI-- | ||
| 4 | suhosin.log.syslog=0 | ||
| 5 | suhosin.log.sapi=0 | ||
| 6 | suhosin.log.stdout=255 | ||
| 7 | suhosin.log.script=0 | ||
| 8 | suhosin.request.array_index_whitelist=abcdefghijklmnopqrstuvwxyz | ||
| 9 | --SKIPIF-- | ||
| 10 | <?php include('skipif.inc'); ?> | ||
| 11 | --COOKIE-- | ||
| 12 | var1[aaa]=1;var2[bbB]=1;var3[ccc][ccC]=1 | ||
| 13 | --GET-- | ||
| 14 | var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1 | ||
| 15 | --POST-- | ||
| 16 | var1[aaa]=1&var2[bbB]=1&var3[ccc][ccC]=1 | ||
| 17 | --FILE-- | ||
| 18 | <?php | ||
| 19 | var_dump($_GET); | ||
| 20 | var_dump($_POST); | ||
| 21 | var_dump($_COOKIE); | ||
| 22 | ?> | ||
| 23 | --EXPECTF-- | ||
| 24 | array(1) { | ||
| 25 | ["var1"]=> | ||
| 26 | array(1) { | ||
| 27 | ["aaa"]=> | ||
| 28 | string(1) "1" | ||
| 29 | } | ||
| 30 | } | ||
| 31 | array(1) { | ||
| 32 | ["var1"]=> | ||
| 33 | array(1) { | ||
| 34 | ["aaa"]=> | ||
| 35 | string(1) "1" | ||
| 36 | } | ||
| 37 | } | ||
| 38 | array(1) { | ||
| 39 | ["var1"]=> | ||
| 40 | array(1) { | ||
| 41 | ["aaa"]=> | ||
| 42 | string(1) "1" | ||
| 43 | } | ||
| 44 | } | ||
| 45 | ALERT - array index contains not whitelisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 46 | ALERT - array index contains not whitelisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 47 | ALERT - array index contains not whitelisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 48 | ALERT - array index contains not whitelisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 49 | ALERT - array index contains not whitelisted characters - dropped variable 'var2[bbB]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 50 | ALERT - array index contains not whitelisted characters - dropped variable 'var3[ccc][ccC]' (attacker 'REMOTE_ADDR not set', file '%s') | ||
| 51 | ALERT - dropped 6 request variables - (2 in GET, 2 in POST, 2 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s') | ||
