Command Palette

Search for a command to run...

Cheatsheets
PreviousNext

Web Fuzzing

What is Web Fuzzing?

Web fuzzing is a technique used to discover vulnerabilities, hidden resources, and security issues in web applications by automatically injecting a large set of input data into the application and analyzing its response. The goal is to identify unexpected behaviors or errors that could indicate potential security weaknesses or misconfigurations.

Fuzzing is commonly employed in security testing to find:

  • Hidden directories and files
  • Insecure APIs and endpoints
  • SQL injection points
  • Cross-site scripting (XSS) vulnerabilities
  • Command injection flaws

Comparison: Brute-Forcing vs. Fuzzing

CriteriaBrute-ForcingFuzzing
DefinitionSystematically trying all possible combinations of input data to guess a specific value.Injecting unexpected or random data into an application to find vulnerabilities and hidden resources.
PurposeCrack passwords, keys, or other access credentials.Discover application vulnerabilities, hidden files, directories, and input validation issues.
MethodologyExhaustive search over all possible input combinations.Dynamic input injection to provoke unexpected application responses.
FocusSpecific input or data, such as passwords or API keys.General application behavior under various input conditions.
EfficiencyTime-consuming due to exhaustive nature; less efficient for large input spaces.More efficient in identifying unexpected behaviors and vulnerabilities with varied input.
Tools UsedPassword crackers, key recovery tools.Web fuzzers, vulnerability scanners.
OutputSuccessful match of the correct input value.Discovery of vulnerabilities, misconfigurations, and hidden resources.

Miscellaneous Commands

Below are some useful commands that can aid in various tasks related to web fuzzing and testing.

CommandDescription
sudo sh -c 'echo "SERVER_IP academy.htb" >> /etc/hosts'Add a DNS entry for a specific IP address to the /etc/hosts file. This helps resolve domain names locally.
for i in $(seq 1 1000); do echo $i >> ids.txt; doneCreate a sequence wordlist from 1 to 1000. Useful for brute-forcing numerical IDs or similar patterns.
curl http://admin.academy.htb:PORT/admin/admin.php -X POST -d 'id=key' -H 'Content-Type: application/x-www-form-urlencoded'Use curl to send a POST request with specific data and headers, simulating form submissions or API calls.

Commonly Used SecLists Wordlists

SecLists is a collection of multiple types of wordlists used by security researchers and penetration testers. Below is a table of some commonly used wordlists from SecLists, which can be incredibly valuable during web fuzzing.

WordlistDescription
/usr/share/seclists/Discovery/Web-Content/common.txtGeneral-Purpose Wordlist: Contains a broad range of common directory and file names on web servers. It's an excellent starting point for fuzzing and often yields valuable results.
/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txtDirectory-Focused Wordlist: A more extensive wordlist specifically focused on directory names. It's a good choice when you need a deeper dive into potential directories.
/usr/share/seclists/Discovery/Web-Content/raft-large-directories.txtLarge Directory Wordlist: Boasts a massive collection of directory names compiled from various sources. It's a valuable resource for thorough fuzzing campaigns.
/usr/share/seclists/Discovery/Web-Content/big.txtComprehensive Wordlist: A massive wordlist containing both directory and file names. Useful when you want to cast a wide net and explore all possibilities.

Tips for Using Wordlists Effectively

TipExplanation
Choose the Right WordlistSelect wordlists relevant to the target environment and technology stack for better results.
Combine WordlistsUse multiple wordlists together to increase the breadth of your fuzzing efforts.
Customize WordlistsModify existing wordlists or create your own based on specific knowledge about the target.
Monitor PerformanceLarge wordlists can be resource-intensive; monitor performance and adjust as needed.
Leverage Community ResourcesUtilize community-maintained wordlists for the latest and most effective fuzzing strategies.

Tools for Web Fuzzing

FFUF

ffuf (Fuzz Faster U Fool) is a fast web fuzzer written in Go that allows you to discover directories and files on web servers.

