Armorizing applications

84
Armorizing Applications Iftach Ian Amit Director of Services Friday, October 11, 13

description

In this talk from Ian Amit, he will try to address things from a more tactical (read: practical) perspective for application development. What 'we' see, or want, from a security practitioner perspective is nice, but enabling it from an application view isn't trivial. He'll cover the aspects that the attendees can gain from having applications designed and implemented in certain manners, while of course not changing the way things are being practiced these days (too much). He will also show how logging (yes… plain old boring logging) can go a long way, and how applications that are a bit more self conscience to their state can be utilised to detect attacks before they actually happen.

Transcript of Armorizing applications

Page 1: Armorizing applications

Armorizing Applications

Iftach Ian AmitDirector of Services

Friday, October 11, 13

Page 2: Armorizing applications

Hi!

Friday, October 11, 13

Page 3: Armorizing applications

I’m not an application guy :-|

Friday, October 11, 13

Page 4: Armorizing applications

I’m a security guy

Who actually used to do some application stuff

Friday, October 11, 13

Page 5: Armorizing applications

whoami?

$ id

uid=501(iamit) gid=20(ioactive) groups=12(hack),33(research),61(dev),79(red_team),80(sexy_defense),81(exil),98(idf),100(dc9723),204(/dev/null)

Friday, October 11, 13

Page 6: Armorizing applications

Attack?

Defense!

Friday, October 11, 13

Page 7: Armorizing applications

So, I’ve been dealing with defense a lot

Friday, October 11, 13

Page 8: Armorizing applications

As in - helping defenders get a head start

Friday, October 11, 13

Page 9: Armorizing applications

Guess what? We are still failing on the basics...

Friday, October 11, 13

Page 10: Armorizing applications

Logs...

Friday, October 11, 13

Page 11: Armorizing applications

Logs...

Firewall

Friday, October 11, 13

Page 12: Armorizing applications

Logs...

FirewallIDS

Friday, October 11, 13

Page 13: Armorizing applications

Logs...

FirewallIDS

IPS

Friday, October 11, 13

Page 14: Armorizing applications

Logs...

FirewallIDS

IPS

Network

Friday, October 11, 13

Page 15: Armorizing applications

Logs...

FirewallIDS

IPS

Network

HTTPD

Friday, October 11, 13

Page 16: Armorizing applications

Logs...

FirewallIDS

IPS

Network

HTTPD

DBMS

Friday, October 11, 13

Page 17: Armorizing applications

Logs...

FirewallIDS

IPS

Network

HTTPD

DBMS DNS

Friday, October 11, 13

Page 18: Armorizing applications

Logs...

FirewallIDS

IPS

Network

HTTPD

DBMS DNS

Application?

Friday, October 11, 13

Page 19: Armorizing applications

We still have sucky application logs :-(

Friday, October 11, 13

Page 20: Armorizing applications

Friday, October 11, 13

Page 21: Armorizing applications

I mean, we came a long way since web-app coding in the 90’s

I know. I’ve lived through it :-(

Friday, October 11, 13

Page 22: Armorizing applications

Example:

Friday, October 11, 13

Page 23: Armorizing applications

Example:

Friday, October 11, 13

Page 24: Armorizing applications

Example:

Uses MVC. Actually very nicely

architected...

Friday, October 11, 13

Page 25: Armorizing applications

Example:

Uses MVC. Actually very nicely

architected...

Friday, October 11, 13

Page 26: Armorizing applications

Example:

Uses MVC. Actually very nicely

architected...Good start. At least

we can haz data.

Friday, October 11, 13

Page 27: Armorizing applications

Example:

Uses MVC. Actually very nicely

architected...Good start. At least

we can haz data.

This is pretty much useless*

Friday, October 11, 13

Page 28: Armorizing applications

Example:

Uses MVC. Actually very nicely

architected...Good start. At least

we can haz data.

This is pretty much useless*

* from a security perspective.no doubt that when this breaks you’ll need it

Friday, October 11, 13

Page 29: Armorizing applications

Let’s get back to basics for a sec here

Friday, October 11, 13

Page 30: Armorizing applications

time=2013-03-02 23:59:57 action=drop orig=192.168.1.103 i/f_dir=inbound i/f_name=eth1c0 has_accounting=0 product=VPN-1 & FireWall-1 policy_name=INTERNET src=1.2.3.4 s_port=37586 dst=3.4.5.6 service=80 proto=tcp rule=16 xlatesrc=8.9.10.11 xlatesport=57517 xlatedport=0 NAT_rulenum=4 NAT_addtnl_rulenum=internal

Friday, October 11, 13

Page 31: Armorizing applications

Friday, October 11, 13

Page 32: Armorizing applications

but wait,

how about them HTTPD?

Friday, October 11, 13

Page 33: Armorizing applications

193.205.210.42 - - [09/Oct/2013:00:57:17 -0700] "GET /blog/2013/07/mail-encryption-for-android/ HTTP/1.1" 200 32064 "https://www.google.it/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:19 -0700] "GET /blog/wp-includes/js/comment-reply.min.js?ver=3.6.1 HTTP/1.1" 200 1068 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:19 -0700] "GET /blog/wp-content/plugins/podpress/js/podpress.js?ver=3.6.1 HTTP/1.1" 200 40786 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:19 -0700] "GET /blog/wp-content/plugins/jetpack/modules/sharedaddy/sharing.css?ver=2.5 HTTP/1.1" 200 11641 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:19 -0700] "GET /blog/wp-content/plugins/lightbox-2/lightbox.js?ver=1.8 HTTP/1.1" 200 21623 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:19 -0700] "GET /blog/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1 HTTP/1.1" 200 7484 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:20 -0700] "GET /blog/wp-content/plugins/podpress/players/1pixelout/1pixelout_audio-player.js HTTP/1.1" 200 12305 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:20 -0700] "GET /blog/wp-content/plugins/jetpack/modules/wpgroho.js?ver=3.6.1 HTTP/1.1" 200 1212 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:20 -0700] "GET /blog/wp-content/plugins/jetpack/modules/sharedaddy/sharing.js?ver=20121205 HTTP/1.1" 200 39040 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:21 -0700] "GET /blog/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=3.5.2 HTTP/1.1" 200 8610 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:21 -0700] "GET /blog/wp-content/plugins/contact-form-7/includes/js/jquery.form.min.js?ver=3.40.0-2013.08.13 HTTP/1.1" 200 14910 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:23 -0700] "GET /favicon.ico HTTP/1.1" 200 1351 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"193.205.210.42 - - [09/Oct/2013:00:57:23 -0700] "GET /blog/wp-includes/js/jquery/jquery.js?ver=1.10.2 HTTP/1.1" 200 93371 "http://www.iamit.org/blog/2013/07/mail-encryption-for-android/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"Friday, October 11, 13

Page 34: Armorizing applications

Don’t get me started...

Friday, October 11, 13

Page 35: Armorizing applications

And that’s AFTER taking into account “log analyzers”

Friday, October 11, 13

Page 36: Armorizing applications

“But you security guys have all these fancy SIEM stuff, right?”

Friday, October 11, 13

Page 37: Armorizing applications

Friday, October 11, 13

Page 38: Armorizing applications

Friday, October 11, 13

Page 39: Armorizing applications

Friday, October 11, 13

Page 40: Armorizing applications

Yes, we have fancy dashboardsand graphs

and sometimes synchronized logs from multiple sources

But it’s still a pain in the tuches

Friday, October 11, 13

Page 41: Armorizing applications

WHY?

Friday, October 11, 13

Page 42: Armorizing applications

Friday, October 11, 13

Page 43: Armorizing applications

The application has ALL THE CONTEXT

Friday, October 11, 13

Page 44: Armorizing applications

Friday, October 11, 13

Page 45: Armorizing applications

Friday, October 11, 13

Page 46: Armorizing applications

Friday, October 11, 13

Page 47: Armorizing applications

Yet you keep it to yourself

Friday, October 11, 13

Page 48: Armorizing applications

This made me cry in joy:

Friday, October 11, 13

Page 49: Armorizing applications

Friday, October 11, 13

Page 50: Armorizing applications

Firewall Web Server

Client XClient XClient YClient XClient YClient YClient XClient XClient XClient YClient Y

indexitemsindexitems+aitemsitems+ccheckoutloginconfirmcheckoutconfirm

Friday, October 11, 13

Page 51: Armorizing applications

Firewall Web ServerApplication

Client XClient XClient YClient XClient YClient YClient XClient XClient XClient YClient Y

indexitemsindexitems+aitemsitems+ccheckoutloginconfirmcheckoutconfirm

- John, from X, justbought A and shippedit paying with CC

- Client from Y tried tobypass app logic and avoidpayment/auth

Friday, October 11, 13

Page 52: Armorizing applications

Friday, October 11, 13

Page 53: Armorizing applications

Friday, October 11, 13

Page 54: Armorizing applications

Friday, October 11, 13

Page 55: Armorizing applications

Rinse, Lather,Repeat

Friday, October 11, 13

Page 56: Armorizing applications

Everywhere!

DB AccessSession ManagementState ManagementUser Management

...

Friday, October 11, 13

Page 57: Armorizing applications

Be a dot connector!

Friday, October 11, 13

Page 58: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Friday, October 11, 13

Page 59: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Account

Friday, October 11, 13

Page 60: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Account

Friday, October 11, 13

Page 61: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Account

>1yr dormant

Friday, October 11, 13

Page 62: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Account

>1yr dormant

laundering

Friday, October 11, 13

Page 63: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Account

>1yr dormant

laundering

Intl. transfers

Friday, October 11, 13

Page 64: Armorizing applications

Counter Intelligence use-case

Problemdormant accounts used

for fraud (and/or money laundering)

Account

>1yr dormant

laundering

Intl. transfersInternal/External???

Friday, October 11, 13

Page 65: Armorizing applications

Account

Friday, October 11, 13

Page 66: Armorizing applications

AccountAccountAccountAccountAccount

Friday, October 11, 13

Page 67: Armorizing applications

List

AccountAccountAccountAccountAccount

Friday, October 11, 13

Page 68: Armorizing applications

Marketing

Accounting

Branch mgmt.List

AccountAccountAccountAccountAccount

Friday, October 11, 13

Page 69: Armorizing applications

Marketing

Accounting

Branch mgmt.

List

AccountAccountAccountAccountAccount

Friday, October 11, 13

Page 70: Armorizing applications

Marketing

Accounting

Branch mgmt.

List

AccountAccountAccountAccountAccount

List

AccountAccountAccountAccountAccount

Friday, October 11, 13

Page 71: Armorizing applications

Marketing

Accounting

Branch mgmt.

List

AccountAccountAccountAccountAccount

List

AccountAccountAccountAccountAccountList

AccountAccountAccountAccountAccount

Friday, October 11, 13

Page 72: Armorizing applications

Marketing

Accounting

Branch mgmt.

List

AccountAccountAccountAccountAccount

List

AccountAccountAccountAccountAccountList

AccountAccountAccountAccountAccount

Internaluser

Friday, October 11, 13

Page 73: Armorizing applications

Marketing

Accounting

Branch mgmt.

List

AccountAccountAccountAccountAccount

List

AccountAccountAccountAccountAccountList

AccountAccountAccountAccountAccount

Internaluser

Friday, October 11, 13

Page 74: Armorizing applications

Marketing

Accounting

Branch mgmt.

List

AccountAccountAccountAccountAccount

List

AccountAccountAccountAccountAccountList

AccountAccountAccountAccountAccount

Internaluser

Friday, October 11, 13

Page 75: Armorizing applications

Internaluser

Friday, October 11, 13

Page 76: Armorizing applications

Internaluser

PC

Friday, October 11, 13

Page 77: Armorizing applications

Internaluser

PC

Friday, October 11, 13

Page 78: Armorizing applications

Internaluser

PC Trojan

Friday, October 11, 13

Page 79: Armorizing applications

Internaluser

PC Trojan

Friday, October 11, 13

Page 80: Armorizing applications

Internaluser

PC Trojan

Friday, October 11, 13

Page 81: Armorizing applications

Internaluser

PC Trojan

C&C

Friday, October 11, 13

Page 82: Armorizing applications

Internaluser

PC Trojan

C&CBad Guys(tm)

Friday, October 11, 13

Page 83: Armorizing applications

Log on context

Weird state changes

Repeatable expectable actions

Who, what, why

Help me get the story right!

Friday, October 11, 13

Page 84: Armorizing applications

Questions? Comments!

Ian Amit@iiamit

[email protected]

Friday, October 11, 13