14

Click here to load reader

Web Application Security 101 - 07 Session Management

Embed Size (px)

DESCRIPTION

In part 7 of Web Application Security 101 we will explore the various security aspects of modern session management systems. We will particularly explore vulnerabilities such as weak session management and more. We will also look into session bruteforce attacks

Citation preview

Page 1: Web Application Security 101 - 07 Session Management

Session ManagementAttacking the post-logging state management system.

Page 2: Web Application Security 101 - 07 Session Management

BackgroundHTTP is stateless protocol.

Cookies were introduced to keep state.

But state can be tracked with other tools too.

Page 3: Web Application Security 101 - 07 Session Management

Session Management Machinery

Client Server

GET /resource

Set­Cookie: cookie

Cookie: cookie

Cookie: cookie

Page 4: Web Application Security 101 - 07 Session Management

Common AttacksSession Guessing

Session Hijacking

Session Fixation

Cross-site Request Forgery (CSRF)

Page 5: Web Application Security 101 - 07 Session Management

Session GuessingCryptographically week.

Improper use of cryptography.

Not enough entropy.

AttacksAnalyzing the session entropy.

Finding session collisions.

Page 6: Web Application Security 101 - 07 Session Management

Which Is The Weakest? Set-Cookie: SESID=1328802552... Set-Cookie: SESID=31b0b3ff82776a18a081973be4f8dd76... Set-Cookie: SESID=04ee313c76d3b90087bd333fe041b5c8f6dd19eb...

Page 7: Web Application Security 101 - 07 Session Management

Session HijackingSessions are sent over HTTP.

Lack of secure flag.

Lack of HTTPOnly flag.

AttacksSniffing network traffic.

Hijacking the session via XSS.

Page 8: Web Application Security 101 - 07 Session Management

Sniffing The Networksudo tcpdump -i en1 -w session.pcaptcpdump -r session.pcap -A | grep ‘Set-Cookie:’

tcpflow -i en1

Page 9: Web Application Security 101 - 07 Session Management

Session FixationThe session is created before login.

The session is never expired.

The session is user controlled.

AttacksObtain a valid session and send it for the victim to authenticate.

Page 10: Web Application Security 101 - 07 Session Management

Session Fixation In Action1. Ask for Cookie

2. Here is a Cookie

Attacker AppVictim

3. Set the Cookie 4. Use the Cookie

Page 11: Web Application Security 101 - 07 Session Management

Cross-site Request ForgeryCookies are sent automatically.

AttacksForging of client-side requests.

Page 12: Web Application Security 101 - 07 Session Management

CSRF In Action

Attacker Victim App

1. Authenticate

2. Visits Site

3. Sends Payload

Page 13: Web Application Security 101 - 07 Session Management

Security ControlsStrong Session Token

Correct Same Origin Policy

Secure Flag

HTTPOnly Flag

Reduced Persistence

Page 14: Web Application Security 101 - 07 Session Management

LabLet's do some session management attacks.