Vulnerability Inheritance in PLCs. K. Reid Wightman Director, Digital Bond Labs



Similar documents
Potential Targets - Field Devices

Analysis of the 3S CoDeSys Security Vulnerabilities for Industrial Control System Professionals

SECURITY TRENDS & VULNERABILITIES REVIEW 2015

Comparison of Firewall, Intrusion Prevention and Antivirus Technologies

Payment Card Industry (PCI) Data Security Standard

SSA : Multiple Vulnerabilities in WinCC flexible and WinCC V11 (TIA Portal)

Security Testing in Critical Systems

Turning your managed Anti-Virus

HoneyBOT User Guide A Windows based honeypot solution

How To Test A Control System With A Network Security Tool Like Nesus

FREQUENTLY ASKED QUESTIONS

The Trivial Cisco IP Phones Compromise

The SCADA That Didn t Cry Wolf: Who s Really Attacking Your SCADA Devices

Exploiting Access Control and Facility Management Systems. Billy Rios Director of Threat Intelligence Qualys

Yahoo Attack. Is DDoS a Real Problem?

Automated Vulnerability Scan Results

noway.toonux.com 09 January 2014

Penetration Testing Report Client: Business Solutions June 15 th 2015

Tools for penetration tests 1. Carlo U. Nicola, HT FHNW With extracts from documents of : Google; Wireshark; nmap; Nessus.

1 Scope of Assessment

Vulnerability Testing of Industrial Network Devices

SSL Tunnels. Introduction

Appalachian Regional Commission Evaluation Report. Table of Contents. Results of Evaluation Areas for Improvement... 2

Securing EtherNet/IP Using DPI Firewall Technology

ModBus Server - KNX. Gateway for integration of KNX equipment into Modbus (RTU and TCP) control systems.

Network Security and Firewall 1

Medical Device Security: The Transition From Patient Privacy To Patient Safety. Scott Erven

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

6WRUP:DWFK. Policies for Dedicated IIS Web Servers Group. V2.1 policy module to restrict ALL network access

Introduction to Endpoint Security

Why Should You Care About Security Issues? SySmox WEB security Top seven ColdFusion Security Issues

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

What is Really Needed to Secure the Internet of Things?

National Endowment for the Arts Evaluation Report. Table of Contents. Results of Evaluation Areas for Improvement Exit Conference...

INDUSTRIAL CONTROL SYSTEMS CYBER SECURITY DEMONSTRATION

Medical Device Security Health Group Digital Output

Running a Default Vulnerability Scan SAINTcorporation.com

ANNEXURE-1 TO THE TENDER ENQUIRY NO.: DPS/AMPU/MIC/1896. Network Security Software Nessus- Technical Details

From Rivals to BFF: WAF & VA Unite OWASP The OWASP Foundation

IMPLEMENTATION OF INTELLIGENT FIREWALL TO CHECK INTERNET HACKERS THREAT

Yun Shield User Manual VERSION: 1.0. Yun Shield User Manual 1 / 22.

3.1 Connecting to a Router and Basic Configuration

Telecom Testing and Security Certification. A.K.MITTAL DDG (TTSC) Department of Telecommunication Ministry of Communication & IT

Virtualization System Security

Using Nessus In Web Application Vulnerability Assessments

Firewall Introduction Several Types of Firewall. Cisco PIX Firewall

VULNERABILITY ASSESSMENT WHITEPAPER INTRODUCTION, IMPLEMENTATION AND TECHNOLOGY DISCUSSION

E-Commerce Security. The Client-Side Vulnerabilities. Securing the Data Transaction LECTURE 7 (SECURITY)

Management (CSM) Capability

The Security Gap. Philip Young aka Soldier of

Medical Device Security Health Imaging Digital Capture. Security Assessment Report for the Kodak DryView 8150 Imager Release 1.0.

Absolute Backdoor Revisited. Vitaliy Kamlyuk, Kaspersky Lab Sergey Belov, Kaspersky Lab Anibal Sacco, Cubica Labs

PHILADELPHIA GAS WORKS Information Security Assessment and Testing Services RFP#30198 Questions & Answers December 4, 2015

Dell Client BIOS: Signed Firmware Update

Port Scanning and Vulnerability Assessment. ECE4893 Internetwork Security Georgia Institute of Technology

Custom Solutions Center. Users Guide. Low Cost OEM PackML Templates L02 Release. Version LC-1.0

