Below is an outline of techniques and considerations that penetration testers (operating in a legal, lab, or authorized testing environment) might use to enumerate and assess non-standard HTTP methods, with an emphasis on methods like PUT and DELETE. I’ve also included details specific to potential misconfigurations in an nginx 1.20.1 setup. This discussion is for educational purposes and to help improve web application security posture.
1. Enumerating HTTP Methods
A. Using the OPTIONS Request
B. Custom Request Methods
- Test Techniques:
- Manually craft requests using non-standard methods (e.g., PUT, DELETE, PATCH).
- Observe the server’s response codes:
- 2xx (e.g., 200 OK, 204 No Content) may indicate that the method is truly enabled.
- 4xx/5xx responses might indicate that the server explicitly rejects these methods.
- Automation:
- Tools like Burp Suite, OWASP ZAP, or custom scripts (e.g., using Python’s
requests library) can help automate the enumeration process.
C. Fuzzing and Extended Testing
- Fuzzing:
- Use fuzzing techniques to test for other less-common methods or variants that might bypass typical filtering.
- Extended Vectors:
- Probe for methods like
PROPFIND, PROPPATCH, MKCOL, or other WebDAV methods that might be inadvertently enabled.
2. Assessing Risky HTTP Methods
A. Understanding Risk Profiles
- PUT Method:
- Could allow file uploads or content modification if not properly restricted.
- Evaluate if the uploaded content is saved in a publicly accessible directory.
- DELETE Method:
- May allow an attacker to delete resources, leading to data loss or defacement.
- Check if authentication and authorization controls are properly enforced.
- Combination Risks:
- Availability of both PUT and DELETE suggests an environment that might allow an attacker to manipulate or remove files on the server if other protections (e.g., authentication, proper directory restrictions) are not in place.
B. Recon and Testing Techniques (Following OWASP Guidelines)
- Reviewing HTTP Headers:
- Identify allowed methods via
OPTIONS response and any custom headers.
- Correlation with Application Functionality:
- Determine if the methods align with application functionality. For instance, does the application provide file upload features that might hint at an oversight when PUT is allowed?
- Testing for Bypasses:
- Test whether endpoints that are expected to allow read-only operations (like GET) are improperly accepting methods like PUT or DELETE.
- Monitoring Responses:
- Look for differences in response times, size, and error messages that may indicate different processing logic for these methods.
C. Logging and Detection Evasion
- Detection Systems Perspective:
- Security logging should correlate method type with user activity.
- Unusual or less common methods should be flagged and reviewed.
- Use anomaly-based detection to alert on unexpected HTTP methods.
3. Niche Insights: nginx 1.20.1 Misconfiguration
A. Potential Misconfigurations Allowing PUT and DELETE
- Default Configuration Caveats:
- nginx does not enable PUT, DELETE, or other non-standard methods by default, but misconfigurations can occur through incorrect location blocks or overly permissive
limit_except directives.
- Common Misconfiguration Scenario:
- Using
limit_except to Restrict Methods:
B. Testing for Misconfigurations in nginx
- Step-by-Step Validation:
- Check Allowed Methods: Issue an
OPTIONS request to suspect endpoints.
- Probe Endpoint Behavior: Attempt PUT or DELETE against endpoints like
/uploads/ to see if file system modifications occur.
- Review Response Codes:
- 201 Created / 204 No Content: May indicate a successful upload or deletion.
- 403 Forbidden / 405 Method Not Allowed: Suggests method restriction enforcement.
- Reviewing Headers:
- Look for headers like
Allow that might be set by nginx or the backend application. Sometimes misconfigured headers can inadvertently expose the allowed methods.
C. Special Considerations
- Scripting and Automation:
- Impact of Virtual Hosts or Proxy Settings:
- In setups where nginx acts as both a reverse proxy and a termination point for SSL, ensure that method restrictions are propagated correctly through all layers.
Conclusion
Understanding these enumeration and assessment techniques is critical in both offensive testing (with proper authorization) and defensive security monitoring. By:
- Enumerating HTTP methods via OPTIONS, custom requests, and fuzzing,
- Assessing risks using OWASP guidelines and reviewing application behavior,
- Examining nginx configurations for method restrictions (or lack thereof),
security professionals can better identify and remediate risky configurations. Always ensure that testing is conducted in legal and authorized environments, and that any findings are responsibly disclosed to improve overall security.
If you have further questions or need more detailed examples tailored to specific scenarios, please let me know!