Nmap

PORT     STATE SERVICE     VERSION
80/tcp   open  http        Apache httpd 2.4.29 ((Ubuntu))
| http-methods: 
|_  Supported Methods: HEAD GET POST OPTIONS
|_http-title: APEX Hospital
|_http-favicon: Unknown favicon MD5: FED84E16B6CCFE88EE7FFAAE5DFEFD34
|_http-server-header: Apache/2.4.29 (Ubuntu)
445/tcp  open  netbios-ssn Samba smbd 4.7.6-Ubuntu (workgroup: WORKGROUP)
3306/tcp open  mysql       MariaDB 5.5.5-10.1.48
| mysql-info: 
|   Protocol: 10
|   Version: 5.5.5-10.1.48-MariaDB-0ubuntu0.18.04.1
|   Thread ID: 33
|   Capabilities flags: 63487
|   Some Capabilities: SupportsLoadDataLocal, InteractiveClient, LongPassword, Support41Auth, SupportsCompression, ODBCClient, SupportsTransactions, Speaks41ProtocolOld, LongColumnFlag, FoundRows, IgnoreSigpipes, Speaks41ProtocolNew, DontAllowDatabaseTableColumn, ConnectWithDatabase, IgnoreSpaceBeforeParenthesis, SupportsAuthPlugins, SupportsMultipleResults, SupportsMultipleStatments
|   Status: Autocommit
|   Salt: GN3S'hW[E&.T=tQv"BcO
|_  Auth Plugin Name: mysql_native_password
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose|router
Running (JUST GUESSING): Linux 4.X|5.X|2.6.X|3.X (97%), MikroTik RouterOS 7.X (97%)
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:6
Aggressive OS guesses: Linux 4.15 - 5.19 (97%), Linux 5.0 - 5.14 (97%), MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) (97%), Linux 2.6.32 - 3.13 (91%), Linux 3.10 - 4.11 (91%), Linux 3.2 - 4.14 (91%), Linux 3.4 - 3.10 (91%), Linux 4.15 (91%), Linux 5.14 - 6.8 (91%), Linux 2.6.32 - 3.10 (91%)
No exact OS matches for host (test conditions non-ideal).
Uptime guess: 6.037 days (since Thu Sep 24 21:05:32 2026)
Network Distance: 4 hops
TCP Sequence Prediction: Difficulty=262 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: Host: APEX

Enumeration

We have access to an anonymous-enabled SMB share.

There is a medical website on port 80. Gobuster finds a couple interesting directories, including a file manager.

It looks like the Documents folder is the same folder as our SMB share.

Was able to see some version information:

Looks like there is a path traversal vulnerability that we can exploit.

There is also an /openemr directory with a logon page. All exploits are authenticated though.

Exploitation

We test it on /etc/passwd and succeed!

Noticed that when a file is viewed via the exploit, it copies it to the file manager.

I looked for config file paths for both services. Couldn’t view any filemanager config files so lets now try openemr config file @

So /var/www/html/openemr/sites/default/config.php
remember always check for config file paths and view them if ever possible. Credentials are often found in these files.
remember Github will often show the config files so you can determine whether credentials are stored within them

We need to adjust the exploit script to point to the Documents folder, so maybe we can see the config file.

Now we can see it in the SMB share.

And we get credentials for mysql it looks like.

We find a table called users_secure and dump it to reveal an admin user and password hash.

admin:$2a$05$bJcIfCBjN5Fuh0K9qfoe0eRJqMdM49sWvuSGqv84VMMAkLgkK8XnC

And hashcat cracks it pretty quickly.

admin:thedoctor

We can probably use this to log in to openemr with this.

Once we’re in, we notice the version here:

Perhaps now we can use an authenticated exploit to get a shell on the target.

Triggering the exploit:

And catching the shell:

Privilege Escalation

There is a user white who we will probably want access to.

Actually no, we just need to test our thedoctor password on root.
remember ALWAYS CHECK ALL CREDENTIALS ON ALL USERS

Done!