CyberSecurity Research

Researcher Exploited CI / CD Pipelines To Gain Full Server Access

A CI/CD pipeline is a series of automated steps that helps software teams deliver code faster, safer, and more reliably. 

It coordinates all the processes involved in continuous integration (CI) and continuous delivery (CD). The CTO of Razz Security, Mukesh, recently exploited CI/CD pipelines to gain full server access.

Researcher Exploited CI / CD Pipelines

A potentially dangerous security flaw has been identified, which has its origins in the presence of an exposed .git directory on a publicly available web server.

Due to this bug, one could read and download the entire version control, which encompassed even the files such as .git/config.

Upon examination, it’s been revealed that this particular configuration file contained sensitive user credentials, and as a result of this, it dramatically escalates the exploit chain further.

Decoding Compliance: What CISOs Need to Know – Join Free Webinar

Here, an attacker could potentially use these credentials to perform a full server takeover by cloning the entire Git repository.

As this enables them to gain access to source code, deployment scripts, and other critical system information. This security oversight highlights the importance of properly securing version control systems in web environments.

Since minor misconfigurations can also lead to severe consequences or security threats.To gain unauthorized access to a production server an attacker exploited Bitbucket Pipelines, reads Razz security report.

After discovering the pipeline configuration file, which automates code deployment, the attacker modified it to include their own SSH (Secure Shell) public key in the server’s authorized_keys file. 

The altered pipeline script used the atlassian/ssh-run:0.2.8 pipe to execute commands on the target server (damn.vulnerable.site) as the ‘ubuntu’ user. 

This modification allowed the attacker to add their key using the command: “echo ssh-rsa AAAA…snip…sw== >> /home/ubuntu/.ssh/authorized_keys”. 

The next pipeline run is triggered by a code push to the master branch, and this change allows the attacker to gain SSH access to the server.

With this foothold, the attacker gained shell access and full control over the compromised server, while this includes the ability to execute arbitrary commands. 

Moreover, they noted a potential privilege escalation vulnerability, and this flaw could lead to root access, further expanding their control over the system.

This exploit chain highlights the dangers of exposing sensitive directories, like the .git folder, to the public and abusing CI/CD pipelines. 

Mitigations

Here below we have mentioned all the mitigations:-

  • Make sure to regularly monitor and review SSH key access.
  • Remove outdated or unnecessary SSH keys.
  • Block public access to your .git directory.

Download Free Incident Response Plan Template for Your Security Team – Free Download

Cyber Advisory

CISO Advisory is a Team of Security Experts Covering Various Cybersecurity Research and Technical Write-ups.

Recent Posts

Hackers Target AI Infrastructure With RCE, Prompt Injection and API Key Theft

Hackers are actively probing AI systems, turning exposed gateways and agent tools into routes for…

2 hours ago

Hackers Make Phishing Pages Change Their Code Every Time Someone Opens Them

Hackers are making some phishing pages harder to track by changing the code delivered to…

3 hours ago

Iran-Linked Hackers Reportedly Knock UK Power Plant Offline for Four Days

A cyber incident reportedly forced a British power plant to halt operations for about four…

4 hours ago

Russian Hackers Use New HOOKEDGE Malware to Spy on European Defense and Diplomatic Targets

Russian hackers have used a new backdoor called HOOKEDGE to target defense manufacturers, government bodies,…

4 hours ago

Ransomware Gang Claims AI Can Analyze 700GB of Stolen Data Every Hour

TITAN ransomware is pairing file encryption with an ambitious claim: artificial intelligence that can sort…

4 hours ago

Hackers Compromise Hundreds of WordPress Sites to Deploy Amatera Stealer via ClickFix

A fake student resume is being used to place a remote-access tool on researchers’ Windows…

6 hours ago