Initial Commit
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user