I was experimenting with a web app on Hack the Box the other day, and remembered something about verb tempering. So I went ahead and intercepted a request in Burp, and then literally typed "POST" instead of "GET" in the HTTP header before forwarding.
Now I found out that there is a "change request method" option Burp...what does that do? I assume it changes other thing in that request to make it a "true" change of the method?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
You've stumbled onto a really interesting area of web application security! You're right to question what's really happening when you manually change the method in the header, and how Burp's "Change request method" feature differs. Let's break it down.
What you did (Manually Changing the Method)
When you manually changed "GET" to "POST" in the HTTP header, you were essentially trying to spoof the request method. This is a basic form of verb tempering. However, simply changing the header isn't usually enough to make the server treat it as a legitimate POST request. Here's why:
Body Content: GET requests, by definition, don't have a body. POST requests typically do. If you just change the header to POST without adding a body, the server might:
Ignore the body: Some servers might just ignore the body because it's unexpected on a GET.
Error out: More likely, the server will reject the request with an error (e.g., 405 Method Not Allowed, 400 Bad Request) because it's expecting a body with a POST and doesn't receive one.
Treat it as a GET with extra data: In rare cases, a poorly written server might try to process the body as query parameters, leading to unexpected behavior.
Content-Type Header: If you do add a body, you also need a Content-Type header to tell the server how to interpret the data (e.g., application/x-www-form-urlencoded, application/json). Without this, the server won't know what to do with the body.
Idempotency: GET requests are supposed to be idempotent (meaning making the same request multiple times has the same effect). POST requests are not. Servers might have logic that relies on this distinction.
Security Measures: Many web frameworks and security tools actively check for method tampering and will reject requests that don't align with expected behavior.
Burp's "Change request method" Feature
Burp's "Change request method" feature is much more sophisticated than just changing the header. It does a lot more to make the method change legitimate and potentially bypass security measures. Here's what it typically does:
Header Modification: It changes the HTTP method in the request line (e.g., from GET /path HTTP/1.1 to POST /path HTTP/1.1).
Body Addition (for POST/PUT/PATCH): If you change to a method that requires a body (POST, PUT, PATCH), Burp will automatically add a default body. This body is usually application/x-www-form-urlencoded encoded with the original GET parameters converted into POST parameters. For example:
Original GET:GET /search?q=test HTTP/1.1
Burp-converted POST:
http
POST /search HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 7
q=test
Content-Type Header: Burp adds the appropriate Content-Type header based on the body it creates.
Content-Length Header: Burp calculates and sets the Content-Length header correctly to match the size of the body.
Other Adjustments: Depending on the target and the method being changed, Burp might also adjust other headers or parameters to ensure the request is more likely to be accepted. This could include things like:
Removing query parameters: If changing to POST, Burp might remove the original query parameters from the URL.
Adding CSRF tokens: If the application uses CSRF protection, Burp might attempt to add or modify CSRF tokens. (This is often handled by Burp's other features, but the method change can interact with it).
Why Burp's Feature is More Effective
Burp's feature aims to create a valid request for the new method, not just a spoofed one. This significantly increases the chances of the server processing the request as intended. It's designed to help you test for vulnerabilities related to improper method validation.
Verb Tempering and Why It Matters
Verb tempering is a technique where you try to manipulate the HTTP method to bypass security checks or access functionality you shouldn't. Here are some scenarios where it can be useful:
Access Control: A server might only check permissions for GET requests on a certain endpoint, but not for POST requests. Changing to POST could allow you to perform actions you're not authorized to do.
CSRF Protection Bypass: Poorly implemented CSRF protection might only validate the method as GET, allowing you to bypass it with a POST.
Hidden Functionality: Sometimes developers leave endpoints that are only intended to be accessed via POST, but aren't properly protected.
State-Changing Operations: You might be able to trigger unintended state changes by using a different method than expected.
In summary:
You were on the right track thinking about verb tempering! However, manually changing the header is a very basic attempt. Burp's "Change request method" feature is a much more comprehensive tool that creates a more legitimate request, making it more likely to succeed in bypassing security measures and uncovering vulnerabilities.
Keep experimenting and learning! Burp Suite is a powerful tool, and understanding how its features work is key to becoming a skilled web application security tester. Also, remember to always test on systems you have permission to test on.
User
haha, makes me wonder if I was closer to that flag than I thought I was
Will try this next time, thanks!
Assistant
You absolutely might have been closer than you thought! Often, the difference between a failed attempt and a successful exploit is just a little bit of finesse – like using the right tool (Burp's method changer) instead of a manual workaround.
It's a great feeling when you realize a small change in your approach unlocks something. Don't be discouraged by initial failures; they're learning opportunities.
Good luck with the rest of the Hack The Box challenge! I hope you find that flag soon. If you run into any other puzzling situations, feel free to ask. I'm happy to help if I can.