> For the complete documentation index, see [llms.txt](https://rouvin.gitbook.io/ibreakstuff/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rouvin.gitbook.io/ibreakstuff/writeups/hackthebox/easy/access.md).

# Access

This is an Easy rated Windows machine. An FTP server with anonymous login has some Database files with Telnet credentials. Then, there's a public exploit for ZKTeco for PE.

## Gaining Access

As usual, we do an Nmap scan to find the services and ports that are running on the machine.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-08214dc89cdf3e6672d2b4af717121669992f8b2%2Fimage.png?alt=media)

### FTP Anonymous Access

When finding FTP open, we can directly check for anonymous login, which works on this machine.

More notably, there's this Telnet service that is running, which is a bit odd and suspicious.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-8911a26e0dffec62110142188d0227d69087c7fe%2Fimage.png?alt=media)

Afterwards, we can proceed to see two types of files that I downloaded back to Kali.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-140a5092cf38f18815bfb2c4b53be6009bbaf2ff%2Fimage.png?alt=media)

The .zip file is password protected, so we can move onto the mdb file first.

When analyzing the .mdb file, we can find out that this is a Microsoft Database file, which should contain passwords and other useful details to us.

After some digging around on Kali Linux tools, we can find that there is this command called `mdbtools` that would allow us to analyse the contents of this file. **For this purpose, make sure to transfer the file in binary mode.**

{% embed url="<https://www.kali.org/tools/mdbtools/>" %}

### Finding Telnet Credentials

When we open this file up in Kali, we can get some interesting results. There are bunch of table names, with one called `auth_user` sticking out.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-3e3915077a9843fac4654d8fb424f2397cc8ee57%2Fimage.png?alt=media)

We can dump out the contents of that table using `mdb-export`.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-50993c28dd9d7f8783c83af3552a37eb35c62dcd%2Fimage.png?alt=media)

With these credentials, we can unzip the file to find a .pst file. .pst files can be read using `readpst`. This would generate another .mbox file, which we can read easily.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-9f87afd2a593ebf84e9e310e04b17a2aaf84f241%2Fimage.png?alt=media)

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-6eaac24efebcd42ecd57fb2d2b75b3ea802ec66a%2Fimage.png?alt=media)

Now we have some credentials. Remembering that there was a Telnet server, we can login easily as the 'security' user.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-a3115bc3e26a5922433ea48ebec27eb9d5b5d2df%2Fimage.png?alt=media)

We can now grab the user flag from this user.

## Privilege Escalation

### ZKTeco Rabbit Hole

Within the machine, there was a ZKTeco directory in C:\\.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-9c003cd1a375d5593d557321c5064ec28766cfc2%2Fimage.png?alt=media)

A quick searchsploit reveals that there is a public exploits available for this version.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-59fe6e27f3286c14045bd65e2fb0c5b6ca0b8a29%2Fimage.png?alt=media)

This exploit details that privilege escalation is possible as we are allowed to change the executable file with any binary that we choose. However, I was unable to exploit this properly.

### Finding Runas hint

While snooping around on the machine, we can find that in `C:\Users\Public\Desktop`, there is a .lnk file that contains some hints that there are Administrator credentials being cached on this machine.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-268c7d1308499bf5773bae844f26e3c8dc2f37f9%2Fimage.png?alt=media)

I see lots of runas.exe being used, and when we check the cached passwords using `cmdkey /list`, we can see that we indeed have the Administrator credentials.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-98e88b3259d6438cc9c6fc77c69610e029e142fa%2Fimage.png?alt=media)

The administrator credentials being cached basically means that we can execute the `runas /savecred /user:ACCESS\administrator <binary>` command, which is basically a sudo command but on windows.

From here, download a simple reverse shell binary generated from MSFVenom and run the command to gain a reverse shell as the administrator on our listening port.

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-9bcf88d4506e7aaacaa1f3419ed3878c982b3b71%2Fimage.png?alt=media)

![](https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-f0fc743f76a87ab9fee7dc2f73d5bafc50198b14%2Fimage.png?alt=media)
