date
Aug 5, 2021 12:02 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 操作系统
 
扩展一下
万能密码
notion image
 

以上为知识点

开始闯关

试错版

notion image
notion image
通过' " 判断为字符型
'构建闭合/注释方式
notion image
notion image
以及不要用#要用转ulr后的%23,浏览器(框太小且不好调试)会自动转url,但burpsuite不会,包括空格%20都要手改,我这里用的+ 就挺好看的,还可以用偶数的!! ~~ 来连接。
notion image
notion image
都可以使用。
判断字段数
notion image
notion image
对比判断字段数为3
找显位
notion image
忘了将union前的语句弄wrong
notion image
两个显位,直接爆表和库,固定语句
union+select+1,group_concat(table_name),database()+from+information_schema.tables+where+table_schema=database()--+
notion image
查列
notion image
查表
union+select+1,group_concat(username,'>',password),3+from+security.users+--+--+
notion image
notion image
渲染突然没了 我也不知道啥原因。加,'>', 只是为了好看。
notion image
不加库名,也能出相同的结果,毕竟flag同库。
 
 
参考
sql注入总结笔记
WARNING: 授权渗透,备份数据后渗透; 在不确定危害的前提下,避免在update、insert、delete种类的注入点进行注入; 避免使用工具进行上述注入; 避免使用sqlmap的-dump功能; 前端构造的SQL语句片段拼接到后台SQL语句中,后台缺乏正确识别和过滤,造成与其外的数据库查询结果。 从技术上来说:未授权、非法增删改查数据库内容,包括窃取信息、删除数据库、读写系统文件、执行命令等等; 从影响上来说:客户数据丢失、系统交易数据被篡改、网站首页被篡改。 按照后台处理前端提交参数的类型来分,分两类:数字型注入和字符型注入。 按照请求方式分:GET、POST 按照其他分类方法,还有一些常见数据库注入类型:报错注入、盲注、延时注入、宽字节注入、二次注入、堆叠注入。 确认是否是动态网站 找到可能与后台数据库产生交互的位置,测试是否是注入点。 联合查询>报错>布尔盲注>延时盲注 宽字节注入、二次注入(代码审计) # 单行,从'#'字符从行尾 --空格 单行,从'-- '序列到行尾 /* 允许注释跨越多行 */ substr(var1, var2, var3) 功能:从字符串里截取其中一段字符(串) var1:被截取的字符串 var2:从哪一位开始截取 var3:截取长度 ascii(var) 功能:取var字符的ascii码(十进制) user() 取得 当前登陆的用户,相当于问 MySQL whoami 的意思。 if(var1,var2,var3) var1:条件 var2:条件为真时返回的值 var3:条件为假时返回的值 sleep(var) 暂停执行var秒,var可以用小数 update user set name='xiaoming', passwd='123456' where
sqli-labs-master前十关过关总结_Alexz__的博客-程序员宅基地 - 程序员宅基地
登入Windows命令行MySQL,方便查验注入命令 源码如下 查列数: 这里需要注意,使用联合查询爆出数据库名称的时候前面id值需要放空: ?id=' union select 1,group_concat( schema_name),3 from information_schema.schemata --+ ?id=' union select 1,group_concat( table_name),3 from information_schema.tables where table_schema='security' --+ ?id=' union select 1,group_concat( column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+ 分别在2,3处显示username和password: ?id=' union select 1,group_concat( username),group_concat( password) from users --+ 通第一关类型一致,但是为数字型报错,不需要闭合 利用Firefox插件MaxHacKBar(f12)中的报错语句 需要了解这两个函数,可以调出数据库的安装路径,以便通过菜刀连接远程服务器 钥匙我们需要写入木马文件,需要先判断是否具有写权限: ?id=1' and (select count(*)from mysql.user)>0 --+ 无法写入,理论上都是正确的。。。先走一步看一步,不要在这儿浪费太多的时间 这一关是基于布尔的盲注,从报错的结果返回来判断我们的猜测是否正确 substr(str, pos, len) :将str从pos位置开始截取len长度的字符进行返回。注意这里的pos位置是从1开始的,不是数组的0开始 mid(str,pos,len):跟上面的一样,截取字符串 ascii(str) :返回字符串str的最左面字符的ASCII代码值。 if(a,b,c) :a为条件,a为true,返回b,否则返回c,如if(1>2,1,0),返回0 security第一个字母就是 s (这里也区分大小写哦) ?id=1' and if(ascii(substr((select database()),1,1))>114,1,0) --+ 通过sleep()函数,通过web界面的返回时间长短判断是否被执行 在时间盲注上的sleep韩束位置选择,最好可以再是错次数交多处进行卡顿,这样可以大大节约测试时间 正在卡顿中....
sqli-labs-master前十关过关总结_Alexz__的博客-程序员宅基地 - 程序员宅基地
 

less2

notion image
在闭合处报错
notion image
回头验证一下 是否为数字型
notion image
notion image
notion image
后续过程同less1
 

less3

notion image
提示括号
notion image
构建闭合
notion image
象征性的拿下答案
notion image
 

less4

notion image
notion image
引号跟less3相反
走人
notion image
 

less5

notion image
嗯嗯
notion image
notion image
notion image
说是报错型注入
不管 ,先闭合
notion image
然后参考

知识点


双查询注入
双注入查询需要理解四个函数/语句
1. Rand() //随机函数
2. Floor() //取整函数
3. Count() //汇总函数
4. Group by clause //分组语句
简单的一句话原理就是有研究人员发现,当在一个聚合函数,比如count函数后面如果使用分组语句就会把查询的一部分以错误的形式显示出来。

测试用语句


go on

回显无法探测
notion image
上公式
 
 
 
手工注入在存在联合和报错注入的情况下,注入速度也是不低于 sqlmap 的哦。
XSSbugku随便玩玩
Loading...