misc challenges
My First C Program!

After having solved this challenge, I learned that the syntax used in this C file is actually a real programming language.
Once you read the readme, it will all make sense why the syntax is so weird.
Flag:
SimpleFTPServer

Enumeration
Connecting using the netcat command, I was greeted with the text 220 vsFTPd (v2.3.4) ready..., which turn out to be red-herring.
Version 2.3.4 of vsftpd is a vulnerable version which allows attackers to open a backdoor for Remote Code Execution. More information here.
You should read this to understand the next part.
Entering gibberish returns error, however the error indicates that the server is running Python.

Although I am unable to login using the USER and PASS command, I soon realized they are all red-herring since I can list the directory with LIST and change directory with CWD.

Using RETR to retrieve a file on flag.txt, I received a fake flag:

and accessing pwn give us access to the source code of the app:
Looking at this script, it appears that all FTP commands are useless (they only return text, unable to return file, os module not interacting with the system). However, the way our input get processed is interesting:
First, our inputs are written into
cmdandargsusing list unpacking.After that, our input is processed using
operator.attrgetter(cmd)(self), so if we enteredLIST, it will attempt to callFTPServerThread().LIST(self).If there are additional arguments being passed in, it will be called by the function in the variable
func.And if the command you run has error, it will return.
--> At this point we can confirm this challenge is indeed PyJail and we need to retrieve the FLAG constant.
Payload
My first attempt is to use basic PyJail payload in order to reach global function then call __import__ to import system modules. However, as I mentioned before, every function call will be called with self. So my payload will now become:
and running this return an error.
So my thought now is to find a function that accept self but still can reach global variables. Luckily, we have a function defined inside this class already - toListItem.

Running this function directly returns a different error, indicating we are going in the right direction.

This is what happens behind the scene:

And since FLAG is a global variable, we can use get function of a dictionary to read the value of FLAG.

baby ruby

This script allows us to input code which is less than 5 characters, then execute it. Therefore, our ultimate goal is to call a shell to execute longer command on the server.
Googling a bit, we already know that backticks (``) can be used to execute system command.
You can watch this video to understand how backticks works:
So far, we know that the output of the command is not being redirected to STDOUT, but to STDERR instead. So we can't see anything. Therefore, we just need to redirect our output it to STDERR using whoami 1>&2, for example.

Rougeful Helper

Thanks to the description, we need to find a ICMP payload - which should come out from a network scanner tool - like nmap or ping.
Unpacking the zip file reveals a file directory structure of a Windows machine.

Checking all of them to find something network-scannning-related, these are some suspicious directory:
\Files\Program Files\VSA X\Probe\Files\Windows\System32\Npcap\Files\Program Files\Npcap
Only the VSA X folder has interesting data. In VSA X\Probe\tmp\scan-run, there are many logs file refering to a network scanning that occurs after the 15:32:20 timestamp. Our answer is in the ndp file, which stores all the payload and options used.

Flag:
Last updated