2021l3hctfwp_web

Image Service 1

给了源码但没完全给,服务是用gin写的,给的是编译后的文件,运行main后可知

image-20211115150111536

运行app的main的时候由于没数据库报错了

image-20211115150229040

以为下面的包名对应的链接给了源码,然而并不能访问到。。。

给了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都无效

image-20211115150445200

注册登录后有上传功能和分享功能,并且可以通过id搜索到其它用户分享的图片,搜索admin的时候还是提示要本地ip,但这些功能点又不像有ssrf

image-20211115150642237

然后就随便搜了个Admin发现就有了。。。

image-20211115150957498

改变其它大小写位置都行,这里可能只判断了admin小写,有点迷。。。

Easy PHP

image-20211115151405100

开始以为这不是直接送分吗,然后写一下发现一直不出,就直接复制到vscode了

image-20211115151659086

这奇奇怪怪的不知道啥玩意,搜索后发现是Unicode 控制字符https://www.jianshu.com/p/2073fccfca4f可以控制字体显示的位置方向啥的,所以 显示出来的代码和真正的代码是不一样的。

开始看题面提示RGB,可以看到高亮显示的位置确实是错位的,于是按照位置又重新组合提交下没有一个正确的,然后看那啥控制符又看了一会,有点难顶,而且我也不知道他是按反转后的直接解析还是加上那些字符一起解析,于是直接本地试了,发现是带这些Unicode字符一起解析的

image-20211115152556317

于是直接按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

image-20211115152825444

trojansource.codes

是个新漏洞,只能说师傅属实太强了,安全问题爆出来的时候总会让人感觉这样居然都行。

image-20211115152924382

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值