Skip to content

Commit 99e95dd

Browse files
committed
Land rapid7#19752, Prometheus pprof endpoint check
2 parents 9c98804 + 1e7c86c commit 99e95dd

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

modules/auxiliary/gather/prometheus_api_gather.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def initialize(info = {})
3131
'h00die'
3232
],
3333
'References' => [
34-
['URL', 'https://jfrog.com/blog/dont-let-prometheus-steal-your-fire/']
34+
['URL', 'https://jfrog.com/blog/dont-let-prometheus-steal-your-fire/'],
35+
['URL', 'https://www.aquasec.com/blog/300000-prometheus-servers-and-exporters-exposed-to-dos-attacks/']
3536
],
3637

3738
'Targets' => [
@@ -145,6 +146,14 @@ def run
145146
json = res.get_json_document
146147
fail_with(Failure::UnexpectedReply, "#{peer} - Unable to parse JSON document") unless json
147148
print_good("Config file: #{json.dig('data', 'config.file')}") if json.dig('data', 'config.file')
149+
150+
# check for pprof
151+
res = send_request_cgi(
152+
'uri' => normalize_uri(target_uri.path, 'debug', 'pprof/'), # include trailing /
153+
'method' => 'GET'
154+
)
155+
fail_with(Failure::Unreachable, "#{peer} - Could not connect to web service - no response") if res.nil?
156+
print_good("#{peer}#{target_uri.path}debug/pprof/ found, potential DoS and information disclosure. Should be manually reviewed.") if res.code == 200 && res.body.include?('Profile Descriptions')
148157
rescue ::Rex::ConnectionError
149158
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
150159
end

modules/auxiliary/gather/prometheus_node_exporter_gather.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def initialize(info = {})
2424
],
2525
'References' => [
2626
['URL', 'https://github.com/prometheus/node_exporter'],
27-
['URL', 'https://sysdig.com/blog/exposed-prometheus-exploit-kubernetes-kubeconeu/']
27+
['URL', 'https://sysdig.com/blog/exposed-prometheus-exploit-kubernetes-kubeconeu/'],
28+
['URL', 'https://www.aquasec.com/blog/300000-prometheus-servers-and-exporters-exposed-to-dos-attacks/']
2829
],
2930

3031
'Targets' => [
@@ -308,6 +309,14 @@ def run
308309
].each do |table|
309310
print_good(table.to_s) if !table.rows.empty?
310311
end
312+
313+
# check for pprof
314+
res = send_request_cgi(
315+
'uri' => normalize_uri(target_uri.path, 'debug', 'pprof/'), # include trailing /
316+
'method' => 'GET'
317+
)
318+
fail_with(Failure::Unreachable, "#{peer} - Could not connect to web service - no response") if res.nil?
319+
print_good("#{peer}#{target_uri.path}debug/pprof/ found, potential DoS and information disclosure. Should be manually reviewed.") if res.code == 200 && res.body.include?('Profile Descriptions')
311320
rescue ::Rex::ConnectionError
312321
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
313322
end

0 commit comments

Comments
 (0)