root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat vulnerability-pattern-sqli.md
// bug-bounty

SQL Injection

23 Jul 2026 · 3 min read

What it is

Unsanitized input reaches a SQL query and changes its logic — from a tautology that returns extra rows to blind, stacked queries that exfiltrate data one character at a time.

Why it matters

Still one of the highest-severity classes available: a single injectable parameter can mean full database read/write, and occasionally remote code execution through database-server features.

Where to look

  • Any parameter feeding a lookup, filter, sort or search — including ones not visible in the UI
  • Hidden POST fields, JSON body keys, HTTP headers (
    User-Agent
    ,
    X-Forwarded-For
    ), and occasionally parameter names themselves

How I test it

  1. Find a parameter that plausibly touches a database — search, filter, sort, an ID lookup.
  2. Send a single quote and see if it breaks the response: an error message, a blank page, or a different status code.
  3. Try a boolean pair —
    ... AND 1=1
    vs
    ... AND 1=2
    — and diff the two responses.
  4. No visible difference? Move to time-based blind: an equivalent of
    WAITFOR DELAY
    /
    SLEEP()
    and measure response time.
  5. Once confirmed, map the injection type — error-based, union, boolean-blind, time-blind — and extract schema info (table/column names) before touching actual user rows.

Hunting checklist

  • Tested a single quote for a syntax break
  • Tested a boolean true/false pair and diffed responses
  • Tested time-based blind if no visible difference appeared
  • Tested hidden fields and headers, not just visible query params
  • Confirmed injection type before extracting any real data
  • Stopped at schema-level proof, didn't dump user tables unnecessarily

Evidence to collect

  • Baseline request/response
  • Request with the boolean-true payload and its response
  • Request with the boolean-false payload and its response
  • Timing proof for blind cases
  • Minimal schema-level data proving impact (e.g. database version), not a full data dump

Recommended fix

  • Parameterized queries / prepared statements everywhere
  • Least-privilege database accounts
  • Input validation as defense in depth, never as the only control
  • Generic error messages — don't leak query structure