Embedded Web Security through Application-Layer …Umbra Embedded Web Security through...

49
Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security of Cyber-Physical Systems 22 September 2015 Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 1 / 36

Transcript of Embedded Web Security through Application-Layer …Umbra Embedded Web Security through...

Page 1: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

UmbraEmbedded Web Security through Application-Layer

Firewalls

Travis Finkenauer J. Alex Halderman

1st Workshop on the Security of Cyber-Physical Systems22 September 2015

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 1 / 36

Page 2: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 2 / 36

Page 3: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 2 / 36

Page 4: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 2 / 36

Page 5: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 3 / 36

Page 6: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 3 / 36

Page 7: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Motivating Example

Authentication bypass inD-Link router

ExploitCookie: cookie lang=1; client login=admin; client password=1

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 4 / 36

Page 8: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Motivating Example

Stack-based buffer overflow inSupermicro IPMI web interface

ExploitPOST /cgi/login.cgi HTTP/1.1Content-Type: application/x-www-form-urlencoded

name=AAAAAAAAAAAAAAAAAA...&pwd=AAAAAAAAAAAAAAAAAA...

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 5 / 36

Page 9: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Motivating Example

No authentication andfirmware upload CSRF vulnin Canon printer

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 6 / 36

Page 10: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Motivating Example

No authentication andfirmware upload CSRF vulnin Canon printer

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 6 / 36

Page 11: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Problem

Security vulnerabilities are prevalent in embeddeddevices

Embedded developers often have limited knowledge andexperience with security

Existing solutions are not sufficient:Standalone network appliancesWeb frameworks

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 7 / 36

Page 12: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Solution

Design drop-in security shim that:

! Integrates simply with existing embedded devices! Operates in small CPU, code size, and memory

footprint! Works on systems where source code is not available

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 8 / 36

Page 13: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Solution

Design drop-in security shim that:! Integrates simply with existing embedded devices

! Operates in small CPU, code size, and memoryfootprint

! Works on systems where source code is not available

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 8 / 36

Page 14: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Solution

Design drop-in security shim that:! Integrates simply with existing embedded devices! Operates in small CPU, code size, and memory

footprint

! Works on systems where source code is not available

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 8 / 36

Page 15: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Solution

Design drop-in security shim that:! Integrates simply with existing embedded devices! Operates in small CPU, code size, and memory

footprint! Works on systems where source code is not available

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 8 / 36

Page 16: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Motivation

Outline

1 Motivation

2 Design and Implementation

3 Evaluation

4 Conclusion

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 9 / 36

Page 17: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation

Outline

1 Motivation

2 Design and Implementation

3 Evaluation

4 Conclusion

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 10 / 36

Page 18: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation

Design

Web ServerClient Umbra Shim

Target Device

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 11 / 36

Page 19: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Threat Model

Threat Model

In Scope Out of ScopeAttacks on webinterfaces

HTTP or HTTPSUser viewingattacker-controlledpages

Attacks on otherservicesNetwork-level attackers

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 12 / 36

Page 20: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation System Design

System Design

ServerClient

HTTP Request Valid HTTP

RequestFormat

Respond w/

Rejection

No

Matches Config

Specification

Umbra Shim

Process Request

HTTP ResponseProcess Response

No

Yes Yes

Process Response

Target Device

Security

Policy

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 13 / 36

Page 21: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation System Design

System Design

Transparent proxy between clients and serverModifies HTTP requests and responsesNon-blocking sockets using Linux’s epoll

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 14 / 36

Page 22: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Features

Security Features

Vulnerability Security Features

XSS Parameter whitelist

CSRF CSRF protection

Authentication bypass Authentication enforcementHTTP method whitelist

Information leakAuthentication enforcementHTTP method whitelistDirectory traversal check

CGI memory corruptionParameter character whitelistParameter length checkHeader field length limit

Directory traversal Directory traversal check

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 15 / 36

Page 23: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Features

Page-level Authentication

Prevents authenticationbypass and information leakvulnerabilitiesUmbra can enforce RFC 2617Basic AuthenticationUmbra reads credentials fromfile at run time

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 16 / 36

