the industrial internet of sitting ducks jos wetzels · modicon quantum plc* large plc for process...

57
The Industrial Internet of Sitting Ducks Jos Wetzels

Upload: others

Post on 07-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

TheIndustrial Internet of

Sitting Ducks

Jos Wetzels

Page 2: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Jos Wetzels

IndependentSecurity Researcher

ICSIoTAutomotiveMedicalAccess ControlsNetworking & Firewalls

(Former)Security Researcher

Critical InfrastructureEmbedded BinSecHIDS / NIDS

www.midnightbluelabs.comsamvartaka.github.io

@s4mvartaka

Page 3: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 4: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

“We are seeing a market failure for

cybersecurity and privacy. (…) Currently there is no basic level, no level zero

defined for the security and privacy of connected and smart devices.

- ENISA / Infineon / NXP / STM

Page 5: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 6: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 7: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Smart Factories

Page 8: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Critical Infrastructure

Page 9: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

* Trend Micro, 2017

Page 10: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

PLCs

RTUs

Sensors, ActuatorsHMIs

Gateways, Modems

Page 11: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

* https://icsmap.shodan.io/

Page 12: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Stuxnet

Page 13: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Sandworm

Page 14: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 15: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

* Stephen A. Ridley, Senrio Inc., 2016

Page 16: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

* https://www.eevblog.com, 2014

I/O Pins Serial Link

MCU

Page 17: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Typical ICS Security #1:Opto 22 OPTEMU-SNR-DR2*

▫ Energy Monitoring & Control Device

▫ Managed over EthernetFTP, SNMP, OptoMMP(unauthenticated), PAC Control (unauthenticated)

▫ Use OptoMMP todisable IP filtering, enable FTP, get FTP credentials

▫ Upload firmware & reflash over FTP(no firmware signing)

* David Barksdale, Jeremy Brown, 2016

Page 18: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Typical ICS Security #2:Modicon Quantum PLC*

▫ Large PLC for process applications

▫ FTP with hardcoded backdoorRead/Write Access to configuration, firmware, passwords, etc.

▫ Telnet with hardcoded backdoorIs actually a C interpreter…

▫ Unauthenticated Modbus ExtensionStart/Stop PLCOverwrite programmable logicEtc.

* K. Reid Wightman, Rubén Santamarta, 2011-2012

Page 19: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Open Secret: ICS Security Sucks

▫ Unauthenticated Plaintext Protocols

▫ Unauthenticated firmware & logic uploads

▫ Default Backdoor Passwords

▫ Absent or Infrequent Patching

▫ Etc.

Page 20: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

(Some) Reasons Why

▫ Insecure by DesignNot designed for ‘open’ networksSecurity not considered

▫ Device Lifespan10+ years

Age-old designs

Ceased vendor support

▫ Legacy / Backwards CompatibilityAdhere to old, insecure standards

Page 21: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Let’s say we fix all this…What’s next?

Page 22: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Memory Corruption is a Big Deal™ in Embedded

* 2016 ICS Vulnerabilities Statistics, Kaspersky

Page 23: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Unsafe LanguagesAre Here To Stay

▫ Ideally use safe languagesJava, Go, Erlang, Rust

▫ But unsafe continues to dominateC, C++

71%

22%

7%

PRIMARY EMBEDDED PROGRAMMING LANGUAGE

C C++ Other

* 2017 Barr Group Embedded Systems Safety & Security Survey

Page 24: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Exploit Mitigations

Page 25: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

General Purpose ExploitationHas Been Getting Harder

2010 2016

Page 26: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

What About Embedded?

Page 27: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Quantitative Analysis

Page 28: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Minimum Mitigation Baseline

▫ ESP / DEP / NX / W^XNon-exec. data memory

▫ ASLRAddress Space Layout Randomization

▫ Stack Canaries / SSPStack buffer overflow protection

Page 29: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Operating System Selection

▫ Selected 45 Popular Embedded Oses

▫ High-end, Low-end, Linux/Windows/BSD-based, proprietary, etc.

▫ Evaluated Support ForMitigation Baseline

Optimistic Assesment

Page 30: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

0

10

20

30

40

50

60

70

80

90

100

All Oses Non-Mobile Non-Win/Lin/BSD Deeply Embedded

Mitigation SupportESP ASLR Stack Canaries

Page 31: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

What’s Going On Here?

31

Page 32: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Usual Embedded Suspects

ResourceConstraints

HardwareLimitations

CostSensitivity

Random NumberGenerator Issues*

* ‘Wheel of Fortune’ – Jos Wetzels, 33C3, 2016

Page 33: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Hardware & Software Dependencies