CommandDescription
ffuf -u http://example.com/FUZZBasic fuzzing of a URL path.
ffuf -u http://example.com/FUZZ -w wordlist.txtFuzz with a specific wordlist.
ffuf -u http://example.com/FUZZ -w wordlist.txt -icFuzz with a specific wordlist, automatically ignoring any comments in the wordlist.
ffuf -u http://example.com/FUZZ -w wordlist.txt -cColorize the output for better readability.
ffuf -u http://example.com/FUZZ -w wordlist.txt -mc 200Filter results by status code (e.g., 200).
ffuf -u http://example.com/FUZZ -w wordlist.txt -mr "Welcome"Filter results by matching a regex pattern.
ffuf -u http://example.com/FUZZ -w wordlist.txt -e .php,.htmlAdd extensions to each wordlist entry.
ffuf -u http://example.com/FUZZ -w wordlist.txt -t 50Set the number of threads (e.g., 50) for faster fuzzing.
ffuf -u http://example.com/FUZZ -w wordlist.txt -x http://127.0.0.1:8080Use a proxy for requests.

gobuster

gobuster is a tool used to brute-force URIs (directories and files) in web sites and DNS subdomains.

CommandDescription
gobuster dir -u http://example.com -w wordlist.txtDirectory fuzzing using a wordlist.
gobuster dir -u http://example.com -w wordlist.txt -x .php,.htmlFuzz with specific extensions.
gobuster dir -u http://example.com -w wordlist.txt -s 200Filter results by status code (e.g., 200).
gobuster dir -u http://example.com -w wordlist.txt -t 50Set the number of concurrent threads (e.g., 50).
gobuster dir -u http://example.com -w wordlist.txt -o results.txtOutput results to a file.
gobuster dns -d example.com -w subdomains.txtFuzz DNS subdomains using a wordlist.
gobuster dns -d example.com -w subdomains.txt -iShow IP addresses of discovered subdomains.
gobuster dns -d example.com -w subdomains.txt -zSilent mode; suppress output except for results.

wenum (Wfuzz Fork)

wenum is a fork of wfuzz, a versatile web application fuzzer for testing web security.

CommandDescription
wenum -c -w wordlist.txt --hc 404 -u http://example.com/FUZZBasic fuzzing excluding 404 responses.
wenum -c -w wordlist.txt -d 'username=FUZZ&password=secret' -u http://example.com/loginFuzz POST data in a form.
wenum -c -w wordlist.txt -b 'session=12345' -u http://example.com/FUZZUse a specific cookie for requests.
wenum -c -w wordlist.txt -H 'User-Agent: Wenum' -u http://example.com/FUZZAdd a custom header to requests.
wenum -c -w wordlist.txt -t 50 -u http://example.com/FUZZSet the number of threads (e.g., 50) for faster fuzzing.
wenum -c -w wordlist.txt -X PUT -u http://example.com/FUZZFuzz using a specific HTTP method (e.g., PUT).
wenum -c -w wordlist.txt --hs 50 -u http://example.com/FUZZFilter responses by content length (e.g., 50 bytes).

feroxbuster

feroxbuster is a tool designed for recursive content discovery and web fuzzing.

CommandDescription
feroxbuster -u http://example.com -w wordlist.txtBasic URL fuzzing with a wordlist.
feroxbuster -u http://example.com -w wordlist.txt -xInclude specified file extensions in fuzzing.
feroxbuster -u http://example.com -w wordlist.txt -C 404Exclude responses with status code 404.
feroxbuster -u http://example.com -w wordlist.txt -t 50Set the number of concurrent threads (e.g., 50).
feroxbuster -u http://example.com -w wordlist.txt --depth 3Set maximum recursion depth (e.g., 3 levels deep).
feroxbuster -u http://example.com -w wordlist.txt -o results.txtSave output to a file.
feroxbuster -u http://example.com -w wordlist.txt --no-recursionDisable recursion into discovered directories.
feroxbuster -u http://example.com -w wordlist.txt --redirectFollow redirects automatically.

Tips for Effective Web Fuzzing

TipExplanation
Use Comprehensive WordlistsThe quality of your wordlist can significantly impact results; choose or create wordlists relevant to the target.
Filter Unwanted ResponsesUse status codes or response size filtering to focus on meaningful results and reduce noise.
Adjust Thread CountIncrease thread count for faster fuzzing, but be mindful of server capabilities to avoid overloading.
Monitor Server ResponsesPay attention to anomalies or unexpected behavior in server responses, indicating potential vulnerabilities.
Fuzz with Various HTTP MethodsTest different HTTP methods (GET, POST, PUT, DELETE) to uncover potential vulnerabilities in all endpoints.

Web APIs: REST, SOAP, and GraphQL

What is a Web API?

A Web API (Application Programming Interface) is a set of rules and protocols for building and interacting with software applications. APIs allow different applications to communicate with each other over the internet, enabling the integration of various services and data exchange.

