Skip to content

Commit 3e4e5dc

Browse files
author
Brent Cook
committed
Land rapid7#8421, fix rspec failures with newer OpenSSL
2 parents 9a0e2e6 + 29d1022 commit 3e4e5dc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/msf/core/exploit/http/typo3/login.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,13 @@ def typo3_helper_login_rsa(e, n, password)
100100
key = OpenSSL::PKey::RSA.new
101101
exponent = OpenSSL::BN.new e.hex.to_s
102102
modulus = OpenSSL::BN.new n.hex.to_s
103-
key.e = exponent
104-
key.n = modulus
103+
if key.respond_to?(:set_key)
104+
# Ruby 2.4+
105+
key.set_key(modulus, exponent, nil)
106+
else
107+
key.e = exponent
108+
key.n = modulus
109+
end
105110
enc = key.public_encrypt(password)
106111
enc_b64 = Rex::Text.encode_base64(enc)
107112
"rsa:#{enc_b64}"

0 commit comments

Comments
 (0)