{"id":583,"date":"2026-02-02T16:06:40","date_gmt":"2026-02-02T16:06:40","guid":{"rendered":"https:\/\/thecyberstaff.com\/?p=583"},"modified":"2026-02-02T16:06:41","modified_gmt":"2026-02-02T16:06:41","slug":"valentine-hackthebox-lab","status":"publish","type":"post","link":"https:\/\/thecyberstaff.com\/?p=583","title":{"rendered":"Valentine- Hackthebox lab"},"content":{"rendered":"\n<p>I began the lab by running an Nmap scan to identify open TCP and UDP ports. Based on the results, I chose to focus first on TCP ports <strong>80 (HTTP)<\/strong> and <strong>443 (HTTPS)<\/strong>, as these services often provide the largest attack surface and the most immediate opportunities for enumeration.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1024x576.png\" alt=\"\" class=\"wp-image-584\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1024x576.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-300x169.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-768x432.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"836\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1-1024x836.png\" alt=\"\" class=\"wp-image-585\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1-1024x836.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1-300x245.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1-768x627.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-1.png 1036w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The Nmap output revealed <strong><code>valentine.htb<\/code><\/strong> as a DNS hostname, so I added it to my local Kali machine\u2019s <code>\/etc\/hosts<\/code> file to ensure proper name resolution during enumeration.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"851\" height=\"327\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-2.png\" alt=\"\" class=\"wp-image-586\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-2.png 851w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-2-300x115.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-2-768x295.png 768w\" sizes=\"auto, (max-width: 851px) 100vw, 851px\" \/><\/figure>\n\n\n\n<p>The web server below is hosted on both 80 and 443.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-3-1024x576.png\" alt=\"\" class=\"wp-image-587\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-3-1024x576.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-3-300x169.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-3-768x432.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-3.png 1224w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Next, I ran <strong>Nikto<\/strong> against the web service to perform an initial vulnerability scan and identify common misconfigurations, outdated components, and potentially sensitive files exposed by the server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"487\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-4-1024x487.png\" alt=\"\" class=\"wp-image-588\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-4-1024x487.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-4-300x143.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-4-768x365.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-4.png 1501w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The Nikto output led me to the <strong><code>\/dev<\/code><\/strong> directory, which contained a notes file and an <strong>SSH private key that was stored in a hex-encoded format<\/strong>, requiring conversion back into a standard PEM file before it could be used.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"505\" height=\"318\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-5.png\" alt=\"\" class=\"wp-image-589\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-5.png 505w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-5-300x189.png 300w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"593\" height=\"241\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-6.png\" alt=\"\" class=\"wp-image-590\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-6.png 593w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-6-300x122.png 300w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"349\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-7-1024x349.png\" alt=\"\" class=\"wp-image-591\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-7-1024x349.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-7-300x102.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-7-768x262.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-7.png 1445w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I saved the extracted hex-encoded SSH key to a local file and converted it back into a usable PEM format using <code>xxd<\/code>. This allowed me to reconstruct the original RSA private key from its hexadecimal representation.<\/p>\n\n\n\n<p>Once converted, I verified the key format and then used <code>ssh2john<\/code> to extract a crackable hash from the encrypted key file. This enabled me to attempt offline passphrase attacks using John the Ripper, confirming that the key was password-protected and could not be used directly without first obtaining the correct passphrase. I was not successful in cracking the passphrase.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"784\" height=\"378\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-8.png\" alt=\"\" class=\"wp-image-592\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-8.png 784w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-8-300x145.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-8-768x370.png 768w\" sizes=\"auto, (max-width: 784px) 100vw, 784px\" \/><\/figure>\n\n\n\n<p>To further enumerate the HTTPS service on port <strong>443<\/strong>, I ran targeted Nmap scripts against the SSL\/TLS configuration. Using the <code>ssl-heartbleed<\/code> script, I discovered that the server was vulnerable to the <strong>Heartbleed<\/strong> vulnerability, which allows an attacker to leak sensitive information directly from the server\u2019s memory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"324\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-9-1024x324.png\" alt=\"\" class=\"wp-image-593\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-9-1024x324.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-9-300x95.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-9-768x243.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-9.png 1498w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I then used the <strong>Metasploit Heartbleed auxiliary module<\/strong> to exploit the vulnerability and dump portions of the server\u2019s memory, allowing me to search for sensitive data such as credentials and encryption passphrases.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"485\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-10.png\" alt=\"\" class=\"wp-image-594\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-10.png 774w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-10-300x188.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-10-768x481.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n\n\n\n<p>Within the memory dump, I identified a <strong>Base64-encoded string<\/strong> and decoded it, which revealed the <strong>passphrase for the encrypted SSH private key<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"561\" height=\"159\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-13.png\" alt=\"\" class=\"wp-image-597\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-13.png 561w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-13-300x85.png 300w\" sizes=\"auto, (max-width: 561px) 100vw, 561px\" \/><\/figure>\n\n\n\n<p>Using the recovered passphrase in combination with the decrypted SSH private key, I was able to successfully authenticate to the SSH service and gain a user-level shell on the target system.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"370\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-14.png\" alt=\"\" class=\"wp-image-598\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-14.png 688w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-14-300x161.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/figure>\n\n\n\n<p>After gaining a foothold, I ran the <strong>linPEAS<\/strong> privilege escalation script and discovered an active <strong>tmux session running under the root user<\/strong>, exposing a writable control socket that could potentially be attached to for privilege escalation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"162\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-15-1024x162.png\" alt=\"\" class=\"wp-image-599\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-15-1024x162.png 1024w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-15-300x47.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-15-768x122.png 768w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-15.png 1106w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>By running the single command below, I was able to attach to the exposed tmux session and escalate my privileges, gaining an interactive <strong>root shell<\/strong> on the system.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"46\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-16.png\" alt=\"\" class=\"wp-image-600\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-16.png 559w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-16-300x25.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"496\" height=\"177\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-17.png\" alt=\"\" class=\"wp-image-601\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-17.png 496w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/02\/image-17-300x107.png 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/figure>\n\n\n\n<p>This box demonstrated how multiple small security misconfigurations can chain together into a full system compromise. An outdated and vulnerable SSL implementation exposed sensitive memory through Heartbleed, ultimately leaking the passphrase for an encrypted SSH key. That initial foothold was then escalated to root due to an insecure tmux session running under the root user with an exposed control socket. Together, these issues highlight the importance of keeping cryptographic libraries up to date, properly securing sensitive credentials, and ensuring that administrative tools are not inadvertently accessible to unprivileged users.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I began the lab by running an Nmap scan to identify open TCP and UDP ports. Based on the results, I chose to focus first on TCP ports 80 (HTTP) and 443 (HTTPS), as these services often provide the largest attack surface and the most immediate opportunities for enumeration. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":602,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-583","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cybersecurity","category-pentesting"],"brizy_media":[],"_links":{"self":[{"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=583"}],"version-history":[{"count":1,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/583\/revisions"}],"predecessor-version":[{"id":603,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/583\/revisions\/603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/media\/602"}],"wp:attachment":[{"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}