Web Tool - WFuzz

Impara l'hacking di AWS da zero a eroe con htARTE (HackTricks AWS Red Team Expert)!

Altri modi per supportare HackTricks:

Uno strumento per FUZZare applicazioni web ovunque.

Wfuzz è stato creato per facilitare il compito nelle valutazioni delle applicazioni web ed è basato su un concetto semplice: sostituisce ogni riferimento alla parola chiave FUZZ con il valore di un payload specificato.

Installazione

Installato in Kali

Github: https://github.com/xmendez/wfuzz

pip install wfuzz

Opzioni di filtraggio

-c / --code

Filtra le risposte in base al codice di stato HTTP specificato.

-w / --wordlist

Filtra le risposte in base alle parole presenti nella wordlist specificata.

-r / --regex

Filtra le risposte in base all'espressione regolare specificata.

-s / --size

Filtra le risposte in base alla dimensione specificata.

-e / --extension

Filtra le risposte in base all'estensione specificata.

-H / --header

Filtra le risposte in base all'intestazione specificata.

-b / --body

Filtra le risposte in base al corpo della risposta specificato.

-D / --data

Filtra le richieste in base ai dati specificati.

Filtra le richieste in base ai cookie specificati.

-A / --auth

Filtra le richieste in base all'autenticazione specificata.

-p / --proxy

Filtra le richieste in base al proxy specificato.

-t / --time

Filtra le risposte in base al tempo di risposta specificato.

-x / --exclude

Esclude le risposte che corrispondono ai criteri specificati.

-z / --status

Filtra le risposte in base allo stato specificato.

-m / --method

Filtra le richieste in base al metodo HTTP specificato.

-u / --url

Filtra le richieste in base all'URL specificato.

-d / --data-only

Mostra solo i dati delle risposte filtrate.

-n / --no-follow

Non seguire i redirect delle risposte.

-f / --follow

Segui i redirect delle risposte.

-F / --follow-all

Segui tutti i redirect delle risposte.

-H / --help

Mostra l'elenco delle opzioni di filtraggio disponibili.

--hs/ss "regex" #Hide/Show
#Simple example, match a string: "Invalid username"
#Regex example: "Invalid *"

--hc/sc CODE #Hide/Show by code in response
--hl/sl NUM #Hide/Show by number of lines in response
--hw/sw NUM #Hide/Show by number of words in response
--hh/sh NUM #Hide/Show by number of chars in response
--hc/sc NUM #Hide/Show by response code

Opzioni di output

wfuzz provides several options to control the output format and content. These options can be useful for analyzing the results of a fuzzing session and extracting relevant information.

-o, --output <file>

Specify the output file where the results will be saved. This option allows you to redirect the output to a file instead of displaying it on the terminal.

-f, --format <format>

Specify the output format. The available formats are:

  • json: Output the results in JSON format.

  • html: Output the results in HTML format.

  • csv: Output the results in CSV format.

  • xml: Output the results in XML format.

  • raw: Output the results in raw format (default).

-s, --saveoutput

Save the output to a file. This option is useful when combined with the -o option to save the output in a file without displaying it on the terminal.

-d, --debug

Enable debug mode. This option displays additional information about the fuzzing process, such as the requests being sent and the responses received.

-q, --quiet

Enable quiet mode. This option suppresses all output except for the final results.

-v, --verbose

Enable verbose mode. This option displays additional information about the fuzzing process, such as the requests being sent and the responses received.

-w, --watch

Enable watch mode. This option continuously monitors the target URL and updates the output whenever a new result is found.

-t, --timeout <seconds>

Specify the timeout for each request. This option allows you to set a maximum time limit for each request. If a request takes longer than the specified timeout, it will be considered as a timeout error.

-r, --retries <num>

Specify the number of retries for each request. This option allows you to set the number of times wfuzz should retry a request if it fails.

-R, --random-agent

Use a random user agent for each request. This option helps to simulate different user agents and avoid detection.

-H, --header <header>

