{"id":554,"date":"2026-01-01T21:56:21","date_gmt":"2026-01-01T21:56:21","guid":{"rendered":"https:\/\/thecyberstaff.com\/?p=554"},"modified":"2026-01-01T21:57:40","modified_gmt":"2026-01-01T21:57:40","slug":"expressway-hackthebox-lab","status":"publish","type":"post","link":"https:\/\/thecyberstaff.com\/?p=554","title":{"rendered":"Expressway- Hackthebox lab"},"content":{"rendered":"\n<p>I began this lab by running <strong>Nmap<\/strong> to identify open TCP and UDP ports on the target system. During the scan, I noticed that <strong>UDP port 500<\/strong> was open, which immediately suggested the presence of an <strong>IPsec\/IKE VPN<\/strong> service.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"538\" height=\"399\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image.png\" alt=\"\" class=\"wp-image-556\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image.png 538w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-300x222.png 300w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/figure>\n\n\n\n<p>Given the open UDP 500 port, I decided to enumerate the service for common IPsec\/IKE weaknesses. I used <strong>ike-scan<\/strong> to probe the service and successfully received an <strong>Aggressive Mode<\/strong> response. This response revealed both a domain name and a valid username: <code>ike<\/code>.<\/p>\n\n\n\n<p>Unfortunately, I forgot to capture a screenshot of this output. Afterward, I downgraded to the Hack The Box free tier, which meant I no longer had access to machine resets, preventing me from re-running the scan successfully. Lesson learned\u2014always take screenshots immediately. I may update this post later if I\u2019m able to reproduce the output.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"147\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-1.png\" alt=\"\" class=\"wp-image-557\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-1.png 906w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-1-300x49.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-1-768x125.png 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/figure>\n\n\n\n<p>Despite this, I was able to <strong>exfiltrate the IKE handshake<\/strong> and save it to a file for offline analysis.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"116\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-3.png\" alt=\"\" class=\"wp-image-559\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-3.png 727w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-3-300x48.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p><strong>Cracking the Pre-Shared Key<\/strong><\/p>\n\n\n\n<p>Using the captured handshake, I ran <strong>psk-crack<\/strong>, which successfully recovered the <strong>pre-shared key<\/strong> associated with the <code>ike<\/code> user. With valid credentials in hand, I attempted an SSH login and was able to authenticate successfully as the <code>ike<\/code> user.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"204\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-2.png\" alt=\"\" class=\"wp-image-558\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-2.png 904w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-2-300x68.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-2-768x173.png 768w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" \/><\/figure>\n\n\n\n<p>Privilege Escalation Enumeration<\/p>\n\n\n\n<p>Once logged in, I transferred <strong>linPEAS<\/strong> to the target system and ran it to enumerate potential privilege escalation vectors. One result immediately stood out: the <strong>installed sudo version<\/strong> appeared to be vulnerable.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"893\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-4.png\" alt=\"\" class=\"wp-image-560\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-4.png 794w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-4-267x300.png 267w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-4-768x864.png 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"265\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-5.png\" alt=\"\" class=\"wp-image-561\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-5.png 901w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-5-300x88.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-5-768x226.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><\/figure>\n\n\n\n<p>I researched local privilege escalation exploits for the identified sudo version and found a promising entry on <strong>Exploit Database<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"620\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-6.png\" alt=\"\" class=\"wp-image-562\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-6.png 780w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-6-300x238.png 300w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-6-768x610.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/figure>\n\n\n\n<p><strong>Exploit Title:<\/strong> Sudo chroot 1.9.17 \u2013 Local Privilege Escalation<br><strong>Exploit Author:<\/strong> Stratascale<br><strong>Date:<\/strong> Mon, 30 Jun 2025<br><strong>CVE:<\/strong> CVE-2025-32463<br><strong>Affected Versions:<\/strong> Sudo 1.9.14 to 1.9.17 (inclusive)<\/p>\n\n\n\n<p>Vulnerability Details<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Background<\/h3>\n\n\n\n<p>This vulnerability abuses sudo\u2019s <code>-R<\/code> (<code>--chroot<\/code>) option. Although the option is intended to allow execution within a user-specified root directory (when permitted by sudoers), a change introduced in sudo 1.9.14 caused paths to be resolved <strong>inside the user-controlled chroot<\/strong> <em>before<\/em> sudoers evaluation was complete.<\/p>\n\n\n\n<p>An attacker can exploit this behavior by crafting a malicious <code>nsswitch.conf<\/code> inside the chroot environment, tricking sudo into loading an arbitrary shared library and ultimately executing code as root.<\/p>\n\n\n\n<p>The issue was reverted in sudo 1.9.17p1, and the chroot feature has since been deprecated and is slated for removal in a future release due to its inherent risk.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Exploit Overview<\/h3>\n\n\n\n<p>The exploit works by:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Spawning a root shell.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creating a temporary chroot directory.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Injecting a malicious <code>nsswitch.conf<\/code>.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Compiling a rogue <code>libnss<\/code> shared object.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Triggering sudo with the <code>-R<\/code> option to load the malicious library.<\/li>\n<\/ul>\n\n\n\n<p>Since the system was vulnerable, I copied and executed the proof-of-concept exploit script.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"568\" height=\"203\" src=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-7.png\" alt=\"\" class=\"wp-image-563\" srcset=\"https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-7.png 568w, https:\/\/thecyberstaff.com\/wp-content\/uploads\/2026\/01\/image-7-300x107.png 300w\" sizes=\"auto, (max-width: 568px) 100vw, 568px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Result<\/h3>\n\n\n\n<p>Running the exploit successfully escalated my privileges to <strong>root<\/strong>, completing the box.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I began this lab by running Nmap to identify open TCP and UDP ports on the target system. During the scan, I noticed that UDP port 500 was open, which immediately suggested the presence of an IPsec\/IKE VPN service. Given the open UDP 500 port, I decided to enumerate the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-554","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\/554","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=554"}],"version-history":[{"count":1,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions"}],"predecessor-version":[{"id":564,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions\/564"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=\/wp\/v2\/media\/565"}],"wp:attachment":[{"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecyberstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}