A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution. This issue is known to be exploited in the wild. This issue only affects Apache 2.4.49 and not earlier versions. The fix in Apache HTTP Server 2.4.50 was found to be incomplete, see CVE-2021-42013.
It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution. This issue only affects Apache 2.4.49 and Apache 2.4.50 and not earlier versions.
- Sending implant to stager
- Tasking with remote code execution
- File exfiltration
- Implant destruction
- HTTPS (TLS) encryption for transport (requires installing attacker's certificate authority on target)
- X25519 Elliptic-Curve Diffie-Hellman (AES) Key Exchange between client and server
- Random ephemeral 256-bit AES key generation every time client starts
- Pre-shared key is used only during key exchange
- AES-256-GCM encryption on all messages with random nonce
- Obfuscated with Pyarmor and compiled into standalone binary with PyInstaller
- Our target uses an alpine docker container to run apache2 so we compile for that (uses musl libc)
- C2 - Attacker starts C2 and leaves it waiting for connections
- Initial exploit - Attacker exploits the file traversal + RCE vulnerability to make Apache2 open a reverse shell from the target
- Stager - Attacker sends a Python command to run a stager which downloads the implant from the C2
- Implant - The python command then runs the implant for full communications with the C2
- RCE and file exfil - Now the attacker can send any commands to the implant, including for file exfiltration
- Destroy implant - When operation is over, attacker sends a self-destruct command to the implant
- Run target with
docker compose up -d
- Get IP of target by running
ip a
in the device running the docker container and looking for the local IPv4 address with "state UP" - Set your C2_IP in
stripped_implant.py
andsetup.sh
- Set your C2_IP and TARGET_IP in
exploit.py
- Set up certs, keys, and payload by running
./setup.sh
(in parent dir) - Run
c2.py
thenexploit.py
in separate shells