The lab
here is how portswigger describes it
This lab makes an assumption about the privilege level of the user based on the HTTP Host header. To solve the lab, access the admin panel and delete the user carlos.
the admin panel is gated on being a "local" user, and the application decides that by looking at the Host header. but the Host header is just a request field we control, so we set it to localhost and the server treats our request as coming from itself. with that, the admin panel opens up and we delete carlos.
why trusting the host header breaks this#
the flaw is an access-control decision made on attacker-controlled input. the server reasons "if the host is localhost, this request is internal, so it must be a trusted local user", but the Host header is set by the client and means nothing about where the request actually came from. it is trivial to send any host value to a public endpoint. so the check that is meant to restrict the admin panel to the loopback interface is really just a string comparison against a header we own. by claiming Host: localhost we assert a privilege we were never granted, and because nothing else verifies locality (no source-IP check, no network segregation) the assertion is accepted.
Step 1 - confirm the host header is accepted#
we send the GET / request that returned 200 to Repeater and change the Host header to an arbitrary value. the home page still loads, so the application does not validate the host against an allowlist.

Step 2 - find the admin panel#
we browse to /robots.txt and see it references an admin panel at /admin.

Step 3 - read the access restriction#
we try to browse to /admin. we are denied, but the error message reveals the panel can be accessed by local users, so access is tied to locality rather than to a logged-in role.

Step 4 - claim locality with the host header#
we send the GET /admin request to Repeater and change the Host header to localhost. the admin panel now loads, showing options to delete users, our request is treated as local.

Step 5 - delete carlos#
we change the request line to GET /admin/delete?username=carlos (keeping Host: localhost) and send it to delete carlos.


with this, the lab is solved!