Specify a custom header to be included in each request. This option allows you to add custom headers to the requests.

-A, --user-agent <user-agent>

Specify a custom user agent to be used for each request. This option allows you to set a specific user agent for the requests.

-X, --proxy <proxy>

Specify a proxy server to be used for each request. This option allows you to route the requests through a proxy server.

-x, --proxy-auth <proxy-auth>

Specify the authentication credentials for the proxy server. This option allows you to provide the username and password for the proxy server.

-U, --proxy-user <proxy-user>

Specify the username for the proxy server. This option allows you to provide the username for the proxy server.

-P, --proxy-pass <proxy-pass>

Specify the password for the proxy server. This option allows you to provide the password for the proxy server.

-T, --tor

Use Tor for each request. This option allows you to route the requests through the Tor network.

-k, --insecure

Disable SSL certificate verification. This option allows you to ignore SSL certificate errors.

Specify a cookie to be included in each request. This option allows you to add a cookie to the requests.

Specify a cookie jar file to store the cookies. This option allows you to save the cookies to a file for later use.

-e, --encoding <encoding>

Specify the encoding to be used for the requests. This option allows you to set the encoding for the requests.

-u, --url <url>

Specify the target URL. This option allows you to specify the URL of the target to be fuzzed.

-m, --method <method>

Specify the HTTP method to be used for the requests. This option allows you to set the HTTP method for the requests.

-d, --data <data>

Specify the data to be sent with the requests. This option allows you to send data with the requests, such as POST data.

-H, --header <header>

Specify a custom header to be included in each request. This option allows you to add custom headers to the requests.

Specify a cookie to be included in each request. This option allows you to add a cookie to the requests.

Specify a cookie jar file to store the cookies. This option allows you to save the cookies to a file for later use.

-e, --encoding <encoding>

Specify the encoding to be used for the requests. This option allows you to set the encoding for the requests.

-u, --url <url>

Specify the target URL. This option allows you to specify the URL of the target to be fuzzed.

-m, --method <method>

Specify the HTTP method to be used for the requests. This option allows you to set the HTTP method for the requests.

-d, --data <data>

Specify the data to be sent with the requests. This option allows you to send data with the requests, such as POST data.

wfuzz -e printers #Prints the available output formats
-f /tmp/output,csv #Saves the output in that location in csv format

Opzioni degli encoder

There are several encoding options available in wfuzz that can be used to modify the payload sent in the requests. These options can be useful in bypassing certain security measures or evading detection.

URL Encoding

The --urlencode option can be used to encode the payload in URL format. This is useful when the target application expects the payload to be URL-encoded.

HTML Encoding

The --htmlencode option can be used to encode the payload in HTML format. This is useful when the target application expects the payload to be HTML-encoded.

Base64 Encoding

The --base64encode option can be used to encode the payload in Base64 format. This is useful when the target application expects the payload to be Base64-encoded.

Hex Encoding

The --hexencode option can be used to encode the payload in hexadecimal format. This is useful when the target application expects the payload to be encoded in hexadecimal.

Binary Encoding

The --binaryencode option can be used to encode the payload in binary format. This is useful when the target application expects the payload to be encoded in binary.

Custom Encoding

The --customencode option can be used to specify a custom encoding format for the payload. This allows for flexibility in encoding the payload according to specific requirements.

These encoding options can be combined with other options in wfuzz to create powerful payloads that can bypass security measures and evade detection.

wfuzz -e encoders #Prints the available encoders
#Examples: urlencode, md5, base64, hexlify, uri_hex, doble urlencode

Per utilizzare un encoder, devi indicarlo nell'opzione "-w" o "-z".

Esempi:

-z file,/path/to/file,md5 #Will use a list inside the file, and will transform each value into its md5 hash before sending it
-w /path/to/file,base64 #Will use a list, and transform to base64
-z list,each-element-here,hexlify #Inline list and to hex before sending values

CheetSheet

Brute force sul modulo di login

POST, Singola lista, filtro stringa (nascondi)

