pwn 0.4.402 → 0.4.403

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d035fc6b4a1f52a40c9e9b1f5a20477bdae1fa051509b4a97254e631b13969e
4
- data.tar.gz: de36dc86c3bc166b9e84bc90c6490a86826feffb29ea86573e3e0a34a178a539
3
+ metadata.gz: 691830c4fb3f20b44d9273da128eb7a9964c0bebfe7e64494ee5d678dd6dbc96
4
+ data.tar.gz: 53e5dd6aeb79f20a300acfb24a8c7cb0d0f09eda28200d57b45ef705cff12c80
5
5
  SHA512:
6
- metadata.gz: d9590faf6e192ae76dc6a2cf3c9b92cfd5b42c429688128747081212c5667635e07789a7bd0b092f610539794c10bdb185c307f7689e60d303dd9a6a7568ed9f
7
- data.tar.gz: fcb0361b99db142051a3cbc208af3977be05ec7065e9fa7cfc084c7b7024d84b1d5d874ab767f7e5aadec64eaa386e1863f98e16a399c82a74a1ffdbdc3ce98a
6
+ metadata.gz: eed1d674dcd714aa9d916012ecf691c5aa0118e2ae2fb9b02ab433a020dab9dd86487e311560b0d718da98e9d103e5be7d5674979f1e4df39a60df4b3a89be42
7
+ data.tar.gz: 70fa790a244ac1642a05ddb10de4060ff8769dfb3dbc16ffd25a34c48113370c6559b467eb84a3d230681031ab8468fec2d9d27ed93ac893686c8751cf18b5c5
data/Gemfile CHANGED
@@ -18,7 +18,7 @@ gem 'aws-sdk', '3.1.0'
18
18
  gem 'bettercap', '1.6.2'
19
19
  gem 'brakeman', '5.2.2'
20
20
  gem 'bson', '4.14.1'
21
- gem 'bundler', '>=2.3.10'
21
+ gem 'bundler', '>=2.3.11'
22
22
  gem 'bundler-audit', '0.9.0.1'
23
23
  gem 'bunny', '2.19.0'
24
24
  gem 'colorize', '0.8.1'
@@ -41,7 +41,7 @@ gem 'net-ldap', '0.17.0'
41
41
  gem 'net-openvpn', '0.8.7'
42
42
  gem 'net-smtp', '0.3.1'
43
43
  gem 'nexpose', '7.3.0'
44
- gem 'nokogiri', '1.13.3'
44
+ gem 'nokogiri', '1.13.4'
45
45
  gem 'oily_png', '1.2.1'
46
46
  gem 'os', '1.1.4'
47
47
  gem 'packetfu', '1.1.13'
@@ -58,7 +58,7 @@ gem 'rex', '2.0.13'
58
58
  gem 'rmagick', '4.2.5'
59
59
  gem 'rspec', '3.11.0'
60
60
  gem 'rtesseract', '3.1.2'
61
- gem 'rubocop', '1.26.1'
61
+ gem 'rubocop', '1.27.0'
62
62
  gem 'rubocop-rake', '0.6.0'
63
63
  gem 'rubocop-rspec', '2.9.0'
64
64
  gem 'ruby-audio', '1.6.1'
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.1@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.402]:001 >>> PWN.help
40
+ pwn[v0.4.403]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
@@ -52,7 +52,7 @@ $ rvm use ruby-3.1.1@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.402]:001 >>> PWN.help
55
+ pwn[v0.4.403]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
data/bin/pwn_sast CHANGED
@@ -76,12 +76,13 @@ begin
76
76
  CmdExecutionRuby
77
77
  CmdExecutionScala
78
78
  CSRF
79
- Emoticon
80
79
  DeserialJava
80
+ Emoticon
81
81
  Eval
82
- InnerHTML
83
- FilePermission
84
82
  Factory
83
+ FilePermission
84
+ HTTPAuthorizationHeader
85
+ InnerHTML
85
86
  LocationHash
