Recientemente un conocido me preguntó si había visto este twitter:

Lo primero que suelo hacer en estos casos es buscar el dominio en Virus Total.

  • Como veis, hay muchos ficheros Excel y una dll.
Relaciéon de dominios Virus Total

Si los descargamos todos:

$ find . -iname "*.xls" -exec md5sum {} \; b5150fcaec456f7803167b755c5da436 ./QF_JULIO_2020_9495.xls f5778e16c498d95161d6d105bc6fe454 ./FACA0000300050810.xls 9afdb5896d650b6ca64975d2fc3556c1 ./CH513530_218.xls 713ca2db26c7029dacff5abaa0189028 ./CH437199_868.xls de8e41ea5fb7fb0e013b983a64ae35ab ./CH861457_499.xls f06bc26fde7e1f80172495ac3bf818d3 ./FACA0000300025849.xls 9bf513bfc65bb39951a0ca09e855b10f ./FACA0000300082875.xls d5aa8c3b5b1b2c2f1b1e909355caed4f ./CH039648_181.xls 2a1d2a8e146093cda6212ff93e699081 ./CH404586_640.xls 867a52e6e1b80abd2f50227e5d76cfc8 ./FACA0000300085048.xls

Y buscamos en su interior, vemos como aparecen en todos ellos los mismos 2 ficheros, dc0c9afb7b7359fa320bedac6d0ea07e.bin y 1afd4c97e88ce2dce8a556710448d001.bin ( utilizamos este script )

$ find . -iname "*.xls" -exec python carvepe.py {} \;
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin
INFO:__main__:found pe at 0x1b53, length: 0x50200
INFO:__main__:writing pe file to dc0c9afb7b7359fa320bedac6d0ea07e.bin
INFO:__main__:found pe at 0x52d29, length: 0x3fa00
INFO:__main__:writing pe file to 1afd4c97e88ce2dce8a556710448d001.bin

Que como veremos a continuación se trata de 2 DLL, lo que indica que todos esos ficheros de Excel están asociados a la misma campaña:

$ file *.bin
1afd4c97e88ce2dce8a556710448d001.bin: PE32+ executable (DLL) (console) x86-64, for MS Windows
dc0c9afb7b7359fa320bedac6d0ea07e.bin: PE32 executable (DLL) (console) Intel 80386, for MS Windows

Los 2 hacen lo mismo, en base a la arquitectura del equipo donde ejecuta o más bien según el Excel utilizado, se decantará por utilizar una u otra.

Siempre es más fácil analizar la de 32 bits, así que me decanto por: dc0c9afb7b7359fa320bedac6d0ea07e.bin

La cargo en el Ollydbg ( lo sé, soy un clásico :P ) y aquí vemos la DLL original, ya desempaquetada y lista para ser analizada.

Ollydbg

Tranquilos, no os podré todos los detalles de donde se saca cada cosa sino el resumen, lo bueno si breve…

Lo primero que necesitamos ver es ese C2 que se veía en el twitter, mira-store.com.

Aquí lo tenemos:

mira-store.com

Vemos que es llamado desde la función fcn.1000392e.

Una forma rápida para saber qué se hace en esa función es buscar qué llamadas a las api de Windows se hacen:

fnc.1000392e

[0x10034770]> pdf@fcn.1000392e~call dword [sym| grep -o "\[.*\]"
[sym.imp.KERNEL32.dll_GetComputerNameExW]
[sym.imp.ADVAPI32.dll_GetUserNameW]
[sym.imp.KERNEL32.dll_K32EnumProcesses]
[sym.imp.KERNEL32.dll_OpenProcess]
[sym.imp.KERNEL32.dll_K32GetModuleFileNameExW]
[sym.imp.KERNEL32.dll_CloseHandle]
[sym.imp.KERNEL32.dll_GetTempPathW]
[sym.imp.KERNEL32.dll_CreateProcessW]

Tenemos que necesitan conocer el nombre del pc donde se ejecuta la muestra, el usuario, los procesos, etc. Hará algo en el directorio temporal y jugará con procesos (se inyectará en Excel.exe).

Nombre equipo TA505

Dicho esto, sigamos mirando, intuyo que las peticiones vía web se harán vía POST.

Método POST TA505

Misma función de antes, todo pasa ahí dentro.

Podemos ir paso a paso viendo lo que hace la función:

Funciones TA505

El user-agent que se va a utilizar (esto podría ser un IOC para detectar más muestras): "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36".

Si buscamos las strings dentro de esta función vemos:

IOCs TA505

Si juntamos todo lo que hemos visto podemos ir sacando qué envía en cada parámetro del POST.

COMPUTERNAME

D=COMPUTERNAME

Y siguiendo el mismo procedimiento podemos sacar el resto de parámetros.

Parámetros C2 TA505 XLS

Siendo estos los parámetros que va a enviar al C2:

  • D: Hostname
  • U: Usuario
  • OS: Versión de Windows
  • OSA: Arquitectura (x86)
  • PR: Procesos en ejecución

Nota: ¿ que hará el servidor si se encuentra con algún proceso como ollydbg.exe, x64dbg.exe, wireshark.exe ?

El envío de información al C2 se realizará llamando a las funciones de la api incluídas en Winhttp.dll.

Winhttp TA505

Todo esto que he ido comentando es solamente para descargarse lo que sería el bot o RAT que comprometa finalmente el equipo.

La forma en la que extrae del fichero Excel la DLL es buenísima, se nota que saben lo que hacen, pero eso lo dejaré para otro post :-D

Espero que os haya gustado!!

Hasta otra ;-)