<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SQLi on unit363</title><link>https://unit363.dev/tags/sqli/</link><description>Recent content in SQLi on unit363</description><generator>Hugo</generator><language>en</language><copyright>unit363</copyright><lastBuildDate>Tue, 27 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://unit363.dev/tags/sqli/index.xml" rel="self" type="application/rss+xml"/><item><title>SQLi Cheat Sheet</title><link>https://unit363.dev/posts/sqli-cheat-sheet/</link><pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate><guid>https://unit363.dev/posts/sqli-cheat-sheet/</guid><description>&lt;h2 id="1-finding-the-injection-point"&gt;1. Finding the Injection Point&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Test &lt;strong&gt;every input&lt;/strong&gt; — URL params, form fields, cookies, HTTP headers (&lt;code&gt;User-Agent&lt;/code&gt;, &lt;code&gt;X-Forwarded-For&lt;/code&gt;, &lt;code&gt;Referer&lt;/code&gt;), JSON/XML API bodies, even filenames.&lt;/li&gt;&#10;&lt;li&gt;Canary characters to try first: &lt;code&gt;'&lt;/code&gt;, &lt;code&gt;&amp;quot;&lt;/code&gt;, &lt;code&gt;)&lt;/code&gt;, &lt;code&gt;;&lt;/code&gt;, backslash — then watch for:&#10;&lt;ul&gt;&#10;&lt;li&gt;A SQL error message (easiest confirmation)&lt;/li&gt;&#10;&lt;li&gt;A blank/different response vs. baseline&lt;/li&gt;&#10;&lt;li&gt;A changed HTTP status code&lt;/li&gt;&#10;&lt;li&gt;A timing difference (if nothing else changes — points to blind/time-based)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Confirm with a boolean pair: something true (&lt;code&gt;' OR '1'='1&lt;/code&gt;) vs. something false (&lt;code&gt;' OR '1'='2&lt;/code&gt;) and compare responses — if they differ, you likely have an injectable boolean condition.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="2-types-of-sqli-and-how-you-notice-each"&gt;2. Types of SQLi (and how you notice each)&lt;/h2&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Type&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Signal&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Notes&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;In-band / Error-based&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;DB error message reflected in response&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Fastest to exploit — error text can leak schema/data directly&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;In-band / UNION-based&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Query result set visible in response&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Requires matching column count and compatible data types&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Blind / Boolean-based&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;No error, no data shown, but true/false conditions change the response (content, length, status)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Slower — extract data one bit/char at a time&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Blind / Time-based&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;No visible difference at all; response is delayed only when condition is true (&lt;code&gt;SLEEP()&lt;/code&gt;, &lt;code&gt;WAITFOR DELAY&lt;/code&gt;)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Use when boolean differences aren&amp;rsquo;t observable; confirm with a clear baseline-vs-delayed timing comparison, repeated to rule out network jitter&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Out-of-band (OOB)&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Response triggers a DNS/HTTP callback to an external listener&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Rare — depends on DB functions that can initiate network requests (e.g., MSSQL &lt;code&gt;xp_dirtree&lt;/code&gt;, Oracle UTL_HTTP)&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Second-order&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Payload stored in one request, triggers when a &lt;em&gt;different&lt;/em&gt; feature later processes that stored value&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Easy to miss — requires tracking where stored data gets reused in another query&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="3-manual-testing-workflow"&gt;3. Manual Testing Workflow&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Confirm injectability&lt;/strong&gt; (Section 1) and identify the DB engine:&#10;&lt;ul&gt;&#10;&lt;li&gt;Error messages often name it directly.&lt;/li&gt;&#10;&lt;li&gt;Engine-specific syntax probes: &lt;code&gt;' AND 1=CONVERT(int,@@version)--&lt;/code&gt; (MSSQL), &lt;code&gt;' AND extractvalue(1,concat(0x7e,version()))--&lt;/code&gt; (MySQL), &lt;code&gt;' AND 1=1::int--&lt;/code&gt; type probes vary — compare behavior of engine-specific functions (&lt;code&gt;SLEEP()&lt;/code&gt; = MySQL, &lt;code&gt;pg_sleep()&lt;/code&gt; = PostgreSQL, &lt;code&gt;WAITFOR DELAY&lt;/code&gt; = MSSQL).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Determine the injection context&lt;/strong&gt;: numeric vs. string, how many columns the surrounding query has (needed for UNION), whether it&amp;rsquo;s inside a &lt;code&gt;WHERE&lt;/code&gt;, &lt;code&gt;ORDER BY&lt;/code&gt;, or elsewhere.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;For UNION-based:&lt;/strong&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Find column count: &lt;code&gt;ORDER BY N--&lt;/code&gt; incrementing N until it errors, or &lt;code&gt;UNION SELECT NULL,NULL,...--&lt;/code&gt; incrementing NULLs until it works.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Find which columns reflect in the output (replace NULLs one at a time with a marker string).&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Enumerate schema (MySQL example):&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39; UNION SELECT table_name,NULL FROM information_schema.tables--&amp;#39;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;UNION&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;SELECT&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;column_name&lt;/span&gt;,&lt;span style="color:#66d9ef"&gt;NULL&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; information_schema.columns &lt;span style="color:#66d9ef"&gt;WHERE&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;table_name&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;users&amp;#39;&lt;/span&gt;&lt;span style="color:#75715e"&gt;--&amp;#39; UNION SELECT username,password FROM users--&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Use &lt;code&gt;group_concat()&lt;/code&gt; (MySQL) / &lt;code&gt;string_agg()&lt;/code&gt; (PostgreSQL) / &lt;code&gt;STUFF(...FOR XML PATH(''))&lt;/code&gt; (MSSQL) to pull multiple rows through a single reflected column.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;For blind boolean:&lt;/strong&gt; automate manually with a binary search against &lt;code&gt;ASCII(SUBSTRING(...))&lt;/code&gt; comparisons if not using sqlmap — slow but useful to understand mechanically before leaning on tooling.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;For blind time-based:&lt;/strong&gt; confirm a clean baseline response time first, then compare against the delayed condition multiple times to rule out noise before concluding.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Check for filters/WAF&lt;/strong&gt; blocking specific syntax (comment style, keywords, spacing) — common bypasses: alternate comment style (&lt;code&gt;#&lt;/code&gt; vs &lt;code&gt;--&lt;/code&gt; ), inline comments to break up keywords (&lt;code&gt;UN/**/ION&lt;/code&gt;), case variation, whitespace alternatives (&lt;code&gt;/**/&lt;/code&gt;, tabs, newlines), encoding.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Check for stacked query support&lt;/strong&gt; (&lt;code&gt;; DROP TABLE ...&lt;/code&gt; style) separately — many drivers/frameworks don&amp;rsquo;t allow multiple statements per query even when the first statement is injectable; a &lt;code&gt;SLEEP()&lt;/code&gt; after a &lt;code&gt;;&lt;/code&gt; is a safe way to test this without writing.&lt;/li&gt;&#10;&lt;/ol&gt;</description></item></channel></rss>