Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen websites placing HTTPS iframes on HTTP pages.

Are there any security concerns with this? Is it secure to transmit private information like credit card details in such a scheme (where the information is only placed on the HTTPS iframe form, and not on the HTTP parent page)?

share|improve this question
up vote 40 down vote accepted

If only the iframe is https, the user cannot trivially see the URL it points to. Therefore, the source http page could be altered to point the iframe anywhere it wanted to. That's pretty much a game-over vulnerability that eliminates the advantages of https.

share|improve this answer
+1 for pointing out the importance of server authentication, which is often forgotten as a benefit of SSL. – AviD Nov 30 '10 at 19:14
I recognize this is an old question, but was hoping someone might explain how having HTTPS in the origin page resolves an issue of a rogue script changing the location of the iframe? If the origin page is HTTPS, you could still have a rogue script changing the iframe destination, no? – Matt James May 2 at 18:08
@MattJames, if the origin page is also HTTPS, then it cannot be changed in transit unless the MitM has a valid certificate for the domain (which shouldn't happen unless the CAs aren't doing their jobs). They can however still intercept the original HTTP -> HTTPS load and redirect it to a domain under their control. Users would be able to detect this by looking at the URL and the certificate, both of which are shown only for the topmost frame. Having said that, most users probably wouldn't actually notice, which is one reason why accounts do get compromised sometimes. – Miral Jul 23 at 6:14
The assumption of course is that the attacker is sitting in the network. If they can modify the source page on the server to include rogue code, then all bets are off. Similarly if they can get a script that can alter page content installed into the user's browser, then they're similarly vulnerable. (So people using Greasemonkey/Tampermonkey/etc need to beware, though again many don't.) – Miral Jul 23 at 6:20

iFrames will expose the inner HTTPS site to numerous javascript and cookie attacks in older browsers, and may cause issues in newer browsers.

To fix this, look up "Frame Busting" to detect if iFrames are being used. Consider this solution on StackOverflow:

In that code, you can detect if iFrames are being used, and offer alternative content to direct the user to the proper site.

share|improve this answer

A HTTPS iframe within a page served over HTTP will not allow the user to be sure they are actually using the HTTPS connection that they expect to be; therefore, this potentially allows the iframe to be hijacked in a simple attack such as an iframe injection. This would allow password harvesting, among other things. Such an attack could begin through a Trojan, a virus, or simply visiting a malicious website.

share|improve this answer

Yes, while most recent browsers will properly sandbox the SSL parts, you are undermining all the functionality added to browser chrome to provide user feedback regarding the contents. I for one would not provide any sensitive information without checking the URL showing in my browser.

share|improve this answer

In addition to the possible hijacking scenarios already given, you may run into issues on IE6/7 if you point to either an HTTP or HTTPS page requiring login. Basically, the cookies from the iframe's page are expecting you to be using the same protocol (HTTP or HTTPS) and so if the page you're putting the iframe on is using HTTP instead of HTTPS, it would prevent the user from being able to log in.

share|improve this answer
this answer seems jumbled. I'm not sure what you are trying to say, or what problem you are alluding to. – D.W. Jun 4 '11 at 5:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.