Skip to content

Commit c12eae6

Browse files
committed
Error and return if public key wasn't retrieved.
1 parent 578002e commit c12eae6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

modules/auxiliary/scanner/ssl/openssl_heartbleed.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ def getkeys()
357357

358358
print_status("#{peer} - Getting public key constants...")
359359
n, e = get_ne
360+
361+
if n.nil? || e.nil?
362+
print_error("#{peer} - Failed to get public key, aborting.")
363+
end
364+
360365
vprint_status("#{peer} - n: #{n}")
361366
vprint_status("#{peer} - e: #{e}")
362367
print_status("#{peer} - #{Time.now.getutc} - Starting.")
@@ -368,11 +373,12 @@ def getkeys()
368373
end
369374

370375
p, q = get_factors(bleed, n) # Try to find factors in mem
371-
unless p.nil? || q.nil?
376+
377+
unless p.nil? || q.nil?
372378
key = key_from_pqe(p, q, e)
373379
print_good("#{peer} - #{Time.now.getutc} - Got the private key")
374380

375-
print_status(key.export)
381+
print_status(key.export)
376382
path = store_loot(
377383
"openssl.heartbleed.server",
378384
"text/plain",

0 commit comments

Comments
 (0)