SQLi Cheat Sheet
SQLi Cheat Sheet
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 1/8
12/26/24, 12:49 PM SQLi Cheat Sheet
SQL injection (SQLi) allows an attacker to interfere with the queries that an
application makes to its database. This can allow an attacker to view data that
they are not normally able to retrieve. This might include data that belongs to
other users, or any other data that the application can access. In many cases,
an attacker can modify or delete this data, causing persistent changes to the
application's content or behavior.
CVE-2024-2879
CVE-2024-2879 was awarded a 5500$ bounty, which is so far the highest paid bounty
by the WordFence bug bounty program. It is an unauthenticated SQL injection in the
LayerSlider WordPress Plugin. LayerSlider has an endpoint with the ls get popup
markup parameter, which was vulnerable to SQL injection. Check here and here for
further details.
3 Types of SQLi
1. Basic SQLi
Union-based SQLi leverages the UNION SQL operator to combine the results
of two or more SELECT statements into a single result which is then returned
as part of the HTTP response.
2. Blind SQLi
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 2/8
12/26/24, 12:49 PM SQLi Cheat Sheet
Time-based SQLi relies on sending an SQL query to the database which forces
the database to wait for a specified amount of time before responding. The
response time will indicate to the attacker whether the result of the query is
TRUE or FALSE.
3. Out-of-band SQLi
How to Hunt
Identification
Probe if SQL injection might be possible with:
• single-quote
• apostrophe
• backtick
• backslash
• some OR payload variations
• etc.
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 3/8
12/26/24, 12:49 PM SQLi Cheat Sheet
Please familiarize yourself well with the contents of your wordlists you are
using, since they can cause a lot of harm to your target. You don’t want to be
responsible for deleting a production db full of user data. Please hack
responsibly!
Injection Points
There are various possibilities to inject the payloads. Equipped with a wordlists you can
use Burp Intruder or Ffuff to fuzz the target. Here are a few ideas on where to inject:
• Value
• Parameter
• Parameter=Value
• Header
• Cookies
• Path
Second-Order SQLi occurs when the application takes user input and stores it
for future use. This is usually done by storing the input into a database. No
vulnerability occurs at this point. Later, when handling another request, the
application retrieves the stored data and incorporates it into an SQL query in an
unsafe way.
sqlmap
sqlmap is the Swiss army knife for SQL Injection attacks.
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 4/8
12/26/24, 12:49 PM SQLi Cheat Sheet
sqlmap is a powerful tool detecting and exploiting SQL injection flaws and
taking over of database servers.
Please check the wiki which explains each option much better than I could do here.
Bypassing WAF with Tamper scripts:
Please have a look at the table at Payloadallthethings for the specifics of the tamper
scripts.
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 5/8
12/26/24, 12:49 PM SQLi Cheat Sheet
Resources
Types of SQL Injection?
Types of SQL injection: SQL injection can be classified into three major categories - In-band SQLi, Inferential
SQLi and Out-of-band SQLi.
https://www.acunetix.com/websitesecurity/sql-injection2/
owasp.org
https://owasp.org/www-chapter-belgium/assets/2010/2010-06-16/Advanced_SQL_InjectionV2.pdf
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 6/8
12/26/24, 12:49 PM SQLi Cheat Sheet
sqlmap
sqlmapproject
https://medium.com/@drag0n/sqlmap-tamper-scripts-sql-inje…
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 7/8
12/26/24, 12:49 PM SQLi Cheat Sheet
https://jasper-join-7e5.notion.site/SQLi-Cheat-Sheet-b03215933d234f11a8ff16b9d02869fe 8/8