Clickjacking, also known as a UI Redress Attack, is when an attacker uses multiple (often transparent) layers so when a user clicks on an area of the web page, they are inadvertently clicking on a button or link on another page.
Using the same technique, keystrokes can also be hijacked, so a user believes they are typing in their password to their email or their bank account, but in reality they are typing into an invisible frame, possibly controlled by the attacker.
For example, imagine an attacker who builds a web site that has a button on it that says "click here for a free iPod". However, on top of that web page, the attacker has loaded an iframe with your mail account, and lined up exactly the "delete all messages" button directly on top of the "free iPod" button. The victim tries to click on the "free iPod" button but instead actually clicked on the invisible "delete all messages" button. In essence, the attacker has "hijacked" the user's click, hence the name "Clickjacking".
One of the most notorious examples of Clickjacking was an attack against the Adobe Flash plugin settings page. By loading this page into an invisible iframe, an attacker could trick a user into altering the security settings of Flash, giving permission for any Flash animation to utilize the computer's microphone and camera.
Defense with FrameBreaker Script
The most popular way to defend against clickjacking is to include a "frame-breaker" script in each page that should not be framed.
<script>if (top!=self) top.location.href=self.location.href</script>
This code ensures the page cannot be embedded into an iframe, and therefore cannot be used as part of a clickjacking attack.
Defense with X-FRAME-OPTIONS Header
Recently, Microsoft introduced a non-standard header that may be simpler to implement in some applications. However, there's an alternative approach that may be simpler to implement. Microsoft has now included a defense in IE8 that allows developers to specify that pages should not be framed. They use a new (nonstandard) X-FRAME-OPTIONS header to mark responses that shouldn't be framed. There are two options with X-FRAME-OPTIONS. The first is DENY, which prevents everyone from framing the content. The other option is SAMEORIGIN, which only allows the current site to frame the content. Currently this works in IE8 RC1+, but will not affect users of other browsers until they decide to implement this feature. Firefox users may want to look at the protection in NoScript.
To implement this protection, you need to add the header to any page that you want to protect from being clickjacked. One way to do this is to add the header manually to every page. A possibly simpler way is to implement a filter that automatically adds the header to every page.
OWASP has an article and some code that provides all the details for implementing this in the Java EE environment.
The SDL blog has posted an article covering how to implement this in a .NET environment.
The original post by Robert Hansen defining this term and introducing the problem is here: http://ha.ckers.org/blog/20081007/clickjacking-details/
Robert Hansen's more detailed post after he was 'allowed' to start talking about it: http://www.sectheory.com/clickjacking.htm
A list of other Clickjacking links: http://www.grc.com/sn/notes-168.htm