Underc0de

Foros Generales => Dudas y pedidos generales => Mensaje iniciado por: banderas20 en Marzo 10, 2020, 02:43:51 PM

Título: Detectar Keylogger
Publicado por: banderas20 en Marzo 10, 2020, 02:43:51 PM
Buenas tardes,

Aparte de pasar un Antivius o Antimalware, ¿Hay alguna manera de detectar si en un equipo hay instalado un Keylogger?

Aparte de mirar el árbol de procesos. Algún comportamiento extraño, o algo así.

Saludos!
Título: Re:Detectar Keylogger
Publicado por: sapewick en Abril 06, 2020, 12:30:11 PM
podrias mirar las  conexiones salientes el inicio en windows en las carpetas %appdata% %temp% (varia ya que en muchos malwares tenes la posibilidad de modificar donde se guarde) activando ver archivos ocultos.
Título: Re:Detectar Keylogger
Publicado por: DtxdF en Abril 08, 2020, 01:27:14 AM
@banderas20 (https://underc0de.org/foro/index.php?action=profile;u=50228)

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
podrias mirar las  conexiones salientes el inicio en windows en las carpetas %appdata% %temp% (varia ya que en muchos malwares tenes la posibilidad de modificar donde se guarde) activando ver archivos ocultos.

¿Que pasaría si el Keylogger es local y no remoto?...  :-X

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Buenas tardes,

Aparte de pasar un Antivius o Antimalware, ¿Hay alguna manera de detectar si en un equipo hay instalado un Keylogger?

Aparte de mirar el árbol de procesos. Algún comportamiento extraño, o algo así.

Saludos!

La API del sistema operativo :-) (Windows en tu caso, supongo)

~ DtxdF
Título: Re:Detectar Keylogger
Publicado por: animanegra en Abril 08, 2020, 02:37:29 AM
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

¿Que pasaría si el Keylogger es local y no remoto?...  :-X


Que si es local probablemente vuelque  la información a fichero y puedes mirar la lista de ficheros abiertos por cada proceso y mirar cuales están en uso. En linux tienes el lsof para ver procesos y ficheros abiertos por ejemplo.

Si ves un fichero que está siempre abierto y además sólo crece en tamaño podría ser un indicativo también de keyloger.
Título: Re:Detectar Keylogger
Publicado por: DtxdF en Abril 08, 2020, 10:29:45 AM
Agregando un poco de lo que dice aminanegra.

Supongo que deseas saber de la detección de un keylogger que no estás probando, tu amigo será lsof (Linux) como nos lo comenta el compañero y  El monitor de recursos (Windows) y debes tener en cuenta que el directorio que mayormente se usaría para estos actos es "/tmp" (Linux), "%tmp%" (Windows). En Linux tiene todos los permisos (drwxrwxrwt) incluido el sticky bit, por lo que no habrá problemas al escribir y leer aquí.

Puedes usar el siguiente comando:

Código (bash) [Seleccionar]
watch --precise --interval 1 lsof -i +D /tmp

Para ver en tiempo real lo que se está haciendo en el directorio temporal, además de mostrar todas las conexiones pertenecientes.

Sin embargo la cosa se complica un poco cuando un atacante puede ejecuar el siguiente comando:

Código (bash) [Seleccionar]
find / -type d -perm 0777

O bueno también se podría "buscar todos los directorios que tengan permiso de escritura y lectura"; eso en caso de que "/tmp" no funcione.

Una cosa más antes de que se me olvide. Use ltrace si tiene el binario para ver las llamadas que está haciendo el programa: Por ejemplo, yo me descarge un keylogger ya hecho desde "https://github.com/SCOTPAUL/keylog" y ejecuté lo siguiente:

Código (bash) [Seleccionar]
make
ltrace ./keylog -f keys.txt


Y obtuve:

