concuss 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c5ead6fff82661378bb379172fb4e62a3d22c5a312d363cc9c49a8ebce268e40
4
+ data.tar.gz: 9bce360c65581ef6ec55ecd6084609680fff69a4480f7ef75041a8cb1c8df756
5
+ SHA512:
6
+ metadata.gz: 5f83174439a0930992841f179026927addfd43b3aab14ce08738959f28a04a23eff6b40d83ca610586b5d23aa22c9073d59c0fa04843e0fe15bcf8f865a51302
7
+ data.tar.gz: 517db0408b735b4f4741f720f23222e5c9ab2f4cdc5b09f3a943df65e54b33dfc68256bcd3b9fda1d350c597003b6ce7cbb6bcc08e39a6b15f8d1233872f2ad3
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-01-18
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in concuss.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+ gem "byebug"
data/Gemfile.lock ADDED
@@ -0,0 +1,36 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ concuss (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ byebug (11.1.3)
10
+ diff-lcs (1.5.0)
11
+ rake (13.0.6)
12
+ rspec (3.12.0)
13
+ rspec-core (~> 3.12.0)
14
+ rspec-expectations (~> 3.12.0)
15
+ rspec-mocks (~> 3.12.0)
16
+ rspec-core (3.12.0)
17
+ rspec-support (~> 3.12.0)
18
+ rspec-expectations (3.12.2)
19
+ diff-lcs (>= 1.2.0, < 2.0)
20
+ rspec-support (~> 3.12.0)
21
+ rspec-mocks (3.12.3)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.12.0)
24
+ rspec-support (3.12.0)
25
+
26
+ PLATFORMS
27
+ x86_64-linux
28
+
29
+ DEPENDENCIES
30
+ byebug
31
+ concuss!
32
+ rake (~> 13.0)
33
+ rspec (~> 3.0)
34
+
35
+ BUNDLED WITH
36
+ 2.4.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Patrick Tulskie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Concuss
2
+
3
+ ## What is it?
4
+
5
+ Concuss is a tool for banging against a url with a bunch of different headers to look for potential vulnerabilities.
6
+
7
+ It works by sending a custom or a random string to a webserver for a specific url in a variety of headers to see if it's able to get that string to appear on the page. If so, you'll get a HIT and you can evaluate that header to see if it's useful for some kind of XSS, cache poisoning, or some other form of injection from malformed headers.
8
+
9
+ ## What it is NOT.
10
+
11
+ Concuss is not a tool for automating vulnerabilities, nor should it be used to certify that a page is safe from vulnerabilities. It should not be used on applications or website that you do not personally have permission to scan.
12
+
13
+ Sending malformed headers to a site can potentially cause errors, crashing, and other damage that I am not responsible for as a result of any usage of this tool. You agree to use this tool at your own risk.
14
+
15
+ ## Installation
16
+
17
+ Install the gem and add to the application's Gemfile by executing:
18
+
19
+ $ bundle add concuss
20
+
21
+ If bundler is not being used to manage dependencies, install the gem by executing:
22
+
23
+ $ gem install concuss
24
+
25
+ ## Usage
26
+
27
+ Primarily, you'll want to use it as a CLI like so:
28
+
29
+ ```
30
+ concuss http://localhost:4567
31
+ concuss http://localhost:4567 -h non_standard
32
+ ```
33
+
34
+ See `concuss --help` for more usage details.
35
+
36
+ While concuss is designed to be used as a command line tool, you can also include it in your own custom application like so:
37
+
38
+ ```
39
+ require 'concuss'
40
+
41
+ concuss = Concuss.new(url: 'http://localhost:4567', file: 'header_file.txt', header_set: :standard, test_string: "OOGABOOGA")
42
+ concuss.attack!
43
+ ```
44
+
45
+ This will spit out the results, which isn't super useful if you need to post process them... I'll work on that though.
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `script/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `script/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ If you add features or fix bugs, please write specs and open up a PR.
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/patricktulskie/concuss
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/concuss ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/concuss'
4
+ require 'optparse'
5
+
6
+ options = { }
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: concuss [url] [options]"
10
+
11
+ opts.on("-f", "--file FILE", "Specify file with custom headers") do |v|
12
+ options[:file] = v
13
+ end
14
+
15
+ opts.on("-h", "--header-set [all|standard|non_standard]", "Header set. Default is 'all'. Ignored if a file is specified. ") do |v|
16
+ options[:header_set] = v.to_sym
17
+ end
18
+
19
+ opts.on("-t", "--test-string STRING", "Set a custom test string. If none specified, it sets a random string to match on.") do |v|
20
+ options[:test_string] = v
21
+ end
22
+ end.parse!
23
+
24
+ if ARGV[0].nil?
25
+ puts "Must provide a url. Try --help for usage."
26
+ exit 1
27
+ end
28
+
29
+ options[:url] = ARGV[0]
30
+
31
+ Concuss.new(**options).attack!
@@ -0,0 +1,79 @@
1
+ class Concuss::Headers
2
+ attr_reader :header_set, :file
3
+
4
+ STANDARD_HEADERS = [
5
+ 'Accept',
6
+ 'Accept-Charset',
7
+ 'Accept-Encoding',
8
+ 'Accept-Language',
9
+ 'Accept-Datetime',
10
+ 'Authorization',
11
+ 'Cache-Control',
12
+ 'Connection',
13
+ 'Cookie',
14
+ 'Content-Length',
15
+ 'Content-MD5',
16
+ 'Content-Type',
17
+ 'Date',
18
+ 'Expect',
19
+ 'From',
20
+ 'Host',
21
+ 'If-Match',
22
+ 'If-Modified-Since',
23
+ 'If-None-Match',
24
+ 'If-Range',
25
+ 'If-Unmodified-Since',
26
+ 'Max-Forwards',
27
+ 'Origin',
28
+ 'Pragma',
29
+ 'Proxy-Authorization',
30
+ 'Range',
31
+ 'Referer',
32
+ 'TE',
33
+ 'User-Agent',
34
+ 'Upgrade',
35
+ 'Via',
36
+ 'Warning'
37
+ ]
38
+
39
+ NON_STANDARD_HEADERS = [
40
+ 'X-Requested-With',
41
+ 'X-Forwarded-For',
42
+ 'X-Forwarded-Proto',
43
+ 'X-Http-Method-Override',
44
+ 'X-CSRF-Token'
45
+ ]
46
+
47
+ def initialize(header_set:, file: nil)
48
+ @header_set = header_set
49
+ @file = file
50
+ end
51
+
52
+ def group
53
+ case @header_set
54
+ when :standard
55
+ STANDARD_HEADERS
56
+ when :non_standard
57
+ NON_STANDARD_HEADERS
58
+ when :all
59
+ STANDARD_HEADERS + NON_STANDARD_HEADERS
60
+ when :file
61
+ read_file(@file)
62
+ else
63
+ fail "Invalid header set"
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ def read_file(file_path)
70
+ lines = []
71
+ File.open(file_path, "r") do |file|
72
+ file.each_line do |line|
73
+ lines << line.strip
74
+ end
75
+ end
76
+ lines
77
+ end
78
+ end
79
+
@@ -0,0 +1,31 @@
1
+ require 'securerandom'
2
+ require 'net/http'
3
+
4
+ class Concuss::Runner
5
+ attr_reader :headers, :url, :test_string
6
+
7
+ def initialize(headers:, url:, test_string: nil)
8
+ @headers = headers
9
+ @url = url
10
+ @test_string = test_string || SecureRandom.hex(25)
11
+ end
12
+
13
+ def run
14
+ uri = URI(@url)
15
+
16
+ @headers.each do |header|
17
+ response = Net::HTTP.get_response(uri,
18
+ { header => test_string }
19
+ )
20
+
21
+ if response.code == "200" && response.body.include?(@test_string)
22
+ result = "HIT"
23
+ else
24
+ result = "MISS"
25
+ end
26
+
27
+ puts "#{header} - #{response.code} - #{result}"
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Concuss
4
+ VERSION = "0.1.0"
5
+ end
data/lib/concuss.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Concuss
4
+ class Error < StandardError; end
5
+
6
+ attr_reader :url, :file, :header_set, :headers, :test_string
7
+
8
+ def initialize(url:, file: nil, header_set: :all, test_string: nil)
9
+ @url = url
10
+ @file = file
11
+ @header_set = file.nil? ? header_set : :file
12
+ @test_string = test_string
13
+
14
+ @headers = Concuss::Headers.new(header_set: @header_set, file: @file).group
15
+ end
16
+
17
+ def attack!
18
+ runner = Concuss::Runner.new(headers: headers, url: url, test_string: test_string)
19
+
20
+ runner.run
21
+ end
22
+ end
23
+
24
+ require_relative "concuss/version"
25
+ require_relative "concuss/headers"
26
+ require_relative "concuss/runner"
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: concuss
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Patrick Tulskie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Test websites for header injection issues
14
+ email:
15
+ - patricktulskie@gmail.com
16
+ executables:
17
+ - concuss
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".rspec"
22
+ - CHANGELOG.md
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - bin/concuss
29
+ - lib/concuss.rb
30
+ - lib/concuss/headers.rb
31
+ - lib/concuss/runner.rb
32
+ - lib/concuss/version.rb
33
+ homepage: https://github.com/patricktulskie/concuss
34
+ licenses:
35
+ - MIT
36
+ metadata:
37
+ homepage_uri: https://github.com/patricktulskie/concuss
38
+ source_code_uri: https://github.com/PatrickTulskie/concuss
39
+ changelog_uri: https://github.com/PatrickTulskie/concuss/blob/main/CHANGELOG.md
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 2.6.0
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubygems_version: 3.4.1
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: Automatic testing for malformed header vulns
59
+ test_files: []