~ubuntu-branches/ubuntu/saucy/nginx/saucy-updates

« back to all changes in this revision

Viewing changes to debian/modules/naxsi/contrib/testing_units_fuzzer/http.py

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Cyril Lavier, Michael Lustfield, Kartik Mistry
  • Date: 2012-05-14 11:15:00 UTC
  • mfrom: (4.2.49 sid)
  • Revision ID: package-import@ubuntu.com-20120514111500-1y9ij7zulu9xnmry
Tags: 1.2.0-1
[Cyril Lavier]
* New upstream release. (Closes: #670306)
  + 1.2.x is stable release now.
* debian/modules/chunkin-nginx-module:
  + Updated chunkin-nginx-module to v0.23rc2-3-g85eca98.
* debian/modules/headers-more-module:
  + Updated headers-more-module to v0.17rc1-4-g33a82ed.
* debian/modules/nginx-development-kit:
  + Updated nginx-development-kit to v0.2.17-7-g24202b4.
* debian/modules/nginx-echo:
  + Updated nginx-echo to v0.38rc2-7-g080c0a1.
* debian/modules/nginx-lua:
  + Updated nginx-lua to v0.5.0rc25-5-g8d28785.
* debian/modules/nginx-upstream-fair:
  + Updated nginx-upstream-fair to a18b409.
* debian/modules/nginx-upload-progress:
  + Updated nginx-upload-progress to v0.9.0-0-ga788dea.
* debian/modules/naxsi:
  + Updated naxsi to 0.46
* debian/modules/README.Modules-versions:
  + Updated versions and URLs for modules.
* debian/naxsi-ui-extract, debian/naxsi-ui-intercept,
  debian/nginx-naxsi-ui.*, debian/naxsi-ui-extract.1,
  debian/naxsi-ui-intercept.1, debian/rules:
  + Added nginx-naxsi-ui package containing the learning daemon
    and the WebUI.
* debian/nginx-common.nginx.default, debian/nginx-common.nginx.init:
  + Renamed files to be compliant with the nginx-naxsi-ui package.
* debian/po:
  + Added needed files for using po-debconf.
  + Added French translation.
* debian/control:
  + Applied the modifications given after the review by Justin Rye.

[Michael Lustfield]
* debian/conf/uwsgi_params:
  + Added UWSGI_SCHEME to uwsgi_params. (Closes: #664878)
* debian/conf/sites-available/default:
  + Added allow directive for ipv6 localhost. (Closes: #664271)

[Kartik Mistry]
* debian/control:
  + wrap-and-sort.
* debian/copyright:
  + Added missing copyrights, minor formatting fixes.
* debian/nginx-common.nginx.init:
  + Added ulimit for restarts, Thanks to Daniel Roschka
    <danielroschka@phoenitydawn.de> for patch. (Closes: #673580)
* debian/conf/sites-available/default:
  + Added patch to fix deprecated "listen" directive, Thanks to
    Guillaume Plessis <gui@dotdeb.org> for patch. (Closes: #672632)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from sulley import *
 
2
import sys
 
3
 
 
4
########################################################################################################################
 
5
s_initialize("HTTP VERBS BASIC")
 
6
s_group("verbs", values=["GET", "HEAD"])
 
7
if s_block_start("body", group="verbs"):
 
8
    s_static(" ")
 
9
    s_delim(" ")
 
10
    s_static("/")
 
11
    s_string("index.html")
 
12
    s_delim("> ")
 
13
    s_string("HTTP")
 
14
    s_delim("/")
 
15
    s_string("1")
 
16
    s_delim(".")
 
17
    s_string("0")
 
18
    s_static("\r\n\r\n")
 
19
s_block_end()
 
20
 
 
21
 
 
22
########################################################################################################################
 
23
s_initialize("HTTP VERBS POST")
 
24
s_static("POST / HTTP/1.0\r\n")
 
25
s_static("Content-Type: ")
 
26
s_string("application/x-www-form-urlencoded")
 
27
s_static("\r\n")
 
28
s_static("Content-Length: ")
 
29
s_size("post blob", format="ascii", signed=True, fuzzable=True)
 
30
s_static("\r\n\r\n")
 
31
 
 
32
if s_block_start("post blob"):
 
33
    s_string("A"*100 + "=" + "B1"*100)
 
34
s_block_end()
 
35
 
 
36
 
 
37
########################################################################################################################
 
38
s_initialize("HTTP HEADERS")
 
39
s_static("GET / HTTP/1.1\r\n")
 
40
 
 
41
# let's fuzz random headers with malformed delimiters.
 
42
s_string("Host")
 
43
s_delim(":")
 
44
s_delim(" ")
 
45
s_string("localhost")
 
46
s_delim("\r\n")
 
47
 
 
48
# let's fuzz the value portion of some popular headers.
 
49
s_static("User-Agent: ")
 
50
s_string("Mozilla/5.0 (Windows; U)")
 
51
s_static("\r\n")
 
52
 
 
53
s_static("Accept-Language: ")
 
54
s_string("en-us")
 
55
s_delim(",")
 
56
s_string("en;q=0.5")
 
57
s_static("\r\n")
 
58
 
 
59
s_static("Keep-Alive: ")
 
60
s_string("300")
 
61
s_static("\r\n")
 
62
 
 
63
s_static("Connection: ")
 
64
s_string("keep-alive")
 
65
s_static("\r\n")
 
66
 
 
67
s_static("Referer: ")
 
68
s_string("http://dvlabs.tippingpoint.com")
 
69
s_static("\r\n")
 
70
s_static("\r\n")
 
71
 
 
72
 
 
73
########################################################################################################################
 
74
s_initialize("HTTP COOKIE")
 
75
s_static("GET / HTTP/1.0\r\n")
 
76
 
 
77
if s_block_start("cookie"):
 
78
    s_static("Cookie: ")
 
79
    s_string("auth")
 
80
    s_delim("=")
 
81
    s_string("1234567890<a>")
 
82
    s_static("\r\n")
 
83
    s_block_end()
 
84
 
 
85
s_repeat("cookie", max_reps=5000, step=500)
 
86
s_static("\r\n")
 
87
 
 
88
 
 
89
s_initialize("HTTP VERBS")
 
90
s_group("verbs", values=["GET", "HEAD", "POST", "OPTIONS", "TRACE", "PUT", "DELETE", "PROPFIND"])
 
91
if s_block_start("body", group="verbs"):
 
92
    s_delim(" ")
 
93
    s_delim("/")
 
94
    s_string("index.html")
 
95
    s_delim("<a ")
 
96
    s_string("HTTP")
 
97
    s_delim("/")
 
98
    s_string("1")
 
99
    s_delim(".")
 
100
    s_string("0")
 
101
    s_static("\r\n\r\n")
 
102
s_block_end()
 
103
 
 
104
sess = sessions.session()
 
105
gc=0
 
106
fw=None
 
107
for target in ("HTTP VERBS", "HTTP COOKIE", "HTTP VERBS BASIC", "HTTP VERBS POST",
 
108
               "HTTP HEADERS"):
 
109
    if (fw is not None):
 
110
        fw.close()
 
111
        fw = None
 
112
    fw = open(target+"-ut.t", "w+")
 
113
    fw.write("# fuzzed testcase. ")
 
114
    fw.write("""
 
115
use lib 'lib';
 
116
use Test::Nginx::Socket;
 
117
 
 
118
plan tests => repeat_each(2) * blocks();
 
119
no_root_location();
 
120
no_long_string();
 
121
$ENV{TEST_NGINX_SERVROOT} = server_root();
 
122
run_tests();
 
123
__DATA__
 
124
""")
 
125
    req = s_get(target)
 
126
    for i in xrange(0,150):
 
127
        gc = gc + 1
 
128
        s_mutate()
 
129
 
 
130
        fw.write("=== "+str(gc)+" in "+target+"\n")
 
131
        fw.write("""--- main_config
 
132
working_directory /tmp/;
 
133
worker_rlimit_core 25M;
 
134
--- http_config
 
135
include /etc/nginx/naxsi_core.rules;
 
136
--- config
 
137
location / {
 
138
SecRulesEnabled;
 
139
 DeniedUrl "/RequestDenied";
 
140
  CheckRule "$SQL >= 8" BLOCK;
 
141
   CheckRule "$RFI >= 8" BLOCK;
 
142
        CheckRule "$TRAVERSAL >= 4" BLOCK;
 
143
        CheckRule "$XSS >= 8" BLOCK;
 
144
         root $TEST_NGINX_SERVROOT/html/;
 
145
         index index.html index.htm;
 
146
         }
 
147
         location /RequestDenied {
 
148
         return 400;
 
149
         }
 
150
--- raw_request eval\n""")
 
151
        fw.write("\""+req.render()+"\"\n")
 
152
        if (target is "foobar"):
 
153
            fw.write("--- error_code: 400\n\n")
 
154
        # elif (target is "HTTP HEADERS"):
 
155
        #     fw.write("--- error_code: 400\n\n")
 
156
        # elif (target is "HTTP VERBS BASIC"):
 
157
        #     fw.write("--- error_code: 400\n\n")
 
158
        else:
 
159
            fw.write("--- error_code: 400\n\n")
 
160
#        print(req.render())
 
161
#        print("#END")
 
162
sys.exit(1);
 
163
 
 
164
########################################################################################################################