当前位置:网站首页>SQL injection less38 (Stack Injection)
SQL injection less38 (Stack Injection)
2022-07-28 22:17:00 【Happy star】
<?php
if(isset($_GET['id']))
{
$id=$_GET['id'];
// connectivity
//mysql connections for stacked query examples.
$con1 = mysqli_connect($host,$dbuser,$dbpass,$dbname);
// Check connection
if (mysqli_connect_errno($con1))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
@mysqli_select_db($con1, $dbname) or die ( "Unable to connect to the database: $dbname");
}
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
/* execute multi query */
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));
}
else
{
echo '<font size="5" color= "#FFFF00">';
print_r(mysqli_error($con1));
echo "</font>";
}
/* close connection */
mysqli_close($con1);
}
else {
echo "Please input the ID as parameter with numeric value";}
?>
mysqli_multi_query() Function to execute one or more queries against the database . Multiple queries are separated by semicolons
mysqli_store_result() Transfer the result set returned by the last query
mysqli_fetch_row() Function takes a line from the result set , And return... As an enumerated array .
So only the results of the first query are displayed , Do not display the following query results .
Look at this question again , You can talk to Less1 equally , use union Inject , It can be used to query data .
Here I try a few with Stack Injection payload?id=1';1=1?id=1';1=2?id=1';nihao?id=1';nihao'
All the results are like this 
So the page only shows the result of the first query . The following queries are irrelevant .
So we can't find the data with Stack Injection , however insert data , Delete data , Update data , Modify the name of the table 、 Database name and other things are ok ?id=1';drop database security;?id=1';drop table users;?id=1';insert into users(username,password) values('happy','coder');
边栏推荐
- 从 Web3到Web2.5,是倒退还是另辟蹊径?
- LVS+KeepAlived高可用部署实战应用
- Practice and exploration of overseas site Seata of ant group
- What is a prime factor? In number theory, a prime factor (prime factor or prime factor) refers to a prime number that can divide a given positive integer
- What is the difference between inline elements and block level elements? Semantic function
- 04.toRef 默认值
- Esp8266 Arduino programming example - timer and interrupt
- Basic introduction of Rockwell AB PLC rslogix digital quantity IO module
- Getting started with Oracle
- HCIP(10)
猜你喜欢
随机推荐
如何在 Web3中建立一个去中心化社区
HCIP(9)
Esp8266 Arduino programming example - SPIFs and data upload (Arduino IDE and platformio IDE)
表单验证和级联下拉列表(多种实现)
Kubevera plug-in addons download address
静态路由和缺省路由实验
JS DOM编程之平平无奇小练习
PCB材料简单介绍
HCIP(9)
DHCP and PPPoE protocols and packet capture analysis
What is a prime factor? In number theory, a prime factor (prime factor or prime factor) refers to a prime number that can divide a given positive integer
Technology selection rust post analysis
Getting started with Oracle
深度学习必备:对数据集的拆分、根据拆分图片拆分labels、对全部标注标签进行区间检查
IFLYTEK written examination
40. Combined sum II
KubeVela 1.4.x 官方文档
ESP8266-Arduino编程实例-深度休眠与唤醒
ECMASript 5/6 笔记
成立不到一年!MIT衍生量子计算公司完成900万美元融资







