<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet href="/scripts/pretty-feed-v3.xsl" type="text/xsl"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:h="http://www.w3.org/TR/html4/"><channel><title>Hack Your Heart</title><link>https://h4cker.zip/tags/hack-the-box/</link><description>临渊羡鱼，不如退而结网</description><generator>Hugo 0.168.0</generator><language>en</language><atom:link href="https://h4cker.zip/tags/hack-the-box/rss.xml" rel="self" type="application/rss+xml"/><lastBuildDate>Tue, 14 Nov 2023 13:37:19 +0800</lastBuildDate><item><title>Hack The Box - Keeper</title><link>https://h4cker.zip/5060e8/</link><pubDate>Tue, 14 Nov 2023 13:37:19 +0800</pubDate><guid isPermaLink="true">https://h4cker.zip/5060e8/</guid><description/><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>好久没打HTB了，之前不打是因为免费的用完了。今天才知道Starting Point里就是玩的，Machines分区有许多免费靶机用。工作空闲时打一下。</p>
<p>:::warning
我使用Windows系统，在用OpenVPN Connect时无法连接HTB，但是用openvpn内置的openvpn-gui就能成功连接
:::</p>
<p><code>nmap -sV -sC -vv 10.10.11.227</code></p>
<p><img
  src="/5060e8/Keeper_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="669" height="311"
/>
</p>
<p>访问80服务，给了一个跳转链接</p>
<p><img
  src="/5060e8/Keeper_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="484" height="159"
/>
</p>
<p>点击会访问失败，链接文本说缺少IT支持，那应该就是在hosts文件里把这个域名加进去，如图</p>
<p><img
  src="/5060e8/Keeper_3.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="263" height="56"
/>
</p>
<p>刷新DNS，<code>ipconfig /flushdns</code></p>
<p>然后再访问，不要开代理。即可访问成功</p>
<p><img
  src="/5060e8/Keeper_4.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="574" height="300"
/>
</p>
<p>然后弱口令，root/password</p>
<p>在菜单栏的“管理员”：用户：选择里有两个用户</p>
<p><img
  src="/5060e8/Keeper_5.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="465" height="322"
/>
</p>
<p>我们是root，那上面这个用户就要仔细研究一下</p>
<p><img
  src="/5060e8/Keeper_6.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1138" height="397"
/>
</p>
<p>点进去，发现是丹麦人。在注释里有这样一句话</p>
<p><em>New user. Initial password set to Welcome2023!</em></p>
<p>所以我们ssh使用这个用户密码登录靶机</p>
<p><img
  src="/5060e8/Keeper_7.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="416" height="151"
/>
</p>
<p>user.txt就是第一个flag</p>
<p>有个RT30000.zip文件，解压后里面有两个文件，分别是<code>KeePassDumpFull.dmp</code>、<code>passcodes.kdbx</code></p>
<blockquote>
<p>KeePass 是一款免费的开源密码管理器，可以帮助您安全地管理密码。您可以将所有密码存储在一个数据库中，该数据库由一把主钥匙锁定。因此，你只需记住一个主密钥，就能解锁整个数据库。数据库文件使用目前已知最好、最安全的加密算法（AES-256、ChaCha20 和 Twofish）进行加密。</p>
</blockquote>
<p>这个系统有个漏洞CVE-2023-32784，KeePass文本框内容输入时，会在其进程内存中创建托管字符串，如果将其内存进行转储，则会导致主密码泄露问题。</p>
<p>而这个dmp格式就是内存转储的保存格式，故<code>KeePassDumpFull.dmp</code>里存在密码泄漏的东西，我使用了这个脚本：https://github.com/CMEPW/keepass-dump-masterkey</p>
<p>因为这个靶机不太好下载github文件，而这个脚本是单文件，方便我直接粘贴到靶机里。</p>
<p>解开后是这样的</p>
<p><img
  src="/5060e8/Keeper_8.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="533" height="258"
/>
</p>
<p>Google一下，发现是丹麦的甜点，结合用户是丹麦人，密码大概率就是这个甜点</p>
<p><img
  src="/5060e8/Keeper_9.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="708" height="307"
/>
</p>
<p>从上面的解密文档里可以看出，并不是英语，而是丹麦语。但是系统无法显示丹麦语，所以部分字母变成了英文字母。单词首字母小写，单词之间的空格也是密码的一部分（我输错好几次，仔细观察才知道）</p>
<p>密码猜测为：<code>rødgrød med fløde</code></p>
<p><code>passcodes.kdbx</code>就是KeePass创建的加密库咯，下载一个KeePass然后打开这个文件，输入密码</p>
<p>双击第一行root的title，或者右键第一行点击Edit Entry，看到下图</p>
<p><img
  src="/5060e8/Keeper_10.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="492" height="475"
/>
</p>
<p>这里的密码没有用处，Notes里的文本明显是PuTTY的配置文件，将其复制存为ppk文件，然后通过PuTTY加载此ppk连接终端</p>
<p>使用ppk连接需要进行以下设置：</p>
<p>Connection：Data里Auto-login username里填写<code>root</code></p>
<p><img
  src="/5060e8/Keeper_11.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="452" height="442"
/>
</p>
<p>Connection：SSH：Auth：Credentials里Private key file for authentication加载私钥，就是那个ppk文件</p>
<p><img
  src="/5060e8/Keeper_12.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="452" height="442"
/>
</p>
<p>Session里填写IP，然后Open，终端就连上了，也是root用户，直接查看root的flag即可</p>
<p><img
  src="/5060e8/Keeper_13.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="661" height="418"
