bitter_domain 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50cc7524ec85308d7779171078697a4375c44b4cd064de0bcb854d000e72d225
4
- data.tar.gz: 72f92a81a31b21799d83b7dc3c2da4773168feded8a0322ac2d6db7f25cc2c2a
3
+ metadata.gz: cc2adbd9a0bfbfec7dc35356bcdb15075c0e71bf41568d75293f501188ea7b9a
4
+ data.tar.gz: 626641a0677c6938b18ade6a259804b52f3a217b685655d76f5df96f7939ed69
5
5
  SHA512:
6
- metadata.gz: 599de2c0dd413a33d9e74f7fc6365cfcc4644e8af0c513af7e0c0601d03ac1c8f0e313c7313c930a179d7429a1077c8aa48faae7a53aa8ff38b52e3c327fd840
7
- data.tar.gz: 9e37fe354980e43e04c887a3b4393ee0e33b1cdf9adff87c4b017e65cd9e46aa5f846678869022c01af4215929358aca623a8b07adc046fd46b3efb754844290
6
+ metadata.gz: 73547ec3b82f3a6cfa6957694638b5eaa93025421a3e408b15b21179b109ed963072c9c6b1677e04aa7f3edd26282585ecc17303036d41c94ffc4ee5ad97a397
7
+ data.tar.gz: cbca5b7ee24407c704a974c98877e7256e89ca6186a207a1812816c6be779e1ab289b46ebfd9c28c1763c60bf43d0a0a12b8220a24dfd348ff6734a17d9a9746
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitter_domain (0.1.0)
4
+ bitter_domain (0.1.2)
5
5
  colorize
6
6
  public_suffix
7
7
  whois (~> 4.0.8)
@@ -52,7 +52,7 @@ GEM
52
52
  pry (0.12.2)
53
53
  coderay (~> 1.1.0)
54
54
  method_source (~> 0.9.0)
55
- public_suffix (3.0.3)
55
+ public_suffix (4.0.0)
56
56
  rake (10.5.0)
57
57
  rb-fsevent (0.10.3)
58
58
  rb-inotify (0.10.0)
data/README.md CHANGED
@@ -1,8 +1,23 @@
1
1
  # BitterDomain
2
+ A Ruby gem for generating domains 1 bit away from a source domain and checking the availability of the generated domains.
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bitter_domain`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+ ### DISCLAIMER
5
+ This project is for *research purposes only*. So don't use it for malicious nonsense or send nasty stuff in response to legitimate HTTP requests. If you want to actually register one of these generated domains and set up a server to listen for requests, sending a `404` to all incoming requests if probably a good idea.
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ ### Description
8
+ A Ruby gem for generating domains 1 bit away from a source domain and checking the availability of the generated domains.
9
+ This project was inspired from a series of Defcon presentations on `bit squatting`.
10
+
11
+ [The original video](https://www.youtube.com/watch?v=aT7mnSstKGs)
12
+ [A second presentation further exploring the vulnerability](https://www.youtube.com/watch?v=IhwE1S4x36s)
13
+
14
+ `Bit squatting` is a close cousin to `typo squatting`, viz., a user makes a typo when entering a common url in a browser address bar and unintentionally makes a request to a domain including the typo that a malicious user has registered. Rather than typos, bit squatting leverages common hardware errors (bit errors) that yield domains that are _1 bit off from the source domain_, e.g., `instagram.com` -> `instagbam.com`. According to the videos above, these errors generate a very high number of potential requests sent to domains with the aforementioned pathological structure.
15
+
16
+ To exploit this vulnerability, an attacker may generate a list of domains 1 bit off from common domains, then register the "bit-flipped" domains, and finally spin up a web server to send responses to these requests from users who intended to make a request to the common source domain but have been routed to the "bit squatted" domain.
17
+
18
+ `BitterDomain` is a gem for generating bit-flipped domains. It does not include a server or other logging utilities. I wrote a small go server for tracking incoming HTTP requests and headers. After registering around 5 domains for flipped versions of facebook's cdn and instagram api domains, I received 3-4 _highly probable_ requests that were intended to be sent to facebook. A high amount of garbage also came in, but that's sufficient evidence for me to conclude that the vulnerability is still exploitable, at least with a minimal amount of set up.
19
+
20
+ `whois` and `whois-parser` are used for checking the DNS availability of the generated domains.
6
21
 
7
22
  ## Installation
8
23
 
@@ -22,17 +37,59 @@ Or install it yourself as:
22
37
 
23
38
  ## Usage
24
39
 
25
- TODO: Write usage instructions here
40
+ #### CLI
41
+
42
+ `BitterDomain` comes with an executable:
43
+
44
+ ```bash
45
+ $ bitter_domain --url <source domain>
46
+ ```
47
+
48
+ where `source domain` could be something like `google.com` or `apopulardomain.net`. Notice that subdomains or protocols are unnecessary, since all that is required is the domain name and extension.
49
+
50
+ The default command prints out a list of available domains that are 1 bit removed from the source url.
51
+
52
+ *This may take a few minutes*. All of the calls to `whois` servers can take some time.
53
+
54
+ The CLI accepts flags for verbose output or the flips only without checking their availability.
55
+
56
+ ```
57
+ Usage:
58
+ bitter_domain get a list of bit flipped domains -u, --url=URL
59
+
60
+ Options:
61
+ -r, [--retry], [--no-retry] # retry any domain that errored out; usually due to a connection reset
62
+ -s, [--flips-only], [--no-flips-only] # limit output to just flips
63
+ -u, --url=URL # url to generate shifts for
64
+ -v, [--verbose=VERBOSE] # print verbose output
65
+
66
+ ```
67
+
68
+ #### Require
69
+
70
+ Or require the gem with
71
+ ```ruby
72
+ require "bitter_domain"
73
+ ```
74
+
75
+ And instantiate a mapper like so:
76
+
77
+ ```ruby
78
+ mapper = BitterDomain::DomainMapper.new("google.com")
79
+ ```
80
+
81
+ `DomainMapper` includes a few instance methods for generating and testing domains
82
+ - `#gen_shifts` will generate and return a list of shifted domains
83
+ - `#print_shifts` will print out just the shifted domains
84
+ - `#check_domains` will test the availability of the shifted domains using `whois`
85
+ - `#print_verbose` and `#print_availabile` are two little output printers for the tested/available domains
26
86
 
