Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. // PHP du serveur (leaké)
  2.  
  3. <?php
  4. if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  5.  
  6. $username = $_POST['username'];
  7. $password = MD5($_POST['password']);
  8.  
  9. $salt = microtime();
  10.  
  11. // plaintext is fine nobody sees this anyway and I have a secure salt !
  12. $admin_password = 'supersecurepassword';
  13.  
  14. $admin_hash = MD5('$salt'.'$admin_password');
  15. if($username === 'admin' and $password === $admin_hash){
  16. echo file_get_contents('flag.txt');
  17. }
  18. else{
  19. echo "<script>alert('Wrong password !');</script>";
  20. }
  21. }
  22.  
  23. ?>
  24.  
  25. // PHP de la requete POST HTTP
  26.  
  27. <?php
  28. $url = 'https://mindblown.capturetheflag.be/';
  29. $admin_password = 'supersecurepassword';
  30. $salt = microtime();
  31. $password = $salt.$admin_password;
  32. $data = array('username' => 'admin', 'password' => '$password');
  33.  
  34. $options = array(
  35. 'http' => array(
  36. 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
  37. 'method' => 'POST',
  38. 'content' => http_build_query($data)
  39. )
  40. );
  41. $context = stream_context_create($options);
  42. $result = file_get_contents($url, false, $context);
  43. if ($result === FALSE) { /* Handle error */ }
  44.  
  45. var_dump($result);
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement