Writeup: PEA 2019 - Educated guess
Information
- category: Web
- points: 600
Description
There is a secured system running at http://shell1.2019.peactf.com:1428/query.php. You have obtained the source code.
Writeup
This is the content of source code’s file:
1 | <!doctype html> |
From this source code filtering and semplifying the content will take us to this piece of code:
1 |
|
Code explanation:
spl_autoload_register('autoload')
: Register given function (in our caseautoload
function) as __autoload() implementation.- If the cookie called
user
is not empty then$user
is the unserialized object written in the cookie - If
$user->is_admin()
returnstrue
the flag is echoed
Solution:
- In oop functions like
is_admin()
are called on objects of classes named likeProfile, User...
, so I created a simpleUser
class (first “educated” guess)- Then I tried to find the class in the domain, success!
- In oop functions like
is_admin()
usually returns boolean variables declared on the class scope, so I added toUser
class the boolean attributeadmin
set totrue
- Then serialize the object created and paste the serialized code in
user
cookie - Something doesn’t work…
- It surely is because of this
- So URL-encode the serialized object
- Get the flag :3
1 |
|
Flag
flag{peactf_follow_conventions_4022940cb27774f618aa62fe8be202bc}