当前位置:网站首页>SQL注入 Less38(堆叠注入)
SQL注入 Less38(堆叠注入)
2022-07-31 22:34:00 【华为云】
<?phpif(isset($_GET['id'])){$id=$_GET['id'];// connectivity//mysql connections for stacked query examples.$con1 = mysqli_connect($host,$dbuser,$dbpass,$dbname);// Check connectionif (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() 函数执行一个或多个针对数据库的查询。多个查询用分号进行分隔==
mysqli_store_result() 转移上一次查询返回的结果集
mysqli_fetch_row() 函数从结果集中取得一行,并作为枚举数组返回。
所以只显示第一个查询的结果,不显示后面的查询结果。
再看这一题,可以和Less1一样,用union注入,可以用来查询数据。
这里我用堆叠注入试了试几个payload?id=1';1=1?id=1';1=2?id=1';nihao?id=1';nihao'
所以的结果都是这样
所以页面只展示第一条查询的结果。后面的查询都无关。
所以我们这里用堆叠注入是查不出数据的,但是==插入数据,删除数据,更新数据,修改表名、数据库名什么的都是可以的==?id=1';drop database security;?id=1';drop table users;?id=1';insert into users(username,password) values('happy','coder');
边栏推荐
- BOW/DOM (top)
- 输入输出优化
- LeetCode 第 304 场周赛
- Several methods for deleting specified elements in Golang slices
- spark reports an error OutOfMemory "recommended collection"
- useragent online lookup
- The uniapp applet checks and prompts for updates
- Write a database document management tool based on WPF repeating the wheel (1)
- hboot与recovery、boot.img、system.img
- Dry goods | 10 tips for MySQL add, delete, change query performance optimization
猜你喜欢

Flex layout in detail

IDA PRO中汇编结构体识别

关注!海泰方圆加入《个人信息保护自律公约》

Go mode tidy reports an error go warning “all” matched no packages

Daily practice——Randomly generate an integer between 1-100 and see how many times you can guess.Requirements: The number of guesses cannot exceed 7 times, and after each guess, it will prompt "bigger"

How to identify fake reptiles?

Summary of the classic drawing method of histogram

The article you worked so hard to write may not be your original

flowable workflow all business concepts

C程序设计-方法与实践(清华大学出版社)习题解析
随机推荐
MySQL数据库‘反斜杠\’ ,‘单引号‘’,‘双引号“’,‘null’无法存储
"SDOI2016" Journey Problem Solution
【Acwing】第62场周赛 题解
NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
BOW/DOM (top)
Learn about C# anonymous methods
BM3 将链表中的节点每k个一组翻转
[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement
Unity-LineRenderer显示一条线
[QNX Hypervisor 2.2 User Manual]9.14 set
如何导入 Golang 外部包并使用它?
IJCAI2022 | 代数和逻辑约束的混合概率推理
22年8月推广大使额外奖励规则
Judging decimal points and rounding of decimal operations in Golang
sqlite3 simple operation
Embedded development has no passion, is it normal?
useragent online lookup
利用反射实现一个管理对象信息的简单框架
Pytest初体验
A shortcut to search for specific character content in idea