> For the complete documentation index, see [llms.txt](https://unsbotch.gitbook.io/unsbotch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsbotch.gitbook.io/unsbotch/my-writeups/xssy/csp-data-url-bypass.md).

# CSP - Data URL Bypass

CSP - Data URL Bypass - medium challenge with 14 solutions, based for csp bypass.

<figure><img src="/files/DXCEaVZksYs7LJomR2El" alt=""><figcaption></figcaption></figure>

As always checking entry points of input on basic XSS payload:

<figure><img src="/files/y5HdjsPie7FdVBKJsPfF" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/2ECAdicV0VwSOLTN7xyB" alt=""><figcaption></figcaption></figure>

Payload inserted as we need but alert didn't return, as name of challenge is "CSP Bypass" it was expected, if we look at console:

<figure><img src="/files/W7R2y6cnIgA5fdR93IOi" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/dz1upkaGgZWdvEaeU340" alt=""><figcaption></figcaption></figure>

We have an configuration of CSP and first thing what we need to do is check csp evaluator:

<figure><img src="/files/S37e4DgoPQAtdCZXJJD6" alt=""><figcaption></figcaption></figure>

"Data"  - allows us to use script tags with this csp, but what is it?\
&#x20;Data:URI (Uniform Resource Identifier) ​​is a resource identifier scheme that allows you to embed data directly into your pages or documents instead of referencing external files via URLs.

I have encountered with XSS via data protocol before and we can trigger an XSS with just following payload:&#x20;

`<script src="data:text/javascript,alert()"></script>`

<figure><img src="/files/p9xTixc0Z2SEtIv5uTFa" alt=""><figcaption></figcaption></figure>
