> For the complete documentation index, see [llms.txt](https://0xmedhat.gitbook.io/whoami/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xmedhat.gitbook.io/whoami/writesup/hammered-cyberdefenders.md).

# Hammered Cyberdefenders

Category : Digital Forensics Log Analysis Honeypot Apache2

* [Details](https://cyberdefenders.org/blueteam-ctf-challenges/42#nav-overview)

This challenge takes you into the world of virtual systems and confusing log data. In this challenge, figure out what happened to this webserver honeypot using the logs from a possibly compromised server.

Challenge files:

* kern.log

* auth.log

* daemon.log

* dmesg

* apache2

* [Questions](https://cyberdefenders.org/blueteam-ctf-challenges/42#nav-questions)

#### Q1 Which service did the attackers use to gain access to the system?

let's investigate <mark style="color:blue;">auth.log</mark> file to see the authentication of accounts&#x20;

```bash
cat auth.log | grep -F 'Failed'
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FWfKgjjhJ30NYHTlaTfni%2Fimage.png?alt=media&amp;token=a4bf4f71-0680-4a09-926d-43a93304ad13" alt=""><figcaption><p>sshd</p></figcaption></figure>

by greping failed authentication attempets we can see that there are many attempts to login by <mark style="color:blue;">sshd</mark> .

okay the service is ssh&#x20;

**Ans : ssh**

#### Q2 What is the operating system version of the targeted system? (one word)

we can look in the <mark style="color:blue;">kern.log</mark> file, as it contains information logged by the kernel

```bash
head kern.log
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2F2duCQZGx7L3LmiUeiL2o%2Fimage.png?alt=media&amp;token=674c5e47-3ea2-4653-9b2f-a9df411368eb" alt=""><figcaption><p>(Ubuntu 4.2.4-1ubuntu3)</p></figcaption></figure>

**Ans : 4.2.4-1ubuntu3**

#### Q3 What is the name of the compromised account?

We can back to <mark style="color:blue;">auth.log</mark> file to see which account was successfully login

```bash
cat auth.log | grep -F 'Accepted password'
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FcFFgFdf7wOJg7kJt6LzK%2Fimage.png?alt=media&amp;token=d25bc419-c6c3-44d8-84e9-4cb4be08024f" alt=""><figcaption><p>root</p></figcaption></figure>

**Ans : root**

#### Q4 Consider that each unique IP represents a different attacker. How many attackers were able to get access to the system?

let's grep failed auth ip&#x20;

```bash
grep sshd auth.log| grep "authentication failure" | awk '{print $14}'  | sort | uniq -c | sort -n
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FGGquog1qXtfrBNR6BoTs%2Fimage.png?alt=media&amp;token=f4829c99-0d9b-4e89-90d6-6cbf2928a145" alt=""><figcaption></figcaption></figure>

and success ip

```bash
cat auth.log |grep "Accepted" | awk '{print $11}' | sort | uniq -c | sort -n
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FGsYCmGD6hTVKb12E3zXA%2Fimage.png?alt=media&amp;token=f70d69e8-596a-442b-97c0-c7818642529a" alt=""><figcaption></figcaption></figure>

By comparing them we found it's 6 login to system

219.150.161.20, 222.66.204.246, 121.11.66.70, 222.169.224.197, 122.226.202.12, 61.168.227.12

**Ans : 6**&#x20;

#### Q5 Which attacker's IP address successfully logged into the system the most number of times?

The two IP addresses 188.131.23.37 and 219.150.161.20 are the highest value &#x20;

but 188.131.23.37 appears only six times in auth.log, and appears 219.150.161.20  many times.

```bash
grep "Accepted" auth.log| grep Accepted | grep root | awk '{print $11}' | sort | uniq -c | sort -n
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FnpOmBMW9ynMQPEzqnmz9%2Fimage.png?alt=media&amp;token=ac870db9-be4e-4b11-8e81-b024dd428cee" alt=""><figcaption></figcaption></figure>

Ans : 219.150.161.20 &#x20;

#### Q6 How many requests were sent to the Apache Server?

The requests store in <mark style="color:blue;">www-access.log</mark>

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FyeHqnecVK4iGgnLIad4w%2Fimage.png?alt=media&amp;token=c2f9d0b8-ccf0-4de9-bc95-af55f399f155" alt=""><figcaption></figcaption></figure>

Ans : 365

#### Q7 How many rules have been added to the firewall?

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2Fup0gROc9SMHWOaqMyieJ%2Fimage.png?alt=media&amp;token=1aa63b6b-5a50-4f60-a066-1cfbb94dfdea" alt=""><figcaption><p> there are 6 rules that have been added.</p></figcaption></figure>

**Ans : 6**

#### Q8 One of the downloaded files to the target system is a scanning tool. Provide the tool name.

We can Look for installed package in <mark style="color:blue;">dpkg.log</mark> file

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2F0KEkjMMFi9HgFzuOEjJc%2Fimage.png?alt=media&amp;token=bbf59203-684b-4fe2-8226-3972d41a3f30" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FIb1JkbSymG0dRdKLJpmu%2Fimage.png?alt=media&amp;token=1abbe538-1e91-4d9b-bcad-f5cc4fb5f45d" alt=""><figcaption></figcaption></figure>

**Ans : nmap**&#x20;

#### Q9 When was the last login from the attacker with IP 219.150.161.20? Format: MM/DD/YYYY HH:MM:SS AM

back to auth.log file and grep login success from the attacker ip address

```bash
 grep "Accepted password" auth.log | grep "219.150.161.20"
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FI940HVBStAhN6SSN1ZUP%2Fimage.png?alt=media&amp;token=ac92f0e6-940d-4637-a70e-6e2d603d1ea6" alt=""><figcaption></figcaption></figure>

last log in Apr 19 05:56:05

Ans :  04/19/2010 05:56:05 AM&#x20;

#### Q10 The database displayed two warning messages, provide the most important and dangerous one.

database  information  stores in <mark style="color:blue;">daemon.log</mark>

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FHLjBOtcbyGcCal5rGQnO%2Fimage.png?alt=media&amp;token=24aa1b36-3aa8-4060-8b21-11be630a8559" alt=""><figcaption></figcaption></figure>

The most dangerous one is creates root users **without passwords**

**Ans : mysql.user contains 2 root accounts without password!**

#### Q11 Multiple accounts were created on the target system. Which one was created on Apr 26 04:43:15?

grep the time in the Q

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2FYHWUFR1HfSkt3a0Ae432%2Fimage.png?alt=media&amp;token=b6a04963-4d99-4851-8111-361fb9449cb9" alt=""><figcaption><p>name=wind3str0y</p></figcaption></figure>

**Ans : wind3str0y**

#### Q12 Few attackers were using a proxy to run their scans. What is the corresponding user-agent used by this proxy?

Grep User-Agent Value from <mark style="color:blue;">www-access.log</mark> file&#x20;

```bash
cat apache2/www-access.log | cut -d ' ' -f 12 | sort | uniq 
```

<figure><img src="https://2672868225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRLWF7BP-xoZbu8kb7J%2Fuploads%2F7AjHExB89fy6Wf1ZXw1O%2Fimage.png?alt=media&amp;token=7f79caf9-07bb-4545-8f3d-37e8abaf9729" alt=""><figcaption><p>pxyscand/2.1</p></figcaption></figure>

Ans : pxyscand/2.1\
\
\
\
Thanks UUUUUUUUUUUUUUUUUU 🥰