86
87
  Log4J
87
88
  Logger
@@ -12,7 +12,7 @@ module PWN
12
12
  @@logger = PWN::Plugins::PWNLogger.create
13
13
 
14
14
  # Supported Method Parameters::
15
- # PWN::SAST::Deseria.scan(
15
+ # PWN::SAST::DeserialJava.scan(
16
16
  # :dir_path => 'optional path to dir defaults to .'
17
17
  # :git_repo_root_uri => 'optional http uri of git repo scanned'
18
18
  # )
@@ -0,0 +1,145 @@
1
+ # frozen_string_literal: false
2
+
3
+ require 'socket'
4
+
5
+ module PWN
6
+ module SAST
7
+ # SAST Module used to identify hard-code/plain-text
8
+ # passwords within source code.
9
+ module HTTPAuthorizationHeader
10
+ @@logger = PWN::Plugins::PWNLogger.create
11
+
12
+ # Supported Method Parameters::
13
+ # PWN::SAST::HTTPAuthorizationHeader.scan(
14
+ # :dir_path => 'optional path to dir defaults to .'
15
+ # :git_repo_root_uri => 'optional http uri of git repo scanned'
16
+ # )
17
+
18
+ public_class_method def self.scan(opts = {})
19
+ dir_path = opts[:dir_path]
20
+ git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
21
+ result_arr = []
22
+ logger_results = ''
23
+
24
+ PWN::Plugins::FileFu.recurse_dir(dir_path: dir_path) do |entry|
25
+ if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/
26
+ line_no_and_contents_arr = []
27
+ filename_arr = []
28
+ entry_beautified = false
29
+
30
+ if File.extname(entry) == '.js' && (`wc -l #{entry}`.split.first.to_i < 20 || entry.include?('.min.js') || entry.include?('-all.js'))
31
+ js_beautify = `js-beautify #{entry} > #{entry}.JS-BEAUTIFIED`.to_s.scrub
32
+ entry = "#{entry}.JS-BEAUTIFIED"
33
+ entry_beautified = true
34
+ end
35
+
36
+ test_case_filter = %(
37
+ grep -Ein \
38
+ -e "Authorization:(\\sBasic|Basic)" \
39
+ -e "Authorization:(\\sBearer|Bearer)" \
40
+ -e "Authorization:(\\sDigest|Digest)" \
41
+ -e "Authorization:(\\sHOBA|HOBA)" \
42
+ -e "Authorization:(\\sMutual|Mutual)" \
43
+ -e "Authorization:(\\sNegotiate|Negotiate)" \
44
+ -e "Authorization:(\\sVapid|Vapid)" \
45
+ -e "Authorization:(\\sSCRAM|SCRAM)" \
46
+ -e "Authorization:(\\sAWS|AWS)" \
47
+ -e "authorization(\\s=|=)" #{entry}
48
+ )
49
+
50
+ str = `#{test_case_filter}`.to_s.scrub
51
+
52
+ if str.to_s.empty?
53
+ # If str length is >= 64 KB do not include results. (Due to Mongo Document Size Restrictions)
54
+ logger_results = "#{logger_results}~" # Catching bugs is good :)
55
+ else
56
+ str = "1:Result larger than 64KB -> Size: #{str.to_s.length}. Please click the \"Path\" link for more details." if str.to_s.length >= 64_000
57
+
58
+ hash_line = {
59
+ timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S.%9N %z').to_s,
60
+ test_case: nist_800_53_requirements,
61
+ filename: filename_arr.push(git_repo_root_uri: git_repo_root_uri, entry: entry),
62
+ line_no_and_contents: '',
63
+ raw_content: str,
64
+ test_case_filter: test_case_filter
65
+ }
66
+
67
+ # COMMMENT: Must be a better way to implement this (regex is kinda funky)
68
+ line_contents_split = str.split(/^(\d{1,}):|\n(\d{1,}):/)[1..-1]
69
+ line_no_count = line_contents_split.length # This should always be an even number
70
+ current_count = 0
71
+ while line_no_count > current_count
72
+ line_no = line_contents_split[current_count]
73
+ contents = line_contents_split[current_count + 1]
74
+ if Dir.exist?("#{dir_path}/.git") ||
75
+ Dir.exist?('.git')
76
+
77
+ repo_root = dir_path
78
+ repo_root = '.' if Dir.exist?('.git')
79
+
80
+ author = PWN::Plugins::Git.get_author(
81
+ repo_root: repo_root,
82
+ from_line: line_no,
83
+ to_line: line_no,
84
+ target_file: entry,
85
+ entry_beautified: entry_beautified
86
+ )
87
+ else
88
+ author = 'N/A'
89
+ end
90
+ hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(line_no: line_no,
91
+ contents: contents,
92
+ author: author)
93
+
94
+ current_count += 2
95
+ end
96
+ result_arr.push(hash_line)
97
+ logger_results = "#{logger_results}x" # Seeing progress is good :)
98
+ end
99
+ end
100
+ end
101
+ logger_banner = "http://#{Socket.gethostname}:8808/doc_root/pwn-#{PWN::VERSION.to_s.scrub}/#{to_s.scrub.gsub('::', '/')}.html"
102
+ if logger_results.empty?
103
+ @@logger.info("#{logger_banner}: No files applicable to this test case.\n")
104
+ else
105
+ @@logger.info("#{logger_banner} => #{logger_results}complete.\n")
106
+ end
107
+ result_arr
108
+ end
109
+
110
+ # Used primarily to map NIST 800-53 Revision 4 Security Controls
111
+ # https://web.nvd.nist.gov/view/800-53/Rev4/impact?impactName=HIGH
112
+ # to PWN Exploit & Static Code Anti-Pattern Matching Modules to
113
+ # Determine the level of Testing Coverage w/ PWN.
114
+
115
+ public_class_method def self.nist_800_53_requirements
116
+ {
117
+ sast_module: self,
118
+ section: 'PROTECTION OF INFORMATION AT REST',
119
+ nist_800_53_uri: 'https://csrc.nist.gov/Projects/risk-management/sp800-53-controls/release-search#!/control/?version=5.1&number=SC-28'
120
+ }
121
+ end
122
+
123
+ # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
124
+
125
+ public_class_method def self.authors
126
+ "AUTHOR(S):
127
+ 0day Inc. <request.pentest@0dayinc.com>
128
+ "
129
+ end
130
+
131
+ # Display Usage for this Module
132
+
133
+ public_class_method def self.help
134
+ puts "USAGE:
135
+ sast_arr = #{self}.scan(
136
+ :dir_path => 'optional path to dir defaults to .',
137
+ :git_repo_root_uri => 'optional http uri of git repo scanned'
138
+ )
139
+
140
+ #{self}.authors
141
+ "
142
+ end
143
+ end
144
+ end
145
+ end
data/lib/pwn/sast.rb CHANGED
@@ -22,6 +22,7 @@ module PWN
22
22
  autoload :Eval, 'pwn/sast/eval'
