XUT_ / COURSES / CYBER SECURITY 101

Tool Overview - How CAPA Works

En esta tarea veremos cómo usar CAPA. Para ejecutar la herramienta, primero abrimos Powershell, después nos tenemos que asegurar de estar en el directorio adecuado (C:\Users\Administrator\Desktop\capa). Luego tenemos que ejecutar capa o capa.exe y apuntar al binario. En este ejemplo usaremos cryptbot.bin.

Después de ejecutar el comando, esperamos el resultado que puede tardar varios minutos.

powershell
PS C:\Users\Administrator\Desktop\capa> capa.exe .\cryptbot.bin
loading : 100%|████████████████████| 485/485 [00:00<00:00, 1108.84     rules/s]
/ analyzing program...

Además del comando -h, el cual nos da más información sobre los parámetros disponibles con la herramienta, dispondremos de los dos parámetros más usados, que son -v y -vv, los cuales nos darán información detallada del resultado.

OpciónDescriptciónSintaxis de Ejemplo
-h or --helpMostrar un mensaje de ayuda y salir.capa -h
-v or --verboseHabilitar verbose para la salida.capa.exe .\cryptbot.bin -v
-vv or --vverboseHabilitar más verbosidadcapa.exe .\cryptbot.bin -vv
Este debería ser el output del comando:
Powershell
PS C:\Users\Administrator\Desktop\capa> capa .\cryptbot.bin
┌─────────────┬─────────────────────────────────────────────────────────────────┐
│ md5         │ 3b9d26d2e7433749f2c32edb13a2b0a2                                │
│ sha1        │ 969437df8f4ad08542ce8fc9831fc49a7765b7c5                        │
│ sha256      │ ae7bc6b6f6ecb206a7b957e4bb86e0d11845c5b2d9f7a00a482bef63b567ce4c│
│ analysis    │ static                                                          │
│ os          │ windows                                                         │
│ format      │ pe                                                              │
│ arch        │ i386                                                            │
│ path        │ /home/strategos/Room-CAPA/cryptbot.bin                          │
└─────────────┴─────────────────────────────────────────────────────────────────┘
┌──────────────────────┬────────────────────────────────────────────────────────┐
│ ATT&CK Tactic        │ ATT&CK Technique                                       │
├──────────────────────┼────────────────────────────────────────────────────────┤
│ DEFENSE EVASION      │ Obfuscated Files or Information [T1027]                │
│                      │ Obfuscated Files or I...Removal from Tools [T1027.005] │
│                      │ Virtualization/Sandbox Evasion::System Checks[T1497.001│
│ DISCOVERY            │ File and Directory Discovery [T1083]                   │
│ EXECUTION            │ Command and Scripting Interpreter::PowerShell [T1059.00│
│                      │ Shared Modules [T1129]                                 │
│ IMPACT               │ Resource Hijacking [T1496]                             │
│ PERSISTENCE          │ Scheduled Task/Job::At [T1053.002]                     │
│                      │ Scheduled Task/Job::Scheduled Task [T1053.005]         │
└──────────────────────┴────────────────────────────────────────────────────────┘
┌─────────────────────────────┬─────────────────────────────────────────────────┐
│ MAEC Category               │ MAEC Value                                      │
├─────────────────────────────┼─────────────────────────────────────────────────┤
│ malware-category            │ launcher                                        │
└─────────────────────────────┴─────────────────────────────────────────────────┘
┌──────────────────────────┬────────────────────────────────────────────────────┐
│ MBC Objective            │ MBC Behavior                                       │
├──────────────────────────┼────────────────────────────────────────────────────┤
│ ANTI-BEHAVIORAL ANALYSIS │ Virtual Machine Detection [B0009]                  │
│ ANTI-STATIC ANALYSIS     │ Executable Code Obfuscation::Argument Obfuscation  │
│                          │ Executable Code Obfuscation::Stack Strings [B0032.0│
│ COMMUNICATION            │ HTTP Communication [C0002]                         │
│                          │ HTTP Communication::Read Header [C0002.014]        │
│ DATA                     │ Check String [C0019]                               │
│                          │ Encode Data::Base64 [C0026.001]                    │
│                          │ Encode Data::XOR [C0026.002]                       │
│ DEFENSE EVASION          │ Obfuscated Files or Information::Encoding-Standard │
│ DISCOVERY                │ File and Directory Discovery [E1083]               │
│ EXECUTION                │ Command and Scripting Interpreter [E1059]          │
│ FILE SYSTEM              │ Create Directory [C0046]                           │
│                          │ Delete File [C0047]                                │
│                          │ Read File [C0051]                                  │
│                          │ Writes File [C0052]                                │
│ MEMORY                   │ Allocate Memory [C0007]                            │
│ PROCESS                  │ Create Process [C0017]                             │
└──────────────────────────┴────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┬────────────────────────┐
│ Capability                                           │ Namespace              │
├──────────────────────────────────────────────────────┼────────────────────────┤
│ reference anti-VM strings                            │ anti-analysis/anti-vm/v│
│ reference anti-VM strings targeting VMWare           │ anti-analysis/anti-vm/v│
│ reference anti-VM strings targeting VirtualBox       │ anti-analysis/anti-vm/v│
│ contain obfuscated stackstrings (2 matches)          │ anti-analysis/obfuscati│
│ reference HTTP User-Agent string                     │ communication/http     │
│ check HTTP status code                               │ communication/http/clie│
│ reference Base64 string                              │ data-manipulation/encod│
│ encode data using XOR                                │ data-manipulation/encod│
│ contain a thread local storage (.tls) section        │ executable/pe/section/t│
│ get common file path                                 │ host-interaction/file-s│
│ create directory                                     │ host-interaction/file-s│
│ delete file                                          │ host-interaction/file-s│
│ read file on Windows (4 matches)                     │ host-interaction/file-s│
│ write file on Windows (5 matches)                    │ host-interaction/file-s│
│ get thread local storage value                       │ host-interaction/proces│
│ create process on Windows                            │ host-interaction/proces│
│ allocate or change RWX memory                        │ host-interaction/proces│
│ reference cryptocurrency strings                     │ impact/cryptocurrency  │
│ link function at runtime on Windows (5 matches)      │ linking/runtime-linking│
│ parse PE header (4 matches)                          │ load-code/pe           │
│ resolve function by parsing PE exports (186 matches) │ load-code/pe           │
│ run PowerShell expression                            │ load-code/powershell/  │
│ schedule task via at                                 │ persistence/scheduled-t│
│ schedule task via schtasks                           │ persistence/scheduled-t│
└──────────────────────────────────────────────────────┴────────────────────────┘

Ya que sabemos que el tiempo de procesado es de varios minutos, hemos pre-procesado esto en un archivo llamado cryptbot.txt, localizado en C:\Users\Administrator\Desktop\capa. En otra Powershell escribe Get-Content cryptbot.txt:

powershell
PS C:\Users\Administrator\Desktop\capa> Get-Content .\cryptbot.txt

Al hacer esto obtendrás el mismo output que si realizaras el escaneo.