{"componentChunkName":"component---src-templates-post-template-js","path":"/hackthebox-windows-optimum-en","result":{"data":{"markdownRemark":{"id":"36e4539c-ed5f-523d-a50e-ccb5d98ab1bc","html":"<blockquote>\n<p>This page has been machine-translated from the <a href=\"/hackthebox-windows-optimum\">original page</a>.</p>\n</blockquote>\n<p>I use the penetration-testing learning platform “Hack The Box” to study security.\nAt the time of writing this article, my rank on “Hack The Box” is ProHacker.</p>\n<img src=\"http://www.hackthebox.eu/badge/image/327080\" alt=\"Hack The Box\">\n<p>This time, I am writing up the retired HackTheBox machine “Optimum”.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 698px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/6a688e520d774e88f9f2bd541e436769/487bb/image-70.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 75%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAAC4klEQVQ4y3WTTW/cVBSGZ5c2bT3f/rq277U99tjjyYxnoqYkhUIBkRSERMWXQALBgkaIQpUWsigSVF3ABqlCrNkh8Q/4A0js+E0PxzOJQGKyeHWvj8/7+ny8bnW8mI1wDV0524OY7a6hE+XYfoHxpihd43gl0TCl55aosCbx56h4h1bbEdL/IAJuzNW+wc41r7xT8/L7S0xaiuAClS64Zmo8p+CKV+PLB1It770ZrYa4CZaIuVXMD4/f4ulHJ3z/yQOenL7JaDYnNAuScsHALAn0gjCpiSVm3AsEm1Yv9yPuvLvL3/ce8/svv/Lbk2f8+dk3HN7dQ/lTRvmcSVZjohmR3iGOBO78YsHtXsDRxy/w1+GH/CQVPnv7Hn+88QFH7+3j2xmdeI4rbVtSVagKYjWWCssLWhZBq2cwN0t+fHCbn5dHfHfjNZ5+ecBkrySwcxGs2QqWbNk1gYglKsXZJHi+kGt2xJVOSHaQ89Lxi9w+vkW5v4N2RqSmIBlKlf4MX54TI4LBSDZeba7QsjUqqfDikq2rimGQ0tEpVjdBD0J8lZP1UsZ9TeCmuH5JKjazvXEjaPgvul7Cdj/g1dfvcnL6LfcfnnJ8/xFfPDrl068+5+HJ19Q3DrGcCckg5bIzkwLEi03LebHZh9ZQ4+qS6e7zVMsDdC42KXaprt+keO4ANVnQ1RXdaEo7rOgnJcOspBdl6wr7QYP47FzfO34kG1RcageMb9mk+zaXLCXxkGGc4I1z3CJfnU46oh+u57+aYdeXdj29Qk/uPRWv0Qi7Qpa/xcu0jCOlrxLJaawleX4iHBmTv85vims1qg1UukMwmtG2zQqRtJlWe5hiSceRhcg/rbIJ4XgiYqMVxzUVyeS68GoRX8da7bPNBqOpiMzki4kM3ODoMWE2E1J5ZicZSailPRmF/a/FfHHDMMxXnCbW6ohF2gJL7NCguTcxaxitY3Kex9qyrPbg7H6e13Ak5zz2D3u8qeiUBOJRAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/6a688e520d774e88f9f2bd541e436769/8ac56/image-70.webp 240w,\n/static/6a688e520d774e88f9f2bd541e436769/d3be9/image-70.webp 480w,\n/static/6a688e520d774e88f9f2bd541e436769/d1b7f/image-70.webp 698w\"\n              sizes=\"(max-width: 698px) 100vw, 698px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/6a688e520d774e88f9f2bd541e436769/8ff5a/image-70.png 240w,\n/static/6a688e520d774e88f9f2bd541e436769/e85cb/image-70.png 480w,\n/static/6a688e520d774e88f9f2bd541e436769/487bb/image-70.png 698w\"\n            sizes=\"(max-width: 698px) 100vw, 698px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/6a688e520d774e88f9f2bd541e436769/487bb/image-70.png\"\n            alt=\"image-70.png\"\n            title=\"image-70.png\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<!-- omit in toc -->\n<h2 id=\"about-this-article\" style=\"position:relative;\"><a href=\"#about-this-article\" aria-label=\"about this article permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>About This Article</h2>\n<p><strong>The content of this article is not intended to encourage acts that are contrary to social order.</strong></p>\n<p>Please note in advance that attempting attacks against environments other than those you own or are authorized to use may violate the Act on the Prohibition of Unauthorized Computer Access (the Unauthorized Access Prohibition Act).</p>\n<p>All statements here are my own and do not represent any organization I belong to.</p>\n<!-- omit in toc -->\n<h2 id=\"table-of-contents\" style=\"position:relative;\"><a href=\"#table-of-contents\" aria-label=\"table of contents permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Table of Contents</h2>\n<ul>\n<li><a href=\"#enumeration\">Enumeration</a></li>\n<li><a href=\"#about-the-vulnerability\">About the Vulnerability</a></li>\n<li>\n<p><a href=\"#local-enumeration\">Local Enumeration</a></p>\n<ul>\n<li><a href=\"#ms16-032\">MS16-032</a></li>\n<li><a href=\"#ms16-034\">MS16-034</a></li>\n<li><a href=\"#ms16-135\">MS16-135</a></li>\n</ul>\n</li>\n<li><a href=\"#powershell-session\">PowerShell Session</a></li>\n<li><a href=\"#summary\">Summary</a></li>\n</ul>\n<h2 id=\"enumeration\" style=\"position:relative;\"><a href=\"#enumeration\" aria-label=\"enumeration permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Enumeration</h2>\n<p>As usual, I started with an Nmap scan.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">Starting Nmap <span class=\"token number\">7.92</span> <span class=\"token punctuation\">(</span> https://nmap.org <span class=\"token punctuation\">)</span> at <span class=\"token number\">2021</span>-10-27 <span class=\"token number\">20</span>:22 JST\nNmap scan report <span class=\"token keyword\">for</span> <span class=\"token number\">10.10</span>.10.8\nHost is up <span class=\"token punctuation\">(</span><span class=\"token number\">0</span>.30s latency<span class=\"token punctuation\">)</span>.\nNot shown: <span class=\"token number\">999</span> filtered tcp ports <span class=\"token punctuation\">(</span>no-response<span class=\"token punctuation\">)</span>\nPORT   STATE SERVICE VERSION\n<span class=\"token number\">80</span>/tcp <span class=\"token function\">open</span>  http    HttpFileServer httpd <span class=\"token number\">2.3</span>\n<span class=\"token operator\">|</span>_http-title: HFS /\n<span class=\"token operator\">|</span>_http-server-header: HFS <span class=\"token number\">2.3</span>\nService Info: OS: Windows<span class=\"token punctuation\">;</span> CPE: cpe:/o:microsoft:windows\n\nService detection performed. Please report any incorrect results at https://nmap.org/submit/ <span class=\"token builtin class-name\">.</span>\nNmap done: <span class=\"token number\">1</span> IP address <span class=\"token punctuation\">(</span><span class=\"token number\">1</span> <span class=\"token function\">host</span> up<span class=\"token punctuation\">)</span> scanned <span class=\"token keyword\">in</span> <span class=\"token number\">42.09</span> seconds</code></pre></div>\n<p>It seems that an application called <code class=\"language-text\">HttpFileServer httpd 2.3</code> is running.</p>\n<p>A quick search immediately turned up exploit code.</p>\n<p>Reference: <a href=\"https://www.exploit-db.com/exploits/49584\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">HFS (HTTP File Server) 2.3.x - Remote Command Execution (3) - Windows remote Exploit</a></p>\n<p>Using it as-is was enough to get a reverse shell.</p>\n<h2 id=\"about-the-vulnerability\" style=\"position:relative;\"><a href=\"#about-the-vulnerability\" aria-label=\"about the vulnerability permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>About the Vulnerability</h2>\n<p>The vulnerability exploited by this exploit code was <a href=\"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6287\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CVE-2014-6287</a>.</p>\n<blockquote>\n<p>The findMacroMarker function in parserLib.pas in Rejetto HTTP File Server (aks HFS or HttpFileServer) 2.3x before 2.3c allows remote attackers to execute arbitrary programs via a %00 sequence in a search action.</p>\n</blockquote>\n<p>It appears that entering <code class=\"language-text\">%00</code> into the search box allows arbitrary code execution.</p>\n<p>In terms of vulnerability classification, it falls under <a href=\"http://cwe.mitre.org/data/definitions/158.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CWE-158: Improper Neutralization of Null Byte or NUL Character</a>.</p>\n<p>In this case, the issue was that a regular expression in <code class=\"language-text\">parserLib.pas</code> did not properly handle NULL bytes, so if <code class=\"language-text\">%00</code> was entered into the search box, the command that followed it would be executed.</p>\n<p>By exploiting this vulnerability, I was able to obtain a reverse shell.</p>\n<h2 id=\"local-enumeration\" style=\"position:relative;\"><a href=\"#local-enumeration\" aria-label=\"local enumeration permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Local Enumeration</h2>\n<p>For the time being, I ran winPEAS.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">Basic System Information\nCheck <span class=\"token keyword\">if</span> the Windows versions is vulnerable to some known exploit https:<span class=\"token operator\">/</span><span class=\"token operator\">/</span>book<span class=\"token punctuation\">.</span>hacktricks<span class=\"token punctuation\">.</span>xyz/windows/windows-local-privilege-escalation<span class=\"token comment\">#kernel-exploits</span>\n    Hostname: optimum\n    ProductName: Windows Server 2012 R2 Standard\n    EditionID: ServerStandard\n    ReleaseId: \n    BuildBranch: \n    CurrentMajorVersionNumber: \n    CurrentVersion: 6<span class=\"token punctuation\">.</span>3\n    Architecture: AMD64\n    ProcessorCount: 2\n    SystemLang: en-US\n    KeyboardLang: English <span class=\"token punctuation\">(</span>United States<span class=\"token punctuation\">)</span>\n    TimeZone: <span class=\"token punctuation\">(</span>UTC+02:00<span class=\"token punctuation\">)</span> Athens<span class=\"token punctuation\">,</span> Bucharest\n    IsVirtualMachine: True\n    Current Time: 3/11/2021 1:02:07 ??\n    HighIntegrity: False\n    PartOfDomain: False\n    Hotfixes: KB2959936<span class=\"token punctuation\">,</span> KB2896496<span class=\"token punctuation\">,</span> KB2919355<span class=\"token punctuation\">,</span> KB2920189<span class=\"token punctuation\">,</span> KB2928120<span class=\"token punctuation\">,</span> KB2931358<span class=\"token punctuation\">,</span> KB2931366<span class=\"token punctuation\">,</span> KB2933826<span class=\"token punctuation\">,</span> KB2938772<span class=\"token punctuation\">,</span> KB2949621<span class=\"token punctuation\">,</span> KB2954879<span class=\"token punctuation\">,</span> KB2958262<span class=\"token punctuation\">,</span> KB2958263<span class=\"token punctuation\">,</span> KB2961072<span class=\"token punctuation\">,</span> KB2965500<span class=\"token punctuation\">,</span> KB2966407<span class=\"token punctuation\">,</span> KB2967917<span class=\"token punctuation\">,</span> KB2971203<span class=\"token punctuation\">,</span> KB2971850<span class=\"token punctuation\">,</span> KB2973351<span class=\"token punctuation\">,</span> KB2973448<span class=\"token punctuation\">,</span> KB2975061<span class=\"token punctuation\">,</span> KB2976627<span class=\"token punctuation\">,</span> KB2977629<span class=\"token punctuation\">,</span> KB2981580<span class=\"token punctuation\">,</span> KB2987107<span class=\"token punctuation\">,</span> KB2989647<span class=\"token punctuation\">,</span> KB2998527<span class=\"token punctuation\">,</span> KB3000850<span class=\"token punctuation\">,</span> KB3003057<span class=\"token punctuation\">,</span> KB3014442<span class=\"token punctuation\">,</span> \n\n  <span class=\"token punctuation\">[</span>?<span class=\"token punctuation\">]</span> Windows vulns search powered by Watson<span class=\"token punctuation\">(</span>https:<span class=\"token operator\">/</span><span class=\"token operator\">/</span>github<span class=\"token punctuation\">.</span>com/rasta-mouse/Watson<span class=\"token punctuation\">)</span></code></pre></div>\n<p>I confirmed that it was a 64-bit Windows Server 2012 R2 system.</p>\n<p>Because Watson’s vulnerability search only works on Windows Server 2016 and later, I used <code class=\"language-text\">Sherlock</code> for enumeration.</p>\n<p>I confirmed that the system was affected by the following three vulnerabilities.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">Title      : Secondary Logon Handle\nMSBulletin : MS16-032\nCVEID      : 2016-0099\nLink       : https:<span class=\"token operator\">/</span><span class=\"token operator\">/</span>www<span class=\"token punctuation\">.</span>exploit-db<span class=\"token punctuation\">.</span>com/exploits/39719/\nVulnStatus : Appears Vulnerable\n\nTitle      : Windows Kernel-Mode Drivers EoP\nMSBulletin : MS16-034\nCVEID      : 2016-0093/94/95/96\nLink       : https:<span class=\"token operator\">/</span><span class=\"token operator\">/</span>github<span class=\"token punctuation\">.</span>com/SecWiki/windows-kernel-exploits/tree/master/MS16-034?\nVulnStatus : Appears Vulnerable\n\nTitle      : Win32k Elevation of Privilege\nMSBulletin : MS16-135\nCVEID      : 2016-7255\nLink       : https:<span class=\"token operator\">/</span><span class=\"token operator\">/</span>github<span class=\"token punctuation\">.</span>com/FuzzySecurity/PSKernel-Primitives/tree/master/Sample-Exploits/MS16-135\nVulnStatus : Appears Vulnerable</code></pre></div>\n<h3 id=\"ms16-032\" style=\"position:relative;\"><a href=\"#ms16-032\" aria-label=\"ms16 032 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>MS16-032</h3>\n<p>This is a vulnerability in which Secondary Logon does not properly manage request handles in memory, allowing arbitrary code execution with administrator privileges.</p>\n<p>Reference: <a href=\"https://docs.microsoft.com/en-us/security-updates/securitybulletins/2016/ms16-032\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Microsoft Security Bulletin MS16-032 - Important | Microsoft Docs</a></p>\n<p><code class=\"language-text\">Secondary Logon</code> is a service that allows a process to be started with different credentials, and it is used by the “Run as different user” feature.</p>\n<h3 id=\"ms16-034\" style=\"position:relative;\"><a href=\"#ms16-034\" aria-label=\"ms16 034 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>MS16-034</h3>\n<p>This is a vulnerability in the way Windows kernel-mode drivers manage objects in memory, and it appears to allow arbitrary code execution.</p>\n<p>Reference: <a href=\"https://docs.microsoft.com/ja-jp/security-updates/securitybulletins/2016/ms16-034\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Microsoft Security Bulletin MS16-034 | Microsoft Docs</a></p>\n<p>The exploit is <a href=\"https://github.com/kash1064/windows-kernel-exploits/blob/master/MS16-034/MS16-034-exp.cpp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">here</a>.</p>\n<h3 id=\"ms16-135\" style=\"position:relative;\"><a href=\"#ms16-135\" aria-label=\"ms16 135 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>MS16-135</h3>\n<p>This appears to be a vulnerability that leaks information from the kernel, leading to an ASLR bypass.</p>\n<p>Reference: <a href=\"https://docs.microsoft.com/ja-jp/security-updates/securitybulletins/2016/ms16-135\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Microsoft Security Bulletin MS16-135 | Microsoft Docs</a></p>\n<h2 id=\"powershell-session\" style=\"position:relative;\"><a href=\"#powershell-session\" aria-label=\"powershell session permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>PowerShell Session</h2>\n<p>Since MS16-032 and MS16-034 are vulnerabilities that allow RCE with administrator privileges, I decided to use one of them.</p>\n<p>When I looked for exploit code, I found a script for MS16-032 that can be run from PowerShell, so I used that one.</p>\n<p>First, MS16-032 can only be exploited from a 64-bit process.</p>\n<p>Therefore, the process from which the reverse shell was obtained also needs to be 64-bit.</p>\n<p>You can easily determine whether the currently running process is 64-bit by using the following .NET command.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\"><span class=\"token namespace\">[Environment]</span>::Is64BitProcess</code></pre></div>\n<p>Reference: <a href=\"https://docs.microsoft.com/en-us/dotnet/api/system.environment.is64bitprocess?view=net-5.0\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Environment.Is64BitProcess Property (System) | Microsoft Docs</a></p>\n<p>The paths for 64-bit and 32-bit PowerShell are as follows, so it may be useful to remember them for later.</p>\n<ul>\n<li>64-bit PowerShell : <code class=\"language-text\">C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe</code></li>\n<li>32-bit PowerShell : <code class=\"language-text\">C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe</code></li>\n</ul>\n<p>The table below shows the combinations of CPU/OS/application bitness and the bitness of the resulting process.</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>CPU</th>\n<th>OS</th>\n<th>Process</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>32-bit CPU</td>\n<td>32bit</td>\n<td>32bit</td>\n<td>32bit</td>\n</tr>\n<tr>\n<td>32-bit OS</td>\n<td>64bit</td>\n<td>32bit</td>\n<td>32bit</td>\n</tr>\n<tr>\n<td>32-bit application</td>\n<td>64bit</td>\n<td>64bit</td>\n<td>32bit(WOW)</td>\n</tr>\n<tr>\n<td>64-bit application</td>\n<td>64bit</td>\n<td>64bit</td>\n<td>64bit</td>\n</tr>\n</tbody>\n</table>\n<p>In this case, the CPU and OS architecture are 64-bit, but if you run 32-bit PowerShell, the process also becomes 32-bit.</p>\n<p>So, after obtaining a reverse shell in a 64-bit process and firing off the MS16-032 exploit, I was able to get root privileges.</p>\n<h2 id=\"summary\" style=\"position:relative;\"><a href=\"#summary\" aria-label=\"summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Summary</h2>\n<p>I decided to study hacking seriously, so for now I will keep solving retired machines.</p>","fields":{"slug":"/hackthebox-windows-optimum-en","tagSlugs":["/tag/hack-the-box-en/","/tag/windows-en/","/tag/easy-box-en/","/tag/english/"]},"frontmatter":{"date":"2021-10-28","description":"A writeup of the retired HackTheBox machine 'Optimum'.","tags":["HackTheBox (en)","Windows (en)","EasyBox (en)","English"],"title":"HackTheBox Writeup: Optimum (Easy/Windows)","socialImage":{"publicURL":"/static/dc4d8b7f8795f3c3d3489d9957d155f2/no-image.png"}}}},"pageContext":{"slug":"/hackthebox-windows-optimum-en"}},"staticQueryHashes":["251939775","401334301","825871152"]}