/>
</p>
]]></content:encoded><h:img src="https://h4cker.zip/5060e8/Keeper_cover.webp"/><enclosure url="https://h4cker.zip/5060e8/Keeper_cover.webp"/><category>Hack The Box</category><category>KeePass</category></item><item><title>Hack The Box - TIER 2 - Archetype Oopsie Vaccine Unified</title><link>https://h4cker.zip/fcd2b5/</link><pubDate>Thu, 03 Mar 2022 20:12:49 +0800</pubDate><guid isPermaLink="true">https://h4cker.zip/fcd2b5/</guid><description/><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>这个阶段的，终于不是之前的傻乎乎操作了，到这我才知道，那些问答不是先问答再渗透的。原来是渗透一步回答相应问题，这里涉及到了许多工具、脚本、提权、端口等知识点，收获丰富。</p>
<h2 id="archetype">Archetype<a class="anchor" href="#archetype">#</a></h2>
<blockquote>
<p>TASK 1</p>
<p>Which TCP port is hosting a database server?</p>
<p>哪个 TCP 端口托管数据库服务器？</p>
<p>答案：1433</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What is the name of the non-Administrative share available over SMB?</p>
<p>SMB 上可用的非管理共享的名称是什么？</p>
<p>答案：backups</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What is the password identified in the file on the SMB share?</p>
<p>SMB 共享文件中标识的密码是什么？</p>
<p>答案：M3g4c0rp123</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What script from Impacket collection can be used in order to establish an authenticated connection to a Microsoft SQL Server?</p>
<p>可以使用 Impacket 集合中的哪些脚本来建立到 Microsoft SQL Server 的经过身份验证的连接？</p>
<p>答案：mssqlclient.py</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What extended stored procedure of Microsoft SQL Server can be used in order to spawn a Windows command shell?</p>
<p>可以使用 Microsoft SQL Server 的哪些扩展存储过程来生成 Windows 命令外壳？</p>
<p>答案：xp_cmdshell</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What script can be used in order to search possible paths to escalate privileges on Windows hosts?</p>
<p>可以使用什么脚本来搜索提升 Windows 主机权限的可能路径？</p>
<p>答案：winpeas</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What file contains the administrator&rsquo;s password?</p>
<p>哪个文件包含管理员的密码？</p>
<p>答案：ConsoleHost_history.txt</p>
</blockquote>
<p>先nmap扫一扫</p>
<p><img
  src="/fcd2b5/Archetype_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="789" height="390"
/>
</p>
<p>看到139端口和445端口就知道是SMB了，同时1433端口也是个敏感端口，是mssql，这里先从SMB下手使用<code>-L</code>命令列出共享文件夹</p>
<p><img
  src="/fcd2b5/Archetype_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="791" height="299"
/>
</p>
<p>带美元符号的是管理员权限，这里我们使用<code>-N</code>符号连接backups，发现有一个dtsConfig文件，这个文件是SSIS的配置文件，SSIS是SQL Server Integration Services，先get下来</p>
<p><img
  src="/fcd2b5/Archetype_3.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="787" height="287"
/>
</p>
<p>查看内容，里面包括了SQL服务的账户密码</p>
<p><img
  src="/fcd2b5/Archetype_4.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="791" height="301"
/>
</p>
<p>既然获得了账户密码，这里使用kali自带的mssql客户端impacket-mssqlclient来连接靶机上的SQL服务</p>
<p><img
  src="/fcd2b5/Archetype_5.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="781" height="490"
/>
</p>
<p>输入help指令显示了可用命令，这里的<code>enable_xp_cmdshell</code>是允许启用系统cmd命令行的指令。<code>xp_cmdshell {cmd}</code>是执行cmd命令的。那这里就先允许启用命令行，然后根据终端上的提示输入重置命令</p>
<p><img
  src="/fcd2b5/Archetype_6.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1185" height="93"
/>
</p>
<p>这里尝试cmd能否使用，并且测试是否有nc命令，如果有就可以通过反弹shell建立起一个持续性的shell。</p>
<p><img
  src="/fcd2b5/Archetype_7.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="678" height="413"
/>
</p>
<p>很可惜没有nc，但是cmd命令行可以用，那我们尝试传一个nc程序过去。这里是提前在kali里存一个nc.exe，然后开启http服务，在靶机里使用wget命令远程下载kali里的文件。这里注意提前将启动http服务的终端进入到存有nc.exe的文件夹里，这样http服务的根目录就是此文件夹，下载nc也更方便。</p>
<p>先查看kali IP</p>
<p><img
  src="/fcd2b5/Archetype_8.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="751" height="72"
/>
</p>
<p>kali开启http服务</p>
<p><img
  src="/fcd2b5/Archetype_9.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="673" height="68"
/>
</p>
<p>靶机下载kali里的nc文件，注意下载的文件夹，其他的文件夹会因为没有权限下载不进去</p>
<p><img
  src="/fcd2b5/Archetype_10.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="785" height="209"
/>
</p>
<p>kali这边也显示文件已被get</p>
<p><img
  src="/fcd2b5/Archetype_11.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="717" height="109"
/>
</p>
<p>这个时候进行反弹shell，kali开启监听，靶机主动连接kali</p>
<p><img
  src="/fcd2b5/Archetype_12.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="788" height="200"
/>
</p>
<p>kali这边已经获得了靶机的shell</p>
<p><img
  src="/fcd2b5/Archetype_13.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="657" height="249"
/>
</p>
<p>Windows列文件是dir，在经过一番寻找后，flag在此用户桌面上</p>
<p><img
  src="/fcd2b5/Archetype_14.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="584" height="341"
/>
</p>
<p>到这我以为结束了，没想到还有一问，管理员账户里还有一个flag，那我们这获取的也是普通用户sql_svc的shell，这里需要提权了。Windows提权，通过资料，这里使用一款叫做winPEAS的工具，它会检索整个系统路径，有搞头的路径或文件会被红色文字列出来。这里还是提前准备winPEAS，靶机下载后，在刚才那个已经连上的shell里直接运行。</p>
<p><img
  src="/fcd2b5/Archetype_15.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="871" height="838"
/>
</p>
<p>运行需要一段时间因为在检索整个系统，结束后会标出可利用文件路径</p>
<p><img
  src="/fcd2b5/Archetype_16.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="807" height="219"
