File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -758,6 +758,7 @@ def valid_transport?(transport)
758
758
#
759
759
def negotiate_tlv_encryption ( timeout : client . comm_timeout )
760
760
sym_key = nil
761
+ is_weak_key = nil
761
762
rsa_key = OpenSSL ::PKey ::RSA . new ( 2048 )
762
763
rsa_pub_key = rsa_key . public_key
763
764
@@ -769,10 +770,13 @@ def negotiate_tlv_encryption(timeout: client.comm_timeout)
769
770
key_enc = response . get_tlv_value ( TLV_TYPE_ENC_SYM_KEY )
770
771
key_type = response . get_tlv_value ( TLV_TYPE_SYM_KEY_TYPE )
771
772
key_length = { Packet ::ENC_FLAG_AES128 => 16 , Packet ::ENC_FLAG_AES256 => 32 } [ key_type ]
772
- is_weak_key = false
773
773
if key_enc
774
774
key_dec_data = rsa_key . private_decrypt ( key_enc , OpenSSL ::PKey ::RSA ::PKCS1_PADDING )
775
+ if !key_dec_data
776
+ raise Rex ::Post ::Meterpreter ::RequestError
777
+ end
775
778
sym_key = key_dec_data [ 0 ..key_length - 1 ]
779
+ is_weak_key = false
776
780
if key_dec_data . length > key_length
777
781
key_dec_data = key_dec_data [ key_length ...]
778
782
if key_dec_data . length > 0
You can’t perform that action at this time.
0 commit comments