
Python implementation of the CaRT library for (un)inerting files.
El formato de archivo CaRT se utiliza para almacenar/transferir malware y sus metadatos asociados. Neutraliza el malware para que no pueda ejecutarse y lo cifra para que el software antivirus no pueda marcar el archivo CaRT como malware.
Ahora que STIX v2 utiliza JSON como codificación, puedes empaquetar tu informe STIX directamente en el formato CaRT.
Cuando CaRT codifica archivos, añade los metadatos del archivo *.cartmeta con el mismo prefijo que tu archivo.
Por lo tanto, si guardas tu informe STIX en un archivo .cartmeta, el archivo CaRT resultante tendrá el
informe STIX completo incrustado en él.
Ejemplo:
$ ls
file.exe - File I want to encode
file.exe.cartmeta - Stix report of file.exe
$ cart file.exe
$ ls
file.exe - File I want to encode
file.exe.cartmeta - Stix report of file.exe
file.exe.cart - CaRT file containing both the file.exe and its STIX report
CaRT tiene un encabezado obligatorio que se ve así:
4s h Q 16s Q
CART<VERSION><RESERVED><ARC4KEY><OPT_HEADER_LEN>
Donde VERSION es 1 y RESERVED es 0. En la mayoría de los casos, la clave RC4 utilizada para descifrar el archivo se almacena en el encabezado obligatorio y es siempre la misma (los primeros 8 dígitos de pi, dos veces). Sin embargo, CaRT ofrece una opción para anular la clave; en ese caso, se almacenan bytes nulos en el encabezado obligatorio. Entonces necesitarás conocer la clave para decodificar el archivo CaRT...
El encabezado opcional de CaRT es un blob RC4 de OPT_HEADER_LEN bytes de un encabezado serializado en JSON
RC4(<JSON_SERIALIZED_OPTIONAL_HEADER>)
El bloque de datos de CaRT es un bloque zlib seguido de RC4
RC4(ZLIB(block encoded stream))
Al igual que el encabezado opcional, el pie de página opcional de CaRT es un blob RC4 de OPT_FOOTER_LEN bytes de un pie de página serializado en JSON
RC4(<JSON_SERIALIZED_OPTIONAL_FOOTER>)
CaRT finaliza su archivo con un pie de página obligatorio que permite al formato leer el pie de página y devolver los hashes sin leer todo el archivo
4s QQ Q
TRAC<RESERVED><OPT_FOOTER_LEN>
Al instalar el paquete pip, obtienes acceso a la biblioteca CaRT y también al CLI de CaRT.
El CLI de CaRT tiene la siguiente prioridad para sus opciones:
~/.cart/cart.cfgEstas son las opciones disponibles en el CLI de CaRT:
usage: cart [options] file1 file2 ... fileN
The CaRT file format is used to store/transfer malware and its associated metadata.
It neuters the malware so it cannot be executed and encrypts it so anti-virus software
cannot flag the CaRT file as malware.
positional arguments:
file
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-d, --delete Delete original after operation succeeded
-f, --force Replace output file if it already exists
-i, --ignore Ignore RC4 key from conf file
-j JSONMETA, --jsonmeta JSONMETA
Provide header metadata as JSON blob
-k KEY, --key KEY Use private RC4 key (base64 encoded). Same key must be provided to unCaRT.
-m, --meta Keep metadata around when extracting CaRTs
-n FILENAME, --name FILENAME
Use this value as metadata filename
-o OUTFILE, --outfile OUTFILE
Set output file
-s, --showmeta Only show the file metadata
CaRT is smart enough to determine if a file needs to be CaRTed or unCaRTed.
To CaRT an unCaRTed file: cart file1
To unCaRT a CaRTed file: cart file1
It is the same command!
El archivo de configuración de CaRT tiene este aspecto:
[global]
# rc4_key is a base64 representation of your key
rc4_key: AvUzYXNkZg==
# keep_meta is an equivalent to -m in the CLI
keep_meta: True
# force is an equivalent to -f in the CLI
force: True
# default_header is a key/value pair of data to be added to the CaRT in the optional header
[default_header]
poc: Your Name
poc_email: [email protected]
También hay implementaciones de CaRT en Rust y Java. Échales un vistazo a continuación: