<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="https://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://shibaolong.com/</link><description>不积跬步无以至千里，不积小流无以成江海</description><item><title>vulnhub-DC-2渗透教程</title><link>https://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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靶场</title><link>https://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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>