27
- ## Development
28
87
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
88
+ ## PS
30
89
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
90
+ #### HAVE FUN AND DON'T BE A JERK
32
91
 
33
- ## Contributing
34
92
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/axylos/bitter_domain.
36
93
 
37
94
  ## License
38
95
 
data/bin/bitter_domain CHANGED
@@ -13,14 +13,15 @@ class CLI < Thor
13
13
  method_option :url, aliases: ['-u'], desc: 'url to generate shifts for', required: true
14
14
  method_option :verbose, aliases: ['-v'], desc: 'print verbose output'
15
15
  def gen_shifts()
16
+ puts "Generating shifted domains"
16
17
  mapper = BitterDomain::DomainMapper.new(options[:url])
17
- shifted_domains = mapper.gen_shifts
18
+ mapper.gen_shifts
19
+ puts "#{mapper.shifted_domains.length} domains generated"
18
20
 
19
21
  if options["flips-only".to_sym]
20
22
  mapper.print_shifts
21
23
  else
22
- checker = BitterDomain::DomainChecker.new(shifted_domains)
23
- checker.test_domains
24
+ puts "Testing for available domains. This may take a few minutes"
24
25
  mapper.check_domains(options[:retry])
25
26
  options[:verbose] ? mapper.print_verbose : mapper.print_available
26
27
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Generate urls with a single bit flipped for researching bit squatting}
13
13
  spec.description = %q{Get a list of available domains 1 bit away from a given domain}
14
- spec.homepage = "https://github.com/Axylos/squat_logs"
14
+ spec.homepage = "https://github.com/Axylos/bitter_domain"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  #spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
21
 
22
22
  spec.metadata["homepage_uri"] = spec.homepage
23
- spec.metadata["source_code_uri"] = "https://github.com/Axylos/squat_logs"
23
+ spec.metadata["source_code_uri"] = "https://github.com/Axylos/bitter_domain"
24
24
  #spec.metadata["changelog_uri"] = "none"
25
25
  else
26
26
  raise "RubyGems 2.0 or newer is required to protect against " \
@@ -59,6 +59,7 @@ module BitterDomain
59
59
  end
60
60
 
61
61
  def print_available
62
+ puts "Here are the available shifted domains"
62
63
  self.checker.print_available
63
64
  end
64
65
 
@@ -1,3 +1,3 @@
1
1
  module BitterDomain
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitter_domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - axylos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-04 00:00:00.000000000 Z
11
+ date: 2019-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -160,6 +160,7 @@ extra_rdoc_files: []
160
160
  files:
161
161
  - ".gitignore"
162
162
  - ".rspec"
163
+ - ".ruby-version"
163
164
  - ".travis.yml"
164
165
  - Gemfile
165
166
  - Gemfile.lock
@@ -176,12 +177,12 @@ files:
176
177
  - lib/bitter_domain/domain_checker.rb
177
178
  - lib/bitter_domain/domain_mapper.rb
178
179
  - lib/bitter_domain/version.rb
179
- homepage: https://github.com/Axylos/squat_logs
180
+ homepage: https://github.com/Axylos/bitter_domain
180
181
  licenses:
181
182
  - MIT
182
183
  metadata:
183
- homepage_uri: https://github.com/Axylos/squat_logs
184
- source_code_uri: https://github.com/Axylos/squat_logs
184
+ homepage_uri: https://github.com/Axylos/bitter_domain
185
+ source_code_uri: https://github.com/Axylos/bitter_domain
185
186
  post_install_message:
186
187
  rdoc_options: []
187
188
  require_paths: