@@ -684,6 +684,84 @@ <h1 class="post-title hover-underline-animation"><a class="post-link" href="/pos
684684</ article >
685685
686686
687+ < article class ="post ">
688+ < div class ="single-container column is-centered ">
689+ < div class ="archive " id ="post-container ">
690+ < header class ="post-header ">
691+ < h1 class ="post-title hover-underline-animation "> < a class ="post-link " href ="/post/d3ctf2025/ "> D3CTF 2025-WP</ a > </ h1 >
692+
693+
694+ </ header >
695+ < div class ="post-content ">
696+ < div class ="excerpt post-summary ">
697+ < h2 id ="前言 "> 前言</ h2 >
698+ < p > 跟着Syc打的,web方向差一题ak,算是有点可惜了</ p >
699+ < h2 id ="d3model "> d3model</ h2 >
700+ < p > 题目内就一个app.py</ p >
701+ < pre tabindex ="0 "> < code > import keras
702+ from flask import Flask, request, jsonify
703+ import os
704+
705+
706+ def is_valid_model(modelname):
707+ try:
708+ keras.models.load_model(modelname)
709+ except Exception as e:
710+ print(e)
711+ return False
712+ return True
713+
714+ app = Flask(__name__)
715+
716+ @app.route('/', methods=['GET'])
717+ def index():
718+ return open('index.html').read()
719+
720+
721+ @app.route('/upload', methods=['POST'])
722+ def upload_file():
723+ if 'file' not in request.files:
724+ return jsonify({'error': 'No file part'}), 400
725+
726+ file = request.files['file']
727+
728+ if file.filename == '':
729+ return jsonify({'error': 'No selected file'}), 400
730+
731+ MAX_FILE_SIZE = 50 * 1024 * 1024 # 50MB
732+ file.seek(0, os.SEEK_END)
733+ file_size = file.tell()
734+ file.seek(0)
735+
736+ if file_size > MAX_FILE_SIZE:
737+ return jsonify({'error': 'File size exceeds 50MB limit'}), 400
738+
739+ filepath = os.path.join('./', 'test.keras')
740+ if os.path.exists(filepath):
741+ os.remove(filepath)
742+ file.save(filepath)
743+
744+ if is_valid_model(filepath):
745+ return jsonify({'message': 'Model is valid'}), 200
746+ else:
747+
748+ return jsonify({'error': 'Invalid model file'}), 400
749+
750+ if __name__ == '__main__':
751+ app.run(host='0.0.0.0', port=5001)
752+ </ code > </ pre > < p > 代码也没啥好审的,很明显就只有一个keras.models.load_model(modelname)能当作sink点,去网上搜一下相关漏洞就能找到现成的payload,题目不出网,外带到index.html即可</ p >
753+ </ div >
754+
755+ < div class ="post-time-container ">
756+ < span class ="post-time "> 0001-01-01 </ span >
757+ </ div >
758+ </ div >
759+
760+ </ div >
761+ </ div >
762+ </ article >
763+
764+
687765 < hr >
688766< section class ="pagination " >
689767
0 commit comments