damariion/CVE-2015-1925
GitHub: damariion/CVE-2015-1925
针对IBM Tivoli FastBack Server 6.1.4的CVE-2015-1925栈溢出漏洞远程代码执行利用程序,含完整的DEP绕过ROP链和反向Shell实现。
Stars: 0 | Forks: 0
# [CVE-2015-1925](https://nvd.nist.gov/vuln/detail/CVE-2015-1925)
该漏洞利用程序针对运行在 **Windows 10 (x86, build: 16299)** 上的 **Tivoli Fastback Server**,影响版本为 **6.1.4**。未经认证的攻击者可以通过 **原始套接字连接** **执行缓冲区溢出**,从而导致 **远程代码执行 (RCE)**。此利用程序假设未通过 [Windows Defender Exploit Guard (WDEG)](https://www.microsoft.com/en-us/security/blog/2017/10/23/windows-defender-exploit-guard-reduce-the-attack-surface-against-next-generation-malware/) 或类似手段强制对易受攻击的软件启用 ASLR。


-blue)
### 流程
1. 将以下数据包发送到 **TCP** 端口 **11460** 上的 `FastBackServer.exe` 应用程序:
header {
00 00000000 00000000 00000000
00
00 00 00000000
00000000 00000000 00000000 00000000
}
buffer {
}
头部通过操作码指定请求的功能,以及描述所提供数据的属性(如大小和偏移量)。第一个 DWORD 指定数据包的总大小。
2. 当收到数据包时,会调用 `_FXCLI_OraBR_Exec_Command` 函数来解释所需的功能(通过操作码)并将执行重定向到相应的代码块。由于我们的数据包是使用操作码 **534** 发送的,应用程序会将执行重定向到一个包含对 `_FXCLI_SetConfFileChunk` 函数调用的代码块。
3. `_FXCLI_SetConfFileChunk` 函数在没有适当边界检查的情况下调用 `_sscanf`,使用 `` 作为源缓冲区。用正好 **276** 字节溢出此缓冲区会覆盖返回地址。
4. 返回地址被静态地址 **0x50501110**(位于 `csftpav6.dll` 中)覆盖。当函数返回时,执行在此地址继续,启动 ROP 链。ROP 链调用 VirtualAlloc 将包含 shellcode 的内存区域标记为可执行,从而绕过 DEP。调用详情如下所示:
LPVOID VirtualAlloc(
LPVOID lpAddress = ,
SIZE_T dwSize = 1,
DWORD flAllocationType = MEM_COMMIT,
DWORD flProtect = PAGE_EXECUTE_READWRITE
);
5. shellcode 遍历 Process Environment Block (PEB),并通过 `InInitializationOrderModuleList` 检索 `kernel32.dll` 的句柄。
6. 使用一个自定义编写的 `GetProcAddress` 函数,该函数通过 `rot13` 算法比较哈希值来查找相应的存根(通过导出表中的 RVA)。通过这种方式,我们检索以下 API 的句柄(用于发起反向 Shell 连接):
- `kernel32!TerminateProcess`
- `kernel32!CreateProcessA`
- `kernel32!LoadLibraryA`
- `ws2_32!WSAStartup`
- `ws2_32!WSASocketA`
- `ws2_32!WSAConnect`
7. 该漏洞利用程序同时绑定到本地接口并在 TCP 端口 **4444** 上监听。一旦 shellcode 执行,受损系统会发起回连到此监听器的连接,从而建立反向 Shell 会话。
8. 当使用 `exit` 命令终止反向 Shell 会话时,shellcode 会调用 TerminateProcess 以优雅地终止易受攻击的应用程序。
### 图表
```
flowchart TD
subgraph A[Attacker host]
A1[Run script with target parameter]
A2[Resolve local host address]
A3[Set local port 4444]
A4[Generate reverse shellcode]
A5[Build DEP NX bypass payload with ROP]
A6[Send exploit payload to target]
A7[Start listener and wait for callback]
end
subgraph B[ROP and shellcode construction]
B1[Build shellcode]
B2[Resolve kernel32 and required APIs using hashing]
B3[Load ws2_32 and initialize winsock]
B4[Connect back to attacker host and port]
B5[Spawn command shell and redirect input output]
B6[Create VirtualAlloc call frame placeholders]
B7[ROP writes VirtualAlloc address into stub]
B8[ROP sets return address to shellcode]
B9[ROP sets lpAddress to shellcode location]
B10[ROP sets memory size allocation and protection flags]
B11[ROP performs stack pivot and triggers VirtualAlloc]
B12[Final payload layout VAS + ROP + padding + shellcode]
end
subgraph C[Delivery to target]
C1[Create packet header with opcode offset and length]
C2[Embed payload into File format string field]
C3[Open TCP connection to target port 11460]
C4[Send packet with length prefix]
end
subgraph D[Target processing and exploitation]
D1[Target parses incoming packet]
D2[sscanf copies string into fixed buffer]
D3[Buffer overflow overwrites control data]
D4[Execution reaches attacker controlled ROP chain]
D5[ROP allocates executable memory using VirtualAlloc]
D6[Execution jumps to injected shellcode]
D7[Shellcode opens reverse connection]
end
subgraph E[Reverse shell session]
E1[Listener accepts incoming connection]
E2[Display exploited remote address]
E3[Read remote output]
E4[Send operator commands]
E5[Close connection when finished]
end
A1 --> A2 --> A3 --> A4 --> A5 --> A6 --> A7
A4 --> B1
A5 --> B6
B1 --> B2 --> B3 --> B4 --> B5 --> B12
B6 --> B7 --> B8 --> B9 --> B10 --> B11 --> B12
A6 --> C1 --> C2 --> C3 --> C4 --> D1 --> D2 --> D3 --> D4 --> D5 --> D6 --> D7 --> E1
A7 --> E1 --> E2 --> E3 --> E4 --> E5
```
### 预览

### 用法
```
usage: exploit.py [-h] -t TARGET
options:
-h, --help show this help message and exit
-t, --target TARGET
```
标签:ASLR, CISA项目, CVE-2015-1925, FastBack Server, IBM Tivoli, Linux, Raw Socket, RCE, sscanf, x86, XXE攻击, 拒绝服务, 栈溢出, 端口 11460, 缓冲区溢出, 编程工具, 网络安全, 远程代码执行, 逆向工具, 隐私保护