/>
</p>
<p>这个ConsoleHost_history.txt是记录了控制台命令历史记录，查看一下</p>
<p><img
  src="/fcd2b5/Archetype_17.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1302" height="99"
/>
</p>
<p>里面记录了管理员账号与密码，kali尝试使用psexec.py脚本连接。psexec 是 windows 下非常好的一款远程命令行工具。psexec的使用不需要对方主机开机3389端口，只需要对方开启admin$共享(该共享默认开启)。但是，假如目标主机开启了防火墙，psexec也是不能使用的，会提示找不到网络路径。由于psexec是windows提供的工具，所以杀毒软件会将其添加到白名单中。</p>
<p><img
  src="/fcd2b5/Archetype_18.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="796" height="334"
/>
</p>
<p>搜索一番后，管理员的flag也在桌面</p>
<p><img
  src="/fcd2b5/Archetype_19.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="480" height="46"
/>
</p>
<p>这个靶机质量可以，学到很多。</p>
<h2 id="oopsie">Oopsie<a class="anchor" href="#oopsie">#</a></h2>
<p>HTB是先做题在回答相关问题，所以后面先写渗透靶机的过程，最后写问题答案</p>
<p>这个也好玩，首先nmap，探测到了22端口和80端口，但是ssh不知道密码无法连接，所以去网页看一看</p>
<p>在网页底部发现了这句提示</p>
<p><img
  src="/fcd2b5/Oopsie_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="355" height="223"
/>
</p>
<p>需要登陆来访问，所以我们的方向转为登录这个站，登录点在哪？这里我是打开源代码发现的</p>
<p><img
  src="/fcd2b5/Oopsie_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="341" height="127"
/>
</p>
<p>在最后的加载js脚本地方发现了，加载登录的脚本，打开这个login路径试试。</p>
<p><img
  src="/fcd2b5/Oopsie_3.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="562" height="479"
/>
</p>
<p>成功找到登陆页面，但是尝试了许多弱口令后都不行，注入也失败，这里看到登录页面有一个<code>Login as Guest</code>，游客登录，我们就以游客登录看看。</p>
<p><img
  src="/fcd2b5/Oopsie_4.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1005" height="585"
/>
</p>
<p>随便点点，（渗透就是要多点点）</p>
<p>在Acount这里发现url里参数content传递了account，id传递的2</p>
<p><img
  src="/fcd2b5/Oopsie_5.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="769" height="395"
/>
</p>
<p>account就是当前页面，id=2应该是当前用户的意思。我们这里试着将id改为1</p>
<p><img
  src="/fcd2b5/Oopsie_6.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="666" height="363"
/>
</p>
<p>居然切换到了admin用户，这叫啥漏洞呢，未授权还是垂直越权。但没什么用，这个页面没啥利用点。其他页面仍然没有啥亮点。Uploads页面的上传功能是我们唯一利用点，但是这里限制了权限，我们就要越权。在这里发现了Cookie</p>
<p><img
  src="/fcd2b5/Oopsie_7.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="682" height="427"
/>
</p>
<p>我们把role值改为admin，user值改为之前admin的access id</p>
<p><img
  src="/fcd2b5/Oopsie_8.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1008" height="483"
/>
</p>
<p>哇哇哇，干他，这里使用kali自带的php shell，由于我不太了解kali的web shell工具，所以这里采用反弹shell的方式，把shell复制过来一份再修改成自己的ip和监听端口。</p>
<p><img
  src="/fcd2b5/Oopsie_9.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1002" height="388"
/>
</p>
<p>上传成功，终端开启监听</p>
<p><img
  src="/fcd2b5/Oopsie_10.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="825" height="368"
/>
</p>
<p>现在我们需要访问这个shell 文件，他就会运行代码，但我们不知道上传路径。这里使用gobuster工具爆破路径。我kali里没有，<code>apt-get install gobuster</code>安装即可。gobuster有俩模式爆破目录和，dns子域名，所以需要先选择dir模式。&ndash;url表示url，&ndash;w表示使用哪个爆破字典，-x表示检索哪种文件扩展名，这个可选。这里使用dirb的小字典。</p>
<p><img
  src="/fcd2b5/Oopsie_11.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="881" height="555"
/>
</p>
<p>给我严查uploads，访问这个文件夹没权限，那访问此文件夹里的php-reverse-shell.php文件试试。</p>
<p><img
  src="/fcd2b5/Oopsie_12.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="781" height="260"
/>
</p>
<p>弹回来了，但是www-data权限太低，而且这个终端太难用。这里使用运行python代码，打开/bin/bash，并查看/etc/passwd文件</p>
<p><img
  src="/fcd2b5/Oopsie_13.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="634" height="141"
/>
</p>
<p>发现了robert，去robert目录看看</p>
<p><img
  src="/fcd2b5/Oopsie_14.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="450" height="196"
/>
</p>
<p>出了一个flag，不出所料应该还有，并且提权才能拿到</p>
<p>现在去登录文件夹寻找蛛丝马迹</p>
<p><img
  src="/fcd2b5/Oopsie_15.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="633" height="108"
/>
</p>
<p>经过一番cat，db.php里有robert账号密码</p>
<p><img
  src="/fcd2b5/Oopsie_16.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="713" height="131"
/>
</p>
<p>切换到robert用户，并查看有哪些可用命令</p>
<p><img
  src="/fcd2b5/Oopsie_17.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1029" height="276"
/>
</p>
<p>好像是用户组不太行，没权限，我们查看一下组</p>
<p><img
  src="/fcd2b5/Oopsie_18.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="720" height="95"
/>
</p>
<p>根据前面也说了robert属于bugtracker，我们查找一下bugtracker，但居然是个文件，那就看一下权限再输出他的文件类型</p>
<p><img
  src="/fcd2b5/Oopsie_19.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1024" height="219"
/>
</p>
<p>可执行文件，运行试试</p>
<p><img
  src="/fcd2b5/Oopsie_20.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="535" height="300"
