50
Enteprise Security API ESAPI Saturday, 2011-02-26

Entreprise Security API - OWASP Montreal

Embed Size (px)

DESCRIPTION

OWASP Enterprise Security API Toolkits help software developers guard against security-related design and implementation flaws. Because it's an API, it can be easely be add to applications and services to protect themselves from attackers. In this talk, I'll present the project, it's PHP implantation and how to add it to your projects.

Citation preview

Page 1: Entreprise Security API - OWASP Montreal

Enteprise Security APIESAPI

Saturday, 2011-02-26

Page 2: Entreprise Security API - OWASP Montreal

Saturday, 2011-02-26

Page 3: Entreprise Security API - OWASP Montreal

Saturday, 2011-02-26

Page 4: Entreprise Security API - OWASP Montreal

I answer question

Saturday, 2011-02-26

Page 5: Entreprise Security API - OWASP Montreal

The problems

Saturday, 2011-02-26

Page 6: Entreprise Security API - OWASP Montreal

The problems

• Input Validation and Output Encoding

• Authentication and Identity

• URL Access Control

• Business Function Access Control

• Data Layer Access Control

Saturday, 2011-02-26

Page 7: Entreprise Security API - OWASP Montreal

The problems

• Presentation Layer Access Control

• Errors, Logging, and Intrusion Detection

• Encryption, Hashing, and Randomness

Saturday, 2011-02-26

Page 8: Entreprise Security API - OWASP Montreal

A2 – Cross-Site Scripting (XSS)

OWASP TOP 10A1 – Injection

A3 – Broken Authentication and Session Management

A4 – Insecure DirectObject References

A7 – Insecure Cryptographic Storage

A6 – Security Misconfiguration

A5 – Cross-Site Request Forgery (CSRF)

A8 - Failure to Restrict URL Access

A9 - Insufficient Transport Layer Protection

A10 – Unvalidated Redirects and Forwards

Saturday, 2011-02-26

Page 9: Entreprise Security API - OWASP Montreal

And over 300 others security problems types

Saturday, 2011-02-26

Page 10: Entreprise Security API - OWASP Montreal

Vulnerabilities and Security Controls

MissingBroken

Ignored Misused

Saturday, 2011-02-26

Page 11: Entreprise Security API - OWASP Montreal

Why Input Validation Is Hard?

Saturday, 2011-02-26

Page 12: Entreprise Security API - OWASP Montreal

<Saturday, 2011-02-26

Page 13: Entreprise Security API - OWASP Montreal

Percent (url) Encoding

• %3c

• %3C

Saturday, 2011-02-26

Page 14: Entreprise Security API - OWASP Montreal

HTML Entity Encoding

• &#60

• &#060

• &#0060

• &#00060

• &#000060

• &#0000060

• &#60;

• &#060;

• &#0060;

• &#00060;

• &#000060;

• &#0000060;

Saturday, 2011-02-26

Page 15: Entreprise Security API - OWASP Montreal

HTML Entity Encoding

• &#x3c

• &#x03c

• &#x003c

• &#x0003c

• &#x00003c

• &#x000003c

• &#x3c;

• &#x03c;

• &#x003c;

• &#x0003c;

• &#x00003c;

• &#x000003c;

Saturday, 2011-02-26

Page 16: Entreprise Security API - OWASP Montreal

HTML Entity Encoding

• &#X3c

• &#X03c

• &#X003c

• &#X0003c

• &#X00003c

• &#X000003c

• &#X3c;

• &#X03c;

• &#X003c;

• &#X0003c;

• &#X00003c;

• &#X000003c;

Saturday, 2011-02-26

Page 17: Entreprise Security API - OWASP Montreal

HTML Entity Encoding

• &#x3C

• &#x03C

• &#x003C

• &#x0003C

• &#x00003C

• &#x000003C

• &#x3C;

• &#x03C;

• &#x003C;

• &#x0003C;

• &#x00003C;

