AppSensor - Near Real Time Event Detection and Response

59
AppSensor ~real-time event detection and response

Transcript of AppSensor - Near Real Time Event Detection and Response

Page 1: AppSensor - Near Real Time Event Detection and Response

AppSensor~real-time event detection and response

Page 2: AppSensor - Near Real Time Event Detection and Response
Page 3: AppSensor - Near Real Time Event Detection and Response

Agenda• who - prior work

• why - motivations

• what - the pitch

• how - the tech

• when - future plans

• who - contributors

Page 4: AppSensor - Near Real Time Event Detection and Response

who

Page 5: AppSensor - Near Real Time Event Detection and Response

prior work

• Network IDS (Denning, * others, NIST SP800-94)

• Intrusion prevention

• Fraud detection

• Rules engines, Risk analysis/reduction (see Groves), HIDS

Page 6: AppSensor - Near Real Time Event Detection and Response

terminology

• event - suspicious

• attack - malicious (1 .. * events)

• response - take action (1 .. 1 attack)

• detection point - activity category (e.g. cookie modification)

Page 7: AppSensor - Near Real Time Event Detection and Response

why

Page 8: AppSensor - Near Real Time Event Detection and Response

~5 yrs ago dev

• mostly web apps [RoR, PHP, .NET, Java)

• ajax (jquery) use growing

• mobile just getting started

• deployment to VMs

• hadoop picking up

• BI tools

• AWS starting

• cloud hype cycle (NIST defines)

Page 9: AppSensor - Near Real Time Event Detection and Response

~now dev• JS everywhere

• functional / rx programming

• cloud everything

• ci/cd

• nosql / CAP light

• containers

• big data

• stream processing

• config management

• iot

• beacons [usage, ads, errors, performance]

• actors/csp

• microservices

• cqrs / event sourcing

• mobile

Page 10: AppSensor - Near Real Time Event Detection and Response

~now dev• JS everywhere

• functional / rx programming

• cloud everything

• ci/cd

• nosql / CAP light

• containers

• big data

• stream processing

• config management

• iot

• beacons [usage, ads, errors, performance]

• actors/csp

• microservices

• cqrs / event sourcing

• mobile 1 .. * of [scale, speed, cloud, lack of environmental access]

Page 11: AppSensor - Near Real Time Event Detection and Response

dev buzzwords• devops

• functional (FP)

• agile

• cqrs / event sourcing

• cloud (-native)

• iot

• scalable

• microservices

• ci/cd

• containers

• big data

• streaming

Page 12: AppSensor - Near Real Time Event Detection and Response
Page 13: AppSensor - Near Real Time Event Detection and Response

- LinkedIn, March 2015

“the Kafka ecosystem at LinkedIn is sent over 800 billion* messages per day..

At the busiest times of day, we are receiving over 13 million messages per second.”

* Update (Sept 2015) : 1.1 Trillion messages per day

Page 14: AppSensor - Near Real Time Event Detection and Response

last ~5 yrs security

• 3rd party libs (dep-check)

• bug bounties

• sast / dast evolve (ZAP)

• iast / rasp

• http security headers

• automatic encoding (JXT)

• *-monkey -NetflixOSS

• bdd-security/gauntlt

• ci/cd plugins

• 2fa

• osquery

1 .. * of [scale, speed, cloud, lack of environmental access]

Page 15: AppSensor - Near Real Time Event Detection and Response

dev vs. security

• dev is exploiting fundamental architectural and deployment changes to add business value

!

• security is iterating on existing solutions - and - trying to close gaps (known problems)

Page 16: AppSensor - Near Real Time Event Detection and Response

having to deal with [scale, speed, cloud, lack of

environmental access] !

represents an enormous opportunity for security

Page 17: AppSensor - Near Real Time Event Detection and Response

what

Page 18: AppSensor - Near Real Time Event Detection and Response

the pitch• security can’t scale without dev + ops

• automated response > manual response

• make IDS primitives available at app layer

• stop attacker before success

• build self-protecting applications

• gain valuable intel

• benefit / extend (existing) secure sdlc efforts

X successAppSensor

Page 19: AppSensor - Near Real Time Event Detection and Response

• picture 1

Page 20: AppSensor - Near Real Time Event Detection and Response
Page 21: AppSensor - Near Real Time Event Detection and Response

Correlation … and scale

Page 22: AppSensor - Near Real Time Event Detection and Response
Page 23: AppSensor - Near Real Time Event Detection and Response
Page 24: AppSensor - Near Real Time Event Detection and Response
Page 25: AppSensor - Near Real Time Event Detection and Response

how

Page 26: AppSensor - Near Real Time Event Detection and Response

examplePOST /account/transfer HTTP/1.1 !Host: 127.0.0.1 User-Agent: Mozilla/5.0 (Win…) Accept: text/html,application/xhtml+xml Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://127.0.0.1/account.php Cookie: PHPSESSID=l9…lgt5 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 30 from_acct=xxx1234&to_acct=xxx9876&amt=20.00

Page 27: AppSensor - Near Real Time Event Detection and Response

examplePOST /account/transfer HTTP/1.1 !Host: 127.0.0.1 User-Agent: Mozilla/5.0 (Win…) Accept: text/html,application/xhtml+xml Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://127.0.0.1/account.php Cookie: PHPSESSID=l9…lgt5 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 30 from_acct=xxx1234&to_acct=xxx9876&amt=20.00

Page 28: AppSensor - Near Real Time Event Detection and Response

examplePOST /account/transfer HTTP/1.1 !Host: 127.0.0.1 User-Agent: Mozilla/5.0 (Win…) Accept: text/html,application/xhtml+xml Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://127.0.0.1/account.php Cookie: PHPSESSID=l9…lgt5 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 30 from_acct=xxx1234&to_acct=xxx9876&amt=20.00

Page 29: AppSensor - Near Real Time Event Detection and Response

example@POST public Response transfer( String from, String to, String amount) { ! transfer(from, to, amount); ! return Response.ok(); }

Page 30: AppSensor - Near Real Time Event Detection and Response

example@POST public Response transfer( String from, String to, String amount) { ! if ( currentUser.owns(from) ) { transfer(from, to, amount); } ! return Response.ok(); }

Page 31: AppSensor - Near Real Time Event Detection and Response

example@POST public Response transfer( String from, String to, String amount) { ! if ( currentUser.owns(from) ) { transfer(from, to, amount); } else {! appsensor.addEvent( new Event(currentUser, "ACE2") );! }!! return Response.ok(); }

Page 32: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDE

• secure programming IDE plugin

• educational component

• https://www.owasp.org/index.php/OWASP_ASIDE_Project

Page 33: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDE

Page 34: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDEBased  on  ESAPI  code  (length  checked),  ASIDE  infers  that  this  may  be  a  point  to  insert  an  app  sensor;  whether  a  sensor  is  placed  relies  on  developer’s  decision.  

Page 35: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDEBased  on  ESAPI  code  (length  checked),  ASIDE  infers  that  this  may  be  a  point  to  insert  an  app  sensor;  whether  a  sensor  is  placed  relies  on  developer’s  decision.  

Page 36: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDEBased  on  ESAPI  code  (length  checked),  ASIDE  infers  that  this  may  be  a  point  to  insert  an  app  sensor;  whether  a  sensor  is  placed  relies  on  developer’s  decision.  

Page 37: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDE

It  not  only  captures  the  context  informaFon  (e.g.  the  sensor  event  is  from  username  field),  but  also  records  that  the  sensor  event  is  due  to  an  exceedingly  lengthy  input.  

Page 38: AppSensor - Near Real Time Event Detection and Response

