Python developers warned to watch for rogue ‘torchtriton’ package

2023-01-05
关注

Python developers are being warned to check they haven’t installed a malicious package and if they have to take action immediately to remove it. Known as “torchtriton”, it is delivered through the Python Package Index (PyPi) and shares a name with a genuine package operated by the PyTorch Foundation.

PyPi vulnerability: Developers warned about rogue package
When installing via PIP packages logged with the Python Package Index take precedence over other indices. (Photo by Trismegist san/Shutterstock)

It is likely a small group of users unintentionally installed the malicious code due to a quirk in the way Python packages are handled and distributed, with those accustomed to installing the latest preview builds of libraries most at risk.

The malicious version of the package was able to send system data from a computer to a recent domain, including nameservers, hostname, current username, current working directly and environment variables. It was also able to read hosts, passwords, the first 1,000 files in home and configuration details.

It was then able to upload all of the information, including the contents of files, through an encrypted DNS query to a specific host server. In a statement to Bleeping Computer, the person behind the malicious package claimed it was “not intended to be malicious” and instead used for research. The developer claims to have reported the bug to Meta, which created the PyTorch framework, on December 29, as well as to other companies affected by the vulnerability. They say they offered to hand over control of the package but have not had any replies.

Companies Intelligence

View All

Reports

View All

Data Insights

View All

“I understand that I could have done a better job to not send all of the user’s data,” the hacker wrote in an email, explaining that previously when investigating these types of issues it wasn’t possible to identify the victims by their hostname, username and CWD so had it sent more data this time. “Looking back this was wrong decision and I should have been more careful.”

The hacker says they are behind the h4ck.cfd website where the data is being uploaded. A message on the site reads: “If you stumbled on this in your logs, then this is likely because your Python was misconfigured and was vulnerable to a dependency confusion attack.”

The “research” note goes on to say that the hacker will delete all of the metadata about the compromised servers once companies and individuals have been identified and they have been able to report the findings. It isn’t clear if this actually happened.

PyPi vulnerability: dummy package logged

Open-source machine learning framework PyTorch, developed by Meta and now part of the Linux Foundation, produces a dependency called “torchtriton”, a language and compiler for custom deep learning operations, that it hosts on its own PyTorch nightly package Index.

Content from our partners

How to develop a constant set of readiness for the next cyberattack

How to develop a constant set of readiness for the next cyberattack

How adopting B2B2C models is enabling manufacturers to get ever closer to their consumers

How adopting B2B2C models is enabling manufacturers to get ever closer to their consumers

Technology and innovation can drive post-pandemic recovery for logistics sector

Technology and innovation can drive post-pandemic recovery for logistics sector

Installing it via that particular library is safe, but over the Christmas break a package with the same name, containing malicious code, was uploaded to the Python Package Index (PyPi) and that is where the issues come from as many developers install libraries using the “pip” command, which defaults to PyPi hosted files.

View all newsletters Sign up to our newsletters Data, insights and analysis delivered to you By The Tech Monitor team

The issue was quickly spotted by the PyTorch Foundation which has since renamed its own dependency to “pytorch-torchtriton”, registered it as a dummy package on PyPi to prevent similar attacks and asked PyPi to hand ownership of “torchtriton” to it and delete the malicious version.

Developers should run a pip3 uninstall comment on “torch torchvision torchaudio torchtriton” then purge the cache, switch to PyTorch stable and then reinstall torchtriton. PyTorch says it has also removed all nightly packages that depend on torchtriton, not just torchtriton itself, until they can be verified.

Tzachi Zorn, Head of SCS at Checkmarx wrote in a Medium blog that PyTorch had effectively been “poisoned with a malicious dependency” that lasted about five days. It specifically targeted developers using Linux systems and contained an executable written in C++.

This form of “dependency confusion technique” was first revealed in 2021 and has been used multiple times in different package registries including PyPi and NPM, explained Zorn.

“Despite any messages or disclaimers that may have been included, it is clear that the package in question is malicious,” he said. “This is not acceptable behaviour for a security researcher and simply claiming to be a security researcher does not give someone permission to engage in malicious activity.”

Read more: AI coding assistants leave developers “deluded” about the quality of their software

Topics in this article : Python