Vulnerability Management in Software: Before Patch Tuesday KYMBERLEE PRICE BUGCROWD

KASPERSKY SECURITY INTELLIGENCE SERVICES. EXPERT SERVICES.

Nessus. A short review of the Nessus computer network vulnerability analysing tool. Authors: Henrik Andersson Johannes Gumbel Martin Andersson

Locking down a Hitachi ID Suite server

Running a Default Vulnerability Scan

Looking for Trouble: ICMP and IP Statistics to Watch

Client logo placeholder XXX REPORT. Page 1 of 37

Table of Contents. Safety Warnings..3. Introduction.. 4. Host-side Remote Desktop Connection.. 5. Setting Date and Time... 7

Kaspersky Endpoint Security 10 for Windows. Deployment guide

Black Box Penetration Testing For GPEN.KM V1.0 Month dd "#$!%&'(#)*)&'+!,!-./0!.-12!1.03!0045!.567!5895!.467!:;83!-/;0!383;!

7.7 Ethernet Communication (AFPX-COM5)

ECE 4893: Internetwork Security Lab 12: Web Security

Patch and Vulnerability Management Program

Nessus scanning on Windows Domain

OPC & Security Agenda

1 hours, 30 minutes, 38 seconds Heavy scan. All scanned network resources. Copyright 2001, FTP access obtained

Installing Virtual Coordinator (VC) in Linux Systems that use RPM (Red Hat, Fedora, CentOS) Document # 15807A1-103 Date: Aug 06, 2012

3.1 RS-232/422/485 Pinout:PORT1-4(RJ-45) RJ-45 RS-232 RS-422 RS-485 PIN1 TXD PIN2 RXD PIN3 GND PIN4 PIN5 T PIN6 T PIN7 R+ PIN8 R-

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

Evading Infrastructure Security Mohamed Bedewi Penetration Testing Consultant

Network Licensing. White Paper 0-15Apr014ks(WP02_Network) Network Licensing with the CRYPTO-BOX. White Paper

SAST, DAST and Vulnerability Assessments, = 4

Missing the Obvious: Network Security Monitoring for ICS

APPLICATION SECURITY RESPONSE: WHEN HACKERS COME A-KNOCKING

