Skip to main content

Settings

Color Mode

Theme Skin

Background

Appearance preferences are saved in this browser only.

Environment

Current Environment Production

Built with JEKYLL_ENV=production. Changes require deployment.

Quick Links

Theme & Build

Jekyll v3.10.0
Last BuildNov 24, 17:25

Page Location

Page Info

Layout default
Collection wargames
Path _wargames/natas/natas24.md
URL /wargames/natas/natas24/
Date 2026-04-07

Natas Level 24

Natas Level 24 — a password check uses strcmp, which behaves unexpectedly when it is given the wrong type of input; learn PHP type confusion.

Table of Contents

Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.

Username: natas24
URL:      http://natas24.natas.labs.overthewire.org

Study guide

Level map: sign in as natas24 and find the password for natas25.

What this level teaches

How unexpected input types can defeat a security comparison.

Key ideas

  • Parameters can be arrays. In PHP, a form field written like name[] arrives as an array, not a string.
  • Functions misbehave on the wrong type. Passing an array where a string is expected produces a warning and a surprising return value.
  • Loose comparison of that value. The check then treats the result as success.
  • Read the manual. The PHP documentation for strcmp lists its return values.

How to approach it

  1. Work out what the code compares and how it interprets the result.
  2. Consider what input types you can send that the developer did not imagine.

How developers prevent it

Validate input types, use strict comparison, and modern PHP versions that raise errors when the wrong type is passed.