23
23
  autoload :Factory, 'pwn/sast/factory'
24
24
  autoload :FilePermission, 'pwn/sast/file_permission'
25
+ autoload :HTTPAuthorizationHeader, 'pwn/sast/http_authorization_header'
25
26
  autoload :InnerHTML, 'pwn/sast/inner_html'
26
27
  autoload :Keystore, 'pwn/sast/keystore'
27
28
  autoload :LocationHash, 'pwn/sast/location_hash'
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.4.402'
4
+ VERSION = '0.4.403'
5
5
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe PWN::SAST::HTTPAuthorizationHeader do
6
+ it 'scan method should exist' do
7
+ scan_response = PWN::SAST::HTTPAuthorizationHeader
8
+ expect(scan_response).to respond_to :scan
9
+ end
10
+
11
+ it 'should display information for nist_800_53_requirements' do
12
+ nist_800_53_requirements_response = PWN::SAST::HTTPAuthorizationHeader
13
+ expect(nist_800_53_requirements_response).to respond_to :nist_800_53_requirements
14
+ end
15
+
16
+ it 'should display information for authors' do
17
+ authors_response = PWN::SAST::HTTPAuthorizationHeader
18
+ expect(authors_response).to respond_to :authors
19
+ end
20
+
21
+ it 'should display information for existing help method' do
22
+ help_response = PWN::SAST::HTTPAuthorizationHeader
23
+ expect(help_response).to respond_to :help
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.402
4
+ version: 0.4.403
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-06 00:00:00.000000000 Z
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 2.3.10
117
+ version: 2.3.11
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 2.3.10
124
+ version: 2.3.11
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler-audit
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -408,14 +408,14 @@ dependencies:
408
408
  requirements:
