Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Test HTTP Methods
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 274% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 143% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 115% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 115% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 104% | 0% |
WSTG-CONF-06
Test HTTP Methods
HTTP methods define the type of action to be performed on a resource. While GET and POST are commonly used, other methods like PUT, DELETE, TRACE, and OPTIONS may be enabled and exploitable. This test identifies which HTTP methods are supported by the web server and checks for potential security issues such as arbitrary file upload (PUT), file deletion (DELETE), cross-site tracing (TRACE), and access control bypasses.
| Method | Purpose | Security Risk | | ------- | ---------------------- | ---------------------------- | | GET | Retrieve resource | Authorization bypass | | POST | Submit data | Authorization bypass | | HEAD | Get headers only | Auth bypass, info disclosure | | PUT | Upload/create resource | Arbitrary file upload | | DELETE | Remove resource | Arbitrary file deletion | | OPTIONS | List supported methods | Information disclosure | | TRACE | Echo request (debug) | Cross-Site Tracing (XST) | | CONNECT | TCP tunnel | Proxy abuse | | PATCH | Partial modification | Data manipulation |
bash# Send OPTIONS request curl -X OPTIONS -I https://target.com/ # Check Allow header curl -X OPTIONS -sI https://target.com/ | grep -i "allow" # Example response: # Allow: GET, HEAD, POST, OPTIONS
bash# Test all methods methods=("GET" "POST" "HEAD" "PUT" "DELETE" "OPTIONS" "TRACE" "CONNECT" "PATCH" "PROPFIND" "PROPPATCH" "MKCOL" "COPY" "MOVE" "LOCK" "UNLOCK") for method in "${methods[@]}"; do status=$(curl -s -o /dev/null -w "%{http_code}" -X $method https://target.com/) echo "$method: $status" done
bash# Test PUT for file upload curl -X PUT https://target.com/test.txt -d "test content" curl -X PUT https://target.com/test.html -d "<h1>Test</h1>" curl -X PUT https://target.com/test.php -d "<?php phpinfo(); ?>" # Check if file was created curl -s https://target.com/test.txt curl -s https://target.com/test.html curl -s https://target.com/test.php # WebDAV PUT curl -X PUT https://target.com/test.txt \ -H "Content-Type: text/plain" \ -d "test content"
bash# Test DELETE (use non-critical path!) curl -X DELETE https://target.com/test.txt -v # Check response # 200/204 = Successful deletion (CRITICAL!) # 405 = Method not allowed (expected) # 403 = Forbidden (access control working)
bash# Test TRACE curl -X TRACE https://target.com/ -v # TRACE should echo the request back # If enabled, can be used for XST attacks to steal cookies # Check response # 200 with request echo = Vulnerable # 405 = Method disabled (secure)
bash# Test protected page with different methods protected_url="https://target.com/admin/" # Normal request (may redirect to login) curl -sI "$protected_url" # Try different methods for method in HEAD POST PUT OPTIONS PATCH; do echo "=== $method ===" curl -s -o /dev/null -w "%{http_code}" -X $method "$protected_url" done # Try arbitrary method curl -s -o /dev/null -w "%{http_code}" -X FAKE "$protected_url" curl -s -o /dev/null -w "%{http_code}" -X FOO "$protected_url"
bash# Method override through headers # If PUT returns 405, try override # X-HTTP-Method-Override curl -X POST https://target.com/resource \ -H "X-HTTP-Method-Override: PUT" \ -d "content=test" # X-HTTP-Method curl -X POST https://target.com/resource \ -H "X-HTTP-Method: DELETE" # X-Method-Override curl -X POST https://target.com/resource \ -H "X-Method-Override: PUT" # _method parameter (Rails, Laravel) curl -X POST https://target.com/resource \ -d "_method=DELETE"
bash# WebDAV specific methods # PROPFIND - Get properties curl -X PROPFIND https://target.com/ \ -H "Depth: 1" \ -H "Content-Type: application/xml" \ -d '<?xml version="1.0"?><propfind xmlns="DAV:"><allprop/></propfind>' # MKCOL - Create directory curl -X MKCOL https://target.com/newdir/ # COPY - Copy resource curl -X COPY https://target.com/file.txt \ -H "Destination: https://target.com/file_copy.txt" # MOVE - Move resource curl -X MOVE https://target.com/file.txt \ -H "Destination: https://target.com/moved_file.txt"
bash# Nmap script for HTTP methods nmap -p 80,443 --script http-methods target.com # With URL path nmap -p 80,443 --script http-methods --script-args http-methods.url-path='/admin/' target.com # Detailed output nmap -p 80,443 --script http-methods --script-args http-methods.test-all=true target.com
| Tool | Description | Usage | | ---------- | ------------ | ---------------------------- | | curl | HTTP client | curl -X METHOD url | | Nmap | NSE scripts | nmap --script http-methods | | Netcat | Raw requests | Manual HTTP crafting |
| Tool | Description | | -------------- | --------------------------- | | Burp Suite | Repeater for method testing | | OWASP ZAP | Request editor | | mitmproxy | Scripted testing |
| Tool | Description | | ---------- | --------------------- | | Nikto | Web server scanner | | Nessus | Vulnerability scanner |
bash#!/bin/bash TARGET=$1 PATH_TO_TEST=${2:-"/"} echo "=== HTTP METHODS TEST ===" echo "Target: $TARGET$PATH_TO_TEST" echo "" # Standard methods echo "[+] Testing standard methods..." methods=("GET" "POST" "HEAD" "PUT" "DELETE" "OPTIONS" "TRACE" "PATCH") for method in "${methods[@]}"; do response=$(curl -s -o /dev/null -w "%{http_code}" -X $method "https://$TARGET$PATH_TO_TEST") echo " $method: $response" # Flag potentially dangerous enabled methods if [ "$method" == "PUT" ] && [ "$response" != "405" ] && [ "$response" != "501" ]; then echo " [!] WARNING: PUT may be enabled!" fi if [ "$method" == "DELETE" ] && [ "$response" != "405" ] && [ "$response" != "501" ]; then echo " [!] WARNING: DELETE may be enabled!" fi if [ "$method" == "TRACE" ] && [ "$response" == "200" ]; then echo " [!] WARNING: TRACE is enabled (XST risk)!" fi done # WebDAV methods echo "" echo "[+] Testing WebDAV methods..." webdav=("PROPFIND" "PROPPATCH" "MKCOL" "COPY" "MOVE" "LOCK" "UNLOCK") for method in "${webdav[@]}"; do response=$(curl -s -o /dev/null -w "%{http_code}" -X $method "https://$TARGET$PATH_TO_TEST") if [ "$response" != "405" ] && [ "$response" != "501" ]; then echo " $method: $response [!] May be enabled!" fi done # Test arbitrary method echo "" echo "[+] Testing arbitrary method handling..." response=$(curl -s -o /dev/null -w "%{http_code}" -X FOOBAR "https://$TARGET$PATH_TO_TEST") echo " FOOBAR: $response" if [ "$response" == "200" ]; then echo " [!] WARNING: Server accepts arbitrary methods!" fi # Test method override echo "" echo "[+] Testing method override headers..." for header in "X-HTTP-Method-Override" "X-HTTP-Method" "X-Method-Override"; do response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ -H "$header: PUT" "https://$TARGET$PATH_TO_TEST") echo " POST with $header: PUT -> $response" done echo "" echo "[+] Test complete"
bash#!/bin/bash TARGET=$1 UPLOAD_PATH="/test_upload_$(date +%s).txt" echo "[+] Testing PUT file upload to $TARGET$UPLOAD_PATH" # Attempt upload response=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \ "https://$TARGET$UPLOAD_PATH" \ -H "Content-Type: text/plain" \ -d "PUT upload test - $(date)") echo "PUT Response: $response" if [ "$response" == "201" ] || [ "$response" == "200" ] || [ "$response" == "204" ]; then echo "[!] CRITICAL: PUT upload successful!" # Verify file exists verify=$(curl -s -o /dev/null -w "%{http_code}" "https://$TARGET$UPLOAD_PATH") if [ "$verify" == "200" ]; then echo "[!] File confirmed accessible at $UPLOAD_PATH" echo "[!] Attempting cleanup..." curl -X DELETE "https://$TARGET$UPLOAD_PATH" fi else echo "[+] PUT upload not allowed (secure)" fi
apache# Allow only GET, POST, HEAD <Directory /> <LimitExcept GET POST HEAD> Require all denied </LimitExcept> </Directory> # Disable TRACE TraceEnable Off
nginx# Allow only specific methods if ($request_method !~ ^(GET|POST|HEAD)$) { return 405; }
xml<system.webServer> <security> <requestFiltering> <verbs> <add verb="PUT" allowed="false" /> <add verb="DELETE" allowed="false" /> <add verb="TRACE" allowed="false" /> <add verb="OPTIONS" allowed="false" /> </verbs> </requestFiltering> </security> </system.webServer>
apache# Apache - disable WebDAV module # Remove or comment out: # LoadModule dav_module modules/mod_dav.so # LoadModule dav_fs_module modules/mod_dav_fs.so
python# Apply same authorization for all methods @app.route('/resource', methods=['GET', 'POST', 'PUT', 'DELETE']) @require_authentication def resource(): # Authorization applied to all methods pass
python# Django - don't use X-HTTP-Method-Override middleware # Remove: 'django.middleware.http.MethodOverrideMiddleware'
| Finding | CVSS | Severity | | ------------------------- | ---- | -------- | | PUT enabled (file upload) | 9.8 | Critical | | DELETE enabled | 8.1 | High | | TRACE enabled | 5.3 | Medium | | Auth bypass via method | 8.8 | High | | WebDAV enabled | 7.5 | High |
PUT Enabled Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
| CWE ID | Title | Description | | ----------- | -------------------------------- | --------------------------------- | | CWE-749 | Exposed Dangerous Method | Dangerous HTTP methods enabled | | CWE-650 | Trusting HTTP Permission Methods | Insufficient method authorization | | CWE-434 | Unrestricted Upload of File | PUT file upload |
[ ] OPTIONS request sent to enumerate methods
[ ] GET method tested
[ ] POST method tested
[ ] HEAD method tested
[ ] PUT method tested (file upload)
[ ] DELETE method tested
[ ] TRACE method tested
[ ] PATCH method tested
[ ] WebDAV methods tested (PROPFIND, etc.)
[ ] Arbitrary method tested (FOOBAR)
[ ] Method override headers tested
[ ] Access control per method verified
[ ] Dangerous methods documented
[ ] Risk assessment completedOther measured skills in the registry, with their headline benchmark lift.