Request and response through an attacker’s eyes: what the client controls
The client controls every element of an HTTP request, and the server cannot tell whether it came from a browser, curl or a script. So checks in the interface (disabled, maxlength, JS validation, hidden fields) are not protection: nothing from the client is trusted. The server itself checks types, limits and permissions and computes the price, role and owner. Requests are changed through a proxy such as Burp or ZAP.
Pentest · HTTP
The page will not let you change the price. Does that mean the server protects it?
An order form shows a price of 100 in a field that cannot be edited, and JavaScript rejects a quantity below 1. A tester who checks only through the interface concludes that the price cannot be changed. An attacker thinks differently: the interface is not a boundary for them, just one of several programs that can send requests. This lesson covers what an HTTP request consists of, what the sender controls in it, how to see and change it through a proxy, and the security rule that follows.
How it works and why. HTTP is a text “request and response” protocol. A request has a request line (method, path with query parameters, version), headers, an empty line and an optional body. A response has a status line, headers and a body.
POST /api/orders?lang=uk HTTP/1.1
Host: shop.example
Content-Type: application/json
Cookie: sid=abc123
{"productId":7,"qty":1}
Everything here is sent by the client: the method, the path, the parameters, any header, the cookie, the body. The server cannot tell whether the request came from a browser, curl or a script. Buttons, disabled, maxlength, JS validation and hidden form fields belong to the interface, that is, to code running in the sender’s hands. Hence the main rule: nothing from the client is trusted. The server checks types, bounds and rights itself and computes what must not be taken from the client (the price, the role, the owner).
A proxy between the browser and the server
In Burp Suite these are Proxy (interception), HTTP history and Repeater (resending a request with edits); in ZAP, Break, History and the Manual Request Editor. For HTTPS the proxy issues its own certificate, so its CA is trusted only in a separate test browser and never in your main one.
Example: a price protected only by the interface. A made-up example on a test environment with permission. The interface sends:
POST /api/orders HTTP/1.1
Host: shop.example
Content-Type: application/json
{"productId":7,"qty":1,"price":100}
In Repeater the tester changes the body to {"productId":7,"qty":1,"price":1} and looks at the response:
HTTP/1.1 201 Created
Content-Type: application/json
{"orderId":981,"total":1}
A total of 1 is a defect: the server took the price from the body. The right behaviour is to ignore the price field or reject the request and compute the total from the catalogue on the server:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{"error":"unknown field: price"}
The temptation to fix it “with one more JavaScript check” fails for the same reason: an attacker just bypasses code in the browser. The fix belongs on the server. A safe place to practise is the PortSwigger Web Security Academy labs and OWASP Juice Shop, and only there or on a system with a scope and written permission.
A real case. In 2019 a journalist told the US company First American Financial that its website served documents at a link with a nine-digit number: by changing a digit anyone could open someone else’s document without authentication (this is how KrebsOnSecurity described the flaw). According to the SEC, over 800 million document images were exposed, some with social security numbers and financial data; the company’s security staff had found the problem earlier but did not fix it, and senior management did not know. In 2021 the company agreed to a penalty of 487,616 dollars. The lesson: a parameter in a URL is client input, and the server must check whether this user is allowed to open this document.
Limits. A proxy shows only the exchange with the client: it cannot see what the server does inside, so conclusions about hidden logic are drawn from responses. Mobile apps with certificate pinning refuse to work through a proxy with a foreign certificate, so the test needs a specially prepared build. Burp and ZAP also show WebSocket and HTTP/2, but in a different view.
Common mistakes.
- Assuming a
disabledfield or a hidden input protects a value: anyone who sees the request can change it. - Testing only through the UI and never trying the same request directly: this never finds a missing server-side check.
- Trusting headers such as
X-Forwarded-FororRefererfor access decisions: the client sets them. - Installing the proxy certificate in your main browser: every site you visit becomes visible to the proxy.
Check yourself
The form does not let you send qty: -1, but the server accepts the same request from Repeater (201 Created). What does this say about validation?
Answer
The check exists only in the form’s JavaScript. The server does not repeat it, so anyone who sends the request directly bypasses it. The rule must run on the server.
A tester changes the number in /doc/000417 to 000418 and sees someone else’s file. What is the conclusion and what to repeat before reporting?
Answer
The object-level authorization check is missing (an insecure direct object reference). Repeat the request with two different accounts and without authentication to show exactly who gets access, and mask customer data in the evidence.