针对 CVE-2019-14751 的概念验证(PoC)
NLTK Downloader 3.5 之前的版本存在目录遍历漏洞,攻击者可通过 NLTK 包(ZIP 存档)中的 ../(点点斜杠)写入任意文件,该问题发生在解压过程中未正确处理此类路径。
更多信息请参阅:https://salvatoresecurity.com/zip-slip-in-nltk-cve-2019-14751/
将 index.xml 和 zip-slip.zip 放置到可通过 Web 服务器提供服务的目录中,调整权限以允许文件被正常访问。
运行 NLTK Downloader
$> python3
>>> import nltk
>>> nltk.download()
将“服务器索引”(Server Index)字段的值改为指向步骤 1 中的 index.xml
点击“下载”(Download)以安装恶意包
检查 /tmp/evil.txt 是否存在。
$> cat /tmp/evil.txt
This is an evil file
$>
该漏洞已在 NLTK 3.4.5 及更高版本中修复。以下提交解决了该漏洞: https://github.com/nltk/nltk/commit/f59d7ed8df2e0e957f7f247fe218032abdbe9a10