| Exposing HMS HICP Protocol + 0Day 'light' + SCADA_SHODAN |
|
|
| Written by Rubén | |
| Monday, 14 December 2009 | |
|
I'll be conducting a Reverse Engineering Training (8 hours = 1 day) within the context of the RootedCON Security Conference on March 15, 2010.RootedCON 2010 will take place at the Auditorium inside the "Centro de Convenciones Mapfre", in Madrid, Spain (Europe :P), on March 18 - 20, 2010. More info: http://www.rootedcon.es Reversemode 2.0 hehe, http://www.twitter.com/reversemode Hi all, After a long period of inactivity I'm back with fresh content. Today we are going to reverse a simple M2M propietary protocol developed by the swedish company HMS.In addition to this, a related 0day will be disclosed and finally, we'll learn to find out SCADA systems with the help of the new toy: SHODAN 1st PART "HMS HICP Protocol" AFAIK there is no public documentation about this protocol, if not so please let me know and I'll repeatedly hit myself with a sharpened stick.All the information presented here has been obviously obtained by reverse engineering. Despite of the fact that this protocol is not complex,I think it has a potential interest regarding SCADA security.You'll see why. HICP, is intented to configure HMS's products that include ethernet/ capabilities, since they need a method for configuring Internal IP,DCHP,NetworkMask,DNS,gateway.... In 2004 HMS released a free tool named "Anybus IPconfig" which can be used to scan a network where the devices are connected, then proceeding to configure them. The components of this application are a simple MFC based GUI and a dll (hicp.dll). So let's take a look at the exports: Code (asm)
.text:100027AF ; int __cdecl HICP_SendModuleScan() In C Code (c)
sprintf(&Dest, "Module Scan"); Any value after the '=' can be modified. +“Protocol version = 1.10; ” # Obvious +”fb type = EVIL-DEVICE; ” # Device Type +”module version = 0.66.6; ” # ... +”mac = 00-30-11-00-CA-FE; ” # MAC +”ip = 192.168.1.252; ” # ... +”sn = 255.255.255.0; ” # Network Mask +”gw = 192.168.1.1; ” # Gateway +”dhcp = off; ” # whether the device is using a DHCP server for obtaining the IP address. (on/off) +”pswd = off; ” # whether the device is using a PASSWORD(on/off) +”hn = morroBufalo; ” # hostname (optional) +”dns1 = 192.168.1.33; ” # Primary DNS +”dns2 = 192.168.1.34; ” # Secondary DNS (optional) +”password = admin; ” # old password (if any, admin by default) +”new password = fatbird; ” # new passwordThese parameters are sent via UDP in plain text, concatenating each one and separated by a ";". If you want to configure a device, you need to prepend a "Configure:" string in this way: "Configure: xx-xx-xx-xx-xx-xx;"+ parameters_string. Where xx-xx-xx-xx-xx-xx is the MAC of the device you want to configure. You can take a look at HICP_SendConfigure code to verity it. This request is broadcasted so is received by any device/machine in the network listening on 3250/UDP. The device checks the MAC against it own and if matches then proceeds to update its internal registers.The first three bytes of the MAC are always 00-30-11 which correspond to the HMS' oui as expected. In addition to this request, there are a couple of additional replyes implemented: + "Invalid Password:" to indicate a failed configuration attempt + "Reconfigured:" to indicate success. That's all. Make your own conclusions about the security level of this protocol.I'm just presenting facts. 2nd Part "Intellicom NetBiterConfing.exe Remote Stack Overwrite". Oday Light. Another swedish company this time, Intellicom develops a serie of SCADA products/devices named NetBiter WebSCADA which are based on HMS AnyBus RemoteCOM device. We can download the firmware, as well as two tools to configure and update these devices respectively.Free goods are always nice. First off, taking a look at the GUI of the tool for configuring devices, NetBiterConfig.exe, we can see that looks pretty similar to the HMS one.Except for a couple of added buttons, one to "wink" a device and the other is to start an "emergency" DHCP server, the tools contains the same components: hicp.dll and a MFC GUI. However, this one contains a surprise. Ok, NetBiterConfig.exe is listening on 3250/UDP receiving packets for any interface, so we can send a specially crafted UDP packet from outside the network to trick the tool into thinking we are a NetBiter device.
If we fill "hn" parameter (HostName) with more than 0x20 bytes, we can start to overwrite data in the stack. By constructing a hostname of 0x60 bytes we can overwrite a pointer to an vtable of applications' subclassing methods, this can be used to achieve code execution by emulating a vtable under our control. 0x60 is not an arbitrary value, it allows us to get %esi pointing to the last 0x20 (approximately) bytes of our shellcode. The flaw is triggered when the admin double-clicks in the list box item.
The flaw is a classic strcpy without proper bounds checking in NetBiterConfig.exe Code (asm)
.text:00403E52 lea edx, [ebp-0ABh] Code (asm)
.text:00403691 push 80h I've got a new ethic rule: "No explicit security contact publicily available + no money involved (I'm used to eat almost three times a day) == 0day". PoC Code (python)
#!/usr/bin/python # Intellicom NetBiterConfig.exe 1.3.0 Remote Stack Overwrite.
import sys s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) Fuji Electric Embedded Web Server: Ouman embedded Web Server for SCADA + NetBiter WebSCADA eWon Boa Web Server EIG Embedded Web Server EnergyICT |
|
| Last Updated ( Sunday, 21 March 2010 ) |
| < Prev | Next > |
|---|




I'll be conducting a
If we fill "hn" parameter (HostName) with more than 0x20 bytes, we can start to overwrite data in the stack. By constructing a hostname of 0x60 bytes we can overwrite a pointer to an vtable of applications' subclassing methods, this can be used to achieve code execution by emulating a vtable under our control. 0x60 is not an arbitrary value, it allows us to get %esi pointing to the last 0x20 (approximately) bytes of our shellcode. The flaw is triggered when the admin double-clicks in the list box item.

