From 8672d5ff3ece1b3232c8eee0a1dec6234c85028c Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Fri, 6 Feb 2015 22:44:37 +0100 Subject: tests for suhosin.mail.protect --- tests/misc/mailprotect_1_header_nl.phpt | 18 ++++++++++++++++++ tests/misc/mailprotect_1_header_nlnl.phpt | 18 ++++++++++++++++++ tests/misc/mailprotect_1_subject.phpt | 18 ++++++++++++++++++ tests/misc/mailprotect_1_subject_long.phpt | 17 +++++++++++++++++ tests/misc/mailprotect_1_to.phpt | 18 ++++++++++++++++++ tests/misc/mailprotect_1_to_long.phpt | 17 +++++++++++++++++ tests/misc/mailprotect_2_bcc.phpt | 18 ++++++++++++++++++ tests/misc/mailprotect_2_cc.phpt | 18 ++++++++++++++++++ tests/misc/mailprotect_2_to.phpt | 18 ++++++++++++++++++ 9 files changed, 160 insertions(+) create mode 100644 tests/misc/mailprotect_1_header_nl.phpt create mode 100644 tests/misc/mailprotect_1_header_nlnl.phpt create mode 100644 tests/misc/mailprotect_1_subject.phpt create mode 100644 tests/misc/mailprotect_1_subject_long.phpt create mode 100644 tests/misc/mailprotect_1_to.phpt create mode 100644 tests/misc/mailprotect_1_to_long.phpt create mode 100644 tests/misc/mailprotect_2_bcc.phpt create mode 100644 tests/misc/mailprotect_2_cc.phpt create mode 100644 tests/misc/mailprotect_2_to.phpt (limited to 'tests') diff --git a/tests/misc/mailprotect_1_header_nl.phpt b/tests/misc/mailprotect_1_header_nl.phpt new file mode 100644 index 0000000..c8f1bc0 --- /dev/null +++ b/tests/misc/mailprotect_1_header_nl.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=1 and extra headers start with newline +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=1 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - double newline in headers, possible injection, mail dropped (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file diff --git a/tests/misc/mailprotect_1_header_nlnl.phpt b/tests/misc/mailprotect_1_header_nlnl.phpt new file mode 100644 index 0000000..cd0083f --- /dev/null +++ b/tests/misc/mailprotect_1_header_nlnl.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=1 and extra headers contain double newline +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=1 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - double newline in headers, possible injection, mail dropped (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file diff --git a/tests/misc/mailprotect_1_subject.phpt b/tests/misc/mailprotect_1_subject.phpt new file mode 100644 index 0000000..e43791c --- /dev/null +++ b/tests/misc/mailprotect_1_subject.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=1 with NL in Subject +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=1 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - newline in Subject header, possible injection, mail dropped (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file diff --git a/tests/misc/mailprotect_1_subject_long.phpt b/tests/misc/mailprotect_1_subject_long.phpt new file mode 100644 index 0000000..dc11783 --- /dev/null +++ b/tests/misc/mailprotect_1_subject_long.phpt @@ -0,0 +1,17 @@ +--TEST-- +Testing: suhosin.mail.protect=1 with valid long Subject +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=1 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +bool(true) diff --git a/tests/misc/mailprotect_1_to.phpt b/tests/misc/mailprotect_1_to.phpt new file mode 100644 index 0000000..59b5202 --- /dev/null +++ b/tests/misc/mailprotect_1_to.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=1 with NL in To +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=1 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - newline in To header, possible injection, mail dropped (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file diff --git a/tests/misc/mailprotect_1_to_long.phpt b/tests/misc/mailprotect_1_to_long.phpt new file mode 100644 index 0000000..9fb08a0 --- /dev/null +++ b/tests/misc/mailprotect_1_to_long.phpt @@ -0,0 +1,17 @@ +--TEST-- +Testing: suhosin.mail.protect=1 with valid long To +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=1 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +bool(true) \ No newline at end of file diff --git a/tests/misc/mailprotect_2_bcc.phpt b/tests/misc/mailprotect_2_bcc.phpt new file mode 100644 index 0000000..f13bcbb --- /dev/null +++ b/tests/misc/mailprotect_2_bcc.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=2 and extra headers contain Bcc: +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=2 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - BCC: headers aren't allowed in the headers parameter. (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file diff --git a/tests/misc/mailprotect_2_cc.phpt b/tests/misc/mailprotect_2_cc.phpt new file mode 100644 index 0000000..960b271 --- /dev/null +++ b/tests/misc/mailprotect_2_cc.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=2 and extra headers contain Cc: +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=2 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - CC: headers aren't allowed in the headers parameter. (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file diff --git a/tests/misc/mailprotect_2_to.phpt b/tests/misc/mailprotect_2_to.phpt new file mode 100644 index 0000000..8723b6f --- /dev/null +++ b/tests/misc/mailprotect_2_to.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing: suhosin.mail.protect=2 and extra headers contain To: +--SKIPIF-- + +--INI-- +suhosin.log.sapi=255 +suhosin.log.stdout=0 +suhosin.log.script=0 +suhosin.log.syslog=0 +suhosin.mail.protect=2 +sendmail_path=/usr/bin/true +--FILE-- + +--EXPECTF-- +ALERT - mail() - To: headers aren't allowed in the headers parameter. (attacker 'REMOTE_ADDR not set', file '%s', line 2) +bool(false) \ No newline at end of file -- cgit v1.3