We are provided the source code and we can see that:

image.png

Exploiting with php://filter

php://filter is a built-in PHP stream wrapper.

Think of it like this:

This is a very common technique that allows for LFI (Local File Inclusion)

<http://sem2ctf.icsi.cyber:3444/?page=php://filter/convert.base64-encode/resource=index.php>

image.png

Copy that value, base64 decode, and you’ll find the flag in the php code.