Attacking Python's pickle

前端 未结 3 936
礼貌的吻别
礼貌的吻别 2020-12-15 16:49

I\'m writing a web app that stores user input in an object. This object will be pickled.

Is it possible for a user to craft malicious input that could do something e

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 17:15

    I found this in the documentation of multiprocessing module which I think answers the question:

    Warning

    The Connection.recv() method automatically unpickles the data it receives, which can be a security risk unless you can trust the process which sent the message.

    Therefore, unless the connection object was produced using Pipe() you should only use the recv() and send() methods after performing some sort of authentication. See Authentication keys.

    (emphasis mine)

    Conclusion is that if the connection object is produced using a trusted Pipe, i.e. a trusted pickle, then it can be safely unpickled.

提交回复
热议问题