How viruses get through browser to pc as JavaScript do not have much privileges?

I would like to know how browser allow viruses to pass through to our computers. Response we receive is a text response.. Only executable thing in the response is JavaScript which does not have much privileges, what makes browser favor certain files to be passed to computer?

13.10.2009 18:39:40

The short list:

  1. Browser plugins. ActiveX* in general and Flash in particular are notorious for having holes.
  2. Buffer overflows. Forming either HTML pages or Javascript in a specific way can lead to being able to write anything you want into memory... which can then lead to remote execution.
  3. Other errors. I recall bugs in the past where the browser could be tricked into downloading files into a known location, then execute them.

*Google is working on expanding this particular kind of hole to other browsers with Native Client.

13.10.2009 18:52:26
If you can craft some HTML in such a way as to confuse the HTML parser, it could work. Even JPGs in web pages had this vulnerability a few years ago because the Windows GDI library had it.
Kev 13.10.2009 20:09:48
I'd completely forgotten about the GDI bug. As I recall, that one hit all the major browsers on Windows.
Powerlord 13.10.2009 21:16:00

Things like ActiveX controls allow native code to be executed on local machines with essentially full privileges. Most viruses propagate through known security holes in unpatched browsers and don't use Javascript directly.

13.10.2009 18:45:26

Browser bugs and misconfiguration can allow sites that should be in the "Internet" (secure) security zone execute code as if they were trusted. They can then use ActiveX components to install malware.

13.10.2009 18:46:57

Exploiting software bugs. Commonly, when rendering images, interpreting html/css/javascript, loading ActiveX components or Flash files.

Once a bug is exploited, the procedure is to inject "shell code" (a chunk of native compiled code), into the process memory to get executed.

13.10.2009 19:16:18