wfuzz -c -w users.txt --hs "Login name" -d "name=FUZZ&password=FUZZ&autologin=1&enter=Sign+in" http://zipper.htb/zabbix/index.php
#Here we have filtered by line

POST, 2 liste, codice di filtro (mostra)

wfuzz.py -c -z file,users.txt -z file,pass.txt --sc 200 -d "name=FUZZ&password=FUZ2Z&autologin=1&enter=Sign+in" http://zipper.htb/zabbix/index.php
#Here we have filtered by code

GET, 2 liste, filtro stringa (mostra), proxy, cookies

wfuzz può essere utilizzato per testare applicazioni web utilizzando richieste GET. Puoi fornire due liste di valori che verranno combinati per generare tutte le possibili combinazioni di richieste. Puoi anche filtrare le risposte in base a una stringa specifica per visualizzare solo le risposte che contengono quella stringa. Inoltre, puoi utilizzare un proxy per instradare le richieste attraverso un server proxy e utilizzare i cookies per simulare sessioni utente.

wfuzz -c -w users.txt -w pass.txt --ss "Welcome " -p 127.0.0.1:8080:HTTP -b "PHPSESSIONID=1234567890abcdef;customcookie=hey" "http://example.com/index.php?username=FUZZ&password=FUZ2Z&action=sign+in"

Bruteforce Directory/RESTful bruteforce

Elenco di parole dei parametri di Arjun

wfuzz -c -w /tmp/tmp/params.txt --hc 404 https://domain.com/api/FUZZ

Parametri di percorso BF

Il parametro di percorso è una parte dell'URL che viene utilizzata per passare dati specifici al server. L'attacco di forza bruta sui parametri di percorso consiste nel tentare di indovinare i valori dei parametri di percorso al fine di ottenere informazioni sensibili o eseguire azioni non autorizzate.

Utilizzo di WFuzz per l'attacco di forza bruta sui parametri di percorso

WFuzz è uno strumento di forza bruta che può essere utilizzato per testare la sicurezza dei parametri di percorso di un'applicazione web. Per eseguire un attacco di forza bruta sui parametri di percorso utilizzando WFuzz, è possibile utilizzare il seguente comando:

wfuzz -c -z file,<wordlist> --hc <response_code> <url>?<param>=FUZZ
  • -c indica a WFuzz di colorare l'output per una migliore leggibilità.

  • -z file,<wordlist> specifica che WFuzz utilizzerà un file di parole per generare i valori dei parametri di percorso.

  • --hc <response_code> specifica il codice di risposta HTTP che indica una risposta valida. Questo può essere utile per filtrare le risposte indesiderate.

  • <url> è l'URL dell'applicazione web che si desidera testare.

  • <param> è il nome del parametro di percorso che si desidera attaccare.

  • FUZZ è il segnaposto che WFuzz sostituirà con i valori del file di parole.

Esempio di attacco di forza bruta sui parametri di percorso con WFuzz

Supponiamo di voler attaccare il parametro di percorso id di un'applicazione web. Possiamo utilizzare WFuzz con il seguente comando:

wfuzz -c -z file,wordlist.txt --hc 200 https://example.com/page?id=FUZZ

In questo esempio, WFuzz sostituirà FUZZ con i valori presenti nel file di parole wordlist.txt e invierà richieste all'URL https://example.com/page?id=<value>. Se il codice di risposta HTTP è 200, WFuzz considererà la risposta come valida.

Considerazioni finali

L'attacco di forza bruta sui parametri di percorso può essere un modo efficace per scoprire informazioni sensibili o eseguire azioni non autorizzate su un'applicazione web. Tuttavia, è importante notare che l'attacco di forza bruta è un'attività illegale e può comportare conseguenze legali. Pertanto, è fondamentale ottenere l'autorizzazione del proprietario del sistema prima di eseguire qualsiasi tipo di attacco di forza bruta.

wfuzz -c -w ~/git/Arjun/db/params.txt --hw 11 'http://example.com/path%3BFUZZ=FUZZ'