/>
</p>
<p>这个程序是cat一个路径然后将内容输出，不存在的编号就会显示无文件。可以利用这个点提权</p>
<p><strong>思路</strong>：bugtracker本来无权进入root目录的，但是使用了setid，使bugtracker暂时拥有了root权限，并且调用cat命令，直接调用cat命令调的是环境变量中的cat，那我们做一个恶意的cat命令，再把这个恶意的cat命令所在文件夹设置为环境变量，那bugtracker调用的就是恶意cat，具体命令如下：</p>
<div class="code-block highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl"><span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/tmp:<span class="nv">$PATH</span>				//将/tmp目录设置为环境变量
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="nb">cd</span> /tmp/							//切换到/tmp目录下
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="nb">echo</span> <span class="s1">&#39;/bin/sh&#39;</span> &gt; cat				//在此构造恶意的cat命令
</span></span><span class="line"><span class="ln">4</span><span class="cl">chmod +x cat						//赋予执行权限</span></span></code></pre><span class="language ps-1 pe-3 text-sm bg-muted text-muted-foreground">bash</span><button class="copy text-muted-foreground p-1 box-content border rounded-lg bg-card" aria-label="Copy code"><div class="ready"><svg
  aria-hidden="true"
  class="pure-icon size-5"
  width="22"
  height="22"
  viewBox="0 0 24 24"
  fill="currentColor"><g fill="none"><path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"></path><path fill="currentColor" d="M15 2c.683 0 1.287.343 1.647.866l.085.134H18a2 2 0 0 1 1.995 1.85L20 5v12a5 5 0 0 1-4.783 4.995L15 22H6a2 2 0 0 1-1.995-1.85L4 20V5a2 2 0 0 1 1.85-1.995L6 3h1.268a2 2 0 0 1 1.563-.993L9 2zM7 5H6v15h9a3 3 0 0 0 3-3V5h-1a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2m5 9a1 1 0 0 1 .117 1.993L12 16H9a1 1 0 0 1-.117-1.993L9 14zm3-4a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2zm0-6H9v1h6z"></path></g></svg>
</div><div class="success hidden"><svg
  aria-hidden="true"
  class="pure-icon size-5"
  width="22"
  height="22"
  viewBox="0 0 24 24"
  fill="currentColor"><g fill="none"><path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"></path><path fill="currentColor" d="M13.586 2A2 2 0 0 1 15 2.586L19.414 7A2 2 0 0 1 20 8.414V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM12 4H6v16h12V10h-4.5A1.5 1.5 0 0 1 12 8.5zm1.59 8.657a1 1 0 0 1 1.415 1.414l-3.111 3.112a1.1 1.1 0 0 1-1.556 0l-1.343-1.344a1 1 0 0 1 1.414-1.414l.707.707ZM14 4.414V8h3.586z"></path></g></svg>
</div></button></div>
<p>然后调用bugtracker，输入任何一个id都会直接调用root用户的shell</p>
<p><img
  src="/fcd2b5/Oopsie_21.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="435" height="492"
/>
</p>
<p>因为，我们修改了环境变量，所以调用的cat是恶意的，所以查看不了文件，这里使用tac命令查看。tac是将行数倒着输出，并不会将一句话的每个字符倒序输出，这里直接tac查看即可</p>
<p><img
  src="/fcd2b5/Oopsie_22.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="766" height="360"
/>
</p>
<p>渗透结束，回答问题，但不是所有渗透都需要问题里的方法</p>
<blockquote>
<p>TASK 1</p>
<p>With what kind of tool can intercept web traffic?</p>
<p>用什么样的工具可以拦截网络流量？</p>
<p>答案：proxy</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What is the path to the directory on the webserver that returns a login page?</p>
<p>网络服务器上返回登录页面的目录的路径是什么？</p>
<p>答案：/cdn-cgi/login</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What can be modified in Firefox to get access to the upload page?</p>
<p>可以在 Firefox 中修改哪些内容以访问上传页面？</p>
<p>答案：cookie</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What is the access ID of the admin user?</p>
<p>admin 用户的访问 ID 是什么？</p>
<p>答案：34322</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>On uploading a file, what directory does that file appear in on the server?</p>
<p>上传文件时，该文件出现在服务器上的哪个目录中？</p>
<p>答案：/uploads</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What is the file that contains the password that is shared with the robert user?</p>
<p>包含与 robert 用户共享的密码的文件是什么？</p>
<p>答案：db.php</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What executible is run with the option &ldquo;-group bugtracker&rdquo; to identify all files owned by the bugtracker group?</p>
<p>使用“-group bugtracker”选项运行什么可执行文件来识别 bugtracker 组拥有的所有文件？</p>
<p>答案：find</p>
</blockquote>
<blockquote>
<p>TASK 8</p>
<p>Regardless of which user starts running the bugtracker executable, what&rsquo;s user privileges will use to run?</p>
<p>无论哪个用户开始运行 bugtracker 可执行文件，运行时使用的用户权限是什么？</p>
<p>答案：root</p>
</blockquote>
<blockquote>
<p>TASK 9</p>
<p>What SUID stands for?</p>
<p>SUID 代表什么？</p>
<p>答案：Set Owner User Id</p>
</blockquote>
<blockquote>
<p>TASK 10</p>
<p>What is the name of the executable being called in an insecure manner?</p>
<p>以不安全方式调用的可执行文件的名称是什么？</p>
<p>答案：cat</p>
</blockquote>
<h2 id="vaccine">Vaccine<a class="anchor" href="#vaccine">#</a></h2>
<p>nmap扫描如下</p>
<p><img
  src="/fcd2b5/Vaccine_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="841" height="556"
/>
</p>
<p>nmap会显示ftp是否能够以匿名用户登录，图中ftp那个部分也有，所以用账户<code>anonymous</code>登录，密码随意</p>
<p><img
  src="/fcd2b5/Vaccine_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="910" height="511"
/>
</p>
<p>发现有个backup.zip文件，下载下来，解压需要密码，这里使用kali自带的压缩包密码猜解工具zip2john，先爆出hash值，然后john命令计算就行</p>
<p><img
  src="/fcd2b5/Vaccine_3.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="790" height="528"
/>
</p>
<p>黄色的数字就是密码，解压后有两个文件，分别是index.php和style.css</p>
<p>查看index.php，发现里面有密码的MD5值</p>
<p><img
  src="/fcd2b5/Vaccine_4.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="587" height="325"
/>
</p>
<p>放网站里解密后是<code>qwerty789</code></p>
<p>浏览器访问网站，用admin和qwerty789登录，然后进入主页，发现右上角的搜索输入<code>'</code>会报错</p>
<p><img
  src="/fcd2b5/Vaccine_5.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="687" height="288"
/>
</p>
<p>尝试sqlmap注入，由于有cookie认证，所以sqlmap命令需要设置cookie（这里机器被我不小心关了，所以后面新开的机器，图片里的ip显示不一样）</p>
<p><img
  src="/fcd2b5/Vaccine_6.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="908" height="213"
/>
</p>
<p>爆到表名的时候，绷不住了，表只有那个车表，看来数据库没什么数据，难道mysql马？但有一个更简单的方法，sqlmap有个os-shell，可以直接打开shell，原理这里先不探究，打开需要满足一定条件，这里我也不知道满没满足。但以后渗透每次都试一下</p>
<p>命令：</p>
<div class="code-block highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl">sqlmap -u http://10.129.15.176/dashboard.php?search<span class="o">=</span><span class="m">1</span> --cookie <span class="nv">PHPSESSID</span><span class="o">=</span>rnjt959pluamccoaj4ricbccg8 --batch --os-shell </span></span></code></pre><span class="language ps-1 pe-3 text-sm bg-muted text-muted-foreground">bash</span><button class="copy text-muted-foreground p-1 box-content border rounded-lg bg-card" aria-label="Copy code"><div class="ready"><svg
  aria-hidden="true"
  class="pure-icon size-5"
  width="22"
  height="22"
  viewBox="0 0 24 24"
  fill="currentColor"><g fill="none"><path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"></path><path fill="currentColor" d="M15 2c.683 0 1.287.343 1.647.866l.085.134H18a2 2 0 0 1 1.995 1.85L20 5v12a5 5 0 0 1-4.783 4.995L15 22H6a2 2 0 0 1-1.995-1.85L4 20V5a2 2 0 0 1 1.85-1.995L6 3h1.268a2 2 0 0 1 1.563-.993L9 2zM7 5H6v15h9a3 3 0 0 0 3-3V5h-1a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2m5 9a1 1 0 0 1 .117 1.993L12 16H9a1 1 0 0 1-.117-1.993L9 14zm3-4a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2zm0-6H9v1h6z"></path></g></svg>
</div><div class="success hidden"><svg
  aria-hidden="true"
  class="pure-icon size-5"
  width="22"
  height="22"
  viewBox="0 0 24 24"
  fill="currentColor"><g fill="none"><path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"></path><path fill="currentColor" d="M13.586 2A2 2 0 0 1 15 2.586L19.414 7A2 2 0 0 1 20 8.414V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM12 4H6v16h12V10h-4.5A1.5 1.5 0 0 1 12 8.5zm1.59 8.657a1 1 0 0 1 1.415 1.414l-3.111 3.112a1.1 1.1 0 0 1-1.556 0l-1.343-1.344a1 1 0 0 1 1.414-1.414l.707.707ZM14 4.414V8h3.586z"></path></g></svg>
</div></button></div>
<p>获得的shell是非交互式的，这里采用反弹shell的方式获得一个交互式shell</p>
<p>推荐一个反弹shell payload网站：https://www.revshells.com/</p>
<p><img
  src="/fcd2b5/Vaccine_7.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="662" height="32"
/>
</p>
<p>反弹成功，kali这边获得了shell</p>
<p><img
  src="/fcd2b5/Vaccine_8.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="816" height="153"
/>
</p>
<p>其实这个时候去~目录，就可以拿到user.txt里的flag。但是这里的shell无法提权。我们先找蛛丝马迹。对于这种网站应用，我们去网站根目录看看，发现了一些配置文件，打开dashboard.php</p>
<p><img
  src="/fcd2b5/Vaccine_9.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="998" height="293"
/>
</p>
<p>这个文件里，有postgres的密码，我们使用这个进行ssh连接，发现了普通用户flag</p>
<p><img
  src="/fcd2b5/Vaccine_10.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="817" height="914"
/>
</p>
<p>尝试提权，查看当前可用sudo命令</p>
<p><img
  src="/fcd2b5/Vaccine_11.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1052" height="218"
/>
</p>
<p>这里是使用vi编辑器提权，vi里可以直接输入命令，因为这个vi是sudo打开，调出的shell也就是root身份。</p>
<p>命令：<code>sudo /bin/vi /etc/postgresql/11/main/pg_hba.conf</code></p>
<p>在vi编辑界面里，输入<code>:!/bin/bash</code></p>
<p><img
  src="/fcd2b5/Vaccine_12.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="719" height="643"
/>
</p>
<p>回车，此时获得了root权限</p>
<p><img
  src="/fcd2b5/Vaccine_13.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="699" height="169"
/>
</p>
<p>搞完了，写问答</p>
<blockquote>
<p>TASK 1</p>
<p>Besides SSH and HTTP, what other service is hosted on this box?</p>
<p>除了 SSH 和 HTTP，这个盒子上还托管了哪些其他服务？</p>
<p>答案：FTP</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>This service can be configured to allow login with any password for specific username. What is that username?</p>
<p>可以将此服务配置为允许使用特定用户名的任何密码登录。 那个用户名是什么？</p>
<p>答案：anonymous</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What is the name of the file downloaded over this service?</p>
<p>通过此服务下载的文件的名称是什么？</p>
<p>答案：backup.zip</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What script comes with the John The Ripper toolset and generates a hash from a password protected zip archive in a format to allow for cracking attempts?</p>
<p>John The Ripper 工具集附带什么脚本，并从受密码保护的 zip 存档中生成哈希，其格式允许破解尝试？</p>
<p>答案：zip2john</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What is the password for the admin user on the website?</p>
<p>网站管理员用户的密码是什么？</p>
<p>答案：qwerty789</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What option can be passed to sqlmap to try to get command execution via the sql injection?</p>
<p>可以将什么选项传递给 sqlmap 以尝试通过 sql 注入来执行命令？</p>
<p>答案：&ndash;os-shell</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What program can the postgres user run as root using sudo?</p>
<p>postgres 用户可以使用 sudo 以 root 身份运行什么程序？</p>
<p>答案：vi</p>
</blockquote>
<h2 id="unified">Unified<a class="anchor" href="#unified">#</a></h2>
<p>就是复现不了，搞一晚上，眼都看瞎了还是不行，我BP发的payload，即使返回信息err，那tcpdump也应该拦截到我被连接的记录，可他显示localhost啥啥的，简直离谱，在别人电脑上就行了，找时间再复现，这个并不难。照着文章做就行，https://www.sprocketsecurity.com/blog/another-log4j-on-the-fire-unifi</p>
<p>但就是不想丸辣</p>
]]></content:encoded><h:img src="https://h4cker.zip/fcd2b5/HackTheBox.webp"/><enclosure url="https://h4cker.zip/fcd2b5/HackTheBox.webp"/><category>Hack The Box</category></item><item><title>Hack The Box - TIER 1 - Appointment Sequel Crocodile</title><link>https://h4cker.zip/fd02bf/</link><pubDate>Tue, 01 Mar 2022 14:35:00 +0800</pubDate><guid isPermaLink="true">https://h4cker.zip/fd02bf/</guid><description/><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<h2 id="appointment">Appointment<a class="anchor" href="#appointment">#</a></h2>
<blockquote>
<p>TASK 1</p>
<p>What does the acronym SQL stand for?</p>
<p>首字母缩写词 SQL 代表什么？</p>
<p>答案：Structured Query Language</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What is one of the most common type of SQL vulnerabilities?</p>
<p>最常见的 SQL 漏洞类型之一是什么？</p>
<p>答案：SQL injection</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What does PII stand for?</p>
<p>PII 代表什么？</p>
<p>答案：Personally Identifiable Information</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What does the OWASP Top 10 list name the classification for this vulnerability?</p>
<p>OWASP 前 10 名列表将此漏洞的分类命名为什么？</p>
<p>答案：A03:2021-Injection</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What service and version are running on port 80 of the target?</p>
<p>目标的 80 端口上正在运行什么服务和版本？</p>
<p>答案：Apache httpd 2.4.38 ((Debian))</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What is the standard port used for the HTTPS protocol?</p>
<p>HTTPS 协议使用的标准端口是什么？</p>
<p>答案：443</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What is one luck-based method of exploiting login pages?</p>
<p>利用登录页面的一种基于运气的方法是什么？</p>
<p>答案：brute-forcing</p>
</blockquote>
<blockquote>
<p>TASK 8</p>
<p>What is a folder called in web-application terminology?</p>
<p>什么是 Web 应用程序术语中的文件夹？</p>
<p>答案：directory</p>
</blockquote>
<blockquote>
<p>TASK 9</p>
<p>What response code is given for &ldquo;Not Found&rdquo; errors?</p>
<p>“未找到”错误的响应代码是什么？</p>
<p>答案：404</p>
</blockquote>
<blockquote>
<p>TASK 10</p>
<p>What switch do we use with Gobuster to specify we&rsquo;re looking to discover directories, and not subdomains?</p>
<p>我们在 Gobuster 中使用什么开关来指定我们正在寻找目录而不是子域？</p>
<p>答案：dir</p>
</blockquote>
<blockquote>
<p>TASK 11</p>
<p>What symbol do we use to comment out parts of the code?</p>
<p>我们用什么符号来注释掉部分代码？</p>
<p>答案：#</p>
</blockquote>
<p>探测出80端口，直接访问ip，一个登录窗口，这个直接出了，万能密码就可以，<code>admin' #</code>，密码任意也可以</p>
<p><img
  src="/fd02bf/Appointment_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1263" height="723"
/>
</p>
<h2 id="sequel">Sequel<a class="anchor" href="#sequel">#</a></h2>
<blockquote>
<p>TASK 1</p>
<p>What does the acronym SQL stand for?</p>
<p>首字母缩写词 SQL 代表什么？</p>
<p>答案：Structured Query Language</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>During our scan, which port running mysql do we find?</p>
<p>在我们的扫描过程中，我们找到了哪个运行 mysql 的端口？</p>
<p>答案：3306</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What community-developed MySQL version is the target running?</p>
<p>目标运行的是哪个社区开发的 MySQL 版本？</p>
<p>答案：MariaDB</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What switch do we need to use in order to specify a login username for the MySQL service?</p>
<p>我们需要使用什么命令来指定 MySQL 服务的登录用户名？</p>
<p>答案：-u</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>Which username allows us to log into MariaDB without providing a password?</p>
<p>哪个用户名允许我们在不提供密码的情况下登录 MariaDB？</p>
<p>答案：root</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What symbol can we use to specify within the query that we want to display eveything inside a table?</p>
<p>我们可以使用什么符号在查询中指定要在表中显示所有内容？</p>
<p>答案：*</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What symbol do we need to end each query with?</p>
<p>我们需要用什么符号来结束每个查询？</p>
<p>答案：;</p>
</blockquote>
<p>这个版本用nmap探测不到，连接上就可以看到是MariaDB，远程连接mysql命令：<code>mysql -h IP -P 端口 -u 用户名 -p 密码</code>，如果没有密码的话<code>-p 密码</code>可不写。</p>
<p><img
  src="/fd02bf/Sequel_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="786" height="265"
