An attacker carefully crafts small snippets of Java Script to efficiently
detect the type of browser the potential victim is using. Having this
knowledge allows an attacker to target the victim with attacks that
specifically exploit known or zero day weaknesses in the type and version of
the browser used by the victim.
The following code snippets can be used to detect various
browsers:
//Firefox 2/3
FF=/a/[-1]=='a'
//Firefox 3
FF3=(function x(){})[-5]=='x'
//Firefox 2
FF2=(function x(){})[-6]=='x'
//IE
IE='\v'=='v'
//Safari
Saf=/a/.__proto__=='//'
//Chrome
Chr=/source/.test((/a/.toString+''))
//Opera
Op=/^function \(/.test([].sort)
Attack Prerequisites
Victim's browser visits a website that contains contains attacker's Java
Script
Java Script is not disabled in the victim's browser