Bagaimana cara meretas kerentanan web dengan nikto?

Pindai Kerentanan di Situs Web Apa Pun Menggunakan Nikto

Pindai Kerentanan di Situs Web Apa Pun Menggunakan Nikto


Pindai Kerentanan di Situs Web ApaPun Menggunakan Nikto


Instal Nikto

Jika Anda menjalankan Kali Linux, Nikto sudah diinstal sebelumnya, jadi Anda tidak perlu mengunduh atau menginstal apa pun. Itu akan ditempatkan di kategori "Analisis Kerentanan". Jika Anda tidak memilikinya karena suatu alasan, Anda bisa mendapatkan Nikto dari GitHub-nya atau cukup gunakan perintah apt install .


apt install nikto


Untuk pengguna Mac


brew install nikto


Langkah 2


Mengenal Nikto

Sebelum Anda mendalami pemindaian server web dengan Nikto, izinkan Anda menggunakan opsi -Help untuk melihat segala sesuatu yang dapat dilakukan di dalam Nikto.


nikto - help


Langkah 3 

Gunakan Sintaks Dasar


Seperti yang Anda lihat dari langkah sebelumnya, Nikto memiliki banyak opsi, tetapi untuk tujuan kita, kita akan tetap menggunakan sintaks dasar sebagai berikut. Kami akan mengganti <IP atau hostname> dengan alamat IP aktual atau nama host tanpa kurung sudut.

nikto-h <IP or hostname>

Namun, Nikto mampu melakukan pemindaian yang dapat dilakukan setelah SSL dan port 443, port yang digunakan situs web HTTPS (HTTP menggunakan port 80 secara default). Jadi kami tidak hanya terbatas pada pemindaian situs lama, kami dapat melakukan penilaian kerentanan pada situs yang menggunakan SSL, yang merupakan persyaratan yang cukup banyak saat ini untuk diindeks dalam hasil pencarian.

Jika kami mengetahui bahwa ini adalah situs SSL yang kami targetkan, kami dapat menentukannya di Nikto untuk menghemat waktu pemindaian dengan menambahkan -ssl di akhir perintah.

nikto-h <IP or hostname> -ssl

Langkah 4 

Pindai Situs Web yang Diaktifkan SSL

Sebagai contoh, mari kita mulai dengan memindai pbs.org untuk melihat beberapa jenis informasi yang akan ditampilkan oleh pemindaian Nikto. Setelah terhubung ke port 443, kami melihat bahwa ada beberapa informasi berguna tentang cipher dan daftar detail lainnya seperti server Nginx, tetapi tidak ada banyak data menarik di sini untuk kami.



nikto-h pbs.org -ssl-

 Nikto v2.1.6-

------------------------------------------------------------------------------

 STATUS: Starting up!

+ Target IP: 54.225.198.196

+ Target Hostname:              pbs.org
+ Traget Port:                  443
------------------------------------------------------------------------------
+ SSl Info:                     Subject:        /CN=www.pbs.org
                                        Altnames:       account.pbs.org, admin.pgs.org, dipsy-tc.pbs.org, docs.pbs.org, ga.video.cdn.pbs.org, git.pbs.org, heart.ops.pbs.org, hub-dev.pbs.org, image.pbs.org,
                                        jaws..pbs.org, kids.pbs.org, koth-qa.svp.pbs.org, login.pbs.org, ops.pbs.org, pbs.org, player.pbs.org, projects.pbs.org, sentry.pbs.org, teacherline.pbs.org,
                                urs.pbs.org, video.pbs.org, weta-qa.svp.pbs.org, whut-qa.svp.pbs.org, wnet.video-qa.pbs.org, wnet.video-staging.pbs.org, www-cache.pbs.org, www.pbs.org
                    Ciphers:    ECDHE-RSA-AES128-GCM-SHA256
                    Issuer:             /C-US/0=Let's Encrypt/CN=Let's Encrypt Authority X3