Page 24: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Features

Header Length Limit

Mitigates buffer overflowsLimits the length of header fields and values

ExploitGET / HTTP/1.1Host: 192.168.1.1Connection: keep-aliveUser-Agent: Mozilla/5.0 (X11; Linux x86 64)Overflow: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 17 / 36

Page 25: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Features

CSRF Protection/change-msg

New message:

Submit

/cgi-bin/set-msg

You set thenew message.

Main Page

attacker.com

Page snippet<form action="cgi-bin/set-msg">

<input type="ext" name="new-message"></form>

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 18 / 36

Page 26: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Features

CSRF Protection/change-msg

New message:

Submit

/cgi-bin/set-msg

You set thenew message.

Main Page

attacker.com

X

Page snippet<form action="cgi-bin/set-msg">

<input type="ext" name="new-message"><input type="hidden"

name=" umbra csrf token"value="D629B39EA123DB0E0C35">

</form>

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 18 / 36

Page 27: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Policy

Security Policy

Manufacturers define good vs. badbehaviorUmbra enforces policy described inconfiguration file

Select any combination of security featuresCompiles configuration into C code,which is compiled into Umbra binary

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 19 / 36

Page 28: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Policy

Security Policy

Sections:Global configurationDefault page policyPer-page policy

Specify conservative global policyRelax policy for specific pages

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 20 / 36

Page 29: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Policy

Example Web Application

/change-msg

New message:

Submit

/

Edit message

This is amessage...

/cgi-bin/set-msg

You set thenew message.

Main Page

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 21 / 36

Page 30: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Policy

Global Page Policy

"global_config": {"enable_request_type_check": true,"enable_param_len_check": true,"enable_param_whitelist_check": true,"enable_csrf_protection": true,"enable_authentication_check": true,"session_life_seconds": 300

}

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 22 / 36

Page 31: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Policy

Default Page Policy

"default_page_config": {"request_types": ["GET", "HEAD"],"requires_login": true,"has_csrf_form": false,"receives_csrf_form_action": false,"max_param_len": 30,"whitelist": "[a-zA-z0-9_]"

}

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 23 / 36

Page 32: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Design and Implementation Security Policy

Per-Page Policy

"page_config": {"/":{

"requires_login": false},"/change-msg":{

"has_csrf_form": true},"/cgi-bin/set-msg": {

"request_types": ["POST"],"receives_csrf_form_action": true,"params": {

"new-msg": {"max_param_len": 200,"whitelist": "[a-zA-z0-9_,.! ]"

}}

}}

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 24 / 36

Page 33: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation

Outline

1 Motivation

2 Design and Implementation

3 Evaluation

4 Conclusion

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 25 / 36

Page 34: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation

Questions

1 What is the performance impact?2 Does Umbra achieve the security goal?

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 26 / 36

Page 35: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Performance

Performance

Tested on Raspberry Pi Model Brunning OpenWRT 14.07Laptop connected via 100 MbpsEthernetUsed Apache Benchmark tool todownload main page (2.2 kB)

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 27 / 36

Page 36: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Performance

Performance

0

0.2

0.4

0.6

0.8

1

0 50 100 150 200

resp

onse

tim

e C

DF

response time (ms)

Web Server Latency CDF

without Umbrawith Umbra

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 28 / 36

Page 37: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Performance

Footprint

Size of dynamically-linked ARM binaryUmbra: 75 kBDropbear: 138 kBBusybox: 370 kB

CPU utilization was 2–3% during benchmarkPeaked at a virtual memory size of 1.2 MB

Raspberry Pi has 512 MB of RAM

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 29 / 36

Page 38: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Security

Security Evaluation

BrotherCannon

CiscoD-LinkLinksysLorex

NetgearSupermicroTP-LINKTrendnet

Xerox

Randomly sampled 100 recentvulnerabilities from eight embeddedmanufacturers

40 out of 100 dealt with embedded webinterfaces

Manually classified:Type of vulnerabilityLevel of protection

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 30 / 36

Page 39: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Security

How well can Umbra protect?

Vulnerability Protection Level TotalNone Partial Full Unknown