参考译文
Python开发人员警告要注意流氓“torchtriton”软件包
Python开发人员被警告检查他们是否安装了恶意软件包,如果他们必须立即采取行动删除它。它被称为“torchtriton”,通过Python包索引(PyPi)交付,并与PyTorch基金会运营的真正包共享名称。由于Python包的处理和分发方式的异常,可能有一小群用户无意中安装了恶意代码,而那些习惯安装最新预览版库的用户面临的风险最大。恶意版本的软件包能够将系统数据从计算机发送到最近的域,包括名称服务器、主机名、当前用户名、当前工作直接和环境变量。它还能读取主机、密码、家里的前1000个文件和配置细节。然后,它能够通过加密的DNS查询将所有信息(包括文件内容)上传到特定的主机服务器。在给“哔哔电脑”的一份声明中,恶意软件包背后的人声称它“不是恶意的”,而是用于研究。该开发人员声称已于12月29日向创建PyTorch框架的Meta以及其他受该漏洞影响的公司报告了该漏洞。他们表示,他们曾提出交出包裹的控制权,但尚未得到任何答复。这名黑客在一封电子邮件中写道:“我知道我本可以做得更好,不发送所有用户的数据。”他解释说,以前在调查这类问题时,无法通过主机名、用户名和CWD识别受害者,所以这次发送了更多数据。“现在回想起来,这是一个错误的决定,我应该更谨慎一些。”黑客说他们是h4ck的幕后黑手。数据上传的CFD网站。该网站上的一条消息写道:“如果你在日志中无意中发现了这个问题,那么这可能是因为你的Python配置错误,容易受到依赖项混淆攻击。”这份“研究”报告接着说,一旦公司和个人被识别出来,并能够报告调查结果,黑客就会删除有关受损服务器的所有元数据。目前还不清楚这是否真的发生了。开源机器学习框架PyTorch由Meta开发,现在是Linux基金会的一部分,它产生了一个名为“torchtriton”的依赖项,这是一种用于自定义深度学习操作的语言和编译器,它托管在自己的PyTorch夜间包索引上。通过特定的库安装它是安全的,但在圣诞假期期间,一个包含恶意代码的同名包被上传到Python包索引(PyPi),这就是问题的来源,因为许多开发人员使用“pip”命令安装库,该命令默认为PyPi托管文件。PyTorch基金会很快发现了这个问题,并将自己的依赖项重命名为“PyTorch -torchtriton”,将其注册为PyPi上的虚拟包,以防止类似的攻击,并要求PyPi将“torchtriton”的所有权移交给它,并删除恶意版本。开发者应该在“torch torchvision torchaudio torchtriton”上运行pip3卸载注释,然后清除缓存,切换到PyTorch stable,然后重新安装torchtriton。PyTorch表示,他们已经删除了所有依赖于torchtriton的夜间包,而不仅仅是torchtriton本身,直到它们可以被验证为止。Checkmarx的SCS主管Tzachi Zorn在Medium博客中写道,PyTorch实际上已经“被恶意依赖中毒”,持续了大约五天。它专门针对使用Linux系统的开发人员,并包含用c++编写的可执行文件。Zorn解释说,这种形式的“依赖混淆技术”于2021年首次被发现,并在不同的包注册中心(包括PyPi和NPM)中多次使用。 他说:“尽管可能包含了任何信息或免责声明,但很明显,有问题的软件包是恶意的。”“对于一名安全研究人员来说,这是不可接受的行为,仅仅声称自己是一名安全研究人员并不能允许某人从事恶意活动。”
  • en
您觉得本篇内容如何
评分

相关产品

EN 650 & EN 650.3 观察窗

EN 650.3 version is for use with fluids containing alcohol.

Acromag 966EN 温度信号调节器

这些模块为多达6个输入通道提供了一个独立的以太网接口。多量程输入接收来自各种传感器和设备的信号。高分辨率,低噪音,A/D转换器提供高精度和可靠性。三路隔离进一步提高了系统性能。,两种以太网协议可用。选择Ethernet Modbus TCP\/IP或Ethernet\/IP。,i2o功能仅在6通道以太网Modbus TCP\/IP模块上可用。,功能

雷克兰 EN15F 其他

品牌;雷克兰 型号; EN15F 功能;防化学 名称;防化手套

Honeywell USA CSLA2EN 电流传感器

CSLA系列感应模拟电流传感器集成了SS490系列线性霍尔效应传感器集成电路。该传感元件组装在印刷电路板安装外壳中。这种住房有四种配置。正常安装是用0.375英寸4-40螺钉和方螺母(没有提供)插入外壳或6-20自攻螺钉。所述传感器、磁通收集器和壳体的组合包括所述支架组件。这些传感器是比例测量的。

TMP Pro Distribution C012EN RF 音频麦克风

C012E射频从上到下由实心黄铜制成,非常适合于要求音质的极端环境,具有非常坚固的外壳。内置的幻像电源模块具有完全的射频保护,以防止在800 Mhz-1.2 Ghz频段工作的GSM设备的干扰。极性模式:心形频率响应:50赫兹-18千赫灵敏度:-47dB+\/-3dB@1千赫

ValueTronics DLRO200-EN 毫欧表

"The DLRO200-EN ducter ohmmeter is a dlro from Megger."

评论

您需要登录才可以回复|注册

提交评论

广告
提取码
复制提取码
点击跳转至百度网盘