409
409
  - - '='
410
410
  - !ruby/object:Gem::Version
411
- version: 1.13.3
411
+ version: 1.13.4
412
412
  type: :runtime
413
413
  prerelease: false
414
414
  version_requirements: !ruby/object:Gem::Requirement
415
415
  requirements:
416
416
  - - '='
417
417
  - !ruby/object:Gem::Version
418
- version: 1.13.3
418
+ version: 1.13.4
419
419
  - !ruby/object:Gem::Dependency
420
420
  name: oily_png
421
421
  requirement: !ruby/object:Gem::Requirement
@@ -646,14 +646,14 @@ dependencies:
646
646
  requirements:
647
647
  - - '='
648
648
  - !ruby/object:Gem::Version
649
- version: 1.26.1
649
+ version: 1.27.0
650
650
  type: :runtime
651
651
  prerelease: false
652
652
  version_requirements: !ruby/object:Gem::Requirement
653
653
  requirements:
654
654
  - - '='
655
655
  - !ruby/object:Gem::Version
656
- version: 1.26.1
656
+ version: 1.27.0
657
657
  - !ruby/object:Gem::Dependency
658
658
  name: rubocop-rake
659
659
  requirement: !ruby/object:Gem::Requirement
@@ -1532,6 +1532,7 @@ files:
1532
1532
  - lib/pwn/sast/eval.rb
1533
1533
  - lib/pwn/sast/factory.rb
1534
1534
  - lib/pwn/sast/file_permission.rb
1535
+ - lib/pwn/sast/http_authorization_header.rb
1535
1536
  - lib/pwn/sast/inner_html.rb
1536
1537
  - lib/pwn/sast/keystore.rb
1537
1538
  - lib/pwn/sast/location_hash.rb
@@ -1825,6 +1826,7 @@ files:
1825
1826
  - spec/lib/pwn/sast/eval_spec.rb
1826
1827
  - spec/lib/pwn/sast/factory_spec.rb
1827
1828
  - spec/lib/pwn/sast/file_permission_spec.rb
1829
+ - spec/lib/pwn/sast/http_authorization_header_spec.rb
1828
1830
  - spec/lib/pwn/sast/inner_html_spec.rb
1829
1831
  - spec/lib/pwn/sast/keystore_spec.rb
1830
1832
  - spec/lib/pwn/sast/location_hash_spec.rb
@@ -2092,6 +2094,7 @@ test_files:
2092
2094
  - spec/lib/pwn/sast/eval_spec.rb
2093
2095
  - spec/lib/pwn/sast/factory_spec.rb
2094
2096
  - spec/lib/pwn/sast/file_permission_spec.rb
2097
+ - spec/lib/pwn/sast/http_authorization_header_spec.rb
2095
2098
  - spec/lib/pwn/sast/inner_html_spec.rb
2096
2099
  - spec/lib/pwn/sast/keystore_spec.rb
2097
2100
  - spec/lib/pwn/sast/location_hash_spec.rb