Detec%on(Point(Type( Detec%on(Points(Covered(

Authen'ca'onExcep'on. AE4:.Unexpected.Quan'ty.of.Characters.in.Username.AE5:.Unexpected.Quan'ty.of.Characters.in.Password.AE6:.Unexpected.Type.of.Character.in.Username.AE7:.Unexpected.Type.of.Character.in.Password.

InputExcep'on. IE1:.Cross.Site.Scrip'ng.AEempt.

EncodingExcep'on. EE1:.Double.Encoded.Character.EE2:.Unexpected.Encoding.Used.

CommandInjec'onExcep'on.

CIE1:.Blacklist.Inspec'on.for.Common.SQL.Injec'on.Values.

Detec%on(Points(Picked( Corresponding(ASIDE(APIs(

AE4:%Unexpected%Quan1ty%of%Characters%in%Username%AE5:%Unexpected%Quan1ty%of%Characters%in%Password%

Java.lang.String%ASIDE.Quan%tyExcep%onSensor(Java.lang.String%parameter)%

AE6:%Unexpected%Type%of%Character%in%Username%AE7:%Unexpected%Type%of%Character%in%Password%

Java.lang.String%ASIDE.TypeExcep%onSensor(Java.lang.String%parameter)%

IE1:%Cross%Site%Scrip1ng%AKempt%

Java.lang.String%ASIDE.XSSSensor(Java.lang.String%parameter)%

EE1:%Double%Encoded%Character%EE2:%Unexpected%Encoding%Used%

Java.lang.String%ASIDE.EncodingExcep%onSensor(Java.lang.String%parameter)%

CIE1:%Blacklist%Inspec1on%for%Common%SQL%Injec1on%Values%

Java.lang.String%ASIDE.SQLInjec%onSensor(Java.lang.String%parameter)%

Page 39: AppSensor - Near Real Time Event Detection and Response

OWASP ASIDE

• eclipse IDE

• reminder icon or highlight

• drop down list of applicable sensors

• auto-insertion of ASIDE sensor APIs and code refactoring

Page 40: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

• Sumanth Damarla

• 6 weeks

• appsensor -> ELK stack

• appsensor -> influxdb -> grafana

Page 41: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

Page 42: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

Page 43: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

Page 44: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

Page 45: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

Page 46: AppSensor - Near Real Time Event Detection and Response

owasp SoC sprint

Page 47: AppSensor - Near Real Time Event Detection and Response

machine learning

• very simple analysis

• generated demo dataset for 1-week

• build base model

• look for “anomalies”

Page 48: AppSensor - Near Real Time Event Detection and Response
Page 49: AppSensor - Near Real Time Event Detection and Response

DEMOappsensor UI

& exception handling example

Page 50: AppSensor - Near Real Time Event Detection and Response

when

Page 51: AppSensor - Near Real Time Event Detection and Response

future

• better story for adding detection points

• more (canned) analysis (exploring machine learning, expert systems)

• more integrations

• standard refactoring / maintenance

Page 52: AppSensor - Near Real Time Event Detection and Response

you• help wanted!

• plenty of places to contribute and improve

• friendly, helpful community

• https://github.com/jtmelton/appsensor/issues

• https://www.owasp.org/index.php/OWASP_AppSensor_Project#tab=Road_Map_and_Getting_Involved

Page 53: AppSensor - Near Real Time Event Detection and Response

who

Page 54: AppSensor - Near Real Time Event Detection and Response

related projects

• ensnare

• fido

• riemann

• elastalert

Page 55: AppSensor - Near Real Time Event Detection and Response

pick a tool … !

but use the idea

Page 56: AppSensor - Near Real Time Event Detection and Response

contributors• https://www.owasp.org/index.php/

OWASP_AppSensor_Project#tab=Acknowledgements

Page 57: AppSensor - Near Real Time Event Detection and Response

me

• appsensor dev lead

• twitter: @_jtmelton

• email: [email protected]

• github: jtmelton

Page 58: AppSensor - Near Real Time Event Detection and Response

links

• https://www.owasp.org/index.php/OWASP_AppSensor_Project

• http://appsensor.org/

• https://github.com/jtmelton/appsensor

Page 59: AppSensor - Near Real Time Event Detection and Response

?