Encrypt Data

November 18, 2024 ยท View on GitHub

ID C0027
Objective(s) Cryptography
Related ATT&CK Techniques None
Version 2.2
Created 13 October 2020
Last Modified 6 February 2024

Encrypt Data

Malware may encrypt data.

Methods

NameIDDescription
AESC0027.001Malware encrypts with the AES algorithm.
Block CipherC0027.014Malware encrypts with a block cipher.
BlowfishC0027.002Malware encrypts with the Blowfish algorithm.
CamelliaC0027.003Malware encrypts with the Camellia algorithm.
3DESC0027.004Malware encrypts with the 3DES algorithm.
HC-128C0027.006Malware encrypts with the HC-128 algorithm.
HC-256C0027.007Malware encrypts with the HC-256 algorithm.
RC4C0027.009Malware encrypts with the RC4 algorithm.
RC6C0027.010Malware encrypts with the RC6 algorithm.
RSAC0027.011Malware encrypts with the RSA algorithm.
SkipjackC0027.013Malware encrypts with the Skipjack block cipher algorithm.
SosemanukC0027.008Malware encrypts with the Sosemanuk stream cipher.
Stream CipherC0027.012Malware encrypts with a stream cipher.
TwofishC0027.005Malware encrypts with the Twofish algorithm.

Use in Malware

NameDateMethodDescription
TrickBot2016C0027.001The malware uses an AES CBC (256 bits) encryption algorithm for its loader and configuration files. [1]
Emotet2018C0027.009Emotet encrypts data using RC4 PRGA. [8]
Emotet2018C0027.011Emotet uses RSA to encrypt network traffic to its C2. [2]
GravityRAT2018C0027.001GravityRat v3 supports file AES file encryption. [3]
Poison Ivy2005C0027.003Poison Ivy's custom network protocol over TCP is encrypted using Camellia cipher with a 256-bit key. [4]
CHOPSTICK2015C0027.009CHOPSTICK encrypts the configuration block using RC4 encryption. [5]
Matanbuchus2021C0027.009The malware decrypts inner configurations stored in the binary. The malware also encrypts the value of each JSON key with RC4 and encodes the value with Base64. [6] [7]
BlackEnergy2007C0027.009BlackEnergy encrypts data using RC4 via WinAPI. [8]
Dark Comet2008C0027.009Dark Comet encrypts data using RC4 PRGA. [8]
DNSChanger2011C0027.009DNSChanger encrypts data using RC4 PRGA. [8]
Hupigon2013C0027.004Hupigon encrypts data using DES. [8]
Kraken2008C0027.009Kraken encrypts data using RC4 PRGA. [8]
Locky Bart2017C0027.009Locky Bart encrypts data using RC4 PRGA. [8]
Redhip2011--Redhip encrypts data using DPAPI. [8]
Rombertik2015C0027.009Rombertik encrypts data using RC4 PRGA. [8]

Detection

