Conteúdo misto

Quando um utilizador visita uma página servida sobre HTTPS, a sua ligação com o servidor da Web é encriptada com TLS e é, portanto, salvaguardada da maioria dos sniffers e ataques man-in-the-middle. Uma página HTTPS que inclui conteúdo obtido utilizando texto simples HTTP é chamada de de página de conteúdo misto. As páginas como esta são apenas parcialmente encriptadas, deixando o conteúdo não encriptado acessível aos sniffers e atacantes man-in-the-middle. Isso deixa as páginas inseguras.

Tipos de conteúdo misto

There are two categories for mixed content: mixed passive/display content and mixed active content. The difference lies in the threat level of the worst case scenario if content is rewritten as part of a man-in-the-middle attack. In the case of passive content, the threat is lower (the page may contain misleading content, or the user's cookies may be stolen). In the case of active content, the threat can lead to phishing, sensitive data disclosure, redirection to malicious sites, etc.

Conteúdo misto passivo/de exibição

Mixed passive/display content is content served over HTTP that is included in an HTTPS webpage, but that cannot alter other portions of the webpage. For example, an attacker could replace an image served over HTTP with an inappropriate image or message to the user. The attacker could also infer information about the user's activities by watching which images are served to the user; often images are only served on a specific page within a website. If the attacker observes HTTP requests to certain images, they could determine which webpage the user is visiting.

Lista de conteúdo passivo

This section lists all types of HTTP requests which are considered passive content:

Conteúdo ativo misto

Mixed active content is content that has access to all or parts of the Document Object Model of the HTTPS page. This type of mixed content can alter the behavior of the HTTPS page and potentially steal sensitive data from the user. Hence, in addition to the risks described for mixed display content above, mixed active content is vulnerable to a few other attack vectors.

In the mixed active content case, a man-in-the-middle attacker can intercept the request for the HTTP content. The attacker can also rewrite the response to include malicious JavaScript code. Malicious active content can steal the user's credentials, acquire sensitive data about the user, or attempt to install malware on the user's system (by leveraging vulnerabilities in the browser or its plugins, for example).

The risk involved with mixed content does depend on the type of website the user is visiting and how sensitive the data exposed to that site may be. The webpage may have public data visible to the world or private data visible only when authenticated. If the webpage is public and has no sensitive data about the user, using mixed active content still provides the attacker with the opportunity to redirect the user to other HTTP pages and steal HTTP cookies from those sites.

Exemplos de conteúdo ativo

This section lists some types of HTTP requests which are considered active content:

Other resource types like web fonts and workers may be considered active mixed content, as they are in Chromium.

Avisos na Consola da Web

The Firefox Web Console displays a mixed content warning message in the Net pane when a page on your website has this issue. The mixed content resource that was loaded via HTTP will show up in red, along with the text "mixed content", which links to this page.

Screen shot of the web console displaying a mixed content warning.

As well as finding these warnings in the Web Console, you could use Content Security Policy (CSP) to report issues or a website crawler to find issues across your site, such as HTTPS Checker or Mixed Content Scan.

Starting in Firefox 23, mixed active content is blocked by default (and mixed display content can be blocked by setting a preference). To make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the Security pane of the Web Console, as seen below:

A screenshot of blocked mixed content errors in the Security Pane of the Web Console

To fix this type of error, all requests to HTTP content should be removed and replaced with content served over HTTPS. Some common examples of mixed content include JavaScript files, stylesheets, images, videos, and other media.

Nota: a partir do Firefox 55, o carregamento de conteúdo misto é permitido em (see bug 903966).  O Chrome permite conteúdo misto em e http://localhost/. O Safari não permite conteúdo misto.

Consultar também