1
sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=name&password=pass"  -D get_method -T user --dump

Output :

[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 code :

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);

The issue is when I run this code sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=name&password=pass" -D get_method -T user --dump it is sending data="name=name&password=pass" while there's no data in database enter image description here

And, I am getting only a data when I run that code.

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

Why I am unable to get all data? I tried this also sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=hello&password=hey" -D get_method -T user --dump Although I was getting same output..

0

Look at your php code at first

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);

Whatever I will send to this file it will only check that look at sql code now. SELECT * FROM `user` WHERE `name`='$name' && `password`='$password' Select everything from user table where name="whatever user send" and password="whatever user send". That's the reason why I wasn't having all of list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.