Loading...
Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

Attacking SCADA Part III: Hardcoded Salt in Schneider Electric EcoStruxure Machine Expert (CVE-2020-28214)

This is part three of our Schneider Electric series. You can read part one here and part two here.

Introduction

When the engineer activates the passwords for application protection, the passwords are hashed and stored in the local project file, which ends with the extension smbp. If we open this file in a notepad, we can find the hashed passwords in this section.

Image001Figure 1: Password hashes in the project file

Analysis

Machine Expert main application is developed with .NET framework. This can be reversed by using dnSpy or any equivalent .NET disassembler.

We were able to find the hard-coded salt in this file:

  • SoMachineBasic.CommonUtility.dll.

In this file, there is a class called EncryptionHelper found in  “SchneiderElectric.Automation.SoMachineBasic.Common.CommonUtility.Cryptography”. This class contains two functions – EncryptSha256 and EncryptSha256Salted.

EncryptSha256 is used to hash the plaintext password. EncryptSha256Salted is used to hash the hashed password again with a hard-coded salt as shown in Figure 2. EncryptSha256Salted appends a hard-coded value to password before hashing it again using EncryptSha256. Since the function uses a hard-coded salt, the same input will always yield the same output. This makes it possible for the attacker to brute force and identify the plaintext password.

Image002Figure 2: These two functions are used to hash the plaintext passwords that are used in the application protections

We wrote a proof-of-concept code in python to demonstrate this vulnerability. This code can be executed using this command: python3 hashThatPassword.py <password to hash>.

Image005

This is the result from running the POC code.

The output from the script is shown in Figure 3. The plaintext password is “password” and it outputs to “0f55c2a5f886d612ad7f919918a49b4af2390f00222600ccdbec10c836c9b2c8”. This output is identical to what we have shown in Figure 2.

Image004Figure 3: Output from the POC code. The hashed password is exactly the same as the one shown in Figure 2 as the plaintext password used in both cases is “password”

Impact

It will be possible for the attacker to build a rainbow table and run brute-force attack to identify the plaintext password used to activate the application protection. This attack does not require the attacker to have any access to network traffic. The attacker can run this POC code offline and do a match to the hashed passwords found in the project files. Once the attacker has the plaintext passwords, he will have sufficient privilege to make changes to the protected application on the controller.

References

Trustwave Advisory TWSL2020-007

Recent SpiderLabs Blog Posts