bscan 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,131 @@
1
+
2
+ == CONVENTIONS
3
+ Config file contains options for Burb, BScan and external BScan modules.
4
+ All bscan properties start with 'bscan.' prefix.
5
+ All modules properties have the following prefix:
6
+
7
+ bscan.<module_name>[.<module_instance_id>].
8
+
9
+ Module <module_instance_id> is optional and is needed when the same
10
+ module is run several times with different parameters.
11
+ bscan.modules property contains a list of all modules to run separated by ','
12
+
13
+ bscan.modules=<module_path>[:<module_instance_id>], ...
14
+
15
+ If <module_path> is realtive, the 'SEARCH PATH RULES' will be used
16
+ If static_request property is set to true, the modules will not be called
17
+ from the Burp's spider, a static request should be provided in a config
18
+ file instead, e.g.
19
+
20
+ bscan.injector.three.file=../config/injector.txt
21
+ bscan.injector.three.check_replay=true
22
+
23
+ injector.txt file should contain a valid request in the example above.
24
+
25
+ == SEARCH PATH RULES
26
+ The following path will be used to search a config file or any relative
27
+ path that configs refers to:
28
+
29
+ .:./lib:~/.bscan:/etc/bscan:<jruby_system_path_defined_by_$:>
30
+
31
+ see BscannerHelper#search_path for details
32
+
33
+ == BScan Specific Parameters
34
+ * bscan.modules - see 'CONVENTIONS' for details
35
+ * bscan.inactivity_to - inactivity is sec that triggers exit
36
+ * bscan.issues=issues - output directory for findings/issues
37
+ * scan.modules_only - if true, only modules with static requests
38
+ will run (no spider)
39
+ * bscan.url - URL to spider, multiple entries are OK. Have no effect
40
+ if scan.modules_only=true
41
+
42
+ == Modules Included to the Package
43
+ * injector.rb - injects malicious patterns provided in a file (e.g. Google's
44
+ fuzzdb) to URL or body parameters. It can also inject to pattern marked
45
+ by special separators (see inject_instead_of param below)
46
+ * many_threads.rb - runs a static query in multiple threads. Can repeat
47
+ patterns multiple times to increase impact on a server
48
+
49
+ == injector.rb Module Parameters
50
+ * bscan.injector.file - file with malicious patterns (e.g. Google's fuzzdb)
51
+ * bscan.injector.inject_to_body - if true injects to body params, otherwise
52
+ to URL params only
53
+ * bscan.injector.check_rsp_max_time=n - log an issue if response time > n sec
54
+ * bscan.injector.check_status - log an issue if a status code >= 500
55
+ * bscan.injector.check_replay - log XSS issue if input is replayed in a
56
+ response
57
+ * bscan.injector.inject_instead_of=<sep>:<request>:<protocol> - replaces
58
+ <sep>(.*)<sep> occurences with injections provided in 'file'
59
+ <request> - a request file with <sep>(.*)<sep> patterns
60
+ <protocol> - either http or https
61
+ * bscan.injector.static_request if true, won't be called from spider
62
+
63
+ == many_threads.rb Module Parameters
64
+ * bscan.many_threads.request=<request>:<protocol>:<rep-pat>
65
+ <request> - a file with a request
66
+ <protocol> - http or https
67
+ <rep-pat> - <rep-pat>(.*)<rep-pat>N patterns will be replaced
68
+ with (.*) repeated N times. Useful if you want to generate
69
+ huge requests using small input files.
70
+ * bscan.many_threads.threads=n - number of threads
71
+ * bscan.many_threads.static_request=true won't be called from spider
72
+ It actually should be true for this module
73
+
74
+ == slowloris.rb Module Parameters
75
+ It's important not to exceed the maximum file number on your
76
+ client, otherwise it might not work. It's also important to
77
+ set up a correct timeout (sleep_time) that should not be
78
+ bigger than server's read timeout.
79
+
80
+ * bscan.slowloris.hostport=<host>:<port>
81
+ no defaults, must provide both
82
+ * bscan.slowloris.protocol=<http protocol>
83
+ https or http, default - http
84
+ * bscan.slowloris.method=<http method>
85
+ POST or GET, default - GET
86
+ * bscan.slowloris.threads=n
87
+ Thread number, default - 20
88
+ * bscan.slowloris.con_nbr_per_thread=n
89
+ Number of connections per thread, default - 50
90
+ * bscan.slowloris.pack_per_con=n
91
+ Max number of data packets to be sent in each connection
92
+ default - 5 (duration of test: pack_per_con*sleep_time)
93
+ * bscan.slowloris.response_time_factor=n
94
+ Normal response time will be multipled by this number to determine
95
+ when report an issue, e.g. if normal reposne time is 2 sec then if
96
+ a response time under attack is bigger than 2*n, it will
97
+ be logged as an issue. Default - 5
98
+ * bscan.slowloris.sleep_time=n
99
+ number of seconds to sleep
100
+ after beginning of a request has been send, default 100
101
+ * bscan.slowloris.static_request=true
102
+ Must be always set to 'true' for this module
103
+
104
+ == kill_apache.rb Module Parameters
105
+ Similar to slowloris a monitoring thread will be checking
106
+ a response time and log an issue if a threshold is reached
107
+ (see 'response_time_factor' for details)
108
+
109
+ * bscan.kill_apache.hostport=<host>:<port>
110
+ no defaults, must provide both
111
+ * bscan.kill_apache.protocol=<http protocol>
112
+ https or http, default - http
113
+ * bscan.kill_apache.threads=n
114
+ Thread number, default - 500
115
+ * bscan.kill_apache.req_per_thread=n
116
+ Number of requests per thread, default - 1
117
+ * bscan.kill_apache.response_time_factor=n
118
+ Normal response time will be multipled by this number to determine
119
+ when report an issue, e.g. if normal reposne time is 2 sec then if
120
+ a response time under attack is bigger than 2*n, it will
121
+ be logged as an issue. Default - 10
122
+ * bscan.kill_apache.read_timeout=n
123
+ client's read timeout, default - 10
124
+ * bscan.kill_apache.static_request=true
125
+ Must be always set to 'true' for this module
126
+ * bscan.kill_apache.range_nbr=n
127
+ Number of elements in 'Range' header, default - 500
128
+
129
+ == Burp Parameters
130
+ To get a list of all Burp parameters, set log level (--loglevel to 2 or 3)
131
+ and you'll see all of them in a log file.
@@ -0,0 +1,140 @@
1
+
2
+ == DESCRIPTION:
3
+ BScan is a configurable and extendable command line application security scanner.
4
+ It's built on top of arguably the most popular commercial security testing tool
5
+ Burp Suite from PortSwigger and Buby from Eric Monti and Timur Duehr
6
+
7
+ == USE CASES:
8
+ * Run security scans offline from a command line headless (without UI).
9
+
10
+ * Change the type of scanning easily by changing configuration parameters.
11
+
12
+ * Extend the BScan's functionality by adding external modules.
13
+
14
+ * Utilize Burp's default spidering, active and passing scanning features.
15
+
16
+ * Integrate scan with different sources of known injections (e.g. Google's fuzzdb: http://code.google.com/p/fuzzdb/).
17
+
18
+ * Create comprehensive security regression tests suites from artifacts provided by security auditors and run them periodically from a command line.
19
+
20
+ * Log found issues to a plain text file.
21
+
22
+ == DOCS, CODE, etc.:
23
+ * Documentation: http://gryb.info/bscan
24
+ * Git repo: git://git.code.sf.net/p/b-scan/trunk
25
+ * Sourceforge: http://sf.net/projects/b-scan/
26
+ * Gem package: http://gemcutter.org (see 'BUILD/INSTALL')
27
+
28
+ == REQUIREMENTS:
29
+ * JRuby - http://jruby.org
30
+ * Burp pro if you want to use default Burp's scanners
31
+ * Burp free if you want to run BScan's modules only
32
+ * Buby 1.3.1 (see http://emonti.github.com/buby/)
33
+
34
+ == BUILD/INSTALL:
35
+
36
+ === Gem
37
+
38
+ sudo jruby -S gem install buby -d --source=http://gemcutter.org
39
+ sudo jruby -S gem install bscan --source=http://gemcutter.org
40
+
41
+ After Buby and BScan are installed, you'll need to link BScan to Burp's JAR (see below)
42
+
43
+ === Building Manually from Git
44
+
45
+ git git://git.code.sf.net/p/b-scan/trunk <src_dir>
46
+ cd <src_dir>
47
+ jruby -S gem build bscan.gemspec
48
+ jruby -S gem install -d --local bscan-*.gem
49
+ bscan --help
50
+ bscan --help config
51
+
52
+ ==== Linking BScan and Buby to Burp's JAR.
53
+
54
+ After Buby and BScan are installed (either manually or by gem)
55
+ you'll need to link them to a Burp's JAR.
56
+
57
+ The easiest way of doing that is to find the directory where buby.jar is located
58
+ and then create a link from that directory to a Burp's jar:
59
+
60
+ cd <dir_where_buby.jar_is_located>
61
+ ln -s <path_to_burp*.jar> <dir_where_buby.jar_is_located>/burp.jar
62
+
63
+ To find where buby.jar is located you can print JRuby's search path using:
64
+
65
+ jruby -e 'puts $:'
66
+
67
+ and then run 'find' command for each dirctory in the search path:
68
+
69
+ find <dir> -name buby.jar
70
+
71
+ == TEST AND USAGE EXAMPLE:
72
+
73
+ To get help run:
74
+
75
+ bscan --help
76
+
77
+ To get help for config layout run:
78
+
79
+ bscan --help config
80
+
81
+ == DOCUMENTATION, SAMPLES, RUNNING HEADLESSLY
82
+ * Rdoc generated files: http://gryb.info/bscan/
83
+ * After installing BScan's gem find the location of 'samples' dir:
84
+ jgem contents bscan | grep samples
85
+ * Check 'config' sub-dir in samples to see examples of config files
86
+ and static requests
87
+ * samples/bscan_headless file show how to run bscan headlesly:
88
+ #!/bin/sh
89
+ jruby -J-Xmx1024M -J-Djava.awt.headless=true -S bscan -c ../config/conf -L 2 -l bscan.log
90
+
91
+
92
+
93
+ == CREDITS:
94
+ * Burp and Burp Suite are trademarks of PortSwigger(ltd)
95
+ Copyright 2012 PortSwigger Ltd. All rights reserved.
96
+ See http://portswigger.net for license terms.
97
+
98
+ * Buby library and the accompanying BurpExtender.java implementation are
99
+ written by Eric Monti @ Matasano Security. Matasano Security claims no
100
+ professional or legal affiliation with PortSwigger LTD.
101
+
102
+ * This BScan tools and library written by Oleg Gryb who claims no professional or
103
+ legal affiliation with PortSwigger LTD or Matasano Security.
104
+
105
+ * The ideas for slowloris attack have been borrowed from slowloris.pl
106
+ written by RSnake and John Kinsella
107
+
108
+ * The ideas for apache killer attack were borrowed from killap.pl written by Kingcope
109
+
110
+ == LICENSE:
111
+
112
+ * Burp and Burp Suite are trademarks of PortSwigger Ltd.
113
+ Copyright 2012 PortSwigger Ltd. All rights reserved.
114
+ See http://portswigger.net for license terms.
115
+
116
+ * The Buby library and its accompanying BurpExtender implementation are
117
+ both freely available under the terms of the MIT public license:
118
+
119
+ (The MIT License)
120
+
121
+ Copyright (C) 2009 Eric Monti, Matasano Security
122
+
123
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
124
+
125
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
126
+
127
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
128
+
129
+ * The BScan tools and library are freely available under the terms of the MIT public license:
130
+
131
+ (The MIT License)
132
+
133
+ Copyright (C) 2012 Oleg Gryb
134
+
135
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
136
+
137
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
138
+
139
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140
+
@@ -0,0 +1,54 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.add_dependency('buby', '>= 1.3.1')
9
+ gem.name = "bscan"
10
+ gem.summary = %q{BScan is an extendable and configurable command line web application security scanner}
11
+ gem.description = %q{BScan is a configurable and extendable web application security scanner that can be run from a command line headless (without UI). It's built on top of arguably the most popular commercial security testing tool Burp Suite from PortSwigger and Buby from Eric Monti and Timur Duehr}
12
+ gem.email = "oleg@gryb.info"
13
+ gem.homepage = "http://sf.net/projects/b-scan/"
14
+ gem.authors = ["Oleg Gryb (ogryb)"]
15
+ #gem.platform = "java"
16
+ gem.test_files = ["test/bscan_test.rb"]
17
+ # gem.require_paths << 'config'
18
+ gem.rdoc_options = ["--main", "README.rdoc"]
19
+ gem.extra_rdoc_files = ["release_notes.txt", "README.rdoc", "CONFIG.rdoc", "bin/bscan"]
20
+ end
21
+ Jeweler::GemcutterTasks.new
22
+ rescue LoadError
23
+ puts "Jeweler (or a dependency) not available. Install it with: sudo jruby -S gem install jeweler"
24
+ end
25
+
26
+ require 'rake/testtask'
27
+ Rake::TestTask.new(:test) do |test|
28
+ test.libs << 'lib' << 'test'
29
+ test.pattern = 'test/**/*_test.rb'
30
+ test.verbose = true
31
+ end
32
+
33
+ task :test => :check_dependencies
34
+
35
+ task :default => :test
36
+
37
+ require 'rdoc/task'
38
+ Rake::RDocTask.new do |rdoc|
39
+ if File.exist?('VERSION')
40
+ version = File.read('VERSION')
41
+ else
42
+ version = ""
43
+ end
44
+
45
+ rdoc.main = "README.rdoc"
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "BScan #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('CONFIG*')
50
+ rdoc.rdoc_files.include('release_notes.txt')
51
+ rdoc.rdoc_files.include('bin/bscan')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
54
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.4.4
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ #require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib bscan]))
4
+ $: << File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib]))
5
+
6
+ require 'buby'
7
+ require 'getoptlong'
8
+ require 'bscan'
9
+ require 'bscan/utils/bscan_helper'
10
+
11
+ include BscanHelper
12
+
13
+ def usage
14
+
15
+ puts %q{
16
+ USAGE: jruby [-J-Xmx<nnn>M] [-J-Djava.awt.headless=true] -S bscan --config path_to_file \
17
+ [--help [config]] [--loglevel n] [--logfile file] [--version]
18
+
19
+ -J-Xmx<nnn>M tells JVM to set maximum heap size to <nnn> MB
20
+ -J-Djava.awt.headless=true tells JVM to run it headless (no UI)
21
+ -S tells jruby to search for bscan in a PATH
22
+ --config -c path_to_file path to config (see 'CONFIG' section in rdoc)
23
+ --help -h this help
24
+ --help config config help
25
+ --loglevel -L 0 errors, 1 - warning, 2 - info, 3 - debug
26
+ --logfile -l path to a log file
27
+ --version -v version
28
+ }
29
+ exit(1)
30
+ end
31
+
32
+ def get_cmd_params
33
+ params = {}
34
+
35
+ opts = GetoptLong.new(
36
+ [ '--help', '-h', GetoptLong::OPTIONAL_ARGUMENT ],
37
+ [ '--version', '-v', GetoptLong::NO_ARGUMENT ],
38
+ [ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT ],
39
+ [ '--loglevel', '-L', GetoptLong::REQUIRED_ARGUMENT ],
40
+ [ '--logfile', '-l', GetoptLong::REQUIRED_ARGUMENT ]
41
+ )
42
+ usage if ARGV.size < 1
43
+
44
+ opts.each do |opt,arg|
45
+ case opt
46
+ when '--help'
47
+ usage if not arg or arg != 'config'
48
+ file=::File.expand_path(File.join(::File.dirname(__FILE__), "../CONFIG.rdoc"))
49
+ if ::File.file?(file)
50
+ puts File.read(file)
51
+ else
52
+ puts "ERROR: Can't find file #{file} "
53
+ end
54
+ exit(1)
55
+ when '--config'
56
+ params['burp_config'], params['bscan_config'] = read_config(arg)
57
+ when '--loglevel'
58
+ params['loglevel'] = arg
59
+ when '--logfile'
60
+ params['logfile'] = arg
61
+ when '--version'
62
+ file=::File.expand_path(File.join(::File.dirname(__FILE__), "../VERSION"))
63
+ if ::File.file?(file)
64
+ puts File.read(file).chomp
65
+ else
66
+ puts "ERROR: Can't find file #{file} "
67
+ exit(1)
68
+ end
69
+ exit(0)
70
+ else
71
+ usage
72
+ end
73
+ end
74
+ params
75
+ end
76
+
77
+ $burp = Buby.new()
78
+ $burp.extend(BScan)
79
+ $burp.start_burp([get_cmd_params.to_json])
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "bscan"
8
+ s.version = "1.4.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Oleg Gryb (ogryb)"]
12
+ s.date = "2012-08-13"
13
+ s.description = "BScan is a configurable and extendable web application security scanner that can be run from a command line headless (without UI). It's built on top of arguably the most popular commercial security testing tool Burp Suite from PortSwigger and Buby from Eric Monti and Timur Duehr"
14
+ s.email = "oleg@gryb.info"
15
+ s.executables = ["bscan"]
16
+ s.extra_rdoc_files = [
17
+ "CONFIG.rdoc",
18
+ "README.rdoc",
19
+ "bin/bscan",
20
+ "release_notes.txt"
21
+ ]
22
+ s.files = [
23
+ "CONFIG.rdoc",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bin/bscan",
28
+ "bscan.gemspec",
29
+ "lib/bscan.rb",
30
+ "lib/bscan/modules/injector.rb",
31
+ "lib/bscan/modules/kill_apache.rb",
32
+ "lib/bscan/modules/many_threads.rb",
33
+ "lib/bscan/modules/slowloris.rb",
34
+ "lib/bscan/utils/bscan_helper.rb",
35
+ "release_notes.txt",
36
+ "samples/config/big_request.txt",
37
+ "samples/config/conf",
38
+ "samples/config/injector.txt",
39
+ "samples/config/request.txt",
40
+ "samples/headless-bscan.sh",
41
+ "test.sh",
42
+ "test/bscan_test.rb"
43
+ ]
44
+ s.homepage = "http://sf.net/projects/b-scan/"
45
+ s.rdoc_options = ["--main", "README.rdoc"]
46
+ s.require_paths = ["lib"]
47
+ s.rubygems_version = "1.8.24"
48
+ s.summary = "BScan is an extendable and configurable command line web application security scanner"
49
+ s.test_files = ["test/bscan_test.rb"]
50
+
51
+ if s.respond_to? :specification_version then
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<buby>, [">= 1.3.1"])
56
+ else
57
+ s.add_dependency(%q<buby>, [">= 1.3.1"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<buby>, [">= 1.3.1"])
61
+ end
62
+ end
63
+