summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Esser2014-02-12 21:46:31 +0100
committerStefan Esser2014-02-12 21:46:31 +0100
commit286ded52361e1cd31151cf945f4d8c7bb05da1c7 (patch)
tree50fbba8762f3969e8193ed3dfa6794dfd0e3e08f /tests
parent80abd49293bfb34f71f96214d615b1bfbc148928 (diff)
Tests for the suhosin.XXX.disallow_nul feature
Diffstat (limited to 'tests')
-rw-r--r--tests/filter/input_filter_allow_nul.phptbin0 -> 934 bytes
-rw-r--r--tests/filter/input_filter_cookie_disallow_nul.phpt29
-rw-r--r--tests/filter/input_filter_get_disallow_nul.phpt29
-rw-r--r--tests/filter/input_filter_post_disallow_nul.phpt29
-rw-r--r--tests/filter/input_filter_request_disallow_nul.phpt48
5 files changed, 135 insertions, 0 deletions
diff --git a/tests/filter/input_filter_allow_nul.phpt b/tests/filter/input_filter_allow_nul.phpt
new file mode 100644
index 0000000..015d211
--- /dev/null
+++ b/tests/filter/input_filter_allow_nul.phpt
Binary files differ
diff --git a/tests/filter/input_filter_cookie_disallow_nul.phpt b/tests/filter/input_filter_cookie_disallow_nul.phpt
new file mode 100644
index 0000000..dab9241
--- /dev/null
+++ b/tests/filter/input_filter_cookie_disallow_nul.phpt
@@ -0,0 +1,29 @@
1--TEST--
2suhosin input filter (suhosin.cookie.disallow_nul)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8suhosin.request.disallow_nul=0
9suhosin.cookie.disallow_nul=1
10--SKIPIF--
11<?php include('skipif.inc'); ?>
12--COOKIE--
13var1=xx%001;var2=2;var3=xx%003;var4=4;
14--GET--
15--POST--
16--FILE--
17<?php
18var_dump($_COOKIE);
19?>
20--EXPECTF--
21array(2) {
22 ["var2"]=>
23 string(1) "2"
24 ["var4"]=>
25 string(1) "4"
26}
27ALERT - ASCII-NUL chars not allowed within COOKIE variables - dropped variable 'var1' (attacker 'REMOTE_ADDR not set', file '%s')
28ALERT - ASCII-NUL chars not allowed within COOKIE variables - dropped variable 'var3' (attacker 'REMOTE_ADDR not set', file '%s')
29ALERT - dropped 2 request variables - (0 in GET, 0 in POST, 2 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')
diff --git a/tests/filter/input_filter_get_disallow_nul.phpt b/tests/filter/input_filter_get_disallow_nul.phpt
new file mode 100644
index 0000000..b7c2ad4
--- /dev/null
+++ b/tests/filter/input_filter_get_disallow_nul.phpt
@@ -0,0 +1,29 @@
1--TEST--
2suhosin input filter (suhosin.get.disallow_nul)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8suhosin.request.disallow_nul=0
9suhosin.get.disallow_nul=1
10--SKIPIF--
11<?php include('skipif.inc'); ?>
12--COOKIE--
13--GET--
14var1=xx%001&var2=2&var3=xx%003&var4=4&
15--POST--
16--FILE--
17<?php
18var_dump($_GET);
19?>
20--EXPECTF--
21array(2) {
22 ["var2"]=>
23 string(1) "2"
24 ["var4"]=>
25 string(1) "4"
26}
27ALERT - ASCII-NUL chars not allowed within GET variables - dropped variable 'var1' (attacker 'REMOTE_ADDR not set', file '%s')
28ALERT - ASCII-NUL chars not allowed within GET variables - dropped variable 'var3' (attacker 'REMOTE_ADDR not set', file '%s')
29ALERT - dropped 2 request variables - (2 in GET, 0 in POST, 0 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')
diff --git a/tests/filter/input_filter_post_disallow_nul.phpt b/tests/filter/input_filter_post_disallow_nul.phpt
new file mode 100644
index 0000000..60c797e
--- /dev/null
+++ b/tests/filter/input_filter_post_disallow_nul.phpt
@@ -0,0 +1,29 @@
1--TEST--
2suhosin input filter (suhosin.post.disallow_nul)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8suhosin.request.disallow_nul=0
9suhosin.post.disallow_nul=1
10--SKIPIF--
11<?php include('skipif.inc'); ?>
12--COOKIE--
13--GET--
14--POST--
15var1=xx%001&var2=2&var3=xx%003&var4=4&
16--FILE--
17<?php
18var_dump($_POST);
19?>
20--EXPECTF--
21array(2) {
22 ["var2"]=>
23 string(1) "2"
24 ["var4"]=>
25 string(1) "4"
26}
27ALERT - ASCII-NUL chars not allowed within POST variables - dropped variable 'var1' (attacker 'REMOTE_ADDR not set', file '%s')
28ALERT - ASCII-NUL chars not allowed within POST variables - dropped variable 'var3' (attacker 'REMOTE_ADDR not set', file '%s')
29ALERT - dropped 2 request variables - (0 in GET, 2 in POST, 0 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')
diff --git a/tests/filter/input_filter_request_disallow_nul.phpt b/tests/filter/input_filter_request_disallow_nul.phpt
new file mode 100644
index 0000000..09903ec
--- /dev/null
+++ b/tests/filter/input_filter_request_disallow_nul.phpt
@@ -0,0 +1,48 @@
1--TEST--
2suhosin input filter (suhosin.request.disallow_nul)
3--INI--
4suhosin.log.syslog=0
5suhosin.log.sapi=0
6suhosin.log.stdout=255
7suhosin.log.script=0
8suhosin.request.disallow_nul=1
9--SKIPIF--
10<?php include('skipif.inc'); ?>
11--COOKIE--
12var1=xx%001;var2=2;var3=xx%003;var4=4;
13--GET--
14var1=xx%001&var2=2&var3=xx%003&var4=4&
15--POST--
16var1=xx%001&var2=2&var3=xx%003&var4=4&
17--FILE--
18<?php
19var_dump($_GET);
20var_dump($_POST);
21var_dump($_COOKIE);
22?>
23--EXPECTF--
24array(2) {
25 ["var2"]=>
26 string(1) "2"
27 ["var4"]=>
28 string(1) "4"
29}
30array(2) {
31 ["var2"]=>
32 string(1) "2"
33 ["var4"]=>
34 string(1) "4"
35}
36array(2) {
37 ["var2"]=>
38 string(1) "2"
39 ["var4"]=>
40 string(1) "4"
41}
42ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'var1' (attacker 'REMOTE_ADDR not set', file '%s')
43ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'var3' (attacker 'REMOTE_ADDR not set', file '%s')
44ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'var1' (attacker 'REMOTE_ADDR not set', file '%s')
45ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'var3' (attacker 'REMOTE_ADDR not set', file '%s')
46ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'var1' (attacker 'REMOTE_ADDR not set', file '%s')
47ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'var3' (attacker 'REMOTE_ADDR not set', file '%s')
48ALERT - dropped 6 request variables - (2 in GET, 2 in POST, 2 in COOKIE) (attacker 'REMOTE_ADDR not set', file '%s')