ModSecurity/tests/regression/misc/25-libinjection.t
Felipe Zimmerle 9602fa4a44 nginx refactoring
Refactoring on the nginx module, including:
 - Better handling larger posts;
 - Now using nginx echo module during the regression tests.
 - Better interacting with neginx chain rules
 - Separation of the request handling and content filters.
 - Better handling nginx sessions and resource counts to allow a
   more efficient garbage collector.
 - Handling both http/1.0 and 1.1, including keep-alive.
 - Tests are now capable to test nginx as a proxy or end-server.
 - Tested agains nginx 1.6 and 1.7.
2016-02-02 12:28:52 -03:00

111 lines
2.6 KiB
Perl

### libinjection.
{
type => "misc",
comment => "libinjection SQLi - with SQLi",
conf => qq(
SecRuleEngine On
SecDebugLog $ENV{DEBUG_LOG}
SecDebugLogLevel 9
SecRequestBodyAccess On
SecRule REQUEST_BODY "\@detectSQLi" "id:192372,log,deny"
),
match_log => {
error => [ qr/detected SQLi using libinjection/, 1],
debug => [ qr/detected SQLi using libinjection/, 1 ],
},
match_response => {
status => qr/^403$/,
},
request => new HTTP::Request(
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
[
"Content-Type" => "application/x-www-form-urlencoded",
],
# Args
"some_variable=-1' and 1=1 union/* foo */select load_file('/etc/passwd')--"
),
},
{
type => "misc",
comment => "libinjection SQLi - without SQLi",
conf => qq(
SecRuleEngine On
SecDebugLog $ENV{DEBUG_LOG}
SecDebugLogLevel 9
SecRequestBodyAccess On
SecRule REQUEST_BODY "\@detectSQLi" "id:192372,log,deny"
),
match_log => {
-error => [ qr/detected SQLi using libinjection/, 1],
-debug => [ qr/detected SQLi using libinjection/, 1 ],
},
match_response => {
status => qr/^200$/,
},
request => new HTTP::Request(
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
[
"Content-Type" => "application/x-www-form-urlencoded",
],
# Args
"some_variable=hello cruel world"
),
},
{
type => "misc",
comment => "libinjection XSS - with XSS",
conf => qq(
SecRuleEngine On
SecDebugLog $ENV{DEBUG_LOG}
SecDebugLogLevel 9
SecRequestBodyAccess On
SecRule REQUEST_BODY "\@detectXSS" "id:192372,log,deny"
),
match_log => {
error => [ qr/detected XSS using libinjection/, 1],
debug => [ qr/detected XSS using libinjection/, 1 ],
},
match_response => {
status => qr/^403$/,
},
request => new HTTP::Request(
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
[
"Content-Type" => "application/x-www-form-urlencoded",
],
# Args
"some_variable=<a href=\"javascript:alert(1)\">"
),
},
{
type => "misc",
comment => "libinjection XSS - without XSS",
conf => qq(
SecRuleEngine On
SecDebugLog $ENV{DEBUG_LOG}
SecDebugLogLevel 9
SecRequestBodyAccess On
SecRule REQUEST_BODY "\@detectXSS" "id:192372,log,deny"
),
match_log => {
-error => [ qr/detected XSS using libinjection/, 1],
-debug => [ qr/detected XSS using libinjection/, 1 ],
},
match_response => {
status => qr/^200$/,
},
request => new HTTP::Request(
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
[
"Content-Type" => "application/x-www-form-urlencoded",
],
# Args
"some_variable=hello cruel world"
),
}