Cookies and Sessions Thierry Security assumptions You have - - PowerPoint PPT Presentation

cookies and sessions
SMART_READER_LITE
LIVE PREVIEW

Cookies and Sessions Thierry Security assumptions You have - - PowerPoint PPT Presentation

Cookies and Sessions Thierry Security assumptions You have absolutely no control on the client Client Side Server Side Web Server Database Web Browser Cookies The big picture key/value pairs data Client Side Server Side HTTP request


slide-1
SLIDE 1

Cookies and Sessions

Thierry

slide-2
SLIDE 2

Security assumptions

Server Side Client Side

Web Server Database Web Browser

You have absolutely no control

  • n the client
slide-3
SLIDE 3

Cookies

slide-4
SLIDE 4

The big picture

Server Side Client Side

Web Server Web Browser HTTP request HTTP response HTTP request HTTP response

key/value pairs data

slide-5
SLIDE 5

Cookies

Cookies are key/value pairs sent back and forth between the browser and the server in HTTP request and response

slide-6
SLIDE 6

Anatomy of a Cookie

  • Text data (Up to 4kb)
  • May (or may not) have an expiration date
  • Can be manipulated from the client and the server
slide-7
SLIDE 7

Manipulating cookies

A cookie can be modified (without any cookie flag set)

  • on the server side

express middleware : cookie

  • on the client side

javascript : Document.cookie

slide-8
SLIDE 8

What cookies are useful for?

  • Shopping cart
  • Browsing preferences
  • User authentication
  • Tracking and advertisement
slide-9
SLIDE 9

Sessions

slide-10
SLIDE 10

The big picture

Server Side Client Side

Web Server Web Browser HTTP request HTTP response HTTP request HTTP response

session id key/value pairs data

slide-11
SLIDE 11

The concept of session

  • There is a session id (aka token)

between the browser and the web application

  • This session id should be unique and unforgeable

(usually a long random number or a hash)

  • This session id is bind to key/value pairs data
slide-12
SLIDE 12

Where sessions values are stored

  • Session ID is stored in a cookie
  • Session key/value pairs are stored on the server
slide-13
SLIDE 13

Hacking sessions

The user can create, modify, delete the session ID in the cookie But cannot access the key/value pairs stored on the server