2025 SEKAICTF Web 題解
前言
這場比賽的題解會以學習Web為主,Writeup會參考官方github連結以及其他參賽者在網路上討論的內容
My flask app
這是一個flask製作的網頁
原始碼可以看到
1 2
| if __name__ == '__main__': app.run(host='0.0.0.0', port=5001, debug=True)
|
發現到他有開啟debug mod,根據這篇blog可以試試看/console路徑但是這個console會需要用到pin碼,這個密碼是可以爆破的,需要兩個probably_public_bits、private_bits
probably_public_bits
private_bits
另外從源碼可以發現到
1 2 3 4 5 6 7 8 9 10 11 12 13
| @app.route('/view') def view(): filename = request.args.get('filename') if not filename: return "Filename is required", 400 try: with open(filename, 'r') as file: content = file.read() return content, 200 except FileNotFoundError: return "File not found", 404 except Exception as e: return f"Error: {str(e)}", 500
|
訪問到view後他會訪問filename的參數,因此可以任意讀檔,透過這個