Web APIs can be categorized into three main types:

  • REST (Representational State Transfer)
  • SOAP (Simple Object Access Protocol)
  • GraphQL

Each type has its own unique characteristics, advantages, and use cases.

REST (Representational State Transfer)

REST is an architectural style that uses standard HTTP methods to access and manipulate resources on a server. It is known for its simplicity, scalability, and statelessness.

FeatureDescription
ProtocolUses HTTP/HTTPS.
Data FormatTypically JSON, but can also use XML, HTML, or plain text.
StatelessEach request from a client to a server must contain all the information needed.
CRUD OperationsUses HTTP methods: GET, POST, PUT, DELETE.
ScalabilityHighly scalable due to its stateless nature.
CachingSupports caching mechanisms to improve performance.
URL StructureUses endpoints that represent resources, e.g., /api/users/.
AdvantagesSimplicity, flexibility, scalability.
DisadvantagesCan lead to over-fetching or under-fetching data.

REST Fuzzing Tips:

TipExplanation
Test All HTTP MethodsEnsure all CRUD operations are tested, as vulnerabilities might exist in any of them.
Validate Input FieldsFuzz input fields with unexpected data types and formats to uncover validation issues.
Examine Error MessagesAnalyze error messages for information disclosure or unintended behavior.
Test Authentication MechanismsCheck for improper authentication and authorization controls.
Explore API Rate LimitsTest rate limits and throttling controls to ensure the API handles requests properly.
Use Comprehensive PayloadsLeverage a variety of payloads (SQLi, XSS) to test for potential security flaws.
Check Resource RepresentationTest different resource representations (JSON, XML) for consistency and security flaws.

SOAP (Simple Object Access Protocol)

SOAP is a protocol for exchanging structured information in web services. It uses XML as its message format and can operate over various protocols like HTTP, SMTP, or TCP.

FeatureDescription
ProtocolProtocol-independent but often used with HTTP/HTTPS.
Data FormatExclusively XML.
Stateful/StatelessCan be either stateful or stateless.
WS-SecurityBuilt-in security features for message integrity and confidentiality.
Error HandlingUses specific error codes and messages.
ComplexityMore complex due to extensive standards and specifications.
ExtensibilityHighly extensible via WS-* standards.
AdvantagesStrong security, reliability, and extensibility.
DisadvantagesMore complex and less flexible compared to REST.

SOAP Fuzzing Tips:

TipExplanation
Analyze WSDL FilesUse WSDL (Web Services Description Language) files to understand the service's operations and inputs.
Validate XML SchemaTest XML inputs against the schema to identify validation flaws.
Check for XML InjectionFuzz XML data to test for injection vulnerabilities.
Test SOAP HeadersFuzz SOAP headers to find potential security issues or misconfigurations.
Evaluate WS-Security ImplementationsEnsure security implementations are robust and correctly configured.
Test Transport SecurityVerify that transport-level security (e.g., HTTPS) is enforced and properly implemented.
Examine SOAP FaultsAnalyze SOAP fault messages for potential information leakage.

GraphQL

GraphQL is a query language and runtime for APIs that allows clients to request specific data and define the structure of the response.

FeatureDescription
ProtocolUses HTTP/HTTPS, typically over POST requests.
Data FormatJSON-based queries and responses.
Stateful/StatelessStateless architecture.
Query FlexibilityClients can request exactly what they need, minimizing over-fetching and under-fetching.
Single EndpointTypically uses a single endpoint for all operations.
IntrospectionAllows clients to query the API schema for available operations and data types.
AdvantagesEfficiency, flexibility, and powerful developer tooling.
DisadvantagesPotential for complex queries leading to performance issues if not properly managed.

GraphQL Fuzzing Tips:

TipExplanation
Test Query Depth and ComplexityEvaluate the server's handling of deeply nested or complex queries to avoid performance bottlenecks.
Validate Input Types and ArgumentsFuzz input arguments with unexpected values and data types to uncover validation flaws.
Examine Query Aliasing and BatchingTest the server's response to aliased queries and batching for potential information leakage.
Check for Introspection MisuseEnsure introspection is not exposing sensitive information or internal schema details.
Assess Authorization ControlsVerify that access controls are properly enforced for different queries and operations.
Evaluate Rate LimitingTest rate limits to ensure the API can handle excessive or malicious requests appropriately.
Fuzz MutationsMutations can alter data; test for security issues and improper input validation.