InBrott
target://sqli-login-gate
easyOPEN

Broken Login Gate

sql-injectionauthentication

// Scenario

A legacy authentication helper authenticate_user (Python) / authenticateUser (JavaScript) validates credentials against an in-memory user directory using SQL queries.

// The Vulnerability

User-supplied username and password values are interpolated directly into the SQL query string. An attacker can inject SQL syntax such as ' OR '1'='1 or comment sequences to bypass password verification and log in as admin.

// Your Task

Fix the query execution so that user inputs are bound as parameters (prepared statements) rather than concatenated into SQL.

  • Keep the exact function signature and return contract: return {"ok": True, "username": ..., "role": ...} (or { ok: true, username, role } in JS) on valid credentials, or {"ok": False} / { ok: false } on invalid credentials or malformed input.

Sample Sanity Checks (2)

  • Valid user login succeeds
    Normal credentials for alice return ok=true and role=user
  • Wrong password fails
    Invalid password returns ok=false
Hints (0/3)
initializing editor...

[idle] Press RUN to execute visible sample checks, or SUBMIT to run hidden exploit & functionality suites.