Iframes and Sandboxed Iframes
Iframes and Sandboxed Iframes
Iframes and Sandboxed Iframes
Clickjacking
If you do not own the source URL you
cannot control the content of the iframe
Webpage redirection
What if the iframe used location.href
and sent the user to another site?
malware
Clickjacking
Display malicious content
Webpage redirection
malware
interference
IFRAMES
Example17-iframes-embedded.php
IFRAMES
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframes - embedded</title>
</head>
<body>
<iframe src = "http://nytimes.com" height="400px" width="600px"
scrolling="yes" frameborder="0">
</iframe>
<iframe src = "Example17-iframes-annoying.php" height="400px" width="600px"
scrolling="yes" frameborder="0">
</iframe>
</body>
</html>
sandbox="" >
</iframe>
No Javascript execution
sandbox="" >
</iframe>
Unique origin
This means that all same-origin
checks will fail for that frame,
unique origins match no other origin
No access to cookies, DBs of any origin
No Javascript execution IFRAMES restrictions
Unique origin <iframe
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;”
sandbox="" >
</iframe>
sandbox="" >
</iframe>
No forms or plugins
You cannot submit forms on the iframe
nor include any new plugins
No Javascript execution IFRAMES restrictions
Unique origin <iframe
src="https://platform.twitter.com/widgets/tweet_button.html"
sandbox="" >
No forms or plugins
</iframe>
No parent navigation
sandbox="" >
No forms or plugins
</iframe>
No parent navigation
No auto-triggered features
sandbox="" >
</iframe>
No Javascript execution
Unique origin
No new windows or dialogs
No forms or plugins
No parent navigation
No auto-triggered features
<iframe
IFRAMES
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;”
sandbox="" >
</iframe>
No Javascript execution
Unique origin
Pretty draconian
No new windows set of
or dialogs
restrictions
No forms or plugins
No parent navigation
No auto-triggered features
<iframe
IFRAMES
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;”
sandbox="" >
</iframe>
No Javascript execution
Unique origin
These might be fine for embedding
No new windows or dialogs
static pages but we have to loosen
No forms or plugins
these when we work with dynamic
No parent navigation
content
No auto-triggered features
<iframe
IFRAMES
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;”
sandbox="" >
</iframe>
No Javascript execution
Unique origin
No new windows or dialogs
No forms or plugins
No parent navigation
No auto-triggered features
IFRAMES
Example18-iframes-sandbox.php
IFRAMES
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframes - sandbox</title>
</head>
<body>
<iframe src="http://nytimes.com" height="400px" width="600px"
scrolling="yes" frameborder="0">
</iframe>
<br>
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;">
</iframe>
</body>
</html>
IFRAMES
<!DOCTYPE html>
using an iframe
</head>
<body>
<iframe src="http://nytimes.com" height="400px" width="600px"
scrolling="yes" frameborder="0">
</iframe>
<br>
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;">
</iframe>
</body>
</html>
It requires a bunch of
permissions to work
IFRAMES
IFRAMES
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframes - sandbox</title>
</head>
<body>
<iframe src="http://nytimes.com" height="400px" width="600px"
scrolling="yes" frameborder="0">
</iframe>
<br>
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;">
</iframe>
</body>
</html>
IFRAMES
<iframe src="http://nytimes.com" height="400px" width="600px"
scrolling="yes" frameborder="0">
</iframe>
<br>
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="https://platform.twitter.com/widgets/tweet_button.html"
style="border: 0; width:80px; height:20px;">
</iframe>
</body>
</html>
IFRAMES
" frameborder="0">
Allows window.open(),
showModalDialog(),
target=“_blank” etc