17. Nmap HTTP Enumeration Detecting HTTP Methods
Enumerating HTTP Methods¶
Explanation:¶
Flags and Options:¶
-
-Pn:- Disables host discovery (no ping).
- Useful for scanning hosts that block ICMP packets or appear offline.
-
-sV: -
Enables service version detection.
- Identifies the software and version running on the web server.
-
-p 80: -
Specifies port 80 (default HTTP port).
-
-T4: -
Sets a faster timing template for quicker scans.
- Suitable for stable network connections.
-
--script http-methods: -
Executes the
http-methodsNSE script, which enumerates supported HTTP methods. -
--script-args http-methods.test=all: -
Configures the script to test all HTTP methods, including standard (e.g., GET, POST) and potentially dangerous ones (e.g., PUT, DELETE, TRACE).
-
nmap.scanme.org: -
The target domain for the scan.
Purpose:¶
- Enumerate HTTP Methods: Identify HTTP methods supported by the target server.
- Test for Misconfigurations: Detect potentially risky HTTP methods (e.g., PUT, DELETE, TRACE) that could be exploited for attacks like file upload or request tracing.
Example Output:¶
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.41
| http-methods:
| Supported Methods: GET HEAD POST OPTIONS TRACE
| Potentially risky methods: TRACE
|_ See https://nmap.org/nsedoc/scripts/http-methods.html
Key Findings:¶
- Supported Methods:
- Lists HTTP methods the server supports, such as
GET,HEAD,POST,OPTIONS, andTRACE.
- Lists HTTP methods the server supports, such as
- Potentially Risky Methods:
- Identifies methods like
TRACE,PUT, orDELETE, which may allow:- TRACE: Cross-Site Tracing (XST) attacks.
- PUT: Arbitrary file uploads, potentially leading to malicious code execution.
- DELETE: Deletion of server files or resources.
- Identifies methods like
Actionable Insights:¶
-
Secure the Server:
- Disable unnecessary or risky HTTP methods (
TRACE,PUT,DELETE) unless explicitly needed. - Update the web server to the latest version if vulnerabilities are identified.
-
Validate Results:
-
Cross-check the findings using tools like
curlor web security scanners to ensure accuracy. -
Enhance Security:
-
Configure web server headers to return only the required HTTP methods.
- Use a Web Application Firewall (WAF) to mitigate risks from misconfigured methods.
- Disable unnecessary or risky HTTP methods (
Use Case:¶
This command is particularly useful in web application penetration testing to detect misconfigurations and potential vulnerabilities related to HTTP methods. Ensure you have proper authorization before performing scans.