• &#x000003C;

Saturday, 2011-02-26

Page 18: Entreprise Security API - OWASP Montreal

HTML Entity Encoding

• &#X3C

• &#X03C

• &#X003C

• &#X0003C

• &#X00003C

• &#X000003C

• &#X3C;

• &#X03C;

• &#X003C;

• &#X0003C;

• &#X00003C;

• &#X000003C;

Saturday, 2011-02-26

Page 19: Entreprise Security API - OWASP Montreal

HTML Entity Encoding

• &lt

• &lT

• &Lt

• &LT

• &lt;

• &lT;

• &Lt;

• &LT;

Saturday, 2011-02-26

Page 20: Entreprise Security API - OWASP Montreal

JavaScript Escape

• \<

• \x3c

• \X3c

• \u003c

• \U003c

• \x3C

• \X3C

• \u003C

• \U003C

Saturday, 2011-02-26

Page 21: Entreprise Security API - OWASP Montreal

CSS Escape

• \3c

• \03c

• \003c

• \0003c

• \00003c

• \3C

• \03C

• \003C

• \0003C

• \00003C

Saturday, 2011-02-26

Page 22: Entreprise Security API - OWASP Montreal

UTF-7 vs UTF-8

• +ADw-

• %c0%bc

• %e0%80%bc

• %f0%80%80%bc

• %f8%80%80%80%bc

• %fc%80%80%80%80%bc

Saturday, 2011-02-26

Page 23: Entreprise Security API - OWASP Montreal

1,677,721,600,000,000ways to encode <script>

Saturday, 2011-02-26

Page 24: Entreprise Security API - OWASP Montreal

The Solutions?

Saturday, 2011-02-26

Page 25: Entreprise Security API - OWASP Montreal

What is Enterprise Security API?

Saturday, 2011-02-26

Page 26: Entreprise Security API - OWASP Montreal

ESAPI CommunityCommunauté ESAPI

Mailing ListLibrary Wiki

Users

Developers

Objective-C

Saturday, 2011-02-26

Page 27: Entreprise Security API - OWASP Montreal

ESAPI CommunityCommunauté ESAPI

Mailing ListLibrary Wiki

Users

Developers

Objective-C

Saturday, 2011-02-26

Page 28: Entreprise Security API - OWASP Montreal

ESAPI CommunityCommunauté ESAPI

Mailing ListLibrary Wiki

Users

Developers

Objective-C

Saturday, 2011-02-26

Page 29: Entreprise Security API - OWASP Montreal

Overview of the Architectural Impact

Saturday, 2011-02-26

Page 30: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

Saturday, 2011-02-26

Page 31: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tionisAuthorizedForData()

isAuthorizedForFile()isAuthorizedForFunction()isAuthorizedForService()isAuthorizedForURL()

Saturday, 2011-02-26

Page 32: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

Saturday, 2011-02-26

Page 33: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

<?php echo $ESAPI ->validator() ->getValidInput( String $context, String $input, String type, int $maxLength, boolean allowNull, ValidationErrorList $errorList);?>

Saturday, 2011-02-26

Page 34: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

assertIsValidHttpRequest() assertIsValidHttpRequest ParameterSet() assertIsValidFileUpload()

getValidDate()getValidDouble()getValidDirectoryPath() getValidDouble() getValidFileContent() getValidFileName()

interfaceValidationRule

abstractBaseValidationRule

CreditCardValidationRule

Saturday, 2011-02-26

Page 35: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

isValidCreditCard() isValidDataFromBrowse()isValidDirectoryPath() isValidFileContent() isValidFileName() isValidHTTPRequest() isValidListItem() isValidRedirectLocation() isValidSafeHTML() isValidPrintable() safeReadLine()

interfaceValidationRule

abstractBaseValidationRule

CreditCardValidationRule

Saturday, 2011-02-26

Page 36: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

encodeForCSS encodeForDNencodeForHTMLencodeForLDAPencodeForSQLencodeForURLencodeForXMLencodeForXPath

