A query is a sentence with grammar. User input is supposed to be a noun inside that sentence. Injection happens when the input changes the grammar instead of filling the blank.
String concatenation places raw input inside a query. A quote closes the intended string, OR changes the predicate, and a comment removes the rest. The database then executes the attacker's sentence with the application's privileges.
- Test the login fields
- Bypass the SQL predicate
- Reach the admin console and capture the flag
Client string to SQL parser
Where to look before you type a payload
The application receives a search term, login, filter, sort key or API parameter.
The value is placed into SQL text instead of being bound as a parameter.
The database parser treats attacker-controlled text as SQL syntax and may change the query structure.
The modified query runs with the application's database privileges.
Open one hint at a time. The first two build the model; the last two point at the boundary.
Hint 1
Send a single quote and watch for errors or changes in behavior.
Hint 2
Try a boolean tautology in the login or search field.
Hint 3
The login query is concatenated. Try a tautology in the username field and comment out the password check.
Hint 4 · near the answer
Bypass authentication or return every record, then capture the flag.
Observe → Hypothesize → Test → Prove → Explain
This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.
Evidence log
Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.
Preview the evidence report
# Lab evidence report — The HR Tautology - Family: SQL Injection - Lab ID: web-sqli-hr-login - Date: 2026-12-05 ## Workflow ### Observe - [ ] Open "The HR Tautology" and record /login, the HTTP method and the role you are given. - [ ] List every parameter, header, cookie and object identifier the normal flow exposes. - [ ] Save a baseline response: status, body shape, timing and the fields that change by user. ### Hypothesize - [ ] Name the server decision that protects /login, and the evidence it should use. - [ ] Use the clue as a constraint, not an answer: The query is built with string concatenation; a tautology can select the first user. - [ ] Predict the exact status, body or state change that would prove the decision is missing. ### Test - [ ] Start from the baseline and change one value: the username field. - [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result. - [ ] Capture the full request and response for the winning attempt, including the flag. ### Prove - [ ] Capture the flag and name the exact foreign object, role or state change it proves. - [ ] Repeat from a clean session and confirm the result is not cached or stale. - [ ] State impact precisely: what data or action did you actually obtain? ### Explain - [ ] State the root cause without naming the payload: which decision failed? - [ ] Name the control that prevents recurrence and the layer where it belongs. - [ ] Write one regression test that fails before the fix and passes after it. ## Evidence ### Target and baseline _Not recorded._ ### Hypothesis _Not recorded._ ### Winning request _Not recorded._ ### Proof _Not recorded._ ### Root cause _Not recorded._ ### Control and regression test _Not recorded._ ## Analyst conclusion The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.
False positives to rule out
- A single quote causes a generic 500: it may be a parser error, but confirm with boolean and time-based tests before calling it injectable.
- A WAF blocks a payload: encoding, alternate syntax and different parameters may still reach the query; never treat the WAF as the fix.
- The ORM is used: raw fragments, order clauses and dynamic identifiers can still be concatenated.
Regression tests to name
- Login tautology: Authentication fails and the query is unchanged
- Search union: The value is treated as literal text and no extra columns appear
- Sort identifier: The server maps only allowlisted columns and rejects the rest
- Use parameterized queries or a query builder that binds values.
- Allowlist identifiers such as sort columns; never concatenate them.
- Run the database with least privilege and return generic errors.
أي إدخال يغيّر بنية الاستعلام هو حقن، وليس مجرد علامة اقتباس.