Another Security Blog

A place to show my mad skills

TidBits Walkthroughs Resources Projects View on GitHub
16 April 2024

CI/CD Pipeline Room Walkthrough

by C. Casquatch

This project consists of practicing the following: Explore what it takes to secure a DevOps pipeline and the builds it produces. Understanding the potential risks and consequences of insecure build processes. Explore common insecurities and how threat actors can exploit these to compromise not only the process, but also production systems.

PL

~ This room took me a while to get through. If I got stuck, I headed to Tyler Ramsbey - He has two great videos to assist with the room.

Languages and Utilities Used

Environments Used

Room walk-through

Learning Objectives for this room:

That was the worst

As a note if you’re completing this room - make sure to take notes at different intervals for credentials or syntax you may need 00

Gathering information: getting the CICD IP - we need this throughout the room

1

Configure DNS

2

Makre sure you can access the login page at Gitlab - this tells you if you are connected properly

3

Login to Mother and register your credentials (note these down, we use these later)

4

Sign into or register for Gitlab and create a fork of the project

5

Follow the instructions to install, run, and register a runner

6

Make a change in the README file on the repo

7

Once the pipeline is complete - open the web application to verify it’s working by going to pipelines and then pipeline schedules on the left hand side

8

Login with the credentials from the repo and grab the flag

9

Make sure Gitlab pip package is installed

To do this I used the below syntax (at the time of writing, note this may change based on the upgrades to gitlab)
pip3 install python-gitlab==3.15.0

10

Grab you personal access token from the user settings > access tokens page. Click the copy button.

11

Add token to the python script we copied from the THM website

12

Grep for “THM” within the Modile Application folder (unzipped)

grep -r "THM"

13

Flag found

14

Create a shell script and set up a listener (this syntax for after script is created)

python3 -m http.server 8080

15

Replace info i nthe kenins file

16

Scroll to the top of the room, we can see a host unlocked

17

Create a forked proect from the merge test

18

After merger request created (we are listening)

19

Get the first flag by following mother orders (log into mother first, she will give you directions)

20

This screenshot is the first part of task 7

21

Once in the target machine - go back to mother and ask for directions to get the flag

22

Create public key for DEV and PROD (This is the start of heavily relying on the youtube videos for assistance / I got stuck here a lot trying to figure out how it works)

23

Try the API key - here is updating the .gitlab-ci.yml file

24

Once we deploy / push the pipeline to get the secret in the file. (This is also the last flag)

25


tags: Gitlab - THM - CI/CD - pipeline