<?php echo $ESAPI ->encoder() ->encodeForHTML($name)?>

encodeForJavaScriptencodeForHTMLAttributeencodeForVBScriptencodeForXMLAttributeencodeForXPath

Saturday, 2011-02-26

Page 37: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion•Add Safe Header

•No Cache Headers•Set Content Type•Add Safe Cookie•Kill Cookie•Change SessionID•CSRF Tokens

•isSecureChannel •Safe Request Logging•Safe File Uploads

•sendSafeForward•sendSafeRedirect

•Encrypt State in Cookie•Hidden Field Encryption•Querystring Encryption

Saturday, 2011-02-26

Page 38: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

<?php $encrypted = $ESAPI->encryptor() ->encrypt($text)?>

•Integrity Seals •Strong GUID•Random Tokens•Encryption•Digital Signatures •Salted Hash

•Safe Config Details•Timestamp

Saturday, 2011-02-26

Page 39: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

Saturday, 2011-02-26

Page 40: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

Saturday, 2011-02-26

Page 41: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion•AccessControlException

•AuthenticationException •AvailabilityException •EncodingException•EncryptionException•ExecutorException•IntegrityException•IntrusionException•ValidationException

Saturday, 2011-02-26

Page 42: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

Saturday, 2011-02-26

Page 43: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

•Configurable Thresholds •Responses•Log Intrusion•Logout User •Disable Account

Saturday, 2011-02-26

Page 44: Entreprise Security API - OWASP Montreal

Entreprise Security API

Aut

hent

icat

or

Use

r

Acc

essC

ontr

olle

r

Acc

essR

efer

ence

Map

Valid

ator

Enco

der

HTT

PUti

litie

s

Encr

ypto

r

Encr

ypte

dPro

pert

ies

Ran

dom

izer

Exce

ptio

n H

andl

ing

Logg

er

Intr

usio

nDet

ecto

r

Secu

rity

Confi

gura

tion

Saturday, 2011-02-26

Page 45: Entreprise Security API - OWASP Montreal

OWASP TOP 10 ESAPIA1: Injection Encoder

A2: Cross Site Scripting (XSS) Encoder, Validator

A3: Broken Authentication and Session Management Authenticator, User, HTTPUtilities

A4: Insecure Direct Object Reference

AccessReferenceMap, AccessController

A5: Cross Site Request Forgery (CSRF) User (CSRF Token)

A6: Security Misconfiguration SecurityConfiguration

A7: Insecure Cryptographic Storage Encryptor

A8: Failure to Restrict URL Access AccessController

A9: Insufficient Transport Layer Protection

HTTPUtilities (Secure Cookie, Channel)

A10: Unvalidated Redirects and Forwards AccessController

Saturday, 2011-02-26

Page 46: Entreprise Security API - OWASP Montreal

Objective -C

AuthenticationIdentity

Access ControlInput ValidationOutput EscapingCanonicalization

EncryptionRandom Numbers

Exception HandlingLogging

Intrusion DetectionSecurity Configuration

WAF

2.0 1.4 1.4 1.42.0 1.4 1.4 1.42.0 1.4 1.4 1.4 1.42.0 1.4 1.4 1.4 1.4 1.4 2.02.0 1.4 1.4 1.4 1.4 2.02.0 1.4 1.4 1.4 1.4 2.02.0 1.4 1.4 1.4 1.42.0 1.4 1.4 1.4 1.42.0 1.4 1.4 1.4 1.4 1.4 2.02.0 1.4 1.4 1.4 1.4 1.4 2.02.0 1.4 1.4 1.42.0 1.4 1.4 1.4 1.4 1.4 2.02.0

Saturday, 2011-02-26

Page 47: Entreprise Security API - OWASP Montreal

Adopters

Saturday, 2011-02-26

Page 50: Entreprise Security API - OWASP Montreal

Saturday, 2011-02-26