JavaScript.
The reason why your device can become infected just by visiting a website is JavaScript. JavaScript is still, primarily, used as a coding language in the browser. When you request a webpage you usually get an HTML file, a CSS file and a JavaScript file. The HTML describes the structure of the page. Think of it as the paragraphs, titles and sentences in an article. The CSS describes the how the page looks. Think of it as the font styles, the page styles etc. And- the JavaScript describes how you can interact with the page, it makes pages dynamic.
An example of JavaScript in Action:
Google suggestions...

JavaScript is often used to show and hide parts of a web page when users interact with it and to request information from the server without having to reload the whole page.
The devil in JavaScript.
The issue is that JavaScript executes without any user interaction. This is considered fine because in most cases, the JavaScript is confined to the browser. This means it should only execute while you are visiting the page from which it was downloaded from. Obviously if you are running an infected page, malicious JavaScript could steal your cookies or form data.
The problem arises when there are browser or software exploits which allow JavaScript files to be downloaded and executed outside of the browser OR if users accept to download malicious code. Hackers accomplish this by using exploit kits which look for vulnerabilities in your computer. If executed outside the browser (which it does by default) in Windows Script Host, JavaScript behaves like any normal programming language. It has access to everything on the device.
What if I disabled JavaScript?
You could! And you can even enable it for trustworthy sites. The issue is that it will definitely make your browsing experience less fun.

What if I simply stopped visiting sites that "seemed dodgy"?
That's a fair strategy and will undoubtedly reduce your risk. However, attackers can sometimes inject JavaScript into a popular webpage in what's known as a XSS (Cross Site Scripting) attack. Perhaps they inject javascript by writing it into the comments section of a blog or it could be much less noticeable e.g. by injecting a hidden html iframe which loads another site.
What should I do to protect myself?
Keeping this simple... You can protect yourself (for the most part) by:
1. Ensuring you have an up-to-date anti virus installed.
2. Ensuring you have an up-to-date Firewall installed.
3. Making sure your browser, OS, Java, Flash etc. plugins are all up-to-date.
4. Be smart. Don't click and open suspicious email files or links. Don't visit dodgy websites.
5. Changing how JavaScript files are opened:
Find a JavaScript file.

or create one in notepad and save with the code:
- Code: Select all
WSH.Echo("Hello World");

Now right click, select open with and then choose another app. Select any text editor like Notepad... and remember to select to ALWAYS use this app to open .js files.

Stay safe!







