A Windows machine where a personal access token buried in a Gitea repository’s commit history unlocks a CI/CD pipeline — and a commercial PDF utility’s privilege escalation flaw delivers the final blow.
Nmap
1 | |
Foothold
There is nothing particularly interesting on port 80.
Browsing to http://10.129.234.64:3000/ reveals a Gitea instance running version 1.21.3.
While exploring repositories, we find one called dev-scripts containing a single file: repos.py.
Reviewing the commit history reveals a Personal Access Token exposed in the initial commit:
1 | |
Enumerating Private Repositories
Using the leaked token, we query the Gitea API:
1 | |
The response shows a private repository:
1 | |
Cloning the Private Repository
We can clone the private repository using the access token:
1 | |
Inside the repository, the readme.md file contains:
1 | |
This indicates that commits are automatically deployed to the IIS webroot.
In other words, any file pushed to the repository will be served by the web server.
Testing Automatic Deployment
We replace index.html with test content:
1 | |
Configure Git and push the changes:
1 | |
Verify deployment:
1 | |
The updated content is served, confirming automatic deployment.
Achieving Remote Code Execution
Since IIS is the web server, we can upload a malicious .aspx web shell to gain RCE.
Generate a reverse shell:
1 | |
Commit and push:
1 | |
Start a Metasploit listener:
1 | |
Trigger the shell:
1 | |
A Meterpreter session is successfully opened.
Credential Discovery
Inside ellen.freeman‘s Documents folder, we find config.xml, which belongs to mRemoteNG.
The file contains a saved RDP session for user gale.dekarios with an encrypted password.
mRemoteNG uses AES-GCM encryption.
We can use this online tool or mremoteng-decrypt to recover the password.
The decrypted password is:
1 | |
RDP Access
Using these credentials:
1 | |
We obtain desktop access and retrieve the user flag.
Privilege Escalation
We notice PDF24 Creator installed on the system.
The version is 11.15.1.
PDF24 Creator 11.15.1 is vulnerable to CVE-2023-49147, which allows a local unprivileged user to escalate privileges to SYSTEM through a chain of actions when installed via MSI.
Searching the system reveals:
1 | |
This confirms MSI installation.
Following this PoC, we are able to spawn a SYSTEM command prompt and reset the Administrator password:
1 | |
Administrator Access
Authenticate via RDP:
1 | |
Root flag successfully obtained.
Attack Chain Summary
- Personal Access Token exposed in Gitea commit history
- Token allowed access to a private repository
- CI/CD auto-deployment enabled arbitrary file upload
- Uploaded malicious ASPX web shell → gained Meterpreter session
- Extracted and decrypted credentials from mRemoteNG config
- Identified vulnerable PDF24 Creator installation (CVE-2023-49147)
- Escalated to SYSTEM and reset Administrator password
Key Takeaways
- Secrets committed to Git remain accessible in repository history
- Personal Access Tokens should be scoped minimally and rotated immediately if exposed
- CI/CD pipelines can become RCE vectors when repository access is compromised
- Encrypted credential storage (like mRemoteNG) may still be recoverable
- Local software enumeration is critical for privilege escalation
- MSI-installed applications may introduce unintended escalation paths