Simulations/XPath Injection

XPath Injection

Intermediate

The login endpoint authenticates against an XML user store by concatenating your username and password straight into //user[username='…' and password='…']. A single quote breaks out of the string and can make the predicate always true. Forge a payload, bypass authentication, then switch to parameterized XPath.

Progress:
1
Bypass the Login
2
Log in as Admin
3
Escape the Input
⚡ Login form
POST /api/login
//user[username='…' and password='…']
🛡 Server protection
Server response log
Waiting for login attempt…

Challenges

1
Bypass the Login
Inject ' or '1'='1 as the username so the XPath predicate is always true and you log in as the first user.
hints
2
Log in as Admin
Craft a payload that pins the admin account specifically, not just any account.
hints
3
Escape the Input
Enable parameterized XPath and confirm the same payload is now treated as a literal username and rejected.
hints
How to fix XPath injection
bound variables, escaping, hashed credentials

Frequently Asked Questions