Demystifying Application Security
Shyam Seshadri
Today’s Agenda
• XSS (Cross Site Scripting)
• CSRF (Cross Site Request Forgery)
• JSON Attacks
• Click-jacking
• Click-baiting
• PTSD
• RSS
• …
THIS IS WHY IT IS HARD TO START
LEARNING ABOUT (WEB) SECURITY!
The Real Agenda.
• Evolution of security
• Understanding the real threat
• Attack vectors
• Thinking about security
About Me
What I doWhat I’ve done What I’ve written
Life before the internet!
Web 1.0
• Server security all that mattered
• Standards
– XSS
– CSRF
• We just started figuring these out when…
Web 2.0
JS Explosion!!
• Everything that used to be the realm of the
server is now being done on the client
• Routing
• Business Logic
• Access Control (Gasp!!)
Framework Developers!
Whose job is Security anyway?
Where’s the threat?
The real threat!
Possible security exploits
• OWASP Top 10
• But what about the others?
• A new exploit almost every other day
• So how do you deal with this?
It starts with trust
Would you trust him?
Would you trust him?
But what if??
Fundamental Rule of Security
Be like Mad-Eye Moody!
Think Attack Vectors!
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Fundamental rule of security
• Never trust!
– Especially the client and user input!
• Question every data element
– and it’s source
– and how it’s transmitted
– and how it’s stored
– Err on the side of caution
• Role / User Based Access Control a must on the server!
My corollary
Convenience / laziness is the simplest path to
security hell!
Convenience – the pathway to hell
Let’s talk about trust
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Thinking about trust
• Source?
• Mutable or pristine?
• Impact of trusting?
Identity in Web Apps
Securing Identity in Web Apps
• Login
– Only time to ask the client who they are
– Even then?
• Post that
– Trust the server generated session id or token, not the user
• Don’t forget
– Check Authentication
– Check Authorization
• Don’t believe the client
Transmission
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Secure transmission in web apps
• Either you reinvent HTTPS on the client and your
server
– Build your crazy cryptographic solution
– That resides on the client…
• or just use HTTPS!
• And don’t let JS and HTTP read your cookies!
– Use secure, httpOnly cookies!
Every non-secure transmission is a leak waiting to happen!
Storage
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Securing data in web apps
• How and what?
– Transient or Stored?
– Uniquely identifiable?
– Needed or convenient?
• Where?
– On the client
– On the server
– Impact of leakage of the data?
– Not all data is created equal
• Access?
Cryptography
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Cryptography
Don’t reinvent the wheel!
Credentials
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Credentials
• Are your DB / AWS / XYZ credentials
– Hard-coded in your code?
– Checked in to your version control?
– Provided to even the janitor at your company?
• You are doing it wrong!
• Never checked in!
• Rotate credentials!
• Need to know basis!
– And no one needs to know!
Updates & Libraries
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Updates
• Don’t wait for a mandatory, forced upgrade
• Make it hygiene
• Smaller, regular updates easier than forced,
large updates
Audit Logs
TrustTransmission
Storage
Cryptography
Credentials &
Access
Outdated /
vulnerable
libraries
Audit logs
Audit Logs
• It’s too late by the time you need it!
• Trustworthy?
• Comprehensive?
Your cheatsheet
• Ask yourself this
– Do I trust this data from the server / client?
– Do I need this entire data to be sent to the client or only a
part of it?
– Can this user actually perform this action on this resource?
– Should I persist this data in the client?
– Is it being securely transmitted?
– Is it stored securely?
– Using the right / latest libraries?
Thank you
Any Questions?

Demystifying Web Application Security - JSFoo 2018

Editor's Notes

  • #8 Physical security all that mattered!
  • #29 Do you trust the provider of the identity?