Image Service 1
给了源码但没完全给,服务是用gin写的,给的是编译后的文件,运行main后可知
运行app的main的时候由于没数据库报错了
以为下面的包名对应的链接给了源码,然而并不能访问到。。。
给了robot的源码
import requests
import time
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))
username = 'admin'
password = os.environ['ADMIN_PASSWORD']
def alert(message):
print(f'!!!!!!{message}!!!!!!')
exit(1)
sess = requests.Session()
while True:
try:
r = sess.post('http://localhost:8000/user/login', data={"username": username, "password": password})
if r.status_code in [200, 403]:
break
except Exception as e:
print("Server not started")
time.sleep(1)
def admin_bot():
r = sess.post('http://localhost:8000/user/register', data={"username": username, "password": password})
r = sess.post('http://localhost:8000/user/login', data={"username": username, "password": password})
assert(r.status_code == 200)
r = sess.get('http://localhost:8000/image/list')
assert(r.status_code == 200)
if r.json():
print("Admin already registered")
exit(0)
r = sess.post('http://localhost:8000/image/upload', files={"image": open("./flag1.png", "rb")})
assert(r.status_code == 200)
r = sess.get('http://localhost:8000/image/list')
assert(r.status_code == 200)
flag1 = r.json()[0]['uuid']
r = sess.post('http://localhost:8000/share/new', data={"uuid": flag1, "public": 1})
assert(r.status_code == 200)
print(f"flag1: {r.text}")
r = sess.post('http://localhost:8000/image/upload', files={"image": open("./flag2.png", "rb")})
assert(r.status_code == 200)
r = sess.get('http://localhost:8000/image/list')
assert(r.status_code == 200)
flag2 = r.json()[0]['uuid']
r = sess.post('http://localhost:8000/share/new', data={"uuid": flag1, "y1": 200, "x1": 200, "text": "secret", "textsize": 50, "blur": 20, "public": 1})
assert(r.status_code == 200)
print(f"flag2: {r.text}")
try:
print("Registering admin")
admin_bot()
print("Admin registered")
except Exception as e:
from traceback import print_exc
print_exc()
alert(f'Admin bot failed: {e}')
注册和登录admin都要本地ip,改xff和client都无效
注册登录后有上传功能和分享功能,并且可以通过id搜索到其它用户分享的图片,搜索admin的时候还是提示要本地ip,但这些功能点又不像有ssrf
然后就随便搜了个Admin发现就有了。。。
改变其它大小写位置都行,这里可能只判断了admin小写,有点迷。。。
Easy PHP
开始以为这不是直接送分吗,然后写一下发现一直不出,就直接复制到vscode了
这奇奇怪怪的不知道啥玩意,搜索后发现是Unicode 控制字符https://www.jianshu.com/p/2073fccfca4f可以控制字体显示的位置方向啥的,所以 显示出来的代码和真正的代码是不一样的。
开始看题面提示RGB,可以看到高亮显示的位置确实是错位的,于是按照位置又重新组合提交下没有一个正确的,然后看那啥控制符又看了一会,有点难顶,而且我也不知道他是按反转后的直接解析还是加上那些字符一起解析,于是直接本地试了,发现是带这些Unicode字符一起解析的
于是直接按vscode里的格式提交就行,由于是Unicode不能直接提交,urlencode下就行
flagC:\Users\meteo\Desktop\l3h\easyphp.php:8:
array(2) {
‘鈥仸L3H鈦┾仸password’ =>
string(21) “鈥仸CTF鈦┾仸l3hctf”
‘username’ =>
string(5) “admin”
}
%E2%80%AE%E2%81%A6L3H%E2%81%A9%E2%81%A6password=>%E2%80%AE%E2%81%A6CTF%E2%81%A9%E2%81%A6l3hctf
username=>admin
http://124.71.176.131:10001/?username=admin&%E2%80%AE%E2%81%A6L3H%E2%81%A9%E2%81%A6password=%E2%80%AE%E2%81%A6CTF%E2%81%A9%E2%81%A6l3hctf
是个新漏洞,只能说师傅属实太强了,安全问题爆出来的时候总会让人感觉这样居然都行。