# Log Analysis - Privilege Escalation

## What user (other than ‘root’) is present on the server?

We can see the user move to a directory called `/home/daniel/`.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FfY0bZSr8ojU7pLfyNKps%2F1.png?alt=media&#x26;token=29311da3-7b40-4962-b473-ce84e14a6f64" alt=""><figcaption></figcaption></figure>

### Answer

```
daniel
```

## What script did the attacker try to download to the server?

The attacker used the `wget` utility to download a Github script.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FiXzLB6VcRyjYyUhEPCA8%2F2.png?alt=media&#x26;token=41b8e6ae-4237-4366-aa8b-6286ae2859c3" alt=""><figcaption></figcaption></figure>

## Answer

```
linux-exploit-suggester.sh
```

## What packet analyzer tool did the attacker try to use?

We can see the command `tcpdump` which is used for packet analysis on the command line.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FOKoJWBKlD88q1Z81ThZ2%2F3.png?alt=media&#x26;token=314947b9-83a0-4f2f-9837-ebfc37d67d5d" alt=""><figcaption></figcaption></figure>

### Answer

```
tcpdump
```

## What file extension did the attacker use to bypass the file upload filter implemented by the developer?

The attacker tried to delete a file named `x.phtml`.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FCTtbVfLgXZXjqwSu0RGB%2F4.png?alt=media&#x26;token=59d14102-df8c-41e1-ac66-8e2f19b7aff3" alt=""><figcaption></figcaption></figure>

The PHTML files contain PHP code that is parsed by a PHP engine which allows the web server to generate dynamic HTML that is displayed in a web browser.

### Answer

```
.phtml
```

## Based on the commands run by the attacker before removing the php shell, what misconfiguration was exploited in the ‘python’ binary to gain root-level access? 1- Reverse Shell ; 2- File Upload ; 3- File Write ; 4- SUID ; 5- Library load

We can see that the attacker tried to find binaries with the SUID bit set.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F8koH35zJaeEy0YlSRbXG%2F5.png?alt=media&#x26;token=033a54d6-08ba-49d5-86c8-6906d6ecf614" alt=""><figcaption></figcaption></figure>

On executing a binary with the SUID bit set, the file executes with the effective permissions of the owner of the file instead of the person executing. This allows for temporary privilege escalation.

Then the attacker executes `sh`.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FYRGjHRp3hwdihDviPSdR%2F6.png?alt=media&#x26;token=e8643511-2be6-49e4-8f44-07ce2f6580b8" alt=""><figcaption></figcaption></figure>

### Answer

```
4
```
