Ignore missing method error when doing aes negotiation
This means that meterpreter instances that don't support will continue to work.bug/bundler_fix
parent
bdcea7bd22
commit
9f2be21eb7
|
@ -693,19 +693,19 @@ class ClientCore < Extension
|
||||||
request = Packet.create_request('core_negotiate_aes')
|
request = Packet.create_request('core_negotiate_aes')
|
||||||
request.add_tlv(TLV_TYPE_RSA_PUB_KEY, rsa_pub_key.to_pem)
|
request.add_tlv(TLV_TYPE_RSA_PUB_KEY, rsa_pub_key.to_pem)
|
||||||
|
|
||||||
|
begin
|
||||||
response = client.send_request(request)
|
response = client.send_request(request)
|
||||||
aes_key_enc = response.get_tlv_value(TLV_TYPE_ENC_AES_KEY)
|
aes_key_enc = response.get_tlv_value(TLV_TYPE_ENC_AES_KEY)
|
||||||
|
|
||||||
if aes_key_enc
|
if aes_key_enc
|
||||||
begin
|
|
||||||
aes_key = rsa_key.private_decrypt(aes_key_enc, OpenSSL::PKey::RSA::PKCS1_PADDING)
|
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
|
else
|
||||||
aes_key = response.get_tlv_value(TLV_TYPE_AES_KEY)
|
aes_key = response.get_tlv_value(TLV_TYPE_AES_KEY)
|
||||||
end
|
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
|
aes_key
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue