24
Everything you know about Injection Attack is Wrong Pravir Chandra Bloomberg [email protected]

Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Everything you know about Injection Attack is Wrong

Pravir Chandra Bloomberg

[email protected]

Page 2: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

SQL Injection

Page 3: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

SQL Injection

Page 4: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l
Page 5: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Prepared Statement

Page 6: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Now what?

Page 7: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Input Validation!!!

Page 8: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Input Validation???

Page 9: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Input Validation

Page 10: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Cross Site Scripting

Page 11: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

XSS – HTML

Page 12: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

XSS – Attribute

Page 13: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

XSS – CSS

Page 14: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

XSS – Javascript

Page 15: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

XSS – URL

Page 16: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

So what’s the real problem here?

Page 17: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l
Page 18: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

LDAP Injection

Malicious Input: foo (| (objectclass=*))

Page 19: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

XPath Injection

Malicious Input: ’ or 1=1 or ‘’=‘

Page 20: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Log Injection

Malicious Input: abc\nUser “admin” logged in successfully

Page 21: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

So how do we prevent it?

Page 22: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Protect output contexts by design

Output

Assembler

Known-Safe

Output Value

HTML Encoder

Escaping Function

...

Parameterization

Logic

Untrusted

Input Value(s)

Output Template

Where the API isn’t given by your platforms/libraries, BUILD IT!

Page 23: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Expose “control” resources indirectly

Internal Reference Map

Direct

References (real resource

names)

Indirect

References(random,

unguessable)

Client's Value Services

Database

...

Page 24: Everything you know about Injection Attack is Wrong · 2020-01-17 · Expose “control” resources indirectly I n te rn a l R e fe re n ce Ma p D ire ct R e fe re n ce s (re a l

Thanks for your time!

Pravir Chandra

[email protected]