Skip to content

Commit 73dda15

Browse files
committed
Improving blog post according to comments by TWB
1 parent 9db350b commit 73dda15

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

_posts/2019-04-23-js-recon-is-no-more.md

+34-35
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ tag:
1111
---
1212

1313
In 2010, Andlabs discovered an attack to fingerprint open TCP ports at client
14-
workstation. Here is a blog post from them which is describing this
15-
vulnerability. JS-Recon was a tool developed by them proving the weakness of
16-
the browser. Unfortunately JS-Recon is not available on mentioned link for
17-
unknown reasons. I tried my best to find the source code of that tool, but I
18-
was ended with no results. Because the source code of the tool is not
19-
available, the only way to confirm the possibility of this attack was to
20-
reconstruct it from steps mentioned by the author.rom steps mentioned by the
21-
author.
14+
workstation. You can read [this blog post][andlabs_blogpost] which is describing
15+
details of this method. JS-Recon was a tool implementing this attack on its
16+
client to prove the danger of this vulnerability. Unfortunately, JS-Recon is not
17+
available on mentioned link for unknown reasons. I tried my best to find the
18+
source code of that tool, but I was ended with no results. Because the source
19+
code of the tool is not available, the only way to confirm the possibility of
20+
this attack was to reconstruct it from steps mentioned at that blog post.
2221

2322
In this post I will share my experience of rebuilding this attack. Because this
2423
attack is from the front-end side, knowledge of basic Javascript API is
@@ -34,12 +33,12 @@ developer console of your browser.
3433
* **XHR**: A short form of [XML Http Request][mdn_xhr].
3534
* **Socket**: A TCP/IP raw socket.
3635

37-
According to the author, If I write a Javascript code to open a XHR to
38-
http://localhost:8084 and host that code at xyz.com then when you visit the
39-
xyz.com the browser will open that XHR to port 8084 of your workstation,
40-
because the localhost for your browser is your workstation. This gap invites
41-
many vulnerabilities for users. One of them is the possibility to fingerprint
42-
open TCP ports at client workstation.
36+
According to that blog post, If I write a Javascript code to open a XHR to
37+
`http://localhost:8084` and host that code at example.com then when you visit
38+
the example.com the browser will open that XHR to port `8084` of your
39+
workstation, because the localhost for your browser is your workstation. This
40+
gap invites many vulnerabilities for users. One of them is the possibility to
41+
fingerprint open TCP ports at client workstation.
4342

4443
The author claims that the browser takes recognizably more time to open a XHR
4544
targeting an occupied port. Comparatively, time took to open a XHR aimed at an
@@ -54,7 +53,7 @@ var requestPort = function(port) {
5453
xhr.onreadystatechange = function() {
5554
if (xhr.readyState === 1) {
5655
var timeTook = Date.now() - startTime;
57-
console.log("Browser took : " + timeTook + " microsecounds to open.");
56+
console.log("Browser took : " + timeTook + " microseconds to open.");
5857
}
5958
};
6059
startTime = Date.now();
@@ -84,17 +83,17 @@ above results, We can conclude that mentioned method is not giving different
8483
results for occupied and empty port. We can conclude that mentioned method by
8584
AndLabs is failing to distinguish an occupied port from a non occupied port.
8685

87-
I tried hard to find any possible cause for the failure of this attack. I
88-
didn't found any certain evidences. May be our hardware or browser code has
89-
improved for opening a TCP sockets quicker than what it used to. I will not
90-
lie, but that abstract blog post by the AndLabs took sometime to understand the
91-
anatomy of this attack. I wasn't happy with going back from this point. Just
92-
for my satisfaction, I tried every possible combinations of `xhr.readyState`
93-
values to find any pattern. From my observation, I recognized that timing for
94-
returning a header from an occupied port was delayed. Comparatively, this
95-
response was quick for ports where no service was running. I am comparing the
96-
time browser took to return a response headers whereas in the previous method
97-
it was dependent on the time browser took for opening a socket.
86+
I tried hard to find any possible cause for the failure of this attack. I didn't
87+
found any conclusive evidences. May be our hardware or browser code has improved
88+
for opening a TCP sockets quicker than what it used to. I will not lie, but that
89+
abstract blog post by the AndLabs took sometime to understand the anatomy of
90+
this attack. I wasn't happy with going back from this point. Just for my
91+
satisfaction, I tried every possible combinations of `xhr.readyState` values to
92+
find any pattern. From my observation, I recognized that timing for returning a
93+
header from an occupied port was delayed. Comparatively, this response was quick
94+
for ports where no service was running. I am comparing the time browser took to
95+
return a response headers whereas in the previous method it was dependent on the
96+
time browser took for opening a socket.
9897

9998
```javascript
10099
var requestPort = function(port) {
@@ -103,7 +102,7 @@ var requestPort = function(port) {
103102
xhr.onreadystatechange = function() {
104103
if (xhr.readyState === 2) {
105104
var timeTook = Date.now() - startTime;
106-
console.log("Browser took : " + timeTook + " microsecounds to send response headers.");
105+
console.log("Browser took : " + timeTook + " microseconds to send response headers.");
107106
}
108107
};
109108
startTime = Date.now();
@@ -125,15 +124,15 @@ go beyond 200 microseconds. Comparing this with a header response time of
125124
occupied ports, we can see that response time of non-empty port is recognizably
126125
higher than empty port.
127126

128-
Browser is the most common tool used by us. Asserting this venerability requires
129-
knowledge of Javascript and everyone is not a developer. As I mentioned earlier,
130-
I failed to find the source code of JS-Recon (the tool written by AndLabs
131-
proving possibility of this attack). For those reasons, I decided to write a
132-
tool pioneered on my improvements on an attempt of Andlabs. Today, I have
133-
successfully completed that tool. I have decided to name it
127+
Browser is the most common tool used by us. Asserting this vulnerability
128+
requires knowledge of Javascript and everyone is not a developer. As I mentioned
129+
earlier, I failed to find the source code of JS-Recon (the tool written by
130+
AndLabs proving possibility of this attack). For those reasons, I decided to
131+
write a tool pioneered on my improvements on an attempt of Andlabs. Today, I
132+
have successfully completed that tool. I have decided to name it
134133
["Chatur"][chatur_pronounciation]. Chatur means intelligent person in Hindi.
135-
Please find the source code of Chatur [here][chatur_github]. Chatur is a free
136-
software. Try this tool and share your thoughts with me. This is not a
134+
Please find the source code of Chatur [on Github][chatur_github]. Chatur is a
135+
free software. Try this tool and share your thoughts with me. This is not a
137136
bulletproofed idea, but it works most of the time you will try.
138137

139138
[andlabs_blogpost]: http://blog.andlabs.org/2010/12/port-scanning-with-html5-and-js-recon.html

0 commit comments

Comments
 (0)