POP Restaurant

`Spent a week to create this food ordering system. Hope that it will not have any critical vulnerability in my application.` A WEB Challenge from HackTheBox

A challenge involving a source code review and PHP- web page injetion

Content:

  • Recon

  • Source Code Review

  • PHP - Coding

  • Injection

How I kinda - solved it:

Thanks to this little help from https://medium.com/@abdallahomaratya0/pop-restaurant-challenge-htb-b10989577596

Using the source code review I first created a docker instance to check the reactions and requests.

I noticed on this code:

<form action="order.php" method="POST">
              <input type="hidden" name="data" value="<?php echo base64_encode(serialize(new Pizza())); ?>">
              <button type="submit" class="order__button">
                <img src="Static/Images/Pizza.gif" alt="Pizza">

That there is a post mechanism - however when you look at the page there aren't really any user input except a few images that you click. I was a bit silly until i realize that every time i click there were a few requests.

Docker Instance of the WebApp

So where am I getting with this? Looking at my docker server, I got some info that this application do POST req. Moving forward.

The next step I did was to look for these objects and see what their code - sort of do, I found that they pretty much use magic methods. Check here for more info about them

https://www.php.net/manual/en/language.oop5.magic.php

three classes ArrayClassHelper Pizza, Spaghetti,IceCream

ArrayHelpers class.

Pizza:

Spaghetti:

IceCream

so I have three diffrent classes and each class has a function.

I was kinda stuck so i looked at @Abdulla Omar Atya work and found that YES you need to recreate a new code to chain the three classes to execute! Sooo i sorta copied his code and meshed it all in one and helped me with it since I am not a PHP kind of guy and by reading through the PHP pages kinda did helped but not really!

His idea of using the ArrayIterator is fantastic!

Goal make chain to this diffrent classes to exec system or any function.

The winning code

Payload Creation

The Request

From the docker instance

Last updated