/>
</p>
<p>然后查看所有库，information_schema、mysql、performance_schema这三个库是MySQL的默认库，所以flag大概率在htb，进入htb，查看所有表，查询一下就看到了</p>
<p><img
  src="/fd02bf/Sequel_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="689" height="807"
/>
</p>
<h2 id="crocodile">Crocodile<a class="anchor" href="#crocodile">#</a></h2>
<blockquote>
<p>TASK 1</p>
<p>What nmap scanning switch employs the use of default scripts during a scan?</p>
<p>什么 nmap 扫描开关在扫描期间使用默认脚本？</p>
<p>答案：-sC</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What service version is found to be running on port 21?</p>
<p>发现什么服务版本在端口 21 上运行？</p>
<p>答案：vsftpd 3.0.3</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What FTP code is returned to us for the &ldquo;Anonymous FTP login allowed&rdquo; message?</p>
<p>“允许匿名 FTP 登录”消息返回给我们的 FTP 代码是什么？</p>
<p>答案：230</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What command can we use to download the files we find on the FTP server?</p>
<p>我们可以使用什么命令来下载我们在 FTP 服务器上找到的文件？</p>
<p>答案：get</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What is one of the higher-privilege sounding usernames in the list we retrieved?</p>
<p>我们检索到的列表中听起来更高权限的用户名之一是什么？</p>
<p>答案：admin</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What version of Apache HTTP Server is running on the target host?</p>
<p>目标主机上运行的是什么版本的 Apache HTTP Server？</p>
<p>答案：2.4.41</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What is the name of a handy web site analysis plug-in we can install in our browser?</p>
<p>我们可以在浏览器中安装的方便的网站分析插件的名称是什么？</p>
<p>答案：wappalyzer</p>
</blockquote>
<blockquote>
<p>TASK 8</p>
<p>What switch can we use with gobuster to specify we are looking for specific filetypes?</p>
<p>我们可以在 gobuster 中使用什么开关来指定我们正在寻找特定的文件类型？</p>
<p>答案：-x</p>
</blockquote>
<blockquote>
<p>TASK 9</p>
<p>What file have we found that can provide us a foothold on the target?</p>
<p>我们发现了哪些文件可以为我们在目标上提供立足点？</p>
<p>答案：login.php</p>
</blockquote>
<p>探测出了ftp和apache，终端连了ftp，提示了只能anonymous，无密码连上，看到俩类似账号密码的文件，先把文件下载下来。</p>
<p><img
  src="/fd02bf/Crocodile_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="879" height="791"
/>
</p>
<p>再浏览器访问80端口，本来啥都没发现，扫出了后台页面login.php，下载的文件admin最像用户，试了一下可以登录，登进去就可以看到flag</p>
<p><img
  src="/fd02bf/Crocodile_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="1908" height="975"
/>
</p>
]]></content:encoded><h:img src="https://h4cker.zip/fd02bf/HackTheBox.webp"/><enclosure url="https://h4cker.zip/fd02bf/HackTheBox.webp"/><category>Hack The Box</category></item><item><title>Hack The Box - TIER 0 - Meow Fawn Dancing</title><link>https://h4cker.zip/fa702b/</link><pubDate>Mon, 28 Feb 2022 23:11:46 +0800</pubDate><guid isPermaLink="true">https://h4cker.zip/fa702b/</guid><description/><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>新学期开始了，新的学习也开始了，寒假打算闭关的，但没耐住玩。2021总结找时间整理整理再写。实战有点难，代码审计有师傅建议先别搞，那刷刷HTB也不错，多方好评。</p>
<h2 id="meow">Meow<a class="anchor" href="#meow">#</a></h2>
<p>看新手入门连接到HTB的靶机过后，就打开了第一个，好像前面不做也只能打开第一个。连接后我先没有看靶机，9个任务居然是问答题，一题一题翻译做，答案如下：</p>
<blockquote>
<p>TASK 1</p>
<p>What does the acronym VM stand for?</p>
<p>首字母缩略词 VM 代表什么？</p>
<p>答案：Virtual Machine</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What tool do we use to interact with the operating system in order to start our VPN connection?</p>
<p>我们使用什么工具与操作系统交互以启动我们的 VPN 连接？</p>
<p>答案：Terminal</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What service do we use to form our VPN connection?</p>
<p>我们使用什么服务来建立我们的 VPN 连接？</p>
<p>答案：OpenVPN</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What is the abreviated name for a tunnel interface in the output of your VPN boot-up sequence output?</p>
<p>在 VPN 启动序列输出的输出中，隧道接口的缩写名称是什么？</p>
<p>答案：tun</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What tool do we use to test our connection to the target?</p>
<p>我们使用什么工具来测试我们与目标的连接？</p>
<p>答案：Ping</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What is the name of the tool we use to scan the target&rsquo;s ports?</p>
<p>我们用来扫描目标端口的工具叫什么名字？</p>
<p>答案：nmap</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What service do we identify on port 23/tcp during our scans?</p>
<p>在扫描过程中，我们在端口 23/tcp 上识别出什么服务？</p>
<p>答案：Telnet</p>
</blockquote>
<blockquote>
<p>TASK 8</p>
<p>What username ultimately works with the remote management login prompt for the target?</p>
<p>什么用户名最终适用于目标的远程管理登录提示？</p>
<p>答案：Root</p>
</blockquote>
<p>这前8个任务都是简单的问答，但也是这个靶机的提示。</p>
<p>首先我们nmap 靶机</p>
<p><img
  src="/fa702b/Meow_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="720" height="233"
/>
</p>
<p>发现有一个23/tcp端口，telnet直接连接</p>
<p><img
  src="/fa702b/Meow_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="523" height="259"
