# Analyzing Logs of a Breach

## JUICY DETAILS WRITEUP

#### *By Jacvbtaylor* <a href="#by_jacvbtaylor__1" id="by_jacvbtaylor__1"></a>

```
           Used Kali Linux 
                     https://tryhackme.com/room/juicydetails
             completed June 5, 2023
```

## <mark style="color:red;">Introduction:</mark> <a href="#step_1_12" id="step_1_12"></a>

One of the biggest Juice Shops in the world has been compromised by a bad actor and the attacker has made their way into the network.

As the SOC Analyst on duty:

* Figure out what techniques and tools the attacker used
* What endpoints were vulnerable
* What sensitive data was accessed and stolen from the environment

## <mark style="color:red;">Reconnaissance:</mark> <a href="#step_1_12" id="step_1_12"></a>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FDunKI0vyl7UPlfgAFzRs%2Fimage.png?alt=media&#x26;token=db618ec0-f1cc-4a11-ba3b-a100a3c756eb" alt=""><figcaption><p>Logs</p></figcaption></figure>

Using the provided logs adding up to almost 1000 lines of data, there are a few questions that can be answered:\
\
\&#xNAN;*<mark style="color:green;">**What tools did the attacker use?**</mark>*&#x20;

Using the access logs, there are 5 tools that can noted, or traced

* nmap, Hydra, sqlmap, curl, feroxbuster

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FjzaKhBbRpbExjJ9jXFPp%2Fimage.png?alt=media&#x26;token=b80e89f6-8101-4fa5-ab5b-9f373f892a9f" alt=""><figcaption><p>nmap</p></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FArrk7Ui8sBgSL4cUkj0O%2Fimage.png?alt=media&#x26;token=7d0a5717-5c2d-47d4-a580-09aa72a46b18" alt=""><figcaption><p>Hydra</p></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FyFEdS9dfsOBglCiLxYEG%2Fimage.png?alt=media&#x26;token=834452b0-ac43-4de5-89eb-e35538f8344f" alt=""><figcaption><p>sqlmap</p></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FWF4EkmxTLZBolsGIMQ5K%2Fimage.png?alt=media&#x26;token=47bd7f64-54b1-41ba-bf70-72cd5f565157" alt=""><figcaption><p>curl</p></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FrPzCR7UO8884s2jn3pam%2Fimage.png?alt=media&#x26;token=184e58a1-12c7-47a0-97f1-affcbdcda561" alt=""><figcaption><p>feroxbuster</p></figcaption></figure>

*<mark style="color:green;">**What endpoint was vulnerable to a brute-force attack?**</mark>*

For the Brute Force, Hydra would be the best tool for this. Tracking Hydra in the logs indicates the following as the endpoint

* "GET <mark style="color:orange;">/rest/user/login</mark> HTTP/1.0" 500 - "-" "Mozilla/5.0 (Hydra)"

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FVd6SPXqIB4B2TDpGTx57%2Fimage.png?alt=media&#x26;token=e93f0f9c-3768-4664-bb6e-a40514cdf657" alt=""><figcaption><p>/rest/user/login</p></figcaption></figure>

*<mark style="color:green;">**What endpoint was vulnerable to SQL injection?**</mark>*

* "GET <mark style="color:orange;">/rest/products/search</mark>?q=1 HTTP/1.1"

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2Fp4ODr1MFasqsBisU80hi%2Fimage.png?alt=media&#x26;token=be40c628-2db1-4a53-9fbf-d1cd306578f3" alt=""><figcaption><p>/rest/products/search</p></figcaption></figure>

*<mark style="color:green;">**What parameter was used for the SQL injection?**</mark>*

* "GET /rest/products/search?<mark style="color:orange;">q</mark>=1 HTTP/1.1"

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FCLxCOsTghFs5WZkvtVg8%2Fimage.png?alt=media&#x26;token=316b1de7-f6f4-4b46-ab24-3a90758d60ed" alt=""><figcaption><p>q</p></figcaption></figure>

*<mark style="color:green;">**What endpoint did the attacker try to use to retrieve files?**</mark>*&#x20;

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FxqCqKkawmqpd446NATk1%2Fimage.png?alt=media&#x26;token=3e38669f-19f8-43ca-8729-65059fcd4155" alt=""><figcaption><p>/ftp</p></figcaption></figure>

## <mark style="color:red;">Stolen data:</mark>

Now that the tactics and point of failures are determined, the next step is to determine the scope and impact. To do this, the following questions were asked:

*<mark style="color:green;">**What section of the website did the attacker use to scrape user email addresses?**</mark>*

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FOVjsL4zCZzTBZMnF28Rt%2Fimage.png?alt=media&#x26;token=8c3f9f13-e147-4a15-a9a1-42ab2c521802" alt=""><figcaption><p>Product Review</p></figcaption></figure>

*<mark style="color:green;">**Was their brute-force attack successful? If so, what is the timestamp of the successful login?**</mark>*

The attack was successful and it ended at *<mark style="color:purple;">11/Apr/2021:09:16:32 +0000</mark>* which is when the user was granted access.

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FHlPYzO28rZiKiXsyEDvb%2Fimage.png?alt=media&#x26;token=e34fdd5e-5eca-4e3a-815b-cb8f9cde892e" alt=""><figcaption><p>11/Apr/2021:09:16:32 +0000</p></figcaption></figure>

*<mark style="color:green;">**What user information was the attacker able to retrieve from the endpoint vulnerable to SQL injection?**</mark>*

The attacker was able to user SQL injection to dump the email and password of select users:

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FU7DvK2hHCimuffftDCN1%2Fimage.png?alt=media&#x26;token=1fda4042-b97f-4bce-92d8-3798d751a501" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2Fvru4ZxCnvKPV6cBI8NHg%2Fimage.png?alt=media&#x26;token=df013e1e-45dc-440e-a747-09bc46257b47" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2F5EzygglI6aTOm0xth36a%2Fimage.png?alt=media&#x26;token=ceef621f-30c5-4be0-a597-7ad2f4c164f2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2Fw3oV8RE9lCLojYur6Mk5%2Fimage.png?alt=media&#x26;token=d8133ce7-8b48-4f91-8e66-8d70fde92bd5" alt=""><figcaption><p>email, password</p></figcaption></figure>

*<mark style="color:green;">**What files did they try to download from the vulnerable endpoint? (endpoint from the previous task, question #5)**</mark>*

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FRdw8AmbwageyGXTsTtVV%2Fimage.png?alt=media&#x26;token=af4529a7-cfd0-4112-907a-ef380745a95e" alt=""><figcaption><p>/coupons_2013.md.bak,/www-data.bak</p></figcaption></figure>

*<mark style="color:green;">**What service and account name were used to retrieve files from the previous question? (service, username)**</mark>*

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2FV6SDzApN8AOvQrONSMEk%2Fimage.png?alt=media&#x26;token=401a62cc-14f4-4ec0-b917-7249c776b172" alt=""><figcaption><p>ftp, anonymous</p></figcaption></figure>

*<mark style="color:green;">**What service and username were used to gain shell access to the server? (service, username)**</mark>*

<figure><img src="https://2598728441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWdpKRmr157xmW0tj5M95%2Fuploads%2Fi03eSfUwABQkAfQZob5p%2Fimage.png?alt=media&#x26;token=babead91-1fe0-4383-968b-3775ebda0e79" alt=""><figcaption><p>ssh, www-data</p></figcaption></figure>
