eavesdropped
Last updated
Last updated
Recently, I discovered that a malicious actor has been using my proxy to obtain specific information from a particular server. Could you help me figure out what the attacker did?
Author: nagi
TSA{c0mmand_4nd_control_0ver_mitmprox1es_c1ee2e623a}
We are given a file containing some sort of log of a network traffic. From the contents, we can see some sort of git clone
operation happening and also some HTTP requests at the end of the log.
Since Git uses Zlib as their compression algorithm, we can use binwalk
to extract all Git objects.
After decompressing the extracted Zlib files, there is one file that contains byte-compiled Python executable. After decompiling the file, we can see a client.py file from a tool called trevorc2.
The trevorc2 tool is used to mask command execution using a cloned website. From the decompiled code, the payload itself will be stored on the nonce with the format nonce="(.+?)"
and will be decrypted using AES with the result of XORing the reversed CIPHER
variable with the __author__
variable as the key. The resulting payload will contain the hostname and the command itself with the format hostname::::command
. After executing the command, the output will be encrypted again using the same algorithm and key and will be hidden on the query parameter.
We parsed the nonces and decrypt using the previously analyzed decryption flow to get the commands used.
From the output, we can see a flag.png
is being archived using a password with some kind of format. The first part of the password is the hostname, the second part is a random password from the first 64 passwords from the rockyou.txt wordlist. The last part is a number between 1 and 65537. Then, the Base64 representation of the flag.zip
is outputted.
Before getting the zip file, we need to create a custom wordlist from the analyzed format. The hostname is retrieved from the first part of the parsed nonces.
After creating a new wordlist, we can get the flag.zip
by parsing the last query parameter on the log file.
Then we can brute-force the zip file using john
.
After opening the zip file, the flag will be stored as a QR code.