Autenticazione dell'intestazione

Base, 2 liste, stringa di filtro (mostra), proxy

wfuzz -c -w users.txt -w pass.txt -p 127.0.0.1:8080:HTTP --ss "Welcome" --basic FUZZ:FUZ2Z "http://example.com/index.php"

NTLM, 2 liste, stringa di filtro (mostra), proxy


NTLM

NTLM (NT LAN Manager) è un protocollo di autenticazione utilizzato in ambienti Windows. È possibile utilizzare wfuzz per testare la presenza di vulnerabilità NTLM.

2 liste

wfuzz supporta l'utilizzo di due liste contemporaneamente. È possibile specificare due file di parole chiave separati da una virgola per eseguire un attacco combinato.

Stringa di filtro (mostra)

La stringa di filtro (mostra) consente di filtrare i risultati in base a una determinata condizione. È possibile utilizzare questa opzione per visualizzare solo i risultati che soddisfano la condizione specificata.

Proxy

wfuzz supporta l'utilizzo di un proxy per instradare le richieste attraverso un server proxy. È possibile specificare l'indirizzo IP e la porta del server proxy utilizzando l'opzione --proxy.

wfuzz -c -w users.txt -w pass.txt -p 127.0.0.1:8080:HTTP --ss "Welcome" --ntlm 'domain\FUZZ:FUZ2Z' "http://example.com/index.php"

Cookie, codice di filtro (mostra), proxy

wfuzz -c -w users.txt -p 127.0.0.1:8080:HTTP --ss "Welcome " -H "Cookie:id=1312321&user=FUZZ"  "http://example.com/index.php"

User-Agent, codice di filtro (nascondi), proxy

Il parametro User-Agent viene utilizzato dal server per identificare il tipo di client che sta facendo la richiesta. È possibile utilizzare questa informazione per inviare richieste personalizzate al server, ad esempio, per simulare il comportamento di un browser specifico o di un dispositivo mobile.

Il filtro del codice viene utilizzato per nascondere parti del codice sorgente di una pagina web. Questo può essere utile per evitare che i dettagli sensibili vengano visualizzati o per semplificare la visualizzazione del codice.

Un proxy è un server intermedio che agisce come intermediario tra il client e il server di destinazione. Può essere utilizzato per nascondere l'indirizzo IP del client, migliorare la velocità di accesso alle risorse o filtrare il traffico in base a determinate regole.

wfuzz -c -w user-agents.txt -p 127.0.0.1:8080:HTTP --ss "Welcome " -H "User-Agent: FUZZ"  "http://example.com/index.php"

Host

wfuzz -c -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-
top1million-20000.txt --hc 400,404,403 -H "Host: FUZZ.example.com" -u
http://example.com -t 100

Utilizzo del file

Il metodo più comune per eseguire un attacco di forza bruta sui verbi HTTP è utilizzare un file che contiene una lista di verbi da testare. Questo approccio è molto flessibile e consente di personalizzare facilmente l'elenco dei verbi da utilizzare.

Per utilizzare un file per l'attacco di forza bruta, è possibile utilizzare lo strumento wfuzz con l'opzione -w seguita dal percorso del file contenente l'elenco dei verbi. Ad esempio:

wfuzz -w /path/to/verbs.txt http://example.com/FUZZ

In questo esempio, wfuzz utilizzerà il file verbs.txt per testare tutti i verbi contenuti nel file contro l'URL http://example.com/FUZZ. Il placeholder FUZZ verrà sostituito con ogni verbo nel file durante l'attacco.

È possibile creare il proprio file di verbi personalizzato o utilizzare uno dei molti file di parole predefiniti disponibili online. Assicurarsi di utilizzare solo verbi HTTP validi e appropriati per evitare di violare le leggi o le politiche del sito web di destinazione.

Esempio di file di verbi

Ecco un esempio di come potrebbe essere strutturato un file di verbi:

GET
POST
PUT
DELETE
HEAD
OPTIONS

