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/natas33.md
URL /wargames/natas/natas33/
Date 2026-04-07

Natas Level 33

Natas Level 33 — an upload checker and a file function combine so that a crafted archive triggers deserialisation; learn about PHP phar attacks.

Table of Contents

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

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

Study guide

Level map: sign in as natas33 and find the password for natas34.

What this level teaches

How seemingly harmless file functions can trigger object deserialisation.

Key ideas

  • Phar archives. PHP can read an archive format called phar, which stores serialised metadata.
  • Stream wrappers. File functions accept URL-like paths such as phar://...; opening one can cause the metadata to be unserialised automatically.
  • Gadget in the source. A class in the page code performs an unsafe action when it is destroyed.
  • Building a phar. PHP’s Phar class lets you create one with your own metadata, if the build is allowed in your environment.

How to approach it

  1. Read the upload and checking code carefully, and find the class that does something interesting.
  2. Work out how to get your file to the server and make a file function open it as a phar.

How developers prevent it

Disallow phar:// for user-controlled paths, update PHP, and avoid dangerous classes that act on destruction.