Initial Commit
This commit is contained in:
1208
naxsi-0.55.3/t/00naxsi_base.t
vendored
Normal file
1208
naxsi-0.55.3/t/00naxsi_base.t
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1194
naxsi-0.55.3/t/01naxsi_whitelists.t
vendored
Normal file
1194
naxsi-0.55.3/t/01naxsi_whitelists.t
vendored
Normal file
File diff suppressed because it is too large
Load Diff
319
naxsi-0.55.3/t/02naxsi_bypass.t
vendored
Normal file
319
naxsi-0.55.3/t/02naxsi_bypass.t
vendored
Normal file
@@ -0,0 +1,319 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1: Basic GET request
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=buibui
|
||||
--- error_code: 200
|
||||
=== TEST 2: DENY : XSS bypass vector 1 (basic url encode)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=%2f%3cSc%3E
|
||||
--- error_code: 412
|
||||
=== TEST 2.1: DENY : XSS bypass vector 2 (\x encode)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=\x2f\x3cSc\x3E
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 2.2: DENY : XSS bypass vector %00 (nullbyte)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=a%00<%00script
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 2.3: DENY : XSS bypass vector %00 (nullbyte) URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a%00aaa
|
||||
--- error_code: 400
|
||||
=== TEST 3.0: DENY : bypass vector ? (multi arg break)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=a?<x
|
||||
--- error_code: 412
|
||||
=== TEST 3.1: DENY : ? break (multi ?)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<a?a
|
||||
--- error_code: 412
|
||||
=== TEST 4.0: malformed URIs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&val
|
||||
--- error_code: 200
|
||||
=== TEST 4.01: malformed URIs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&va<l
|
||||
--- error_code: 412
|
||||
=== TEST 4.1: malformed URIs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?val&&
|
||||
--- error_code: 412
|
||||
=== TEST 4.2: malformed URIs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&val
|
||||
--- error_code: 200
|
||||
=== TEST 4.21: malformed URIs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&va<l
|
||||
--- error_code: 412
|
||||
=== TEST 4.3: malformed URIs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?val&
|
||||
--- error_code: 412
|
||||
156
naxsi-0.55.3/t/03naxsi_profile.t
vendored
Normal file
156
naxsi-0.55.3/t/03naxsi_profile.t
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1: Basic GET request
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=buibui
|
||||
--- error_code: 200
|
||||
=== TEST 2: DENY : Obvious GET XSS
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a="><ScRiPt>alert(1)</scRiPt>
|
||||
--- error_code: 412
|
||||
=== TEST 2.1: DENY : Obvious RFI
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=http://evil.com/eva.txt
|
||||
--- error_code: 412
|
||||
=== TEST 2.3: DENY : Obvious LFI
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 2" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=../../../../../bar.txt
|
||||
--- error_code: 412
|
||||
=== TEST 3: OBVIOUS GET SQL INJECTION
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=1'+Or+'1'='1
|
||||
--- error_code: 412
|
||||
=== TEST 3bis: OBVIOUS (quoteless) GET SQL INJECTION
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=1+UnIoN+SeLeCt+1
|
||||
--- error_code: 412
|
||||
1003
naxsi-0.55.3/t/04naxsi_files.t
vendored
Normal file
1003
naxsi-0.55.3/t/04naxsi_files.t
vendored
Normal file
File diff suppressed because it is too large
Load Diff
359
naxsi-0.55.3/t/05naxsi_advanced_whitelists.t
vendored
Normal file
359
naxsi-0.55.3/t/05naxsi_advanced_whitelists.t
vendored
Normal file
@@ -0,0 +1,359 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== WL TEST 5.0: Two whitelists on two named arguments, same URL
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla|$URL:/buixor";
|
||||
BasicRule wl:1998 "mz:$ARGS_VAR:blu|$URL:/buixor";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?bla=1999
|
||||
--- error_code: 200
|
||||
=== WL TEST 5.1: Two whitelists on two named arguments, same URL
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla|$URL:/buixor";
|
||||
BasicRule wl:1998 "mz:$ARGS_VAR:blu|$URL:/buixor";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?blu=1999
|
||||
--- error_code: 412
|
||||
=== WL TEST 5.2: Two whitelists on two named arguments, same URL
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla|$URL:/buixor";
|
||||
BasicRule wl:1998 "mz:$ARGS_VAR:blu|$URL:/buixor";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?bla=1999&blu=1998
|
||||
--- error_code: 200
|
||||
=== WL TEST 5.3: Two whitelists on two named arguments, same URL
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla|$URL:/buixor";
|
||||
BasicRule wl:1998 "mz:$ARGS_VAR:blu|$URL:/buixor";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?buixor=1998
|
||||
--- error_code: 412
|
||||
=== WL TEST 5.4: Whitelists on ARGS/URLs that are URLencoded
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:b_@_la|$URL:/buixor";
|
||||
BasicRule wl:1998 "mz:$ARGS_VAR:blu|$URL:/buixor";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?b_@_la=1999
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 5.5: Whitelists on ARGS/URLs that are URLencoded
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:b[]la|$URL:/buixor";
|
||||
BasicRule wl:1998 "mz:$ARGS_VAR:blu|$URL:/buixor";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?b]la=1999
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 6: Whitelists trying to provoke collisions ($ARGS_VAR:x + $URL:x|ARGS)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
>>> bla
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
# BasicRule wl:1999 "mz:$ARGS_VAR:/bla";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /bla?1998
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 6.0: Whitelists trying to provoke collisions ($ARGS_VAR:x + $URL:x|ARGS)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
# BasicRule wl:1999 "mz:$ARGS_VAR:/bla";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?/bla=1998
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 6.1: Whitelists trying to provoke collisions ($ARGS_VAR:x + $URL:x|ARGS)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
>>> bla
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /bla?bla=1999&toto=1998
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 6.2: Whitelists trying to provoke collisions ($ARGS_VAR:x + $URL:x|ARGS)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:/bla";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?/bla=1999
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 6.3: Whitelists trying to provoke collisions ($ARGS_VAR:x + $URL:x|ARGS)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
>>> bla
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:/bla";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /bla?/bla=1999&bu=1998
|
||||
--- error_code: 200
|
||||
|
||||
130
naxsi-0.55.3/t/06naxsi_weirds.t
vendored
Normal file
130
naxsi-0.55.3/t/06naxsi_weirds.t
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== WL TEST 1.0: weird request in URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&&&a&&&&&
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.01: weird request in URL (wl on fullzone)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:12 "mz:ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&&&a&&&&&
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.02: weird request in URL (wl on zone+URL)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:12 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&&&a&&&&&
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.03: weird request in URL (fail wl on zone+bad URL)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:12 "mz:$URL:/a|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&&&a&&&&&
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.04: weird request in URL (fail wl on bad zone+URL)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:12 "mz:$URL:/|URL";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?&&&&a&&&&&
|
||||
--- error_code: 412
|
||||
730
naxsi-0.55.3/t/07naxsi_argnames.t
vendored
Normal file
730
naxsi-0.55.3/t/07naxsi_argnames.t
vendored
Normal file
@@ -0,0 +1,730 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== WL TEST 1.0: Obvious test in arg
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.01: Check non-collision of zone and 'name' flag
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:5 "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=foobar
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.1: Generic whitelist in ARGS_NAME
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== WL TEST 1.11: Generic whitelist in ARGS_NAME, limit
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.12: Generic whitelist in ARGS_NAME, limit
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=foobar
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.2: whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.21: whitelist in ARGS_NAME+$URL, limit
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.22: whitelist in ARGS_NAME+$URL, limit
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=foobar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== WL TEST 1.3: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/z|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.31: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=foobar
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.32: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:b|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?b=foobar
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.33: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=bui
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.34: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:foobra" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:2999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
BasicRule wl:2999 "mz:$URL:/|$ARGS_VAR:foobar";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foobra
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.35: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:foobra" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:2999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
BasicRule wl:2999 "mz:$URL:/|$ARGS_VAR:foobar";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foobar
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.36: failed whitelist in ARGS_NAME+$URL
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:foobra" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:2999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
BasicRule wl:2999 "mz:$URL:/|$ARGS_VAR:foobar";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foobar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== WL TEST 1.4: whitelist in ARGS_NAME+$URL+$ARGS_VAR
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.41: whitelist in ARGS_NAME+$URL+$ARGS_VAR
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=foobar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== WL TEST 1.5: whitelist in ARGS_NAME+$URL+$ARGS_VAR, limit
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foobar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== WL TEST 1.51: whitelist in ARGS_NAME+$URL+$ARGS_VAR, limit
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foo
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.6: whitelist in $URL+$ARGS_VAR | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foobar
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.6.1: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=foobar
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.6.2: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=lol
|
||||
--- error_code: 200
|
||||
=== WL TEST 1.6.3: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?lol=foobar
|
||||
--- error_code: 200
|
||||
=== WL TEST 1.6.4: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
# BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?lol=foobar
|
||||
--- error_code: 412
|
||||
=== WL TEST 1.6.5: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
# BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=lol
|
||||
--- error_code: 412
|
||||
=== WL TEST 1.6.6: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
# BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?lol=foobar
|
||||
--- error_code: 200
|
||||
=== WL TEST 1.6.7: whitelist in $URL+ARGS | NAME, (collision)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
|
||||
# BasicRule wl:1999 "mz:$URL:/|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?lol=foobar
|
||||
--- error_code: 412
|
||||
|
||||
372
naxsi-0.55.3/t/08negative_whitelists.t
vendored
Normal file
372
naxsi-0.55.3/t/08negative_whitelists.t
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
__DATA__
|
||||
|
||||
=== WL TEST 1.0
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "str:foobar" "msg:foobar test pattern" "mz:$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?b=toto
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.01
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "str:foobar" "msg:foobar test pattern" "mz:$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?b=foobar
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.03
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "str:foobar" "msg:foobar test pattern" "mz:$URL:/|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobar
|
||||
--- error_code: 404
|
||||
|
||||
=== WL TEST 1.04
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "str:foobar" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobrar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.0
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:foobar" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobrar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.01
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:foobar" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobar
|
||||
--- error_code: 404
|
||||
|
||||
|
||||
=== WL TEST 2.02
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^foobar" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?b=foobar
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 2.03
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^foobar" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=rfoobar
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.04
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^foobar" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobar
|
||||
--- error_code: 404
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.05
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^foobar$" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobar
|
||||
--- error_code: 404
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.06
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^foobar$" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobara
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.07
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^[0-9]+$" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=foobara
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== WL TEST 2.08
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^[0-9]+$" "msg:foobar test pattern" "mz:$URL:/a|$ARGS_VAR:b" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /a?b=1234
|
||||
--- error_code: 404
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
883
naxsi-0.55.3/t/09sqlmap_tamper.t
vendored
Normal file
883
naxsi-0.55.3/t/09sqlmap_tamper.t
vendored
Normal file
@@ -0,0 +1,883 @@
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TODO: naxsi does not support utf8, potential bypass. Still too marginal to be worth checking
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=AND+%EF%BC%871%EF%BC%87=%EF%BC%871%EF%BC%87 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 1: hey 2
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=AND+%00%271%00%27=%00%271%00%27 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 3
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=AND+1=1%00 Union select 1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== NOT TODO: base64, not worthing checking
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=MScgQU5EIFNMRUVQKDUpIw== HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 1: hey 5
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a='A+NOT+BETWEEN+0+AND+B' HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 6
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=%2553%2545%254c%2545%2543%2554%2520%2546%2549%2545%254c%2544%2520%2546%2552%254f%254d%2520%2554%2541%2542%254c%2545 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 7
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=%53%45%4c%45%43%54%20%46%49%45%4c%44%20%46%52%4f%4d%20%54%41%42%4c%45 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 8
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=%u0053%u0045%u004c%u0045%u0043%u0054%u0020%u0046%u0049%u0045%u004c%u0044%u0020%u0046%u0052%u004f%u004d%u0020%u0054%u0041%u0042%u004c%u0045' HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 9
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=SELECT+*+FROM+users+WHERE+id+LIKE+1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 10
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=value'/*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)),+NULL,+NULL#/*!0AND+'QDWa'='QDWa HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 11
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=IF(ISNULL(1),+2,+1) HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 12
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1+/*!30000AND+2>1*/-- HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 13
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1+/*!00000AND+2>1*/-- HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 14
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=+UNION+++SELECT++ HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== IIS/ASP Encoding
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=%S%E%L%E%C%T+%F%I%E%L%D+%F%R%O%M+%T%A%B%L%E HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 16
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1 UnioN SeLEct 1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 17
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=AND+1=1+and+'0having'='0having' HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 18
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=SELECT/**/id/**/FROM/**/users HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 19
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1--PTTmJopxdWJ%0AAND--cWfcVRPV%0A9227=9227 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 20
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1%23PTTmJopxdWJ%0AAND%23cWfcVRPV%0A9227=9227 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 21
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1%23PTTmJopxdWJ%0AAND%23cWfcVRPV%0A9227=9227 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 22
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=SELECT%08id%02FROM%0Fusers HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 23
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1%23%0A9227=922%237 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 24
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=SELECT%0Bid%0BFROM%A0users HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 25
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1--%0AAND--%0A9227=9227 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 26
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=SELECT+id+FROM+users HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== TEST 1: hey 28
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1%bf%27+AND+1=1--%20 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 29
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,+CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURRENT_USER()/*!AS*//*!CHAR*/),CHAR(32)),CHAR(58,100,114,117,58))# HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 1: hey 30
|
||||
--- main_config
|
||||
working_directory /tmp/;
|
||||
worker_rlimit_core 25M;
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a=1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,/*!CONCAT*/(/*!CHAR*/(58,122,114,115,58),/*!IFNULL*/(CAST(/*!CURRENT_USER*/()/*!AS*//*!CHAR*/),/*!CHAR*/(32)),/*!CHAR*/(58,115,114,121,58))# HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
423
naxsi-0.55.3/t/10naxsi_modifiers.t
vendored
Normal file
423
naxsi-0.55.3/t/10naxsi_modifiers.t
vendored
Normal file
@@ -0,0 +1,423 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
repeat_each(3);
|
||||
|
||||
plan tests => repeat_each(1) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1.0 : Runtime Learning force (per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
if ($remote_addr = "127.0.0.1") {
|
||||
set $naxsi_flag_learning 1;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 1.01 : Runtime Learning force (absolute)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_learning 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 1.1: Runtime Learning force (fail - per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
if ($remote_addr = "127.0.0.42") {
|
||||
set $naxsi_flag_learning 1;
|
||||
}
|
||||
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 1.2: Runtime Learning force (fail - in location)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
# this will not work, as naxsi
|
||||
# is processed before var set in location.
|
||||
set $naxsi_flag_learning 1;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== TEST 1.3: Runtime Learning disable (per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
if ($remote_addr = "127.0.0.1") {
|
||||
set $naxsi_flag_learning 0;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 1.4: Runtime Learning disable (fail - per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
if ($remote_addr = "127.0.0.42") {
|
||||
set $naxsi_flag_learning 0;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 2.00 : Check that SecRulesDisabled correctly works
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 2: Runtime disable force (absolute)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_enable 0;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 2.2: Runtime enable force
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_enable 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 2.3: Runtime enable force, with static learning (which is pointless)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_enable 1;
|
||||
location / {
|
||||
LearningMode;
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 2.4: Runtime enable + learning mode (absolute)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_learning 1;
|
||||
set $naxsi_flag_enable 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 3.0: Runtime enable + learning mode (per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
if ($remote_addr = "127.0.0.1") {
|
||||
set $naxsi_flag_enable 1;
|
||||
set $naxsi_flag_learning 1;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 3.1: Runtime enable + learning mode (per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
if ($remote_addr = "127.0.0.42") {
|
||||
set $naxsi_flag_enable 1;
|
||||
set $naxsi_flag_learning 1;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 3.2: Runtime enable + learning mode (per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_enable 1;
|
||||
if ($remote_addr = "127.0.0.1") {
|
||||
set $naxsi_flag_learning 1;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 3.3: Runtime enable (success) + learning mode (fail - per ip)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_enable 1;
|
||||
if ($remote_addr = "127.0.0.42") {
|
||||
set $naxsi_flag_learning 1;
|
||||
}
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
SecRulesDisabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=<>
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2363
naxsi-0.55.3/t/11naxsi_newstyle_config.t
vendored
Normal file
2363
naxsi-0.55.3/t/11naxsi_newstyle_config.t
vendored
Normal file
File diff suppressed because it is too large
Load Diff
67
naxsi-0.55.3/t/12naxsi_argnames_extended.t
vendored
Normal file
67
naxsi-0.55.3/t/12naxsi_argnames_extended.t
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== WL TEST 1.0: Obvious test in arg
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.1: Obvious test in arg
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:foobar|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foobar=a
|
||||
--- error_code: 200
|
||||
|
||||
80
naxsi-0.55.3/t/13test.t
vendored
Normal file
80
naxsi-0.55.3/t/13test.t
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# This File is used for broken tests.
|
||||
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
# This one should actually return 200, but a hashtable collision happens
|
||||
=== WL TEST 6.1: Whitelist provoking collision
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
>>> bla
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/bla|ARGS|NAME";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /bla?blx=1998&1999=bla
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 6.2: Trigger multi-line logs
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
>>> bla
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL:/bla|ARGS|NAME";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA5=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA10=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA11=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA12=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA13=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA14=1998&AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA15=1998
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
742
naxsi-0.55.3/t/14json.t
vendored
Normal file
742
naxsi-0.55.3/t/14json.t
vendored
Normal file
@@ -0,0 +1,742 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== JSON0 : Valid JSON
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\", \"XML\"]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== JSON1 : invalid JSON (double closing ']')
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\", \"XML\"]]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== JSON2 : invalid JSON (missing closing ']')
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\", \"XML\"
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
=== JSON3 : invalid JSON (closing array with '}' instead of ']')
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\", \"XML\"}
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
=== JSON4 : invalid JSON (Missing final closing '}')
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\", \"XML\"]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
=== JSON5 : invalid JSON (Extra closing '}')
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\", \"XML\"]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}"
|
||||
--- error_code: 412
|
||||
=== JSON6 : invalid JSON (Missing ',' in array)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\" \"XML\"]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}"
|
||||
--- error_code: 412
|
||||
=== JSON7 : Valid JSON with empty array item (Extra ',' in array)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"GML\",\"XML\",]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}"
|
||||
--- error_code: 200
|
||||
=== JSON8 : valid JSON - too deep !
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{{{{{{{{{{{{[\"lol\"]}}}}}}}}}}}}"
|
||||
--- error_code: 412
|
||||
=== JSON9 : Valid JSON with ev0l stuff (array => var content)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAlso\": [\"G<ML\",\"XML\",]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}"
|
||||
--- error_code: 412
|
||||
=== JSON10 : Valid JSON with ev0l stuff (array => var name)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"glossary\": {
|
||||
\"title\": \"example glossary\",
|
||||
\"GlossDiv\": {
|
||||
\"title\": \"S\",
|
||||
\"GlossList\": {
|
||||
\"GlossEntry\": {
|
||||
\"ID\": \"SGML\",
|
||||
\"SortAs\": \"SGML\",
|
||||
\"GlossTerm\": \"Standard Generalized Markup Language\",
|
||||
\"Acronym\": \"SGML\",
|
||||
\"Abbrev\": \"ISO 8879:1986\",
|
||||
\"GlossDef\": {
|
||||
\"para\": \"A meta-markup language used to create markup languages such as DocBook.\",
|
||||
\"GlossSeeAl<so\": [\"GML\",\"XML\",]
|
||||
},
|
||||
\"GlossSee\": \"markup\"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}"
|
||||
--- error_code: 412
|
||||
=== JSON11 : Empty JSON object
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
|
||||
}"
|
||||
--- error_code: 200
|
||||
=== JSON12 : malformed (closing object before array) Json
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"fuu\" : [\"laul\", {\"die\" : \"nope\" ]}
|
||||
}"
|
||||
--- error_code: 412
|
||||
=== JSON12 : malformed (unescaped quotes)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"fuu\" : [\"laul\", {\"die\" : \"n\"ope\" }]
|
||||
}"
|
||||
--- error_code: 412
|
||||
|
||||
=== JSON12 : escaped quotes
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
BasicRule wl:1001,1205;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"fuu\" : [\"laul\", {\"die\" : \"n\\\"ope\" }]
|
||||
}"
|
||||
--- error_code: 200
|
||||
=== JSON13 : concatenation attempt (ie "foo":"bar"+eval(evil)+"foo")
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"fuu\" : \"oh \"+eval(evil)+\" my\"]
|
||||
}"
|
||||
--- error_code: 412
|
||||
=== JSON13 : concatenation attempt (ie "foo":"bar"+eval(evil)+"foo")
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"obvious\" : \"a<a\"]
|
||||
}"
|
||||
--- error_code: 412
|
||||
=== JSON14 : unfinished sub object
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"obvious\" : \"a<a\",
|
||||
\"fu\" : { \"aa\" : \"bb\"
|
||||
}"
|
||||
--- error_code: 412
|
||||
559
naxsi-0.55.3/t/15json_wl.t
vendored
Normal file
559
naxsi-0.55.3/t/15json_wl.t
vendored
Normal file
@@ -0,0 +1,559 @@
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== json wl 0.1 : no rulematch
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : \"bar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== json wl 0.2 : rulematch
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : \"foobar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
=== json wl 0.3 : rulematch + wl on full zone
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:BODY";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : \"foobar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== json wl 0.4 : rulematch + wl on zone + varname
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$BODY_VAR:lol";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : \"foobar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
=== json wl 0.5 : rulematch + wl on zone + varname + url
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$BODY_VAR:lol|$URL:/test_uri";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
\"lol\" : \"foobar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
=== json wl 0.6 : rulematch + wl on zone + varname + url [fail]
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$BODY_VAR:lol|$URL:/test_uri";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : \"foobar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
=== json wl 0.7 : rulematch + wl on zone + varname (in sub-json element)
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$BODY_VAR:test_123|$URL:/test_uri";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
\"oh\" : [\"there\", \"is\", \"no\", \"way\"],
|
||||
\"this\" : { \"will\" : [\"work\", \"does\"],
|
||||
\"it\" : \"??\" },
|
||||
\"trigger\" : {\"test_123\" : [\"foobar\", \"will\", \"trigger\", \"it\"]},
|
||||
\"foo\" : \"baar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
=== json wl 0.8 : rulematch + wl on zone + varname (in sub-json element) [fail]
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$BODY_VAR:test_123|$URL:/test_uri";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
\"oh\" : [\"there\", \"is\", \"no\", \"way\"],
|
||||
\"this\" : { \"will\" : [\"work\", \"does\"],
|
||||
\"it\" : \"??\" },
|
||||
\"trigger\" : {\"test_1234\" : [\"foobar\", \"will\", \"trigger\", \"it\"]},
|
||||
\"foo\" : \"baar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
=== json wl 0.9 : match in varname
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
\"oh\" : [\"there\", \"is\", \"no\", \"way\"],
|
||||
\"this\" : { \"will\" : [\"work\", \"does\"],
|
||||
\"it\" : \"??\" },
|
||||
\"tr<igger\" : {\"test_1234\" : [\"foobar\", \"will\", \"trigger\", \"it\"]},
|
||||
\"foo\" : \"baar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
=== json wl 1.0 : match in varname + wl on varname
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1302 "mz:$BODY_VAR:tr<igger|NAME";
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
\"oh\" : [\"there\", \"is\", \"no\", \"way\"],
|
||||
\"this\" : { \"will\" : [\"work\", \"does\"],
|
||||
\"it\" : \"??\" },
|
||||
\"tr<igger\" : {\"test_1234\" : [\"foobar\", \"will\", \"trigger\", \"it\"]},
|
||||
\"foo\" : \"baar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== json wl 1.1 : match (empty variable name)
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
\"\" : [\"there\", \"is\", \"no\", \"way\"]
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== json wl 1.1 : match (no variable name)
|
||||
--- user_files
|
||||
>>> test_uri
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /test_uri
|
||||
{
|
||||
[\"there\", \"is\", \"no\", \"way\"]
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== json wl 2.0 : malformed json (missing opening {)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
|
||||
\"lol\" : \"bar\"
|
||||
}
|
||||
"
|
||||
--- error_code: 412
|
||||
=== json wl 2.1 : Numeric content json
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : 372
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
=== json wl 2.2 : true/false content json
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : false,
|
||||
\"serious_stuff\" : true,
|
||||
\"extra_coverage\" : null
|
||||
}
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
=== json wl 2.3 : malformed json
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:BODY" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/json
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
{
|
||||
\"lol\" : false,
|
||||
\"serious_stuff\" : true,
|
||||
\"extra_coverage\" : null
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
574
naxsi-0.55.3/t/16rx_mz.t
vendored
Normal file
574
naxsi-0.55.3/t/16rx_mz.t
vendored
Normal file
@@ -0,0 +1,574 @@
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== RXWL TEST 1.0: simple wide regex ($args_var)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?bla=1999
|
||||
--- error_code: 200
|
||||
=== RXWL TEST 1.1: simple wide regex ($args_var)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?bra=1999
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 1.2: simple wide regex ($args_var)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?aablaaa=1999
|
||||
--- error_code: 200
|
||||
=== RXWL TEST 1.3: simple end-restrictive regex ($args_var_x:..$)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla$";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?aabla=1999
|
||||
--- error_code: 200
|
||||
=== RXWL TEST 1.3: simple end-restrictive regex ($args_var_x:..$)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla$";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?aabla=1999
|
||||
--- error_code: 200
|
||||
=== RXWL TEST 1.4: simple end-restrictive regex ($args_var_x:..$)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla$";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?aablaa=1999
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 1.5: simple begin-restrictive regex ($args_var_x:^..)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^bla";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?blaa=1999
|
||||
--- error_code: 200
|
||||
=== RXWL TEST 1.6: simple begin-restrictive regex ($args_var_x:^..)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^bla";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?blaa=1999
|
||||
--- error_code: 200
|
||||
=== RXWL TEST 1.7: simple begin-restrictive regex ($args_var_x:^..)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^bla";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?ablaa=1999
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 1.8: simple full-restrictive regex ($args_var_x:^..$)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^bla$";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?abla=1999
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 1.9: simple full-restrictive regex ($args_var_x:^..$)
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^bla$";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /buixor?bla=1999
|
||||
--- error_code: 200
|
||||
|
||||
=== RXWL TEST 2.0: simple wide regex ($args_var|$url)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla|$URL_X:/foo";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?bla=1999
|
||||
--- error_code: 200
|
||||
|
||||
=== RXWL TEST 2.1: simple wide regex ($args_var|$url)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:bla|$URL_X:/foo";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foz?bla=1999
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 2.2: simple half-restrictive regex ($args_var|$url)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^bla$|$URL_X:/foo";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?blaz=1999
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 3.0: simple wide regex (url|args|name)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL_X:/foo|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?19991999=foo
|
||||
--- error_code: 200
|
||||
|
||||
=== RXWL TEST 3.1: simple wide regex (url|args|name)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL_X:/foo|ARGS|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?foo=1999
|
||||
--- error_code: 412
|
||||
|
||||
=== RXWL TEST 4.0: simple restrictive+complex regex ($URL_X|URL)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS|URL" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$URL_X:^/foo_[0-9]+_$|URL";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo_1999_?x=x
|
||||
--- error_code: 404
|
||||
=== RXWL TEST 4.1: simple restrictive+complex regex ($ARGS_VAR_X|NAME)
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS|URL" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^foo_[0-9]+_$|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo_1999_inject=x
|
||||
--- error_code: 412
|
||||
=== RXWL TEST 5.0: file ext ($URL|NAME) XXX
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS|URL" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^foo_[0-9]+_$|NAME";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo_1999_inject=x
|
||||
--- error_code: 412
|
||||
|
||||
=== RXWL TEST 6.0: case sensitiveness
|
||||
--- user_files
|
||||
>>> foo
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:abcd" "msg:foobar test pattern #1" "mz:ARGS|URL" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR_X:^foo_[0-9]+_$";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo_1999_=ABCD
|
||||
--- error_code: 200
|
||||
99
naxsi-0.55.3/t/17case.t
vendored
Normal file
99
naxsi-0.55.3/t/17case.t
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== WL TEST X.0: URL case sensitive wl
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999,1000 "mz:$URL:/foobar/tableDropdown|URL";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foobar/tableDropdown
|
||||
--- error_code: 404
|
||||
|
||||
=== WL TEST X.1: URL case sensitive wl
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1000 "mz:$URL:/wp-content/plugins/ultimate-tinymce/tableDropdown/editor_plugin.js|URL";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /wp-content/plugins/ultimate-tinymce/tableDropdown/editor_plugin.js
|
||||
--- error_code: 404
|
||||
=== WL TEST 6.3: Whitelists trying to provoke collisions
|
||||
--- user_files
|
||||
>>> buixor
|
||||
eh yo
|
||||
>>> bla
|
||||
eh yo
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1999" "msg:foobar test pattern #2" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
#LearningMode;
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:/bla";
|
||||
BasicRule wl:1998 "mz:$URL:/bla|ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /bla?/bla=1999&bu=1998
|
||||
--- error_code: 200
|
||||
354
naxsi-0.55.3/t/18ids.t
vendored
Normal file
354
naxsi-0.55.3/t/18ids.t
vendored
Normal file
@@ -0,0 +1,354 @@
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== ID TEST 1.0: Disabled IDs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 200
|
||||
=== ID TEST 1.1: Disabled IDs (fail)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1998
|
||||
--- error_code: 412
|
||||
=== ID TEST 1.2: Disabled negative IDs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1998
|
||||
--- error_code: 200
|
||||
=== ID TEST 1.3: Disabled negative IDs (fail)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
=== ID TEST 1.4: Multiple Disabled negative IDs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999,-1998;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1997
|
||||
--- error_code: 200
|
||||
=== ID TEST 1.5: Multiple Disabled negative IDs
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999,-1998;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== ID TEST 2.0: BasicRule negative id test
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999 "mz:$URL:/|$ARGS_VAR:foo";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=1999
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== ID TEST 2.1: BasicRule negative id test (fail)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999 "mz:$URL:/|$ARGS_VAR:foo";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=1998
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== ID TEST 2.2: BasicRule negative id test (fail on internal ID)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1999;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:-1999 "mz:$URL:/|$ARGS_VAR:foo";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=a%00a
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== ID TEST 3.0: Partial disabled whitelist
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS|URL" "s:$SQL:42" id:1999;
|
||||
# MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
# MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=a1999a
|
||||
--- error_code: 200
|
||||
|
||||
=== ID TEST 3.1: Partial disabled whitelist (fail zone)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS|URL" "s:$SQL:42" id:1999;
|
||||
# MainRule "str:1998" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1998;
|
||||
# MainRule "str:1997" "msg:foobar test pattern #1" "mz:ARGS" "s:$SQL:42" id:1997;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1999 "mz:ARGS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /1999?foo=aa
|
||||
--- error_code: 412
|
||||
|
||||
=== ID TEST 4.0: header disabled rule
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:HEADERS|ARGS" "s:$SQL:42" id:1998;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
foo: 1998
|
||||
--- request
|
||||
GET /
|
||||
--- error_code: 412
|
||||
|
||||
=== ID TEST 4.1: header disabled rule wl
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1998" "msg:foobar test pattern #1" "mz:HEADERS|ARGS" "s:$SQL:42" id:1998;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
BasicRule wl:1998 "mz:HEADERS";
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
foo: 1998
|
||||
--- request
|
||||
GET /
|
||||
--- error_code: 200
|
||||
|
||||
381
naxsi-0.55.3/t/19targets.t
vendored
Normal file
381
naxsi-0.55.3/t/19targets.t
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== ID TEST 1.0: Drop rule without learning
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:DROP" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
=== ID TEST 1.1: whitelisted drop rule without learning
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:DROP" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
BasicRule wl:1999 "mz:ARGS";
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 200
|
||||
|
||||
=== ID TEST 1.2: bad whitelisted drop rule without learning
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:DROP" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
BasicRule wl:1999 "mz:URL";
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
=== ID TEST 1.3: drop rule with learning
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:DROP" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== ID TEST 1.4: drop rule with learning + correct whitelist
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:DROP" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== ID TEST 1.5: drop rule with learning + incorrect whitelist
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:DROP" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
BasicRule wl:1999 "mz:$ARGS_VAR:bla|$URL:/x";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== ID TEST 2.0: drop checkrule
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO >= 8" DROP;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
=== ID TEST 2.1: drop checkrule, with whitelisted rule
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO >= 8" DROP;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR_X:^bla$";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 200
|
||||
=== ID TEST 2.2: drop checkrule, with failed whitelisted rule
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO >= 8" DROP;
|
||||
BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR_X:^bla1";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
=== ID TEST 3.0: <= checkrule (why not dude)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO <= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
=== ID TEST 3.1: <= checkrule : Is useless, as score will go through value 8 before reaching 16, thus the checkrule will be applied
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO <= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999&blu=1999
|
||||
--- error_code: 412
|
||||
=== ID TEST 3.2: < checkrule (why not dude)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO < 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 200
|
||||
=== ID TEST 3.3: < checkrule (why not dude)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:7" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO < 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
=== ID TEST 3.4: > checkrule (why not dude)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:8" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO > 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 200
|
||||
|
||||
=== ID TEST 3.5: > checkrule (why not dude)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:1999" "msg:foobar test pattern #1" "mz:ARGS" "s:$FOO:9" id:1999;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO > 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?bla=1999
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== ID TEST 4.0: super long exception (trigger 400 bad request on old versions)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$FOO > 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
error_page 405 = $uri;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /
|
||||
a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2=<>(){}[]'--;=a&a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1=<>(){}[]'--;=a&a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3=<>(){}[]'--;=a&a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4=<>(){}[]'&a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5=<>(){}[]'"
|
||||
--- error_code: 200
|
||||
|
||||
806
naxsi-0.55.3/t/20sqlmap.t
vendored
Normal file
806
naxsi-0.55.3/t/20sqlmap.t
vendored
Normal file
@@ -0,0 +1,806 @@
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
repeat_each(3);
|
||||
|
||||
plan tests => repeat_each(1) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1 : sqlmap-master/tamper/randomcomments.py -- I/**/N/**/SERT
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?I/**/N/**/SERT
|
||||
--- error_code: 412
|
||||
=== TEST 2 : sqlmap-master/tamper/space2plus.py -- SELECT+id+FROM+users
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT+id+FROM+users
|
||||
--- error_code: 412
|
||||
=== TEST 3 : sqlmap-master/tamper/multiplespaces.py -- 1++++UNION+++++SELECT+++foobar
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1++++UNION+++++SELECT+++foobar
|
||||
--- error_code: 412
|
||||
=== TEST 4 : sqlmap-master/tamper/base64encode.py -- MScgQU5EIFNMRUVQKDUpIw==
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?MScgQU5EIFNMRUVQKDUpIw==
|
||||
--- error_code: 200
|
||||
=== TEST 5 : sqlmap-master/tamper/between.py -- 1+AND+A+NOT+BETWEEN+0+AND+B--
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+AND+A+NOT+BETWEEN+0+AND+B--
|
||||
--- error_code: 200
|
||||
=== TEST 6 : sqlmap-master/tamper/unmagicquotes.py -- 1%bf%27+AND+1=1--+
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1%bf%27+AND+1=1--+
|
||||
--- error_code: 412
|
||||
=== TEST 7 : sqlmap-master/tamper/appendnullbyte.py -- 1+AND+1=1%00
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+AND+1=1%00
|
||||
--- error_code: 412
|
||||
=== TEST 8 : sqlmap-master/tamper/unionalltounion.py -- -1+UNION+SELECT
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?-1+UNION+SELECT
|
||||
--- error_code: 412
|
||||
=== TEST 9 : sqlmap-master/tamper/greatest.py -- 1+AND+GREATEST(A,B+1)=A
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+AND+GREATEST(A,B+1)=A
|
||||
--- error_code: 412
|
||||
=== TEST 10 : sqlmap-master/tamper/chardoubleencode.py -- %2553%2545%254C%2545%2543%2554%2520%2546%2549%2545%254C%2544%2520%2546%2552%254F%254D%2520%2554%2541%2542%254C%2545
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?%2553%2545%254C%2545%2543%2554%2520%2546%2549%2545%254C%2544%2520%2546%2552%254F%254D%2520%2554%2541%2542%254C%2545
|
||||
--- error_code: 412
|
||||
=== TEST 11 : sqlmap-master/tamper/space2comment.py -- SELECT/**/id/**/FROM/**/users
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT/**/id/**/FROM/**/users
|
||||
--- error_code: 412
|
||||
=== TEST 12 : sqlmap-master/tamper/apostrophenullencode.py -- 1+AND+%00%271%00%27=%00%271
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+AND+%00%271%00%27=%00%271
|
||||
--- error_code: 412
|
||||
=== TEST 13 : sqlmap-master/tamper/bluecoat.py -- SELECT%09id+FROM+users+where+id+LIKE+1
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT%09id+FROM+users+where+id+LIKE+1
|
||||
--- error_code: 412
|
||||
=== TEST 14 : sqlmap-master/tamper/halfversionedmorekeywords.py -- /*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)),/*!0NULL,/*!0NULL#/*!0AND+QDWa=
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?/*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)),/*!0NULL,/*!0NULL#/*!0AND+QDWa=
|
||||
--- error_code: 412
|
||||
=== TEST 15 : sqlmap-master/tamper/space2dash.py -- 1--nVNaVoPYeva%0AAND--ngNvzqu%0A9227=9227
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1--nVNaVoPYeva%0AAND--ngNvzqu%0A9227=9227
|
||||
--- error_code: 412
|
||||
=== TEST 16 : sqlmap-master/tamper/space2randomblank.py -- SELECT%0Did%0DFROM%0Ausers
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT%0Did%0DFROM%0Ausers
|
||||
--- error_code: 412
|
||||
=== TEST 17 : sqlmap-master/tamper/randomcase.py -- INseRt
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?INseRt+UnIon+plz
|
||||
--- error_code: 412
|
||||
=== TEST 18 : sqlmap-master/tamper/versionedmorekeywords.py -- 1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,/*!CONCAT*/(/*!CHAR*/(58,122,114,115,58),/*!IFNULL*/(CAST(/*!CURRENT_USER*/()/*!AS*//*!CHAR*/),/*!CHAR*/(32)),/*!CHAR*/(58,115,114,121,58))#
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,/*!CONCAT*/(/*!CHAR*/(58,122,114,115,58),/*!IFNULL*/(CAST(/*!CURRENT_USER*/()/*!AS*//*!CHAR*/),/*!CHAR*/(32)),/*!CHAR*/(58,115,114,121,58))#
|
||||
--- error_code: 412
|
||||
=== TEST 19 : sqlmap-master/tamper/percentage.py -- %S%E%L%E%C%T+%F%I%E%L%D+%F%R%O%M+%T%A%B%L%E
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?%S%E%L%E%C%T+%F%I%E%L%D+%F%R%O%M+%T%A%B%L%E
|
||||
--- error_code: 412
|
||||
=== TEST 20 : sqlmap-master/tamper/ifnull2ifisnull.py -- IF(ISNULL(1),2,1)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?IF(ISNULL(1),2,1)
|
||||
--- error_code: 412
|
||||
=== TEST 21 : sqlmap-master/tamper/equaltolike.py -- SELECT+*+FROM+users+WHERE+id+LIKE+1
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT+*+FROM+users+WHERE+id+LIKE+1
|
||||
--- error_code: 412
|
||||
=== TEST 22 : sqlmap-master/tamper/space2mysqlblank.py -- SELECT%0Bid%0DFROM%0Cusers
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT%0Bid%0DFROM%0Cusers
|
||||
--- error_code: 412
|
||||
=== TEST 23 : sqlmap-master/tamper/space2mssqlblank.py -- SELECT%0Eid%0DFROM%07users
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?SELECT%0Eid%0DFROM%07users
|
||||
--- error_code: 412
|
||||
=== TEST 24 : sqlmap-master/tamper/space2hash.py -- 1%23nVNaVoPYeva%0AAND%23ngNvzqu%0A9227=9227
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1%23nVNaVoPYeva%0AAND%23ngNvzqu%0A9227=9227
|
||||
--- error_code: 412
|
||||
=== TEST 25 : sqlmap-master/tamper/modsecurityversioned.py -- 1+/*!30874AND+2>1*/--
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+/*!30874AND+2>1*/--
|
||||
--- error_code: 412
|
||||
=== TEST 26 : sqlmap-master/tamper/versionedkeywords.py -- 1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,+CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURRENT_USER()/*!AS*//*!CHAR*/),CHAR(32)),CHAR(58,100,114,117,58))#
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,+CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURRENT_USER()/*!AS*//*!CHAR*/),CHAR(32)),CHAR(58,100,114,117,58))#
|
||||
--- error_code: 412
|
||||
=== TEST 27 : sqlmap-master/tamper/apostrophemask.py -- 1+AND+%EF%BC%871%EF%BC%87=%EF%BC%871
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+AND+%EF%BC%871%EF%BC%87=%EF%BC%871
|
||||
--- error_code: 200
|
||||
=== TEST 28 : sqlmap-master/tamper/space2morehash.py -- 1%23ngNvzqu%0AAND%23nVNaVoPYeva%0A%23lujYFWfv%0A9227=9227
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1%23ngNvzqu%0AAND%23nVNaVoPYeva%0A%23lujYFWfv%0A9227=9227
|
||||
--- error_code: 412
|
||||
=== TEST 29 : sqlmap-master/tamper/securesphere.py -- 0having=0having
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?0having=0having
|
||||
--- error_code: 200
|
||||
=== TEST 30 : sqlmap-master/tamper/sp_password.py -- 1+AND+9227=9227--+sp_password
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+AND+9227=9227--+sp_password
|
||||
--- error_code: 200
|
||||
=== TEST 31 : sqlmap-master/tamper/nonrecursivereplacement.py -- 1+UNIOUNIONN+SELESELECTCT+2--
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+UNIOUNIONN+SELESELECTCT+2--
|
||||
--- error_code: 412
|
||||
=== TEST 32 : sqlmap-master/tamper/charencode.py -- %53%45%4C%45%43%54%20%46%49%45%4C%44%20%46%52%4F%4D%20%54%41%42%4C%45
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?%53%45%4C%45%43%54%20%46%49%45%4C%44%20%46%52%4F%4D%20%54%41%42%4C%45
|
||||
--- error_code: 412
|
||||
=== TEST 33 : sqlmap-master/tamper/modsecurityzeroversioned.py -- 1+/*!00000AND+2>1*/--
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1+/*!00000AND+2>1*/--
|
||||
--- error_code: 412
|
||||
=== TEST 34 : sqlmap-master/tamper/charunicodeencode.py -- %u0053%u0045%u004C%u0045%u0043%u0054%u0020%u0046%u0049%u0045%u004C%u0044%u0020%u0046%u0052%u004F%u004D%u0020%u0054%u0041%u0042%u004C%u0045
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?%u0053%u0045%u004C%u0045%u0043%u0054%u0020%u0046%u0049%u0045%u004C%u0044%u0020%u0046%u0052%u004F%u004D%u0020%u0054%u0041%u0042%u004C%u0045
|
||||
--- error_code: 412
|
||||
=== TEST 35 : sqlmap-master/tamper/space2mysqldash.py -- 1--%0AAND--%0A9227=9227
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1--%0AAND--%0A9227=9227
|
||||
--- error_code: 412
|
||||
=== TEST 36 : sqlmap-master/tamper/space2mssqlhash.py -- 1%23%0AAND%23%0A9227=9227
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?1%23%0AAND%23%0A9227=9227
|
||||
--- error_code: 412
|
||||
362
naxsi-0.55.3/t/22libinjection-base.t
vendored
Normal file
362
naxsi-0.55.3/t/22libinjection-base.t
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
repeat_each(3);
|
||||
|
||||
plan tests => repeat_each(1) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 2 : Check libinjection_xss is disabled by default
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=a' onmouseover='alert(1) HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 2.1 : Check libinjection_xss can be enabled
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LibInjectionXss;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=<script>alert(1)</script> HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 2.2 : Check libinjection_xss can be enabled and dyn disabled
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_xss 0;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LibInjectionXss;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=<script>alert(1)</script> HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 2.3 : Check libinjection_xss can be disabled and dyn enabled
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_xss 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=<script>alert(1)</script> HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 3 : Check libinjection_sql is disabled by default
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=1' OR '1'='1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 3.1 : Check libinjection_sql can be enabled
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LibInjectionSql;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=1' OR '1'='1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 3.2 : Check libinjection_sql can be enabled and dyn disabled
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_sql 0;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LibInjectionSql;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=1' OR '1'='1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
=== TEST 3.3 : Check libinjection_sql can be disabled and dyn enabled
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_sql 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=1' OR '1'='1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
=== TEST 4.0 : whitelist libinjection_sql
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_sql 1;
|
||||
location / {
|
||||
BasicRule wl:17 "mz:$URL:/|$ARGS_VAR:x";
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=1' OR '1'='1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
=== TEST 4.1 : whitelist libinjection_xss
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_xss 1;
|
||||
location / {
|
||||
BasicRule wl:18 "mz:$URL:/|$ARGS_VAR:x";
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?x=<script>alert(1)</script> HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 4.2 : whitelist libinjection_xss (|NAME)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_xss 1;
|
||||
location / {
|
||||
BasicRule wl:18 "mz:$URL:/|ARGS|NAME";
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?<script>alert(1)</script>=1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 4.3 : whitelist libinjection_sql (|NAME)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_sql 1;
|
||||
location / {
|
||||
BasicRule wl:17 "mz:$URL:/|ARGS|NAME";
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a/**/UNION+SELECT+1,1=1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 4.3.1 : whitelist fail libinjection_sql (|NAME)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_sql 1;
|
||||
location / {
|
||||
BasicRule wl:17 "mz:$URL:/x|ARGS|NAME";
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a' UNION SELECT 1,1=1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 4.3.2 : whitelist fail libinjection_xss (|NAME)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_flag_libinjection_xss 1;
|
||||
location / {
|
||||
BasicRule wl:18 "mz:$URL:/x|ARGS|NAME";
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?a><script>alert(1)</script>=1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
262
naxsi-0.55.3/t/23verylong.t
vendored
Normal file
262
naxsi-0.55.3/t/23verylong.t
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
naxsi-0.55.3/t/24rawbody.t
vendored
Normal file
BIN
naxsi-0.55.3/t/24rawbody.t
vendored
Normal file
Binary file not shown.
368
naxsi-0.55.3/t/25extra-coverage.t
vendored
Normal file
368
naxsi-0.55.3/t/25extra-coverage.t
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
repeat_each(3);
|
||||
|
||||
plan tests => repeat_each(1) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1.0: Basic GET request, with allow rule (useless, just for coverage. ALLOW should be killed)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:ARGS" "s:$TEST:42";
|
||||
#MainRule id:4242 "str:XXX" "s:$SQL:8" "mz:ARGS";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=ratataXXX
|
||||
--- error_code: 200
|
||||
=== TEST 1.1: Basic GET request, with global score increase
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:ARGS" "s:42";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?a=ratataXXX
|
||||
--- error_code: 200
|
||||
=== TEST 1.2: rule on headers
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
BasicRule id:4241 "str:ratata" "mz:HEADERS" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- more_headers
|
||||
headertest: ratata
|
||||
--- request
|
||||
GET /?a=XXX
|
||||
--- error_code: 412
|
||||
=== TEST 1.2: extensive log while targeting name
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
BasicRule id:4241 "str:ratata" "mz:ARGS" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?ratata=tututu
|
||||
--- error_code: 200
|
||||
=== TEST 1.2: extensive log while targeting name
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
BasicRule id:4241 "str:ratata" "mz:ARGS" "s:LOG";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?ratata=tututu
|
||||
--- error_code: 200
|
||||
=== TEST 1.3: rule on url
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
BasicRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /ratata?x=tututu
|
||||
--- error_code: 412
|
||||
=== TEST 1.4: add post action as dynamic flag
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
set $naxsi_flag_post_acton 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
BasicRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /ratata?x=tututu
|
||||
--- error_code: 412
|
||||
=== TEST 1.5.0: HEADER_VAR_X
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule id:4241 "str:ratata" "mz:$HEADERS_VAR_X:ruuu" "s:BLOCK";
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
set $naxsi_flag_post_acton 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
# BasicRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- more_headers
|
||||
ruuu: ratata1
|
||||
--- request
|
||||
GET /ratata?x=tututu
|
||||
--- error_code: 412
|
||||
=== TEST 1.5.1: HEADER_VAR_X
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule id:4241 "str:ratata" "mz:$HEADERS_VAR_X:ruuu|$URL_X:^/fufu" "s:BLOCK";
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
set $naxsi_flag_post_acton 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
# BasicRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- more_headers
|
||||
ruuu: ratata1
|
||||
--- request
|
||||
GET /fufu?x=tututu
|
||||
--- error_code: 412
|
||||
=== TEST 1.5.2: HEADER_VAR_X
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule id:4241 "str:ratata" "mz:$HEADERS_VAR_X:ruuu|$URL_X:^/fufu" "s:BLOCK";
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
set $naxsi_flag_post_acton 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
# BasicRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- more_headers
|
||||
ruuu: ratata1
|
||||
--- request
|
||||
GET /fuf?x=tututu
|
||||
--- error_code: 404
|
||||
=== TEST 1.6.0: URL + URL wl
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
set $naxsi_flag_post_acton 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
BasicRule wl:4241 "mz:URL";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /ratata
|
||||
--- error_code: 404
|
||||
=== TEST 1.6.1: URL + URL wl
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule id:4241 "str:ratata" "mz:URL" "s:BLOCK";
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
set $naxsi_flag_post_acton 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
BasicRule wl:4241 "mz:BODY";
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
# return 412;
|
||||
}
|
||||
--- request
|
||||
GET /ratata
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
592
naxsi-0.55.3/t/26improved-matchzones.t
vendored
Normal file
592
naxsi-0.55.3/t/26improved-matchzones.t
vendored
Normal file
@@ -0,0 +1,592 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
repeat_each(3);
|
||||
|
||||
plan tests => repeat_each(1) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
__DATA__
|
||||
=== TEST 1.0: blacklist on static var name (good)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratz" "mz:$ARGS_VAR:foo1|$URL:/ff" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:foo" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratz" "mz:$ARGS_VAR:foo1" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=ratataXXX
|
||||
--- error_code: 412
|
||||
=== TEST 1.1: blacklist on static var name (bad)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:foo1/$URL:/zz" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:foo" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:foo/$URL:/zz" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foox=ratataXXX
|
||||
--- error_code: 200
|
||||
=== TEST 2.0: blacklist on rx var name (good)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^foa[0-9]+$|$URL_X:/f1" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^foo[0-9]+$" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^foa[0-9]+$|$URL_X:/ff" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^foa[0-9]+$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo888=ratataXXX
|
||||
--- error_code: 412
|
||||
=== TEST 2.1: blacklist on rx var name (bad)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^foo[0-9]+$/$URL_X:/z" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^foo[0-9]+$" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^fo1[0-9]+$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foob=ratataXXX
|
||||
--- error_code: 200
|
||||
=== TEST 3.0: blacklist on rx var name (bad zone)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$BODY_VAR_X:^foo[0-9]+$|$URL_X:/fz" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$BODY_VAR_X:^foo[0-9]+$" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$BODY_VAR_X:^fo1[0-9]+$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo88=ratataXXX
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 3.1: blacklist on static var name (bad zone)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$BODY_VAR:foo|$URL:/f" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$BODY_VAR:foo" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=ratataXXX
|
||||
--- error_code: 200
|
||||
|
||||
=== TEST 4.0: blacklist on multi static var name (one good, many bad)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/zz|$ARGS_VAR:aaa|$ARGS_VAR:foo|$ARGS_VAR:nope" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:aaa|$ARGS_VAR:foo|$ARGS_VAR:nope" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 4.1: blacklist on multi rx var name (one good, many bad)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL_X:^/z$|$ARGS_VAR_X:^aaa$|$ARGS_VAR_X:^foo$|$ARGS_VAR_X:^nope$" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^aaa$|$ARGS_VAR_X:^foo$|$ARGS_VAR_X:^nope$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 5.0: blacklist on multi rx var name (many bad)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^aaa$|$ARGS_VAR_X:^foo$|$ARGS_VAR_X:^nope$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo1=ratataXXX
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 5.1: blacklist on multi rx var name (many bad, one good zone)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR_X:^aaa$|$ARGS_VAR_X:^foo$|$ARGS_VAR_X:^nope$|ARGS" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo1=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 6.0: blacklist on multi static var name (many bad)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:^aaa$|$ARGS_VAR:^foo$|$ARGS_VAR:^nope$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo1=ratataXXX
|
||||
--- error_code: 200
|
||||
|
||||
|
||||
=== TEST 6.1: blacklist on multi static var name (many bad, one good zone)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$ARGS_VAR:^aaa$|$ARGS_VAR:^foo$|$ARGS_VAR:^nope$|ARGS" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?foo1=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 7.0: static blacklist on $URL:/ | $ARGS_VAR (both good)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/fooa|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/foo|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/fooz|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?aaa=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 7.1: static blacklist on $URL:/ | $ARGS_VAR (bad url)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/foo1|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/foo|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/foo2|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foox?aaa=ratataXXX
|
||||
--- error_code: 404
|
||||
|
||||
|
||||
|
||||
=== TEST 7.2: static blacklist on $URL:/ | $ARGS_VAR (bad ARGS_VAR)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/foo|$ARGS_VAR:aaa" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?axaa=ratataXXX
|
||||
--- error_code: 404
|
||||
|
||||
=== TEST 7.3: static blacklist on $URL:/ | $ARGS_VAR (one bad ARGS_VAR and one good)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL:/foo|$ARGS_VAR:aaa|$ARGS_VAR:tutu" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?tutu=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 7.0: rx blacklist on $URL_X:/ | $ARGS_VAR_X (both good)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL_X:^/foo$|$ARGS_VAR_X:^aaa[0-9]+$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?aaa4242=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 7.1: rx blacklist on $URL_X:/ | $ARGS_VAR_X (bad url)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL_X:^/foo$|$ARGS_VAR_X:^aaa$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foox?aaa=ratataXXX
|
||||
--- error_code: 404
|
||||
|
||||
|
||||
|
||||
=== TEST 7.2: rx blacklist on $URL_X:/ | $ARGS_VAR_X (bad ARGS_VAR)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL_X:^/foo$|$ARGS_VAR_X:^aaa$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?axaa=ratataXXX
|
||||
--- error_code: 404
|
||||
|
||||
=== TEST 7.3: static blacklist on $URL:/ | $ARGS_VAR (one bad ARGS_VAR and one good)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule id:4241 "str:ratata" "mz:$URL_X:^/foo$|$ARGS_VAR_X:^aaa$|$ARGS_VAR_X:^tutu$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /foo?tutu=ratataXXX
|
||||
--- error_code: 412
|
||||
|
||||
|
||||
=== TEST 8.0: gni ?
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "str:foobar" "mz:$ARGS_VAR_X:^foo.*" "msg:lol" "s:DROP" id:42424242;
|
||||
#MainRule id:4241 "str:ratata" "mz:$URL_X:^/foo$|$ARGS_VAR_X:^aaa$|$ARGS_VAR_X:^tutu$" "s:$XSS:8";
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
CheckRule "$RFI >= 8" BLOCK;
|
||||
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||
CheckRule "$XSS >= 8" BLOCK;
|
||||
CheckRule "$TEST >= 8" ALLOW;
|
||||
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?fooxxxad=foobar
|
||||
--- error_code: 412
|
||||
|
||||
157
naxsi-0.55.3/t/27libinjection-blacklist.t
vendored
Normal file
157
naxsi-0.55.3/t/27libinjection-blacklist.t
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
repeat_each(3);
|
||||
|
||||
plan tests => repeat_each(1) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1 : Enable libinjection s:DROP on named var
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "d:libinj_xss" "s:DROP" "mz:$ARGS_VAR:ruuu" id:41231;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?ruuu=a' onmouseover='alert(1) HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
=== TEST 1.1 : Enable libinjection s:DROP on (bad) named var
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "d:libinj_xss" "s:DROP" "mz:$ARGS_VAR:ruuuu" id:41231;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?ruuu=a' onmouseover='alert(1) HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
=== TEST 1.2 : Enable libinjection s:DROP on (bad) named var
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "d:libinj_xss" "s:DROP" "mz:$ARGS_VAR:ruu" id:41231;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?ruuu=a' onmouseover='alert(1) HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 200
|
||||
=== TEST 2.1 : Enable libinjection s:$FOOBAR on named var
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "d:libinj_xss" "s:$FOOBAR:8" "mz:$ARGS_VAR_X:^fuu[0-9]+$" id:41231;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
CheckRule "$FOOBAR >= 8" DROP;
|
||||
DeniedUrl "/RequestDenied";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /?fuu4242424=a' onmouseover='alert(1) HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
|
||||
=== TEST 3.0 : Enable libinjection (sql) s:DROP on named var+url
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "d:libinj_sql" "s:$FOOBAR:8" "mz:$ARGS_VAR_X:^fuu[0-9]+$|$URL_X:^/foobar/$" id:41231;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
CheckRule "$FOOBAR >= 8" DROP;
|
||||
DeniedUrl "/RequestDenied";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /foobar/?fuu4242424=1' OR '1'='1 HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 412
|
||||
=== TEST 3.0 : Enable libinjection (sql) s:DROP on named var+url (not a valid sqli)
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "d:libinj_sql" "s:$FOOBAR:8" "mz:$ARGS_VAR_X:^fuu[0-9]+$|$URL_X:^/foobar/$" id:41231;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
CheckRule "$FOOBAR >= 8" DROP;
|
||||
DeniedUrl "/RequestDenied";
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- raw_request eval
|
||||
"GET /foobar/?fuu4242424=1' OR \"1\"= HTTP/1.0
|
||||
|
||||
"
|
||||
--- error_code: 404
|
||||
|
||||
160
naxsi-0.55.3/t/28log.t
vendored
Normal file
160
naxsi-0.55.3/t/28log.t
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
log_level('error');
|
||||
#1.3 : +2 tests
|
||||
plan tests => repeat_each() * (blocks() * 2 + (7));
|
||||
no_root_location();
|
||||
#no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
|
||||
|
||||
__DATA__
|
||||
=== TEST 1.0 : learning + block score, NAXSI_FMT
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule "str:," "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request eval
|
||||
"GET /x,y?uuu=b,c"
|
||||
--- error_code: 404
|
||||
--- error_log eval
|
||||
qr@NAXSI_FMT: ip=127\.0\.0\.1&server=localhost&uri=/x,y&learning=1&vers=[^&]+&total_processed=1&total_blocked=1&block=1&cscore0=\$SQL&score0=8&zone0=URL&id0=1015&var_name0=&zone1=ARGS&id1=1015&var_name1=uuu@
|
||||
=== TEST 1.2 : no-learning + block score, NAXSI_FMT
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule "str:," "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /x,y?uuu=b,c
|
||||
--- error_code: 412
|
||||
--- error_log eval
|
||||
qr@NAXSI_FMT: ip=127\.0\.0\.1&server=localhost&uri=/x,y&learning=0&vers=[^&]+&total_processed=1&total_blocked=1&block=1&cscore0=\$SQL&score0=8&zone0=URL&id0=1015&var_name0=&zone1=ARGS&id1=1015&var_name1=uuu, client: 127\.0\.0\.1, server: localhost,@
|
||||
=== TEST 1.3 : learning + block score + naxsi_extensive_log, NAXSI_EXLOG and NAXSI_FMT
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule "str:," "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /x,y?uuu=b,c
|
||||
--- error_code: 404
|
||||
--- error_log eval
|
||||
[qr@NAXSI_FMT: ip=127\.0\.0\.1&server=localhost&uri=/x,y&learning=1&vers=[^&]+&total_processed=1&total_blocked=1&block=1&cscore0=\$SQL&score0=8&zone0=URL&id0=1015&var_name0=&zone1=ARGS&id1=1015&var_name1=uuu@,
|
||||
qr@NAXSI_EXLOG: ip=127\.0\.0\.1&server=localhost&uri=/x,y&id=1015&zone=URL&var_name=&content=/x,y,@,
|
||||
qr@NAXSI_EXLOG: ip=127\.0\.0\.1&server=localhost&uri=/x,y&id=1015&zone=ARGS&var_name=uuu&content=b,c@
|
||||
]
|
||||
=== TEST 1.4 : learning + no-block score + naxsi_extensive_log, NAXSI_EXLOG only
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule "str:," "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
||||
--- config
|
||||
set $naxsi_extensive_log 1;
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /x,y?uuu=bc
|
||||
--- error_code: 404
|
||||
--- error_log eval
|
||||
qr@NAXSI_EXLOG: ip=127\.0\.0\.1&server=localhost&uri=/x,y&id=1015&zone=URL&var_name=&content=/x,y, client: 127\.0\.0\.1,@
|
||||
--- no_error_log
|
||||
NAXSI_FMT
|
||||
=== TEST 1.6 : learning + block-score + naxsi_extensive_log, NAXSI_EXLOG only
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule "str:foo" "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request eval
|
||||
[["GET /", "afoo"x256, "?f", "ufoo"x256, "=1", "Afoo"x256]]
|
||||
--- error_code: 404
|
||||
--- error_log eval
|
||||
[ qr@NAXSI_FMT: ip=127\.0\.0\.1&server=localhost&uri=/afooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafoo&learning=\d+&vers=[^&]+&total_processed=\d+&total_blocked=\d+&block=1&cscore0=\$SQL&score0=3072&zone0=URL&id0=1015&var_name0=&seed_start=\d+,@ ,
|
||||
qr@NAXSI_FMT: seed_end=\d+&zone1=ARGS&id1=1015&var_name1=fufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufoo&seed_start=\d+, @,
|
||||
qr@NAXSI_FMT: seed_end=\d+&zone2=ARGS|NAME&id2=1015&var_name2=fufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufoo,@]
|
||||
=== TEST 1.7 : learning + block-score + naxsi_extensive_log, NAXSI_EXLOG only
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
MainRule "str:foo" "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
LearningMode;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 8" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request eval
|
||||
[["GET /", "afoo"x128, "?f", "ufoo"x256, "=1", "Afoo"x1024]]
|
||||
--- error_code: 404
|
||||
--- error_log eval
|
||||
[ qr@NAXSI_FMT: ip=127\.0\.0\.1&server=localhost&uri=/afooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafooafoo&learning=1&vers=[^&]+&total_processed=\d+&total_blocked=\d+&block=1&cscore0=\$SQL&score0=5632&zone0=URL&id0=1015&var_name0=&zone1=ARGS&id1=1015&var_name1=fufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufoo&seed_start=\d+,@ ,
|
||||
qr@NAXSI_FMT: seed_end=\d+&zone2=ARGS|NAME&id2=1015&var_name2=fufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufooufoo, @]
|
||||
--- no_error_log
|
||||
NAXSI_EXLOG
|
||||
|
||||
|
||||
211
naxsi-0.55.3/t/29regression.t
vendored
Normal file
211
naxsi-0.55.3/t/29regression.t
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
#vi:filetype=perl
|
||||
|
||||
|
||||
# A AJOUTER :
|
||||
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
|
||||
# La même sur des arguments :)
|
||||
|
||||
use lib 'lib';
|
||||
use Test::Nginx::Socket;
|
||||
|
||||
plan tests => repeat_each(2) * blocks();
|
||||
no_root_location();
|
||||
no_long_string();
|
||||
$ENV{TEST_NGINX_SERVROOT} = server_root();
|
||||
run_tests();
|
||||
__DATA__
|
||||
=== WL TEST 1.0: [ARGS zone WhiteList] Adding a test rule in http_config (ARGS zone) and disable rule.
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /?driveOnDate=2016-11-29
|
||||
--- error_code: 200
|
||||
|
||||
=== WL TEST 1.1: testing multiple alternate matching/non-matching rules
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "rx:zz" "mz:$URL_X:/foo/|$ARGS_VAR_X:^id$" "s:DROP" id:4242001;
|
||||
MainRule negative "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242002;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /wp-json/wp/v2/?id=a
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.2: testing multiple alternate matching/non-matching rules
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "rx:zz" "mz:$URL_X:/foo/|$ARGS_VAR_X:^id$" "s:DROP" id:4242001;
|
||||
MainRule negative "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242002;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /wp-json/wp/v2?id=a
|
||||
--- error_code: 404
|
||||
|
||||
=== WL TEST 1.3: testing multiple alternate matching/non-matching rules
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "rx:zz" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242001;
|
||||
MainRule negative "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242002;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /wp-json/wp/v2?id=11
|
||||
--- error_code: 404
|
||||
|
||||
=== WL TEST 1.4: testing multiple alternate matching/non-matching rules
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "rx:zz" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242001;
|
||||
MainRule "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242002;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /wp-json/wp/v2/?id=zz
|
||||
--- error_code: 412
|
||||
|
||||
=== WL TEST 1.5: testing multiple alternate matching/non-matching rules
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule "rx:zz" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242001;
|
||||
MainRule "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$ARGS_VAR_X:^id$" "s:DROP" id:4242002;
|
||||
MainRule "str:iyxnlnjrf" "mz:$URL_X:^(/index.php)?/qquoteadv|ARGS|BODY" "s:DROP" "msg:base64_" id:42000526;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- request
|
||||
GET /qquoteadv?id=iyxnlnjrf1
|
||||
--- error_code: 412
|
||||
=== WL TEST 2.0: log + drop
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^[\d_-]+$" "mz:$ARGS_VAR:id" "s:$LOG_TEST:1" "msg:wordpress < 4.7.2 wp-json" id:42000530;
|
||||
MainRule negative "rx:^[\d_-]+$" "mz:$BODY_VAR:id" "s:$LOG_TEST:1" "msg:wordpress < 4.7.2 wp-json" id:42000529;
|
||||
MainRule negative "rx:^\d+$" "mz:$ARGS_VAR_X:^id$|$URL_X:/wp-json/wp/v2/" "s:$UWA:8" "msg:wordpress < 4.7.2 wp-json" id:42000531;
|
||||
MainRule negative "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$BODY_VAR_X:^id$" "s:$UWA:8" "msg:wordpress < 4.7.2 wp-json" id:42000532;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
CheckRule "$LOG_TEST >= 1" LOG;
|
||||
CheckRule "$UWA >= 8" DROP;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /wp-json/wp/v2/posts/111
|
||||
id=1a&foo2=bar2"
|
||||
--- error_code: 412
|
||||
=== WL TEST 2.01: log + block
|
||||
--- main_config
|
||||
load_module /tmp/naxsi_ut/modules/ngx_http_naxsi_module.so;
|
||||
|
||||
--- http_config
|
||||
include /tmp/naxsi_ut/naxsi_core.rules;
|
||||
MainRule negative "rx:^[\d_-]+$" "mz:$ARGS_VAR:id" "s:$LOG_TEST:1" "msg:wordpress < 4.7.2 wp-json" id:42000530;
|
||||
MainRule negative "rx:^[\d_-]+$" "mz:$BODY_VAR:id" "s:$LOG_TEST:1" "msg:wordpress < 4.7.2 wp-json" id:42000529;
|
||||
MainRule negative "rx:^\d+$" "mz:$ARGS_VAR_X:^id$|$URL_X:/wp-json/wp/v2/" "s:$UWA:8" "msg:wordpress < 4.7.2 wp-json" id:42000531;
|
||||
MainRule negative "rx:^\d+$" "mz:$URL_X:/wp-json/wp/v2/|$BODY_VAR_X:^id$" "s:$UWA:8" "msg:wordpress < 4.7.2 wp-json" id:42000532;
|
||||
--- config
|
||||
location / {
|
||||
SecRulesEnabled;
|
||||
CheckRule "$LOG_TEST >= 1" LOG;
|
||||
CheckRule "$UWA >= 8" BLOCK;
|
||||
DeniedUrl "/RequestDenied";
|
||||
CheckRule "$SQL >= 4" BLOCK;
|
||||
root $TEST_NGINX_SERVROOT/html/;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /RequestDenied {
|
||||
return 412;
|
||||
}
|
||||
--- more_headers
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
--- request eval
|
||||
use URI::Escape;
|
||||
"POST /wp-json/wp/v2/posts/111
|
||||
id=1a&foo2=bar2"
|
||||
--- error_code: 412
|
||||
Reference in New Issue
Block a user