From 3633df4e81087816924ae206c758e504a115c047 Mon Sep 17 00:00:00 2001 From: CPol Date: Tue, 28 Jun 2022 23:06:59 +0000 Subject: [PATCH] GitBook: [#3296] No subject --- .../README.md | 9 ++++- pentesting-web/xs-search.md | 12 +++++-- .../xs-search/css-injection/README.md | 35 +++++++++++++++++++ .../xss-cross-site-scripting/README.md | 35 +++++++++++++++++++ 4 files changed, 88 insertions(+), 3 deletions(-) diff --git a/pentesting-web/content-security-policy-csp-bypass/README.md b/pentesting-web/content-security-policy-csp-bypass/README.md index 397728174..52ffeab9e 100644 --- a/pentesting-web/content-security-policy-csp-bypass/README.md +++ b/pentesting-web/content-security-policy-csp-bypass/README.md @@ -286,7 +286,14 @@ You can bypass this CSP exfiltrating the data via images (in this occasion the X From: [https://github.com/ka0labs/ctf-writeups/tree/master/2019/nn9ed/x-oracle](https://github.com/ka0labs/ctf-writeups/tree/master/2019/nn9ed/x-oracle) -You could also abuse this configuration to **load javascript code inserted inside an image**. If for example, the page allows to load images from twitter. You could **craft** an **special image**, **upload** it to twitter and abuse the "**unsafe-inline**" to **execute**a JS code (as a regular XSS) that will **load** the **image**, **extract** the **JS** from it and **execute** **it**: [https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/](https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/) +You could also abuse this configuration to **load javascript code inserted inside an image**. If for example, the page allows to load images from twitter. You could **craft** an **special image**, **upload** it to twitter and abuse the "**unsafe-inline**" to **execute** a JS code (as a regular XSS) that will **load** the **image**, **extract** the **JS** from it and **execute** **it**: [https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/](https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/) + +### PHP response buffer overload + +PHP is known for **buffering the response to 4096** bytes by default. Therefore, if PHP is showing warning, by providing **enough data inside warnings**, the **response** will be **sent** **before** the **CSP header**, causing the header to be ignored.\ +Then, the technique consist basically in filling the response buffer with warnings so the CSP header isn't sent. + +Idea from [**this writeup**](https://hackmd.io/@terjanq/justCTF2020-writeups#Baby-CSP-web-6-solves-406-points). ### img-src \*; via XSS (iframe) - Time attack diff --git a/pentesting-web/xs-search.md b/pentesting-web/xs-search.md index e1b9350cf..6af75126f 100644 --- a/pentesting-web/xs-search.md +++ b/pentesting-web/xs-search.md @@ -557,6 +557,9 @@ Web applications can deploy COOP response header to prevent other websites from If a server-side redirect uses **user input inside the redirection** and **extra data**. It's possible to detect this behaviour because usually **servers** has a **limit request length**. If the **user data** is that **length - 1**, because the **redirect** is using **that data** and **adding** something **extra**, it will trigger an **error detectable via Error Events**. +If you can somehow set cookies to a user, you can also perform this attack by **setting enough cookies** ([**cookie bomb**](hacking-with-cookies/cookie-bomb.md)) so with the **response increased size** of the **correct response** an **error** is triggered. In this case, remember that is you trigger this request from a same site, `