Bypass 1 0 4 0 5CSRF 0 0 5 1 6Information leak 1 0 3 0 4Command injection 0 0 2 0 2Directory traversal 0 0 1 0 1SQL injection 0 0 0 1 1Other 0 0 0 1 1Denial of service 3 1 1 1 6Memory corruption 2 0 1 0 3XSS 2 3 3 3 11

Protect Totals 9 4 20 7 40

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 31 / 36

Page 40: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Security

How well can Umbra protect?

Vulnerability Protection Level TotalNone Partial Full Unknown

Bypass 1 0 4 0 5CSRF 0 0 5 1 6Information leak 1 0 3 0 4Command injection 0 0 2 0 2Directory traversal 0 0 1 0 1SQL injection 0 0 0 1 1Other 0 0 0 1 1Denial of service 3 1 1 1 6Memory corruption 2 0 1 0 3XSS 2 3 3 3 11

Protect Totals 9 4 20 7 40

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 31 / 36

Page 41: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Security

Security Features Used

Vulnerability Security Feature Total

Auth CSRF Param.White.

Dir.Traver.

HeaderLengthCheck

Param.Length

Bypass 4 0 0 0 0 0 4Command injection 0 0 2 0 0 0 2CSRF 0 5 0 0 0 0 5Denial of service 0 0 0 0 1 0 1Directory traversal 0 0 0 1 0 0 1Information leak 2 1 0 0 0 0 3Memory corruption 0 0 0 0 0 1 1Other 0 0 0 0 0 0 0SQL injection 0 0 0 0 0 0 0XSS 0 0 3 0 0 0 3

Feature Totals 6 6 5 1 1 1 20

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 32 / 36

Page 42: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Evaluation Security

Security Features Used

Vulnerability Security Feature Total

Auth CSRF Param.White.

Dir.Traver.

HeaderLengthCheck

Param.Length

Bypass 4 0 0 0 0 0 4Command injection 0 0 2 0 0 0 2CSRF 0 5 0 0 0 0 5Denial of service 0 0 0 0 1 0 1Directory traversal 0 0 0 1 0 0 1Information leak 2 1 0 0 0 0 3Memory corruption 0 0 0 0 0 1 1Other 0 0 0 0 0 0 0SQL injection 0 0 0 0 0 0 0XSS 0 0 3 0 0 0 3

Feature Totals 6 6 5 1 1 1 20

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 32 / 36

Page 43: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Conclusion

Outline

1 Motivation

2 Design and Implementation

3 Evaluation

4 Conclusion

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 33 / 36

Page 44: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Conclusion

Future Work

Automatically learning a securitypolicyApplying formal methods to UmbracodeHandling other managementprotocols

SNMPIPMITelnet/SSH

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 34 / 36

Page 45: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Conclusion

Conclusion

Built Umbra, an HTTP firewall that comfortablyruns in the footprint of an embedded systemUmbra is capable of preventing about half of thesurveyed vulnerabilities dealing with embedded webinterfacesConfiguration is expressive

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 35 / 36

Page 46: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Conclusion

UmbraEmbedded Web Security through Application-Layer

Firewalls

Travis Finkenauer J. Alex Halderman

Umbra is available as free and open source software:

https://github.com/umbra-firewall/umbra

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 36 / 36

Page 47: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Backup Slides

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 1 / 3

Page 48: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Standalone Firewalls

Operate as separate network entityMany require inline hardware appliances

Examples:Akamai KonaCisco ACEHP TippingPoint

FeaturesOutbound filtering for personalinformation such as credit card numbersDetect common web attacks

Akamai Kona

Cisco ACE

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 2 / 3

Page 49: Embedded Web Security through Application-Layer …Umbra Embedded Web Security through Application-Layer Firewalls Travis Finkenauer J. Alex Halderman 1st Workshop on the Security

Host-based Firewalls

Operate as a plug-in for common webservers

ModSecurityIronBee

Analyzes items such as user-agentstrings, SQL queries, real-time IPblacklist, and HTTP parameters

Travis Finkenauer (University of Michigan) Umbra WOS-CPS 2015 3 / 3