hacktricks/pentesting-web/web-tool-wfuzz.md

584 lines
19 KiB
Markdown
Raw Permalink Normal View History

2022-08-07 12:55:22 +00:00
# Web Tool - WFuzz
2022-04-28 16:01:33 +00:00
<details>
2024-01-10 10:21:44 +00:00
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-01-10 10:21:44 +00:00
Other ways to support HackTricks:
2022-04-28 16:01:33 +00:00
2024-01-10 10:21:44 +00:00
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
2024-02-09 07:14:36 +00:00
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
2024-01-10 10:21:44 +00:00
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
A tool to FUZZ web applications anywhere.
2024-02-06 03:10:38 +00:00
> [Wfuzz](https://github.com/xmendez/wfuzz) has been created to facilitate the task in web applications assessments and it is based on a simple concept: it replaces any reference to the FUZZ keyword by the value of a given payload.
2022-08-07 12:55:22 +00:00
## Installation
Installed in Kali
Github: [https://github.com/xmendez/wfuzz](https://github.com/xmendez/wfuzz)
2022-08-07 12:55:22 +00:00
```
pip install wfuzz
```
2022-08-07 12:55:22 +00:00
## Filtering options
2024-02-10 17:52:19 +00:00
### `-c` / `--code`
#### Description
Filter by HTTP response code.
#### Example
```
wfuzz -c 200,301,302 https://example.com/FUZZ
```
### `-w` / `--wordlist`
#### Description
Filter by response content.
#### Example
```
wfuzz -w wordlist.txt https://example.com/FUZZ
```
### `-r` / `--regex`
#### Description
Filter by response content using regular expressions.
#### Example
```
wfuzz -r "Welcome, FUZZ!" https://example.com/FUZZ
```
### `-s` / `--size`
#### Description
Filter by response size.
#### Example
```
wfuzz -s 1000-2000 https://example.com/FUZZ
```
### `-H` / `--header`
#### Description
Filter by response headers.
#### Example
```
wfuzz -H "Server: Apache" https://example.com/FUZZ
```
### `-C` / `--cookie`
#### Description
Filter by response cookies.
#### Example
```
wfuzz -C "session=123456" https://example.com/FUZZ
```
### `-R` / `--redirect`
#### Description
Filter by redirect location.
#### Example
```
wfuzz -R "https://example.com/login" https://example.com/FUZZ
```
### `-t` / `--timeout`
#### Description
Filter by response timeout.
#### Example
```
wfuzz -t 5 https://example.com/FUZZ
```
### `-x` / `--proxy`
#### Description
Filter by proxy.
#### Example
```
wfuzz -x http://127.0.0.1:8080 https://example.com/FUZZ
```
### `-X` / `--proxy-auth`
#### Description
Filter by proxy authentication.
#### Example
```
wfuzz -X "username:password" https://example.com/FUZZ
```
### `-P` / `--proxy-headers`
#### Description
Filter by proxy headers.
#### Example
```
wfuzz -P "X-Forwarded-For: 127.0.0.1" https://example.com/FUZZ
```
### `-e` / `--encoding`
#### Description
Filter by response encoding.
#### Example
```
wfuzz -e gzip https://example.com/FUZZ
```
### `-T` / `--content-type`
#### Description
Filter by response content type.
#### Example
```
wfuzz -T "application/json" https://example.com/FUZZ
```
### `-A` / `--user-agent`
#### Description
Filter by user agent.
#### Example
```
wfuzz -A "Mozilla/5.0" https://example.com/FUZZ
```
### `-b` / `--brute`
#### Description
Filter by brute force.
#### Example
```
wfuzz -b "FUZZ:password" https://example.com/login
```
```bash
--hs/ss "regex" #Hide/Show
#Simple example, match a string: "Invalid username"
#Regex example: "Invalid *"
--hc/sc CODE #Hide/Show by code in response
2022-08-07 12:55:22 +00:00
--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
```
2022-08-07 12:55:22 +00:00
## Output options
2024-02-10 17:52:19 +00:00
### Standard output
The `-o` option allows you to specify the output format for the results of the fuzzing process. The available options are:
- `stdout`: This is the default option, which prints the results to the standard output.
- `file`: This option allows you to specify a file where the results will be saved. You can use the `-o` option followed by the file path to specify the output file.
For example, to save the results to a file named `output.txt`, you can use the following command:
```
wfuzz -o output.txt ...
```
### JSON output
The `-o json` option allows you to save the results in JSON format. This can be useful if you want to process the results programmatically or analyze them using other tools.
For example, to save the results in JSON format, you can use the following command:
```
wfuzz -o json ...
```
### XML output
The `-o xml` option allows you to save the results in XML format. This can be useful if you want to import the results into other tools or perform further analysis.
For example, to save the results in XML format, you can use the following command:
```
wfuzz -o xml ...
```
### HTML output
The `-o html` option allows you to save the results in HTML format. This can be useful if you want to view the results in a web browser or share them with others.
For example, to save the results in HTML format, you can use the following command:
```
wfuzz -o html ...
```
### Custom output
The `-o custom` option allows you to specify a custom output format using a template file. This can be useful if you want to customize the way the results are displayed.
For example, to use a custom template file named `template.txt`, you can use the following command:
```
wfuzz -o custom --output-format template.txt ...
```
```bash
wfuzz -e printers #Prints the available output formats
-f /tmp/output,csv #Saves the output in that location in csv format
```
2024-02-10 17:52:19 +00:00
### Encoders qarDaS
#### HTML Encoding
HTML encoding is a technique used to convert special characters into their corresponding HTML entities. This is useful when dealing with user input that may contain characters that have special meaning in HTML, such as `<`, `>`, and `&`. By encoding these characters, we can prevent them from being interpreted as HTML tags or entities.
To use HTML encoding with wfuzz, you can use the `--html-encode` option. This will encode all special characters in the payload, ensuring that they are treated as literal characters and not interpreted as part of the HTML markup.
Example:
```
wfuzz --html-encode
```
#### URL Encoding
URL encoding is a technique used to convert special characters into their corresponding percent-encoded values. This is necessary when including special characters in a URL, as certain characters have special meaning and may cause issues if not properly encoded.
2024-02-10 17:52:19 +00:00
To use URL encoding with wfuzz, you can use the `--url-encode` option. This will encode all special characters in the payload, ensuring that they are treated as literal characters and not interpreted as part of the URL.
2024-02-10 17:52:19 +00:00
Example:
```
wfuzz --url-encode
```
#### Base64 Encoding
Base64 encoding is a technique used to convert binary data into a text format that can be safely transmitted over text-based protocols, such as HTTP. This encoding scheme represents binary data as a string of ASCII characters, making it suitable for use in situations where binary data needs to be included in a payload.
To use Base64 encoding with wfuzz, you can use the `--base64-encode` option. This will encode the payload using the Base64 encoding scheme.
Example:
```
wfuzz --base64-encode
```
#### Hex Encoding
Hex encoding is a technique used to convert binary data into a hexadecimal representation. This encoding scheme represents binary data as a string of hexadecimal digits, making it suitable for use in situations where binary data needs to be included in a payload.
To use Hex encoding with wfuzz, you can use the `--hex-encode` option. This will encode the payload using the Hex encoding scheme.
Example:
```
wfuzz --hex-encode
```
#### Unicode Encoding
Unicode encoding is a technique used to represent characters from various writing systems in a standardized way. This encoding scheme allows for the representation of characters from different languages and scripts, making it suitable for use in situations where multilingual support is required.
To use Unicode encoding with wfuzz, you can use the `--unicode-encode` option. This will encode the payload using the Unicode encoding scheme.
Example:
```
wfuzz --unicode-encode
```
#### UTF-8 Encoding
UTF-8 encoding is a variable-length encoding scheme used to represent Unicode characters. This encoding scheme allows for the representation of characters from different languages and scripts, making it suitable for use in situations where multilingual support is required.
To use UTF-8 encoding with wfuzz, you can use the `--utf8-encode` option. This will encode the payload using the UTF-8 encoding scheme.
Example:
```
wfuzz --utf8-encode
```
```bash
wfuzz -e encoders #Prints the available encoders
#Examples: urlencode, md5, base64, hexlify, uri_hex, doble urlencode
```
2024-02-10 17:52:19 +00:00
**tlhIngan Hol:**
2024-02-10 17:52:19 +00:00
encoder vItlhutlhlaHchugh, **"-w"** yIlo' **"-z"** option vItlhutlhlaHchugh.
Examples:
2020-12-01 15:32:24 +00:00
```bash
-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
```
2022-08-07 12:55:22 +00:00
## CheetSheet
2022-08-07 12:55:22 +00:00
### Login Form bruteforce
2022-08-07 12:55:22 +00:00
#### **POST, Single list, filter string (hide)**
2024-02-10 17:52:19 +00:00
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
#### **POST, Single list, filter string (hide)**
```bash
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
```
2024-02-10 17:52:19 +00:00
#### **POST, 2 qama, filter code (show)**
```bash
2020-12-01 15:37:13 +00:00
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
```
2024-02-10 17:52:19 +00:00
#### **GET, 2 qama, filter string (show), proxy, cookies**
---
##### **GET**
The GET method is used to retrieve information from a specified resource. It sends data in the URL query parameters.
##### **2 lists**
2024-02-10 17:52:19 +00:00
In the context of web fuzzing, "2 lists" refers to the use of two different wordlists. These wordlists contain potential values that will be tested against the target application.
2024-02-10 17:52:19 +00:00
##### **filter string (show)**
The "filter string (show)" parameter is used to specify a string that should be present in the response in order for it to be displayed. This is useful for filtering out irrelevant responses and focusing on the desired ones.
##### **proxy**
A proxy acts as an intermediary between the client and the server. It can be used to intercept and modify requests and responses, making it a valuable tool for analyzing and manipulating web traffic.
##### **cookies**
Cookies are small pieces of data stored on the client's computer by the web server. They are commonly used for session management and tracking user activity. In the context of web fuzzing, cookies can be included in requests to simulate authenticated sessions or to test specific functionalities that rely on cookies.
2020-12-01 15:55:38 +00:00
```bash
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
2021-06-16 15:34:44 +00:00
[Arjun parameters wordlist](https://raw.githubusercontent.com/s0md3v/Arjun/master/arjun/db/params.txt)
2022-08-07 12:55:22 +00:00
```
wfuzz -c -w /tmp/tmp/params.txt --hc 404 https://domain.com/api/FUZZ
```
2024-02-10 17:52:19 +00:00
### Path Parameters BF
#### tlhIngan Hol Translation:
### Path Parameters BF
#### tlhIngan Hol Translation:
2022-08-07 12:55:22 +00:00
### Path Parameters BF
2020-12-01 15:55:38 +00:00
2024-02-10 17:52:19 +00:00
#### tlhIngan Hol Translation:
### Path Parameters BF
#### tlhIngan Hol Translation:
2020-12-01 15:55:38 +00:00
```bash
wfuzz -c -w ~/git/Arjun/db/params.txt --hw 11 'http://example.com/path%3BFUZZ=FUZZ'
```
2022-08-07 12:55:22 +00:00
### Header Authentication
2022-08-07 12:55:22 +00:00
#### **Basic, 2 lists, filter string (show), proxy**
2024-02-10 17:52:19 +00:00
#### **Qa'Hom, 2 lojmIt, filter string (choH), proxy**
#### **Basic, 2 lojmIt, filter string (choH), proxy**
2020-12-11 18:40:49 +00:00
```bash
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"
```
2024-02-10 17:52:19 +00:00
#### **NTLM, 2 qetlh, filter string (show), proxy**
---
##### **NTLM**
NTLM stands for NT LAN Manager, which is a suite of Microsoft security protocols that provides authentication, integrity, and confidentiality to users. It is commonly used in Windows environments for user authentication.
##### **2 qetlh**
2 qetlh refers to the use of two lists during a hacking technique. These lists are typically used to perform a brute force attack or to test for vulnerabilities. The first list contains a set of usernames, while the second list contains a set of passwords. By combining the usernames and passwords from these lists, an attacker can attempt to gain unauthorized access to a system.
##### **filter string (show)**
A filter string (show) is a parameter used in hacking tools to filter and display specific information. It allows the user to define a string or pattern that the tool will use to filter the output and only display the relevant information.
2024-02-10 17:52:19 +00:00
##### **proxy**
2024-02-10 17:52:19 +00:00
A proxy is an intermediary server that acts as a gateway between a client and a server. It can be used to hide the client's IP address, bypass network restrictions, or cache and filter web content. In the context of hacking, a proxy can be used to anonymize the attacker's identity and hide their activities from being traced back to them.
2020-12-11 18:40:49 +00:00
```bash
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"
```
2022-08-07 12:55:22 +00:00
### Cookie/Header bruteforce (vhost brute)
2022-08-07 12:55:22 +00:00
#### **Cookie, filter code (show), proxy**
2024-02-10 17:52:19 +00:00
#### **Cookie/Header bruteforce (vhost brute)**
##### **Cookie, filter code (show), proxy**
2020-12-11 18:40:49 +00:00
```bash
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"
```
2024-02-10 17:52:19 +00:00
#### **User-Agent, filter code (hide), proxy**
2022-08-07 12:55:22 +00:00
#### **User-Agent, filter code (hide), proxy**
2024-02-10 17:52:19 +00:00
#### **User-Agent, filter code (hide), proxy**
2020-12-11 18:40:49 +00:00
```bash
wfuzz -c -w user-agents.txt -p 127.0.0.1:8080:HTTP --ss "Welcome " -H "User-Agent: FUZZ" "http://example.com/index.php"
```
2022-08-07 12:55:22 +00:00
#### **Host**
2020-12-11 18:40:49 +00:00
```bash
wfuzz -c -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-
2024-02-10 17:52:19 +00:00
top1million-20000.txt --hc 400,404,403 -H "Host: FUZZ.example.com" -u
http://example.com -t 100
```
2024-02-10 17:52:19 +00:00
#### **ghItlhvam** (HTTP Verbs) bruteforce
2022-08-07 12:55:22 +00:00
#### **Using file**
2020-12-11 18:40:49 +00:00
```bash
wfuzz -c -w methods.txt -p 127.0.0.1:8080:HTTP --sc 200 -X FUZZ "http://example.com/index.php"
```
2022-08-07 12:55:22 +00:00
#### **Using inline list**
2020-12-11 18:40:49 +00:00
```bash
$ wfuzz -z list,GET-HEAD-POST-TRACE-OPTIONS -X FUZZ http://testphp.vulnweb.com/
```
2024-02-10 17:52:19 +00:00
### QaStaHvIS & qawHaq
#### wfuzz
wfuzz is a web application brute-forcing tool that helps in finding hidden directories, files, and parameters by launching a dictionary-based attack. It can be used to discover sensitive information, such as backup files, configuration files, and more.
#### Installation
To install wfuzz, you can use the following command:
```
$ sudo apt-get install wfuzz
```
#### Basic Usage
To perform a directory brute-force attack using wfuzz, you need to specify the target URL and the wordlist containing the directories and files to be tested. The following command demonstrates the basic usage of wfuzz:
```
$ wfuzz -c -z file,wordlist.txt http://target.com/FUZZ
```
In the above command, `-c` is used to display the output in a colored format, `-z` specifies the payload type as a file, and `wordlist.txt` is the file containing the list of directories and files to be tested. `http://target.com/FUZZ` is the target URL where `FUZZ` will be replaced by the entries from the wordlist.
#### Advanced Usage
2024-02-10 17:52:19 +00:00
wfuzz provides various options to customize the brute-force attack. Some of the commonly used options are:
2024-02-10 17:52:19 +00:00
- `-w` to specify the wordlist file
- `-t` to set the number of concurrent connections
- `-p` to specify the proxy
- `-H` to add custom headers
- `-d` to specify POST data
- `-o` to save the output to a file
For example, the following command demonstrates the usage of some advanced options:
```
$ wfuzz -c -w wordlist.txt -t 50 -p 127.0.0.1:8080 -H "Authorization: Bearer token" -d "username=admin&password=FUZZ" -o output.txt http://target.com/login
```
In the above command, `-w` is used to specify the wordlist file, `-t` sets the number of concurrent connections to 50, `-p` specifies the proxy as `127.0.0.1:8080`, `-H` adds a custom header `Authorization: Bearer token`, `-d` specifies the POST data with `username=admin&password=FUZZ`, and `-o` saves the output to `output.txt`. `http://target.com/login` is the target URL.
#### Tips
- Use a good wordlist that covers common directories and files.
- Customize the request headers to simulate different user agents or authentication tokens.
- Use the `-o` option to save the output for further analysis.
- Be cautious while performing brute-force attacks, as they can be resource-intensive and may trigger security measures.
2020-12-01 15:55:38 +00:00
```bash
#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
```
2022-08-07 12:55:22 +00:00
## Tool to bypass Webs
[https://github.com/carlospolop/fuzzhttpbypass](https://github.com/carlospolop/fuzzhttpbypass)
2022-04-28 16:01:33 +00:00
<details>
2024-01-10 10:21:44 +00:00
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-01-10 10:21:44 +00:00
Other ways to support HackTricks:
2022-04-28 16:01:33 +00:00
2024-01-10 10:21:44 +00:00
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
2024-02-09 07:14:36 +00:00
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
2024-01-10 10:21:44 +00:00
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>