Strategies to Protect Against Distributed Denial of Service (DD

virtualization.info Review Center SWsoft Virtuozzo (for Windows) //

What IT Auditors Need to Know About Secure Shell. SSH Communications Security

School of Information Science (IS 2935 Introduction to Computer Security, 2003)

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

THE TOP 4 CONTROLS.

IPPBX FAQ. For Firmware Version: V2.0/V

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Multi-Master DF1 Protocol User Guide

Overview of Network Security The need for network security Desirable security properties Common vulnerabilities Security policy designs

On the use of Honeypots for Detecting Cyber Attacks on Industrial Control Networks

How-to: DNS Enumeration

What is Web Security? Motivation

Post-Access Cyber Defense

Technical Information

Transcription:

Vulnerability Inheritance in PLCs K. Reid Wightman Director, Digital Bond Labs

About Digital Bond Labs New division of Digital Bond Focused on working with vendors Finding new vulns in products Fixing bugs before they re an issue We find the kinds of bugs shown here I am biased Strong advocate of Red Teaming products Hire any outside team (or build your own)

Outline Vulnerabilities: What are they? Inheritance -3 rd party libraries Specific example Deep Dive Affected Vendor #1 Affected Vendor #2 Conclusion

Vulnerability In Industrial space this is strangely ambiguous, thanks to ICS-CERT My definition: Any mechanism which allows unauthorized changes to configuration or control Includes traditional bugs Authentication bypass Parsing errors Includes insecure by design

Outline Vulnerabilities: What are they? 3 rd party libraries Specific example Deep Dive Affected Vendor #1 Affected Vendor #2 Conclusion

3 rd Party Libraries Any OS (vxworks, GNU/Linux, Windows CE) Common embedded servers (GoAhead Webserver, fnord, boa, etc) Common libraries (OpenSSL, GNU/Bash) Specialized Industrial Libraries: CoDeSys, ProConOs

Ownership is the issue 3 rd Party Libraries You own any problems with 3 rd party software If Vendor software depends upon library, end user must have Vendor assurance that patch will work For embedded, end user needs Vendor to produce patched firmware Ex: Windows CE may have bugs Will vendor keep track of the bugs? Will vendor produce a patch to firmware? Will vendor inform customers of the patch?

Outline Vulnerabilities: What are they? 3 rd party libraries ICS-Specific example Deep Dive Affected Japanese Vendor #1 Affected Japanese Vendor #2 Conclusion

CoDeSys Programmable Logic Controller (PLC) Runtime and Engineering Software Used by hundreds of ICS vendors Primarily used in Europe, though some inroads into USA, Japan

CoDeSys: Select Vendors

CoDeSysComponents PLC Ladder Logic Runtime Runs on vxworks, WinCE, Linux, Nucleus, and others Executes ladder logic Comms for sending status and receiving commands Engineering Workstation (EWS) Software Common GUI for programming PLCs Supports LAD, STL, FBD, etc. Communicates with PLC via plugins OPC Server Gateway (Optional) between EWS and PLC

CoDeSys Components G L24V G 0V Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 AC(L) AC(N) C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 +V OUTPUT6-27V= :Sinking PWR: 100-240V~ 50-60Hz 1.0A Output 40VA 12 16 17 20 21 22 10 13 14 15 23 Y X0123456711 INPUT: 12-24V ~15mA PWR RUN CPU TX1 RX1 TX2 RX2 C0 X1 X3 X4 X6 C2 X11 X13 X14 X16 C4 X21 X23 N.C. X0 X2 C1 X5 X7 X10 X12 C3 X15 X17 X20 X22 N.C. PLC WWW Web Application Gateway Server OPC Server HMI Engineering Station

CoDeSysDeep Dive CoDeSysV2 protocol analysis and tools released in 2012 CoDeSysV3 protocol analysis done by DB Labs September 2014, internal tools developed The protocol changed a bit from V2 (more complex) Identical vulnerabilities as V2

CoDeSysV2 Flaws Unauthenticated ladder logic upload Unauthenticated command line for debugging Unauthenticated start/stop process control Directory traversal Upload/Download arbitrary files Rootkit deployment is free Many systems internet-connected (see joint paper with Éireann Leverett)

ICS-CERT advisory CVE-2012-6068 (CVSS score: 10.0) CVE-2012-6069 (CVSS score: 10.0) ICS-CERT Advisory ICSA-13-011-01

CoDeSysV3 Flaws Unauthenticated ladder logic upload Unauthenticated command line for debugging Unauthenticated start/stop process control Directory traversal quite likely Upload/Download arbitrary files Rootkit deployment possible Internet scan more difficult

CoDeSysDeployment Issues Usually installed/runs with root privileges (Linux) and SYSTEM (Windows) Why? CoDeSys runtime interacts with IO directly Easiest to run with elevated privs, instead of learning what is actually required A symptom of rushed development WHY? Bad news: CoDeSysruntime executes binary blobs that are uploaded to it, by design. rootkit ability is a side-effect.

No Security CoDeSysFlaws Summary Original vendor (3S-Software) may have assumed that no-one would learn protocol Original vendor (3S-Software) likely never had a Red Team look at components Original vendor has taken the stance, This is not our problem.

CoDeSysV2 Simple Protocol: Start bytes (usually 0xbbbb or 0xcccc), length field, function code, arguments Uses TCP/1200 (some systems use TCP/2455 or custom port) Determined how protocol works through protocol analysis (quite straightforward)

CoDeSysV2 3S Software included password protection in V2 Password protection was not enforced by PLC initially 3S Software provided patch for PLC to fix that To date, one model of PLC has the patch PLC-enforced password protection interferes with 3S OPC Server one reason offered by vendor Patching insecure-by-design is too late in Development Lifecycle Requires changing too much other software

CoDeSysV2 Ladder Logic PLC Runtime Loads DEFAULT.PRG into RAM Runtime then literally jumps into copied program Ladder Logic rootkit possible No verification of DEFAULT.PRG functionality PLC Runtime often runs with administrator privileges Needs access to hardware: read+write hardware I/O On poorly configured deeply embedded OSes(vxWorks), can read/write any memory Very bad design decision Example: Ladder Logic can call system()/execve() as root on Linux PLCs, if it wants

CoDeSysV2 Application Literally code injection, without authentication PC equivalent: service open on PC which accepts and runs binary blobs with admin privileges with no authentication Exploitation == learn how it works

CoDeSysV2 Lessons to Learn Apply Security Development Lifecycle to products Have Red Team review components Look at the design early and the implementation often Decide: Will we live with these vulnerabilities, will we fix them, or will we stop using the component? Determine how you will monitor and patch future problems Catching this problem early saved the two vendors who fixed it a lot of trouble

CoDeSysV2 Lessons to Learn Component DESIGN problems are contamination One component s insecure-by-design causes add-ons to expect that behavior Now instead of one fix, you need at least two The problem gets worse as more components communicate Fixing a design problem late is often impossible Great example: Modbus It could have security added via reserved function code but then every system on Earth would have to be changed

Protocol differs from v2 Can use UDP or TCP CoDeSysV3 UDP limits attack surface somewhat, although we can get around this TCP has not been thoroughly tested on live PLCs, only our simulator

CoDeSysV3 Notes No documentation on CoDeSysprotocols is publicly available Example presented is based entirely on reverse engineering and protocol analysis Our terminology may not match 3S Software s (debugging symbols removed from binaries, mostly) UDP/1740, TCP/11740

CoDeSysV3 First Packet M->S c5 73 40 40 00 11 00 e6 00 1e 00 00 c3 00 01 01 6a d5 79 f4 e1 17 9d 84 00 40 1f 00 04 00 00 00 Destination Address, Last Octet E.g. 192.168.63.230, 230 == 0xE6 Source Address, Last Octet E.g. 192.168.63.30, 30 == 0x1E CRC CRC is calculated based on 0xC3 (byte 13) onward CRC algorithm is selected via protocol (more on this) Random Nonce

CoDeSysV3 First Reply S->M c5 f3 40 40 00 11 00 1e 00 e6 00 00 83 00 01 01 51 a7 eb 4c e1 17 9d 84 00 00 00 2c 94 24 00 00 01 04 62 de Session ID (2 bytes)

CoDeSysV3 Session Packet M->S c5 73 40 40 00 11 00 e6 00 1e 00 00 01 81 00 2c 37 02 00 00 fd 01 00 00 1c 00 00 00 97 fa b3 5e cd 55 00 0c 00 02 00 10 00 00 1a c5 00 00 00 0c 81 01 88 00 11 84 80 00 00 00 45 f9 Session Identifier, 2 bytes Master Sequence number Little Endian Unsigned Int Starts with 1, increments with each request from master Slave Sequence number Little Endian, increments with each response from slave Length CRC

CRC Algorithm Took some time to learn how this works Appeared to be CRC32 Several CRC algorithms implemented in GatewayService.exe, but no calls to these algorithms Debugged application to learn how it gets called

CoDeSysV3 CRC Selection (packet parser disassembly)

CoDeSysV3 CRC Selection Interesting place to look for bugs, both in EWS and Firmware Some suggestions that other fields in the protocol work the same way (no function references that we would expect in the disassembly) A good Red Team would shout about this implementation lots to go wrong

CoDeSysV3 UDP Security Security completely dependent upon session ID Local Subnet == Hacker wins 100% Remote Subnet == Easy to work around Session ID only 16384 values 2 bytes (up to 65536 values) but PLC increments value by 4 with each new session

So CoDeSysV3 IsVulnerable! ICS-CERT gets it wrong ICS-CERT probably got this information from 3S- Software. They don t verify vendor claims.

So CoDeSysV3 IsVulnerable! 3S-Software gets it wrong Bad Info ( affects V2.3? Also V2.4 and V3!) Only OEMs can download patch

CoDeSysV3 Lessons 3 rd party library vendor analysis Most will say, We have no problem Ask to see vendor s SDL documentation Trust But Verify Bring in Red Team and test yourself

CoDeSysV3 Lessons ICS-CERT reports untrustworthy ICS-CERT either can t do or can t publish own analysis Pretty obvious in this case would have spotted problem in 1 day of analysis Does more harm than good in this case (V3 users read, we aren t vulnerable, unlikely to pay attention to future issues)

Outline Vulnerabilities: What are they? 3 rd party libraries Specific example Deep Dive Affected Vendor #1 Affected Vendor #2 Conclusion

Vulnerable Vendor Highlight Hitachi EHV+ Line CoDeSysV3

Hitachi EHV+ Line: CoDeSysV3 EHV-CPU 1025 tested UDP only* Command line disabled* * These features might be enabled via updating config.cfg file on the PLC. No success yet.

Hitachi EHV+ Line: What They Did Right Hitachi deserves some credit EHV+ has no open TCP ports by default Only one open UDP port that we could tell (CoDeSys V3) This is much smaller attack surface than most vendors

Hitachi EHV+ Line No mechanism seen for applying a firmware update (Have not reverse engineered firmware, though, so maybe there is a way)

Hitachi EHV+: Exploiting UDP No security on CoDeSysV3 Protocol, just SID 2 bytes, so range is 0-65535 but PLC increments by 4, so only 16384 values No mechanism for adding password via CoDeSys Engineering Software Exploit script capabilities tested: Stop/Start CPU Retrieve/Send Ladder Logic Send New config.cfg Change IP address

Attacking UDP Attacker Network Router CoDeSys PLC PC (Might not exist)

Attacking UDP Attacker Request Session Source address: PC Network Router CoDeSys PLC PC (Might not exist)

Attacking UDP Attacker Network Router PLC Sends Session ID To Local PC PC may not expect message, or PC may not exist! CoDeSys PLC PC (Might not exist)

Attacking UDP Attacker Attacker must guess Session ID to STOP CPU Network Router CoDeSys PLC PC (Might not exist)

Outline Vulnerabilities: What are they? 3 rd party libraries Specific example Deep Dive Affected Vendor #1 Affected Japanese Vendor #2 Conclusion

Vulnerable Vendor Highlight Sanyo-Denki SanMotion C CoDeSysV2 vxworks debugger service Backdoor accounts (FTP)

Sanyo-Denki SanMotionC

SanMotionC FestoCECX-X-M1

SanMotion C Festo CECX-X-M1 Keba CP 232/Z

Festo/Sanyo/OEM? Festoand Sanyo seem to use same OEM Identical firmware on all systems Also in use by Keba, Kuka, Trumpf, Haitian, Buehler, Duerr, Engel, and other vendors OEM probably Keba Automation CP 232/Z (Austria) Tons of software components in system vxworks CoDeSys CANOpen protocol stack Etc

Festo/Sanyo/EtcVulnerabilities CoDeSysV2 All V2 problems exist First contacted Festo via ICS-CERT in early 2013 See ICS-CERT advisory ICSA-14-084-01, Festorefused to fix any problems vxworks Debugging Backdoor CVE-2005-3804 Unauthenticated read/write to all memory Vulnerability was 5 years old at product release Backdoor FTP account CANBus debugging protocol ports

Festo/Sanyo/EtcVulnerabilities Of the 9 total companies affected, none of them spotted the security problems Likely that none of these companies do internal or external red teaming Unknown if any of these companies share vulnerability information (what about hardware defect information?)

Outline Vulnerabilities: What are they? 3 rd party libraries Specific example Deep Dive Affected Vendor #1 Affected Vendor #2 Conclusion

Conclusions but first.nl Shared scan script with John Matherly~2014 CoDeSys now searchable on Shodan country:nl 3s-smart 68 total devices (number has been increasing) Quite a few devices in Netherlands! Many HVAC systems One navigation/engine controller identified onboard a ferry (public transportation) Mostly devices for which we do not know the purpose

On Scanning for Systems Leverett smetric: cost for finding vulnerable devices 2013 stats: 600 devices found on Internet, cost was 1.30 per discovered device Cost: VPS rental and time to massage data 2015 stats: 1500 devices found on Internet, cost is 0.01 per discovered device Cost: 17 for Shodanfilter access

On Scanning for Systems Hardest part is what to do with device lists Most CERT/CSIRT have no authority to do anything May have friends at ISPs/companies, but cannot compel action Most ISPs refuse to forward security advisories to clients Legal issues abound: sometimes not allowed, sometimes afraid if we do it for this vuln, and not another, we may get sued Very rarely, device owners can be identified, but even they don t always take action One recent conversation: Yes, that is ours, but we don t know where it is.

Conclusions Identify security issues before product release Vendors should build list of 3 rd party products and monitor them for vulnerabilities In Sanyo-Denki example, controller released April 2010 (5 years after vxworksvulnerability widely known) In Hitachi example, EHV+ line released before v2 vulnerability was public, ~June-September 2010. Should have been noticed during internal security analysis

Plan to Patch Conclusions 2 Design an update mechanism Secure by design (functional/interface security) Genuine bugs are then easy to patch Design problems major problem for ICS Ex: Schneider patches webserver directory traversal (Billy Rios) quickly, but years later design problems persist Ex: 3S Software patched directory traversal bugs (Aaron Portnoy) quickly, took >1 year to patch CoDeSys design problem.

Questions? Reid Wightman wightman@digitalbond.com @ReverseICS Twitter