Skip to content

Natas Level 8

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

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

Study guide

Level map: sign in as natas8 and find the password for natas9.

What this level teaches

Reading code that stores a secret in a transformed form, and undoing the steps.

Key ideas

  • Encoding chains. The code applies several reversible functions (such as hexadecimal conversion, string reversal and Base64) to the secret before storing it.
  • Reverse the order. If the program applies steps in sequence A, B, C, you undo them as C, B, A.
  • PHP functions. The manual page for each function states exactly what it does, and PHP has a counterpart that reverses most of them.
  • Run it yourself. A small script, or an online PHP sandbox, is the easiest way to check each step.

How to approach it

  1. Read the stored value and the function chain.
  2. Write the inverse operations in reverse order and test them on a sample.

How developers prevent it

Use proper hashing for passwords (a slow, salted hash) so that nothing needs to be reversible, and never store secrets in source code.