Tool: capaMappingAPIs
encrypt or decrypt via WinCryptEncrypt Data (C0027)CryptEncrypt, CryptDecrypt, CryptAcquireContext, CryptGenKey, CryptImportKey
encrypt data using memfrob from glibcEncrypt Data (C0027)memfrob
encrypt data using HC-128Encrypt Data::HC-128 (C0027.006)--
encrypt data using HC-128 via WolfSSLEncrypt Data::HC-128 (C0027.006)--
encrypt data using RC6Encrypt Data::RC6 (C0027.010)--
encrypt data using twofishEncrypt Data::Twofish (C0027.005)--
encrypt data using AES MixColumns stepEncrypt Data::AES (C0027.001)--
encrypt data using AES via WinAPIEncrypt Data::AES (C0027.001)CryptGenKey, CryptDeriveKey, CryptImportKey, CryptAcquireContext, CryptEncrypt, CryptDecrypt
encrypt data using AES via .NETEncrypt Data::AES (C0027.001)--
manually build AES constantsEncrypt Data::AES (C0027.001)--
encrypt data using SosemanukEncrypt Data::Sosemanuk (C0027.008)--
encrypt data using CamelliaEncrypt Data::Camellia (C0027.003)--
encrypt data using vestEncrypt Data (C0027)--
encrypt data using DPAPIEncrypt Data (C0027)CryptProtectMemory, CryptUnprotectMemory, crypt32.CryptProtectData, crypt32.CryptUnprotectData, System.Security.Cryptography.ProtectedData::Unprotect, System.Security.Cryptography.ProtectedData::Protect, SystemFunction040, SystemFunction041
encrypt data using DESEncrypt Data::3DES (C0027.004)--
encrypt data using DES via WinAPIEncrypt Data::3DES (C0027.004)CryptGenKey, CryptDeriveKey, CryptImportKey, CryptAcquireContext, CryptEncrypt, CryptDecrypt
encrypt data using RC4 PRGAEncrypt Data::RC4 (C0027.009)--
encrypt data using RC4 with custom key via WinAPIEncrypt Data::RC4 (C0027.009)CryptImportKey, CryptAcquireContext, CryptEncrypt
encrypt data using RC4 via WinAPIEncrypt Data::RC4 (C0027.009)CryptGenKey, CryptDeriveKey, CryptImportKey, CryptAcquireContext, CryptEncrypt, CryptDecrypt
encrypt data using RC4 KSAEncrypt Data::RC4 (C0027.009)--
encrypt data using skipjackEncrypt Data::Skipjack (C0027.013)--
encrypt data using blowfishEncrypt Data::Blowfish (C0027.002)--
Tool: CAPEClassMappingAPIs
mass_data_encryptionMassDataEncryptionEncrypt Data (C0027)CryptEncrypt
encrypt_data_agentteslaEnryptDataAgentTeslaHTTPEncrypt Data (C0027)CryptEncrypt
encrypt_data_agentteslat2_httpEnryptDataAgentTeslaHTTPT2Encrypt Data (C0027)CryptEncrypt, GetComputerNameW, GetUserNameW
encrypt_data_nanocoreEnryptDataNanoCoreEncrypt Data (C0027)CryptEncrypt, GetComputerNameW, GetUserNameW
dcrat_behaviorDCRatAPIsEncrypt Data (C0027)CryptHashData
rat_nanocoreNanocoreRATEncrypt Data (C0027)CryptHashData
rat_luminosityLuminosityRATEncrypt Data (C0027)CryptHashData
script_network_activityScriptNetworkActvityEncrypt Data (C0027)SslEncryptPacket
ransomware_file_modificationsRansomwareFileModificationsEncrypt Data (C0027)--
blackrat_apisBlackRATAPIsEncrypt Data (C0027)CryptHashData

Code Snippets

C0027 Snippet

Encrypt Data SHA256: c86cbf5e78c9f05ecfc11e4f2c147781cef77842a457e19ba690477eb564c22b
asm
push    ebx
mov     ebx, [esp+4+arg_4]
push    esi
lea     eax, [ebx+20h]
push    eax             ; unsigned int
call    ??2@YAPAXI@Z    ; operator new(uint)
mov     ecx, [esp+0Ch+arg_C]
mov     edx, eax
add     esp, 4
mov     esi, [ecx]
mov     [edx], esi
mov     esi, [ecx+4]
mov     [edx+4], esi
mov     ecx, [ecx+8]
mov     [edx+8], ecx
mov     edx, [esp+8+arg_8]
test    ebx, ebx
mov     [eax+0Ch], edx
jle     short loc_B
mov     esi, [esp+8+arg_0]
push    edi
mov     edi, 0FFFFFFFDh
lea     edx, [eax+3]
sub     edi, eax

loc_A: mov cl, [edx-3] xor cl, [edx+2] xor cl, [edx-1] xor cl, [edx] mov [edx+0Dh], cl xor [esi], cl inc edx inc esi lea ecx, [edi+edx] cmp ecx, ebx jl short loc_A pop edi

loc_B: push eax ; void * call ??3@YAXPAX@Z ; operator delete(void *) add esp, 4 mov eax, 1 pop esi pop ebx retn

References

[1] https://www.securityartwork.es/wp-content/uploads/2017/07/Trickbot-report-S2-Grupo.pdf

[2] https://documents.trendmicro.com/assets/white_papers/ExploringEmotetsActivities_Final.pdf

[3] https://blog.talosintelligence.com/2018/04/gravityrat-two-year-evolution-of-apt.html

[4] https://www.mandiant.com/sites/default/files/2021-09/rpt-poison-ivy.pdf

[5] https://web.archive.org/web/20210307034415/https://www.fireeye.com/content/dam/fireeye-www/global/en/current-threats/pdfs/rpt-apt28.pdf

[6] https://www.0ffset.net/reverse-engineering/matanbuchus-loader-analysis/

[7] https://www.cyberark.com/resources/threat-research-blog/inside-matanbuchus-a-quirky-loader

[8] capa v4.0, analyzed at MITRE on 10/12/2022