NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home / News / Webmaster / Tips and Tricks

Tips and Tricks


An Unwanted Trip To A Porn Website ?

Demonstration of Websites Visitors Redirection with External Javascripts

By Catalin Bocanu, Web News Editor

21st of January 2008, 17:01 GMT

Adjust text size:


Security Tab - Internet Explorer Options
Enlarge picture
There are situations when you call a certain web address in your web browser, but instead you could be redirected to a website having porn content or other type of content. This was the unfortunate
case of perl.com website, which was redirected for a short period of time to a porn website, due to the presence of a remotely-included Javascript in their webpages HTML code.

O'Reilly Radar stated: "One of our advertisers was using an ads system that required our pages to load Javascript from their site. It only took three things to turn perl.com into porn.com: (1) the advertiser's domain lapsed, (2) the porn company bought it, (3) they replaced the Javascript that we were loading with a small chunk that redirected to the porn site (note that nothing on or about perl.com changed)." They initially thought that the perl.com website was hacked, because the respective Javascript does not indicate website security leak, due to the known provenance. Their unpleasant experience should always remember us about the insecurities induced by the external Javascripts, widgets or any other type of included code that will be executed on client side.

It is very simple to demonstrate how can a website address, domain or subdomain name be redirected to another one through an external Javascript. Lets consider the next two codes listings, which must be saved as redirection.js:

CODE
window.location="http://webscripts.softpedia.com"
alert ("You will be redirected to SOFTPEDIA WEBSCRIPTS SECTION")

respectively index.html:

CODE

Javascript Redirection Example



This is an example of redirection Javascript.


The fourth line from the index.html file (in the second code listing) will load the external Javascript called redirection.js determining the index.html page visitor to be redirected to the web address http://webscripts.softpedia.com. The redirection.js Javascript can be included anywhere in the HTML code. In the presented case, it is assumed that the redirection.js is in the same folder with index.html.

Now we will demonstrate the loading of the redirection.js Javascript from a certain web address. If this Javascript is situated on a webserver, at the address http://domainname.com/redirection.js, then the fourth line in the index.html file will become

CODE

This is only a simple example of Javascript redirection. It is useful when you define your own Javascript redirection codes. But in case of external Javascript from third party websites, you could always have unpleasant surprises if an ad or widget code is changed. Beside domain redirection with Javascript, other malicious actions could be conducted as long as the respective client side code can be executed through your web pages calls. In conclusion, you must always trust the source code provided by your advertisers and eventually look at the content and code structure in order to determine its actions, especially in case of client side code when known security leaks may exist.

TAGS:

Javascript Security | Javascript Redirection | Redirection Tips | Redirection Code | Domain Redirection
Read by 3,172 user(s) | Add comment | Link to this article TWEET THIS


Article rating:
Good (3.4/5) 7 vote(s)    

Subscribe to news | Print article | Send to friend

© Copyright 2001-2009 Softpedia
Contact:

 

 

SEARCH THE NEWS ARCHIVE :




Today's News
| Yesterday's News | News Archive


MORE RELATED ARTICLES:


The Basic Structure of a HTML Template

Client-Side Programming

HTML Purifier

Web Site Development with WYSIWYG HTML Editors

Easy Building of Web Applications with HTML/OS

Trip into the Future of HTML

Windows Media Player in HTML

Google Page Creator

A Simple Javascript Example

Free Translation of Web Pages

User opinions:

No user comments yet.
Be the first to express your opinion using the form below!

Share your opinion:

Your Name:
Your Email Address:
(will not be used for commercial purposes)
Solve this to prove you're not a bot: =
Your review/opinion:

 




Windows tabGames tabDrivers tabMac tabLinux tabScripts tabMobile tabHandheld tabGadgets tabNews tab

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM