Time

Challenge: Time

Category: Web

Get the current date and time, anytime, anywhere!

I notice that it changed when I click the What’s the date? menu.

Since it's a web challenge, I thought of a possible code injection vulnerability.

They provided a source code:

First, I checked the directory structure, so it's MVC since we have controller, model, and views folders. Second, I checked the Dockerfile and build it inside my machine, and examine what is the docker image, command used and where’s the flag located.

I found that the flag is located in /flag path, but they provided a sample flag inside their source code:

Next is I checked controllers/TimeController.php

This indicated that the Controller called/created the object TimeModel, so I checked the models/TimeModel.php

I found $this->command = β€œdate β€˜+” . $format . β€œβ€˜ 2>&1”;

This means that we need to inject command (command injection vulnerability) We can break out the string by adding a single quote (β€˜) and add a semi-colon(;)

I make an easy request using Burpsuite:

/?format='; cat ' ../flag

Gotcha, I found a flag!!!

Last updated