Ignore missing method error when doing aes negotiation

This means that meterpreter instances that don't support will continue
to work.
bug/bundler_fix
OJ 2017-06-26 15:22:56 +10:00
parent bdcea7bd22
commit 9f2be21eb7
No known key found for this signature in database
GPG Key ID: D5DC61FB93260597
1 changed files with 9 additions and 9 deletions

View File

@ -693,19 +693,19 @@ class ClientCore < Extension
request = Packet.create_request('core_negotiate_aes')
request.add_tlv(TLV_TYPE_RSA_PUB_KEY, rsa_pub_key.to_pem)
begin
response = client.send_request(request)
aes_key_enc = response.get_tlv_value(TLV_TYPE_ENC_AES_KEY)
if aes_key_enc
begin
aes_key = rsa_key.private_decrypt(aes_key_enc, OpenSSL::PKey::RSA::PKCS1_PADDING)
rescue OpenSSL::PKey::RSAError
# probably failed due to padding, everything else can be bubbled up, but
# we'll stick with a blank key
end
else
aes_key = response.get_tlv_value(TLV_TYPE_AES_KEY)
end
rescue OpenSSL::PKey::RSAError, Rex::Post::Meterpreter::RequestError
# 1) OpenSSL error may be due to padding issues (or something else)
# 2) Request error probably means the request isn't supported, so fallback to plain
end
aes_key
end