Low

CSP Bypass level Low on DVWA

Di bawah ini adalah source-code dari CSP Bypass level low di DVWA.

vulnerabilities/csp/source/low.php
<?php

$headerCSP = "Content-Security-Policy: script-src 'self' https://pastebin.com  example.com code.jquery.com https://ssl.google-analytics.com ;"; // allows js from self, pastebin.com, jquery and google analytics.

header($headerCSP);

# https://pastebin.com/raw/R570EE00

?>
<?php
if (isset ($_POST['include'])) {
$page[ 'body' ] .= "
    <script src='" . $_POST['include'] . "'></script>
";
}
$page[ 'body' ] .= '
<form name="csp" method="POST">
    <p>You can include scripts from external sources, examine the Content Security Policy and enter a URL to include here:</p>
    <input size="50" type="text" name="include" value="" id="include" />
    <input type="submit" value="Include" />
</form>
';

Mencari Informasi

Terdapat form untuk yang memasukkan script dari sumber eksternal, memeriksa Content Security Policy dan memasukkan URL untuk disertakan di sini:

Mencoba inspect element melihat CSP:

Terlihat salah satunya lewat pastebin diizinkan, pada source diberi petunjuk untuk menggunakan pastebin yang telah ia buat(https://pastebin.com/raw/R570EE00), yang berisi:

Melakukan Serangan

Last updated