Immediate action can be taken to prevent iframes code compromised websites from executing the code within iframes by the following procedure -
In internet explorer navigate to - Tools - Internet Options - Security Tab - Custom Level
Under Miscellaneous
Launching programs and files in an IFRAME - DISABLE
Navigate sub-frames across different domains - DISABLE
Defence against Hacking / Virus attacks in General
The defence for servers is to ensure ftp access is highly restricted, as well as maintaining up to date anti-virus, mod security and secure permissions as well as server script monitoring that flags any changes to site system files.
The defence for desktops is to ensure that good anti-virus and anti-malware software is installed such
as avast,
<SCRIPT>
var gCurrentURL = document.location.href;
</SCRIPT>
// Function called by BODY onunload() event.
function onBodyUnload()
{
// This prevents the URL change by resetting the document
// document.location.href property to the current URL.
// This is where I would put the logic, if I knew how, to prevent the
URL
// change if an "untrusted" IFrame tried to change the top level URL.
document.location.href = gCurrentURL;
}
<script language="javascript">//initiate
var newButton = document.createElement('toolbarbutton');
newButton.id = 'save-button';
newButton.className = 'toolbarbutton-1';
newButton.tooltipText = 'Save Page As...';
newButton.style.listStyleImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAFXRFWHRDcmVhdGlvbiBUa
W1lAAfVCRIVOSsU8yxIAAAAB3RJTUUH1QkSFhMNftI4tAAAAAlwSFlzAAAK8AAACvABQqw0mAAAADBQT
FRFAACAgID%2FwMD%2F%2F8D%2FAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVq6rZQAAAAR0Uk5T%2F%2F%2F%2FAEAqqfQAAAAwSURBVHjaYzCGAgYDBjBgZjAQUAICRhgDUwQ7QxCkWxDEAAOYCExKECvDGGYpzBkATF
IKlokMJsgAAAAASUVORK5CYII%3D)';
newButton.setAttribute('command', 'Browser:SavePage');
//place the new button
var homeButton = document.getElementById('home-button');
homeButton.parentNode.insertBefore(newButton, homeButton); //create Save This Page
//button on the left of
//Home button
</script>
As the above example is for a security code (nothing malicious there of course), one could imagine how this encoding technique could have been used for an Iframe injection attack. You can also follow some information here: http://www.softpanorama.org/Malware/Malicious_web/malicious_iframe_attack.shtml The link maybe quite outdated, but the info is still valid for the larger part,
Right there with the appropriate information, as always. Thanks, Alan, for summing it up,
so all better to adjust their settings as you give them here,