/>
</p>
<p>在这里可以看到，telnet是可以连接到的，在通常情况下，需要账户以及密码，但是这个靶机多尝试一些弱口令，比如admin、administrator、root之类的，并且祈祷密码为空，但是前俩需要密码。当我输入root直接登进去了。</p>
<p><img
  src="/fa702b/Meow_3.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="723" height="511"
/>
</p>
<p>其他就是Linux简单命令了。</p>
<p><img
  src="/fa702b/Meow_4.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="372" height="105"
/>
</p>
<p>把flag提交到第9个任务那里，就完成了第一个HTB靶机，very easy的难度就是用来熟悉htb操作的。并且完成靶机后会有一个喝彩特效和音效！</p>
<h2 id="fawn">Fawn<a class="anchor" href="#fawn">#</a></h2>
<blockquote>
<p>TASK 1</p>
<p>What does the 3-letter acronym FTP stand for?</p>
<p>3 个字母的首字母缩写词 FTP 代表什么？</p>
<p>答案：File Transfer Protocol</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What communication model does FTP use, architecturally speaking?</p>
<p>从架构上讲，FTP 使用什么通信模型？</p>
<p>答案：client-server model</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What is the name of one popular GUI FTP program?</p>
<p>一种流行的 GUI FTP 程序的名称是什么？</p>
<p>答案：fileZilla</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>Which port is the FTP service active on usually?</p>
<p>FTP服务通常在哪个端口上激活？</p>
<p>答案：21 tcp</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What acronym is used for the secure version of FTP?</p>
<p>FTP 的安全版本使用什么首字母缩写词？</p>
<p>答案：sftp</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What is the command we can use to test our connection to the target?</p>
<p>我们可以使用什么命令来测试我们与目标的连接？</p>
<p>答案：ping</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>From your scans, what version is FTP running on the target?</p>
<p>根据您的扫描，目标上运行的 FTP 版本是什么？</p>
<p>答案：vsftpd 3.0.3</p>
</blockquote>
<blockquote>
<p>TASK 8</p>
<p>From your scans, what OS type is running on the target?</p>
<p>根据您的扫描，目标上正在运行什么操作系统类型？</p>
<p>答案：Unix</p>
</blockquote>
<p>这跟上个靶机几乎一样，连上就nmap，不过这里使用<code>nmap -sV</code>命令，这句用来<strong>探测打开端口对应服务的版本信息</strong>，在第7、第8问只nmap是探测不到这些信息的。</p>
<p>ftp直接连接，账号用匿名<code>anonymous</code>，密码为空</p>
<p><img
  src="/fa702b/Fawn_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="488" height="217"
/>
</p>
<p>然后ls看到flag.txt，使用get命令下载到本地直接查看就行</p>
<p><img
  src="/fa702b/Fawn_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="795" height="535"
/>
</p>
<h2 id="dancing">Dancing<a class="anchor" href="#dancing">#</a></h2>
<blockquote>
<p>TASK 1</p>
<p>What does the 3-letter acronym SMB stand for?</p>
<p>3 个字母的首字母缩写词 SMB 代表什么？</p>
<p>答案：Server Message Block</p>
</blockquote>
<blockquote>
<p>TASK 2</p>
<p>What port does SMB use to operate at?</p>
<p>SMB 使用什么端口进行操作？</p>
<p>答案：445</p>
</blockquote>
<blockquote>
<p>TASK 3</p>
<p>What network communication model does SMB use, architecturally speaking?</p>
<p>从架构上讲，SMB 使用什么网络通信模型？</p>
<p>答案：Client-Server Model</p>
</blockquote>
<blockquote>
<p>TASK 4</p>
<p>What is the service name for port 445 that came up in our nmap scan?</p>
<p>我们的 nmap 扫描中出现的端口 445 的服务名称是什么？</p>
<p>答案：microsoft-ds</p>
</blockquote>
<blockquote>
<p>TASK 5</p>
<p>What is the tool we use to connect to SMB shares from our Linux distribution?</p>
<p>我们使用什么工具从我们的 Linux 发行版连接到 SMB 共享？</p>
<p>答案：smbclient</p>
</blockquote>
<blockquote>
<p>TASK 6</p>
<p>What is the <code>flag</code> or <code>switch</code> we can use with the SMB tool to <code>list</code> the contents of the share?</p>
<p>我们可以使用 SMB 工具来“列出”共享内容的“标志”或“开关”是什么？</p>
<p>答案：-L</p>
</blockquote>
<blockquote>
<p>TASK 7</p>
<p>What is the name of the share we are able to access in the end?</p>
<p>我们最终能够访问的共享名称是什么？</p>
<p>答案：WorkShares</p>
</blockquote>
<blockquote>
<p>TASK 8</p>
<p>What is the command we can use within the SMB shell to download the files we find?</p>
<p>我们可以在 SMB shell 中使用什么命令来下载我们找到的文件？</p>
<p>答案：get</p>
</blockquote>
<p>这个是我知识盲区了，smb了解不多，看着YouTube做的。其实百度也能做，nmap探测出smb端口，然后使用<code>smbclient -L</code>列出共享内容</p>
<p><img
  src="/fa702b/Dancing_1.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="815" height="642"
/>
</p>
<p>列出的用户里，后面有美元符号$的都是管理员权限的，所以我们只能连接WorkShares这个用户。这里有个时髦语法，<code>smbclient \\\\IP\\用户</code> 连接，密码为空直接回车。连接进去有两个用户，都看了看，James.P里有flag.txt，get命令下载即可</p>
<p><img
  src="/fa702b/Dancing_2.webp"
  alt=""
  class="zoomable"
  loading="lazy"
  decoding="async" width="802" height="729"
/>
</p>
<p>TIER 0 Free结束了，怪不得very easy，VIP是不可能的，直接TIER 1！</p>
]]></content:encoded><h:img src="https://h4cker.zip/fa702b/HackTheBox.webp"/><enclosure url="https://h4cker.zip/fa702b/HackTheBox.webp"/><category>Hack The Box</category></item></channel></rss>