In questo esempio, il file contiene una lista di verbi HTTP comuni che possono essere utilizzati per l'attacco di forza bruta. È possibile aggiungere o rimuovere verbi a seconda delle esigenze specifiche dell'attacco.

Conclusioni

L'utilizzo di un file per eseguire un attacco di forza bruta sui verbi HTTP è un metodo flessibile e personalizzabile. Assicurarsi di utilizzare solo verbi HTTP validi e appropriati e rispettare le leggi e le politiche del sito web di destinazione durante l'attacco.

wfuzz -c -w methods.txt -p 127.0.0.1:8080:HTTP --sc 200 -X FUZZ "http://example.com/index.php"

Utilizzo di elenco inline

Sometimes, when fuzzing a web application, you may need to provide a list of values to test against a specific parameter. Instead of creating a separate file with the list of values, you can use the --list option in wfuzz to specify an inline list.

A volte, durante il fuzzing di un'applicazione web, potresti dover fornire un elenco di valori da testare su un parametro specifico. Invece di creare un file separato con l'elenco dei valori, puoi utilizzare l'opzione --list in wfuzz per specificare un elenco inline.

For example, let's say you want to fuzz the id parameter with a list of possible values. Instead of creating a file with the list, you can use the --list option followed by the values separated by commas:

Ad esempio, supponiamo che tu voglia effettuare il fuzzing del parametro id con un elenco di valori possibili. Invece di creare un file con l'elenco, puoi utilizzare l'opzione --list seguita dai valori separati da virgole:

wfuzz -c -z list,admin,user,guest --hh 0 -u http://example.com/?id=FUZZ

This command will fuzz the id parameter with the values admin, user, and guest.

Questo comando effettuerà il fuzzing del parametro id con i valori admin, user e guest.

$ wfuzz -z list,GET-HEAD-POST-TRACE-OPTIONS -X FUZZ http://testphp.vulnweb.com/

Bruteforce di Directory e File

La tecnica di bruteforce viene spesso utilizzata per scoprire directory e file nascosti su un sito web. Questo può essere utile durante un test di penetrazione per identificare potenziali punti deboli nel sistema.

Uno strumento comune utilizzato per eseguire il bruteforce di directory e file è wfuzz. Questo strumento consente di inviare richieste HTTP a un server web e di testare diverse combinazioni di nomi di directory e file per individuare quelli validi.

Ecco un esempio di utilizzo di wfuzz per eseguire il bruteforce di directory:

wfuzz -c -z file,/path/to/wordlist.txt http://example.com/FUZZ

In questo esempio, wfuzz utilizzerà il file di wordlist specificato per testare tutte le possibili combinazioni di nomi di directory nella URL fornita. I risultati verranno visualizzati a schermo, indicando quali directory sono state trovate.

È importante utilizzare una wordlist di alta qualità per ottenere i migliori risultati. Esistono diverse wordlist disponibili online che possono essere utilizzate per questo scopo.

Inoltre, è possibile utilizzare wfuzz per eseguire il bruteforce di file. Ad esempio, se si desidera testare tutte le possibili estensioni di file per un determinato percorso, è possibile utilizzare il seguente comando:

wfuzz -c -z file,/path/to/extensions.txt http://example.com/path/to/file.FUZZ

In questo caso, wfuzz testerà tutte le possibili estensioni di file specificate nel file di estensioni fornito.

Il bruteforce di directory e file può rivelare informazioni sensibili o vulnerabilità nel sistema. Tuttavia, è importante utilizzare questa tecnica con cautela e solo con il permesso del proprietario del sistema.

#Filter by whitelisting codes
wfuzz -c -z file,/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt --sc 200,202,204,301,302,307,403 http://example.com/uploads/FUZZ

Strumento per bypassare i siti web

https://github.com/carlospolop/fuzzhttpbypass

Impara l'hacking di AWS da zero a eroe con htARTE (HackTricks AWS Red Team Expert)!

Altri modi per supportare HackTricks:

Last updated