Dill显然是一个非常有用的模块,而且只要你小心管理文件,它似乎是相对安全的。但我被以下声明推迟了:
Thus dill is not intended to be secure against erroneously or maliciously constructed data. It is left to the user to decide whether the data they unpickle is from a trustworthy source.
我读入了https://pypi.python.org/pypi/dill .由用户决定如何管理他们的文件。
如果我没理解错的话,一旦它被莳萝 pickle 过,你就很容易发现原始脚本会做什么,而不需要一些特殊的技巧。
我的问题是:虽然我没有看到警告,pickle 是否也存在类似情况?
请您参考如下方法:
Dill 建立在 pickle 之上,警告同样适用于 pickle 和 dill。
Pickle 使用堆栈语言 有效地执行任意 Python 代码。例如,攻击者可以潜入指令以打开到您机器的反向端口。永远不要使用来自不受信任来源的 pickle 数据。
documentation包括一个明确的警告:
Warning: The
picklemodule is not secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