Page 34: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 35: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

MPUs/MMUs & Hardware ESP Support

Page 36: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 37: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 38: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,
Page 39: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

0

10

20

30

40

50

60

70

80

90

100

All Oses Non-Mobile Non-Win/Lin/BSD Deeply Embedded

Software Dependency SupportMemory Protection Virtual Memory OS CSPRNG

Page 40: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Hardware Selection

▫ Selected 78 Popular Embedded ‘Core Families’

▫ Evaluated for Hardware Dependency Support

Page 41: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

0

10

20

30

40

50

60

70

80

90

100

Hardware Dependency Support (VNA)MPU MMU Hardware ESP

Page 42: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Practical (I)IoT Examples

Page 43: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Typical (Entry-Level) PLC:Modicon Momentum Unity

▫ ST SPEAr 320s (ARM926EJ-S)Von NeumannMMU (No XN Bit)No TRNG

▫ VxWorks RTOSNo MitigationsMemory ProtectionVirtual MemoryNo OS CSPRNG

Page 44: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Typical Wireless Sensor Node:Advantech WISE-1021

▫ MSP430F5419AVon NeumannNo MPU / MMUNo TRNG

▫ TI-RTOSNo MitigationsMemory ProtectionNo Virtual MemoryNo OS CSPRNG

Page 45: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

▫ Library based RTOSBased on Wind River Rocket

▫ OS Linux Foundation ProjectAimed at resource-constrained IoT

▫ Young (2016) but promisingInput from major chipmakers

Explicit focus on security

Page 46: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

ZephyrStack Canaries

▫ Based on Clang/GCC SSP

▫ One master canary for entire address spaceGenerated once at system boot

▫ Generated using RNG APIImplementation depends on chosen random driver

Page 47: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Zephyr Random APIRANDOM_HAS_DRIVER (TRNG)

▫ RANDOM_MCUX_RNGANXP Kinetis K64F

▫ RANDOM_MCUX_TRNGNXP Kinetis KW40Z & KW41Z

▫ RANDOM_STM32_RNGSTM32 Boards

▫ RANDOM_ESP32_RNGESP32 Boards(requires Wi-Fi & Bluetooth enabled)

Page 48: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

52%48%

TRNG Support

Yes No 0

10

20

30

40

50

60

70

80

90

100

TRNG Support Per Architecturex86 ARM ARC NIOS II

TRNGs Among Zephyr 1.8 Supported Boards

Page 49: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Zephyr Random APITEST_RANDOM_DRIVER (PRNG)

▫ X86_TSC_RANDOM_GENERATOR / TIMER_RANDOM_GENERATORUses timestamp (eg. x86 RDTSC)

Directly, not pulled through PRNG

Canary 1st value drawn from API ->little difference between bootruns

Infoleaks everywhere

▫ Had contact with Zephyr team, plans to integrate OS CSPRNG

Page 50: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Defense

Page 51: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

(Some) IoT Binary Security Tips

Harvard CPU

VNA CPUwith MPU/MMU

& XN

MCU with TRNG

Security-Oriented (RT)OS(Warning: Still early days)

Page 52: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

But: Reality Strikes(& Sucks)

▫ Lifespan & LegacyWhat we buy today was designed years ago

What we design today might still be used in 10+ years

▫ Mitigations are a stop-gapNeed to start work on long-term now

Page 53: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Safe Languages

▫ Can’t emphasize this enough

▫ Move to safe embedded development as soon as possible

Page 54: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Renewable Security & Defense in Depth*

▫ Make your device patchable, ensure an update infrastructure is in place

▫ Layer your defenses, avoid single points of failure

* ‘The Seven Properties of Highly Secure Devices’ –Galen Hunt, Microsoft, 2017

Page 55: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Compartmentalization & Small TCB*

▫ Use hardware to enforce barriers between software components(MMU, TrustZone)

▫ Principle of Least PrivilegeKeep your TCB Small

* ‘The Seven Properties of Highly Secure Devices’ –Galen Hunt, Microsoft, 2017

Page 56: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Failure Reporting*

▫ If possible, ensure failures (eg. segfaults) are reported to cloud-based backend for later analysis

▫ Windows Error ReportingThe Inside Story Behind MS08-067, John Lambert, 2015

* ‘The Seven Properties of Highly Secure Devices’ –Galen Hunt, Microsoft, 2017

Page 57: The Industrial Internet of Sitting Ducks Jos Wetzels · Modicon Quantum PLC* Large PLC for process applications FTP with hardcoded backdoor Read/Write Access to configuration, firmware,

Questions?🐦🐦 @s4mvartaka

[email protected]