+ Start Time:                   2018-12-05 23:34:06 (GMT-8)
------------------------------------------------------------------------------
+ Server: nginx
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ Uncommon header 'x-pbs-fwsrvname' found, with contents: fwcacheproxy1
+ The site uses SSL and the Strict-Transport-Security HTTP header is not defined.
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Root page / redirects to: https://www.pbs.org/
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ RC-1918 IP address found in the 'x-pbs-appsvrip' header: The IP is "10.137.181.52".
+ Uncommon header 'x-cache-fs-status' found, with contents: EXPIRED
+ Uncommon header 'x-pbs-appsvrname' found, with contents: fwcacheproxy1
+ Uncommon header 'x-pbs-appsvrip' found, with contents: 10.137.181.52
+ Server leaks inodes via ETags, header found with file /pbs.org.zip, fields: 0x5b96537e 0x1678
+ 7446 requests: 0 error(s) and 10 item(s) reported on remote host
+ End Time:                             2018-12-06 00:30:29 (GMT-8) (3383 seconds)
------------------------------------------------------------------------------
+ 1 host(s) tested





Langkah 5 

Pindai Alamat IP

Sekarang setelah kita melakukan pemindaian cepat sebuah situs web, mari kita coba menggunakan Nikto di jaringan lokal untuk menemukan server tertanam seperti halaman login untuk router atau layanan HTTP di komputer lain yang hanya server tanpa situs web. Untuk memulai, mari cari alamat IP kita menggunakan ifconfig .

ifconfig
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST>  mtu 1500
        inet 192.168.0.48  netmask 0xffffff00  broadcast 192.168.0.255
        inet6 XXXX::XXX:XXXX:XXXX:XXXX%en0  prefixlen 64  secured scopeid 0x8
        ether XX:XX:XX:XX:XX:XX  txqueuelen 1000  (Ethernet)
        inet6 XXXX::XXX:XXXX:XXXX:XXXX%en0  prefixlen 64 autoconf secured
        inet6 XXXX::XXX:XXXX:XXXX:XXXX%en0  prefixlen 64 autoconf temporary
        nd6 options=201<PERFORMNUD,DAD>
        media: autoselect
        status: active

en2: flags=8863<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST>  mtu 1500
        options=60<TS04,TS06>
        ether XX:XX:XX:XX:XX:XX
        media: autoselect <full-duplex>
        status: inactive

Alamat IP yang kita inginkan adalah yang "inet". Kemudian kita dapat menjalankan ipcalc di atasnya untuk mendapatkan jangkauan jaringan kita. Jika Anda tidak memiliki ipcalc , Anda dapat menginstalnya dengan apt install ipcalc , lalu coba lagi. Rentang akan berada di sebelah "Jaringan", dalam kasus saya, 192.168.0.0/24.

ipcalc 192.168.0.48
Address:   192.168.0.48         11000000.10101000.00000000. 00110000
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   192.168.0.0/24       11000000.10101000.00000000. 00000000
HostMin:   192.168.0.1          11000000.10101000.00000000. 00000001
HostMax:   192.168.0.254        11000000.10101000.00000000. 11111110
Broadcast: 192.168.0.255        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet

Sekarang, kita akan ingin menjalankan Nmap untuk menemukan layanan yang berjalan dalam jangkauan jaringan. Mari kita pindai port 80 dengan jangkauan kita dan tempelkan -oG (output grepable) untuk mengekstrak hanya host yang aktif dan berjalan, yaitu yang merespons yang menunjukkan bahwa port 80 terbuka. Kemudian kita akan menyimpan semuanya ke sebuah file, yang saya beri nama nullbyte.txt , tapi bisa diberi nama apa saja.