Código (text) [Seleccionar]
scandir(0x557bf0fa7299, 0x7fff0ef9ec60, 0x557bf0fa6bf5, 0x7eff97d975b0 <unfinished ...>
snprintf("/dev/input/.", 512, "%s%s", "/dev/input/", ".")                                             = 12
__xstat(1, "/dev/input/.", 0x7fff0ef9e910)                                                            = 0
snprintf("/dev/input/..", 512, "%s%s", "/dev/input/", "..")                                           = 13
__xstat(1, "/dev/input/..", 0x7fff0ef9e910)                                                           = 0
snprintf("/dev/input/event9", 512, "%s%s", "/dev/input/", "event9")                                   = 17
__xstat(1, "/dev/input/event9", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event8", 512, "%s%s", "/dev/input/", "event8")                                   = 17
__xstat(1, "/dev/input/event8", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event7", 512, "%s%s", "/dev/input/", "event7")                                   = 17
__xstat(1, "/dev/input/event7", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event6", 512, "%s%s", "/dev/input/", "event6")                                   = 17
__xstat(1, "/dev/input/event6", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event5", 512, "%s%s", "/dev/input/", "event5")                                   = 17
__xstat(1, "/dev/input/event5", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/by-id", 512, "%s%s", "/dev/input/", "by-id")                                     = 16
__xstat(1, "/dev/input/by-id", 0x7fff0ef9e910)                                                        = 0
snprintf("/dev/input/by-path", 512, "%s%s", "/dev/input/", "by-path")                                 = 18
__xstat(1, "/dev/input/by-path", 0x7fff0ef9e910)                                                      = 0
snprintf("/dev/input/event4", 512, "%s%s", "/dev/input/", "event4")                                   = 17
__xstat(1, "/dev/input/event4", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event3", 512, "%s%s", "/dev/input/", "event3")                                   = 17
__xstat(1, "/dev/input/event3", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event2", 512, "%s%s", "/dev/input/", "event2")                                   = 17
__xstat(1, "/dev/input/event2", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event1", 512, "%s%s", "/dev/input/", "event1")                                   = 17
__xstat(1, "/dev/input/event1", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/event0", 512, "%s%s", "/dev/input/", "event0")                                   = 17
__xstat(1, "/dev/input/event0", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/mouse0", 512, "%s%s", "/dev/input/", "mouse0")                                   = 17
__xstat(1, "/dev/input/mouse0", 0x7fff0ef9e910)                                                       = 0
snprintf("/dev/input/mice", 512, "%s%s", "/dev/input/", "mice")                                       = 15
__xstat(1, "/dev/input/mice", 0x7fff0ef9e910)                                                         = 0
<... scandir resumed> )                                                                               = 12
snprintf("/dev/input/event0", 512, "%s%s", "/dev/input/", "event0")                                   = 17
open("/dev/input/event0", 0, 01676365161)                                                             = 3
ioctl(3, -2147203808, 0x7fff0ef9ea5c)                                                                 = 4
ioctl(3, -2147203807, 0x7fff0ef9ea5c)                                                                 = 4
strdup("/dev/input/event0")                                                                           = 0x557bf2a0b260
close(3)                                                                                              = 0
free(0x557bf2a134b0)                                                                                  = <void>
free(0x557bf2a13480)                                                                                  = <void>
free(0x557bf2a13450)                                                                                  = <void>
free(0x557bf2a13420)                                                                                  = <void>
free(0x557bf2a133f0)                                                                                  = <void>
free(0x557bf2a133c0)                                                                                  = <void>
free(0x557bf2a13390)                                                                                  = <void>
free(0x557bf2a13360)                                                                                  = <void>
free(0x557bf2a13330)                                                                                  = <void>
free(0x557bf2a13300)                                                                                  = <void>
free(0x557bf2a135c0)                                                                                  = <void>
free(0x557bf2a13590)                                                                                  = <void>
free(0x557bf2a134e0)                                                                                  = <void>
getopt(3, 0x7fff0ef9edb8, "sn:f:")                                                                    = 102
getopt(3, 0x7fff0ef9edb8, "sn:f:")                                                                    = -1
open("keys.txt", 1089, 04)                                                                            = 3
open("/dev/input/event0", 0, 02101)                                                                   = 4
signal(SIGINT, 0x557bf0fa6582)                                                                        = 0
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("CAPSLOCK")                                                                                    = 8
write(3, "CAPSLOCK", 9)                                                                               = 9
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "3\317\215^", 3072)                                                                           = 48
read(4, "3\317\215^", 3072)                                                                           = 72
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("U")                                                                                           = 1
write(3, "U", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
Usigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "3\317\215^", 3072)                                                                           = 72
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("CAPSLOCK")                                                                                    = 8
write(3, "CAPSLOCK", 9)                                                                               = 9
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "3\317\215^", 3072)                                                                           = 72
read(4, "3\317\215^", 3072)                                                                           = 48
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("N")                                                                                           = 1
write(3, "N", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n") n                                                                                         = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "3\317\215^", 3072)                                                                           = 72
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("D")                                                                                           = 1
write(3, "D", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2d)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "3\317\215^", 3072)                                                                           = 72
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("E")                                                                                           = 1
write(3, "E", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4e, "3\317\215^", 3072)                                                                           = 72
read(4, "3\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("R")                                                                                           = 1
write(3, "R", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4r, "4\317\215^", 3072)                                                                           = 72
read(4, "4\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("C")                                                                                           = 1
write(3, "C", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }c, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "4\317\215^", 3072)                                                                           = 72
read(4, "4\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("0")                                                                                           = 1
write(3, "0", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n"0)                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "4\317\215^", 3072)                                                                           = 72
read(4, "4\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("D")                                                                                           = 1
write(3, "D", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4d, "4\317\215^", 3072)                                                                           = 72
read(4, "4\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("E")                                                                                           = 1
write(3, "E", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4e, "4\317\215^", 3072)                                                                           = 72
read(4, "J\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("LEFTCTRL")                                                                                    = 8
write(3, "LEFTCTRL", 9)                                                                               = 9
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
read(4, "J\317\215^", 3072)                                                                           = 72
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }^C <no return ...>
--- SIGINT (Interrupt) ---
<... sigaction resumed> , { 0, <>, 0, 0 })                                                            = 0
strlen("C")                                                                                           = 1
write(3, "C", 2)                                                                                      = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
sigemptyset(<>)                                                                                       = 0
sigaction(SIGPIPE, { 0x1, <>, 0, 0 }, { 0, <>, 0, 0 })                                                = 0
strlen("\n")                                                                                          = 1
write(3, "\n", 2)                                                                                     = 2
sigaction(SIGPIPE, { 0, <>, 0, 0 }, nil)                                                              = 0
close(4)                                                                                              = 0
close(3)                                                                                              = 0
free(0x557bf2a0b260)                                                                                  = <void>
+++ exited (status 0) +++


Que leyendo el archivo generado:

Código (bash) [Seleccionar]
tr -d "\n" < keys.txt && echo

Obtenemos:

Código (text) [Seleccionar]
HOLALEFTCTRLCCAPSLOCKUCAPSLOCKNDERC0DELEFTCTRLC

Creo que le será de utilidad para detectar keylogger's manualmente, pero claro, hay muchas maneras de detectarlos y más complejas y efectivas, incluso igual que los AVs (Aunque a veces la mano humana es más efectiva >:-)).

~ DtxdF