-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
371 lines (334 loc) · 12.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Spline+Sans+Mono:wght@400;700&display=swap" rel="stylesheet">
<title>Document</title>
<style>
body {
margin: 16px;
display: flex;
align-items: center;
justify-content: center;
}
#content {
max-width: 90%;
width: 1000px;
}
th,td {
border: 2px solid black;
min-width: 250px;
padding: 4px;
border-right: none;
border-top: none;
}
tr:last-child td {
border-bottom: none;
}
tr td:first-child,th:first-child {
border-left: none
}
th {
background-color: black;
color: white;
}
button {
background-color: white;
color: black;
border: 3px solid black;
border-radius: 6px;
font-weight: bold;
padding: 4px 8px;
font-size: 16px;
margin: 16px 8px;
display: block;
}
p {
display: block;
margin: 16px 0px;
}
button:hover {
cursor: pointer
}
button:active {
transform: translate(0px, 1px)
}
table {
box-sizing: border-box;
overflow: hidden;
border: 2px solid black;
border-radius: 10px;
}
#table-placeholder {
background-color: #ddd;
text-align: center;
padding: 16px 0px;
color: #333;
font-weight: bold;
}
* {
font-family: "Spline Sans Mono", monospace;
}
.check-inprogress {
color: #333;
font-style: italic;
}
.attribution {
margin-top: -8px;
margin-bottom: 24px;
}
</style>
</head>
<body>
<div id="content">
<h1>
TCP Sidechannel Fingerprinting
</h1>
<p class="attribution">
by <a href="https://patrickbeart.com">Patrick Beart</a>
</p>
<p>
This page makes HTTP requests to a number of local addresses and local network addresses at various
ports, exploiting the fact that although the
<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin">Access-Control-Allow-Origin</a>
header can restrict code from another origin from receiving an HTTP
<strong>response</strong>, whether the requests complete can still be
determined from how long it takes.
</p>
<p>
Since a request completing before timing out only requires that the request ended
before the timeout, either because the remote
port sent <strong>something</strong> before the timeout (or more precisely,
sent something invalid <strong>or</strong> a whole valid response), or the request
immediately failed (e.g.)
</p>
<p>
As long as the remote TCP
port responds to invalid data (in this case an HTTP request) with some data
(again, more precisely, data that doesn't happen to be some of but not all
of a valid HTTP response), listening TCP ports can be detected by measuring how long the request
takes to complete.
</p>
<button id="testbutton" onclick="buttonclick();">Run Tests</button>
<div id="display"></div>
<p><strong>
If 'LocalHostBlocked' is indicated, that means that localhost is not accessible, and therefore any positive detection outcomes are false positives.
</strong>
</p>
<table cellspacing="0" id="table">
<tr>
<th>
Service
</th>
<th>
Indicates
</th>
<th>
Detected?
</th>
<tr>
<td colspan="3" id="table-placeholder">
No tests have been run yet
</td>
</tr>
</tr>
</table>
</div>
<script>
let service_defs = {
ReservedPort: {
Indicates: "LocalHostBlocked",
RequiredPorts: [1024],
Time: 500
},
DiscordRPCWS: {
Indicates: "Discord",
RequiredPorts: [6463],
Time: 500
},
MinecraftRCON: {
Indicates: "MinecraftServer",
RequiredPorts: [25565],
Time: 500
},
SpotifyConnect: {
Indicates: "Spotify",
RequiredPorts: [57621],
Time: 500,
},
AsusLinkNear: {
Indicates: "Asus",
RequiredPorts: [49670, 49671],
Time: 10000
},
PresonusHardwareAccel: {
Indicates: "PresonusUniversalControl",
RequiredPorts: [49669],
Time: 4000,
},
RekordboxOauth: {
Indicates: "Rekordbox6",
RequiredPorts: [55000],
Time: 1000,
},
RekordboxAgent: {
Indicates: "Rekordbox6",
RequiredPorts: [30001],
Time: 1100,
},
VMWareAuthd: {
Indicates: "VMWareWorkstation",
RequiredPorts: [912, 902],
Time: 1600,
},
Port80: {
Indicates: "LocalWebServer",
RequiredPorts: [80],
Time: 500,
},
NowTVSelfHeal: {
Indicates: "NowTVRouter",
URL: "http://192.168.0.12/Now_TV_self_heal-checking.html",
Time: 200,
},
Router: {
Indicates: "NetworkResidential",
RequiredPorts: [80],
Host: "192.168.0.1",
},
Router2: {
Indicates: "NetworkResidential",
RequiredPorts: [80],
Host: "192.168.1.1",
},
Router3: {
Indicates: "NetworkResidential",
RequiredPorts: [80],
Host: "192.168.0.2",
}
}
let completed_requests = {
};
function do_prod(service_description) {
let ports = service_description.RequiredPorts;
if (typeof ports == "undefined") {
ports = [-1];
};
let service_key = service_description.ServiceKey;
let repeat_count = 10;
completed_requests[service_key] = {
ServiceKey: service_key,
MadeRequests: [],
}
ports.forEach((portno) =>
{
for (let i = 0; i<repeat_count; i++) {
const xhr = new XMLHttpRequest();
let host = "localhost";
if (typeof service_description.Host != "undefined") {
host = service_description.Host;
};
let url = `http://${host}:${portno}`;
if (typeof service_description.URL != "undefined") {
url = service_description.URL;
};
xhr.open("GET", url, true);
console.log(url);
let timeout = Object.is(service_description["Time"], null) ? 1000 : service_description["Time"] * 1.5;
console.log(timeout);
xhr.timeout = timeout;
let request = {
StartTime: null,
EndTime: null,
Duration: null,
Port: portno,
Timeout: null,
Complete: false
}
completed_requests[service_key].MadeRequests.push(request);
xhr.onload = (e) => {
request.EndTime = performance.now();
request.Duration = request.EndTime - request.StartTime;
request.Timeout = false;
request.Complete = true;
}
xhr.ontimeout = (e) => {
request.Timeout = true;
request.Complete = true;
}
xhr.onerror = (e) => {
request.EndTime = performance.now();
request.Duration = request.EndTime - request.StartTime;
request.Timeout = false;
request.Complete = true;
}
request.StartTime= performance.now();
xhr.send(null);
}
});
}
function buttonclick() {
for (const [key, value] of Object.entries(service_defs)) {
sd = value;
sd.ServiceKey = key;
do_prod(sd);
}
}
function checkServicePresent(completed_request) {
let def = service_defs[completed_request.ServiceKey];
let incomplete = (completed_request.MadeRequests.some((req) => {return req.Complete == false}));
if (incomplete) {
return '<span class="check-inprogress">checking...</span>';
} else {
if (completed_request.MadeRequests.some((req) => {return req.Timeout == false})) {
return "✅ <strong>Yes</strong>"
} else {
return "❌ No"
}
}
}
window.setInterval(() => {
let table = document.getElementById("table");
let placeholder_display;
if (Object.entries(completed_requests).length == 0) {
placeholder_display = "default";
} else {
placeholder_display = "none";
}
document.getElementById("table-placeholder").style.display = placeholder_display;
for (const [key, req] of Object.entries(completed_requests)) { /*completed_requests)) {*/
completed_requests
let existing_row = table.querySelector(`[data-servicekey="${key}"]`);
if (existing_row) {
let service = existing_row.getElementsByClassName("datarow-service").item(0);
service.innerText = key;
let indicates = existing_row.getElementsByClassName("datarow-indicates").item(0);
indicates.innerText = service_defs[key].Indicates;
let detected = existing_row.getElementsByClassName("datarow-detected").item(0);
detected.innerHTML = checkServicePresent(req);
} else {
let service = document.createElement("td");
service.className = "datarow-service";
service.innerText = key;
let indicates = document.createElement("td");
indicates.className = "datarow-indicates";
indicates.innerText = service_defs[key].Indicates;
let detected = document.createElement("td");
detected.className = "datarow-detected";
detected.innerHTML = checkServicePresent(req);
let row = document.createElement("tr");
row.setAttribute("data-servicekey", key);
row.appendChild(service);
row.appendChild(indicates);
row.appendChild(detected);
table.appendChild(row);
}
};
}, 500)
</script>
</body>
</html>