nmap -p 80 192.168.0.0/24 -oG nullbyte.txt
Starting Nmap 7.60 ( https://nmap.org ) at 2018-12-06 00:43 PST
Nmap scan report for 192.168.0.1
Host is up (0.021s latency).

PORT   STATE SERVICE
80/tcp open  http

Nmap scan report for 192.168.0.2
Host is up (0.088s latency).

PORT   STATE SERVICE
80/tcp open  http

Nmap scan report for 192.168.0.4
Host is up (0.032s latency).

PORT   STATE SERVICE
80/tcp open  http

Nmap scan report for 192.168.0.5
Host is up (0.020s latency).

PORT   STATE SERVICE
80/tcp open  http

Nmap scan report for 192.168.0.11
Host is up (0.068s latency).

PORT   STATE  SERVICE
80/tcp closed http

Nmap scan report for 192.168.0.24
Host is up (0.023s latency).

PORT   STATE  SERVICE
80/tcp closed http

Nmap scan report for 192.168.0.31
Host is up (0.059s latency).

PORT   STATE  SERVICE
80/tcp closed http

Nmap scan report for 192.168.0.48
Host is up (0.030s latency).

PORT   STATE  SERVICE
80/tcp closed http

Nmap scan report for 192.168.0.60
Host is up (0.092s latency).

PORT   STATE  SERVICE
80/tcp closed http

Nmap done: 256 IP addresses (9 hosts up) scanned in 8.92 seconds

Ada trik kecil yang bagus yang dapat mengirim semua host langsung ke Nikto untuk dipindai. Kami menggunakan cat untuk membaca output yang disimpan dalam dokumen nullbyte.txt kami (atau apa pun namanya). Lalu, ada awk , alat Linux yang akan membantu mencari pola berikut, di mana Up berarti host sudah aktif dan print $2 berarti mencetak kata kedua di baris itu untuk masing-masing, yaitu, hanya alamat IP. Kemudian, kami mengirimkan data tersebut ke file baru bernama targetIP.txt (atau apa pun yang Anda ingin beri nama).

cat nullbyte.txt | awk '/Up$/{print $2}' | cat >> targetIP.txt

Kita sekarang dapat melihat isi file baru kita dengan cat untuk melihat semua alamat IP yang memiliki port 80 terbuka.



cat targetIP.txt
192.168.0.1
192.168.0.2
192.168.0.4
192.168.0.5
192.168.0.11
192.168.0.24
192.168.0.31
192.168.0.48
192.168.0.60

Ini sempurna untuk Nikto karena dapat dengan mudah menginterpretasikan file seperti ini. Jadi kita bisa mengirimkan output ini ke Nikto dengan perintah berikut.

nikto -h targetIP.txt

Hasilnya akan terlihat mirip dengan yang kami dapatkan saat melakukan pemindaian SSL.

Langkah 6 

Pindai Situs Web HTTP

Kami telah memindai situs web yang aman dan alamat IP di jaringan lokal, dan sekarang saatnya untuk mencari domain web yang tidak aman menggunakan port 80. Untuk contoh ini, saya menggunakan " afl.com.au ,' yang bukan menggunakan SSL pada saat saya melakukan pemindaian ini.

nikto -h www.afl.com.au
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          159.180.84.10
+ Target Hostname:    www.afl.com.au
+ Target Port:        80
+ Start Time:         2018-12-05 21:48:32 (GMT-8)
---------------------------------------------------------------------------
+ Server: instart/nginx
+ Retried via header: 1.1 varnish (Varnish/6.1), 1.1 e9ba0a9a729ff2960a04323bf1833df8.cloudfront.net (CloudFront)
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ Uncommon header 'x-cache' found, with contents: Miss from cloudfront
+ Uncommon header 'x-instart-cache-id' found, with contents: 17:12768802731504004780::1544075250
+ Uncommon header 'v-cache-hit' found, with contents: Hit
+ Uncommon header 'x-amz-cf-id' found, with contents: Dr-r6OwO5kk9ABt4ejzpc7R7AIF6SuH6kfJHQgP0v6xZoHwMLE55rQ==
+ Uncommon header 'x-instart-request-id' found, with contents: 12814413144077601501:BEQ01-CPVNPPRY18:1552504721:0
+ Uncommon header 'x-oneagent-js-injection' found, with contents: true
+ Uncommon header 'grace' found, with contents: cache
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Uncommon header 'x-ruxit-js-agent' found, with contents: true
+ Cookie dtCookie created without the httponly flag
+ Server banner has changed from 'instart/nginx' to 'nginx' which may suggest a WAF, load balancer or proxy is in place
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Entry '/sites/' in robots.txt returned a non-forbidden or redirect HTTP code (200)
+ Entry '/search/' in robots.txt returned a non-forbidden or redirect HTTP code (200)
+ Entry '*.mobileapp' in robots.txt returned a non-forbidden or redirect HTTP code (400)
+ Entry '*.liveradio' in robots.txt returned a non-forbidden or redirect HTTP code (400)
+ Entry '*.smartmobile' in robots.txt returned a non-forbidden or redirect HTTP code (400)
+ Entry '*.responsive' in robots.txt returned a non-forbidden or redirect HTTP code (400)
+ Entry '/stats?*/' in robots.txt returned a non-forbidden or redirect HTTP code (200)
+ "robots.txt" contains 8 entries which should be manually viewed.
+ OSVDB-3092: /sitemap.xml: This gives a nice listing of the site content.
+ OSVDB-3092: /psql_history: This might be interesting...
+ OSVDB-3092: /global/: This might be interesting...
+ OSVDB-3092: /home/: This might be interesting...
+ OSVDB-3092: /news: This might be interesting...
+ OSVDB-3092: /search.vts: This might be interesting...
+ OSVDB-3092: /stats.htm: This might be interesting...
+ OSVDB-3092: /stats.txt: This might be interesting...
+ OSVDB-3092: /stats/: This might be interesting...
+ OSVDB-3092: /Stats/: This might be interesting...
+ OSVDB-3093: /.wwwacl: Contains authorization information
+ OSVDB-3093: /.www_acl: Contains authorization information
+ OSVDB-3093: /.htpasswd: Contains authorization information
+ OSVDB-3093: /.access: Contains authorization information
+ OSVDB-3093: /.addressbook: PINE addressbook, may store sensitive e-mail address contact information and notes
+ OSVDB-3093: /.bashrc: User home dir was found with a shell rc file. This may reveal file and path information.
+ OSVDB-3093: /.bash_history: A user's home directory may be set to the web root, the shell history was retrieved. This should not be accessible via the web.
+ OSVDB-3093: /.forward: User home dir was found with a mail forward file. May reveal where the user's mail is being forwarded to.
+ OSVDB-3093: /.history: A user's home directory may be set to the web root, the shell history was retrieved. This should not be accessible via the web.
+ OSVDB-3093: /.htaccess: Contains configuration and/or authorization information
+ OSVDB-3093: /.lynx_cookies: User home dir found with LYNX cookie file. May reveal cookies received from arbitrary web sites.
+ OSVDB-3093: /.mysql_history: Database SQL?
+ OSVDB-3093: /.passwd: Contains authorization information
+ OSVDB-3093: /.pinerc: User home dir found with a PINE rc file. May reveal system information, directories and more.
+ OSVDB-3093: /.plan: User home dir with a .plan, a now mostly outdated file for delivering information via the finger protocol
+ OSVDB-3093: /.proclog: User home dir with a Procmail rc file. May reveal mail traffic, directories and more.
+ OSVDB-3093: /.procmailrc: User home dir with a Procmail rc file. May reveal subdirectories, mail contacts and more.
+ OSVDB-3093: /.profile: User home dir with a shell profile was found. May reveal directory information and system configuration.
+ OSVDB-3093: /.rhosts: A user's home directory may be set to the web root, a .rhosts file was retrieved. This should not be accessible via the web.
+ OSVDB-3093: /.sh_history: A user's home directory may be set to the web root, the shell history was retrieved. This should not be accessible via the web.
+ OSVDB-3093: /.ssh: A user's home directory may be set to the web root, an ssh file was retrieved. This should not be accessible via the web.
+ OSVDB-5709: /.nsconfig: Contains authorization information
+ /portal/changelog: Vignette richtext HTML editor changelog found.
+ 7587 requests: 4 error(s) and 55 item(s) reported on remote host
+ End Time:           2018-12-05 22:42:41 (GMT-8) (3249 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested

Di atas, kita dapat melihat bahwa ada server Varnish dan beberapa header yang membantu menunjukkan bagaimana situs web dikonfigurasi. Namun, hal yang lebih menarik adalah direktori yang ditemukan yang dapat membantu mengambil file konfigurasi yang mungkin berisi kredensial atau hal lain yang salah konfigurasi dan dibiarkan dapat diakses secara tidak sengaja.


Aigore

Tujuan saya buat blog ini adalah untuk sharing sekaligus belajar.

Posting Komentar

Lebih baru Lebih lama