Section 6:
Session Management, Lab 2, & Clickjacking
CSE 484 / CSE M 584
Section 6: Session Management, Lab 2, & Clickjacking CSE 484 / - - PowerPoint PPT Presentation
Section 6: Session Management, Lab 2, & Clickjacking CSE 484 / CSE M 584 Homework 2 Due @ 11:59pm Lab 2 Due @ 11:59pm May 8 May 22 Administrivia May 15 Final Project Checkpoint 1 Due Web Session Management Primitive Online
CSE 484 / CSE M 584
May 8
Homework 2 Due @ 11:59pm
May 15
Final Project Checkpoint 1 Due
May 22
Lab 2 Due @ 11:59pm
www.e_buy.com www.e_buy.com/ shopping.cfm? uid=269
View catalog
www.e_buy.com/ shopping.cfm? uid=269& item1=102030405 www.e_buy.com/ checkout.cfm? uid=269& item1=102030405
Check out Select item Store session information in URL; easily read on network 👏
URLs
and modification
private
EN ENCOD ODING ST STATE IN UR URL L IS IS A BA BAD ID IDEA
generated, user is given special URL containing the authenticator
https://www.fatbrain.com/HelpAccount.asp?t=0&p1=me@me.com&p2=540555758
That’s true, BUT…
https://www.fatbrain.com/HelpAccount.asp?t=0&p1=SomeoneElse&p2=540555752
– “A premium, comprehensive, Perl shopping cart. Increase your web sales by making it easier for your web store customers to
<FORM METHOD=POST ACTION="http://www.dansie.net/cgi-bin/scripts/cart.pl"> Black Leather purse with leather straps<BR>Price: $20.00<BR> <INPUT TYPE=HIDDEN NAME=name VALUE="Black leather purse"> <INPUT TYPE=HIDDEN NAME=price VALUE="20.00"> <INPUT TYPE=HIDDEN NAME=sh VALUE="1"> <INPUT TYPE=HIDDEN NAME=img VALUE="purse.jpg"> <INPUT TYPE=HIDDEN NAME=custom1 VALUE="Black leather purse with leather straps"> <INPUT TYPE=SUBMIT NAME="add" VALUE="Put in Shopping Cart"> </FORM>
Change this to 2.00 Bargain shopping! Fix: validate with data stored on server!
that web server (and only that web server)
www.example.com Browser GET example.com 200 OK, set-cookie user=123 example.com: user=123 GET example.com/myprofile Cookie: user=123
making the request and whether they have logged in Authentication 🔒
previous visits Personalization 👖
their browsing behavior Tracking 🕶
an authenticator and gives it back to browser in the form of a cookie
tamper-proof
With each request, browser presents the cookie Server recomputes and verifies the authenticator
Can be used to login as the victim user!
Which cookies can be set by login.site.com? login.site.com can set cookies for all of .site.com (domain suffix), but not for another site or top-level domain (TLD) and not for a specific different subdomain on site.com.
Allowed Domains: ✅ login.site.com ✅ .site.com Disallowed Domains: ❌ othersite.com ❌ user.site.com
Cross Site Scripting
extra credit SQL Injection
extra credit Cross Site Request Forgery
A bit of: HTML, JS, (less
Lots of resources in spec
cookie to open
Goal: Steal Meowth’s server’s cookie Use this cookie to open the safe
Input string: <ui><li>List item 1</li><li>List item 2</li></ui>
Set up a PHP script for receiving the cookie (a simple server)
Construct and send a cookie- stealing URL to the bot
Retrieve the cookie from your server and use it to access the safe
Goal: get the bot to visit an attacker-controlled URL with its cookie included
Step 1
You have access to CSE web hosting! Host a PHP script at homes.cs.washington.edu
/cse/web/homes/<netid>/cookieEater.php
https://homes.cs.washington.edu/~<netid>/coo kieEater.php
Step 2
When your XSS attack gets the bot to call this URL, pass the cookie as a URL parameter
insert it into the URL
kieEater.php?cookie=secretCookieValue
Step 3 & 4 Extract the cookie from the URL. In your script, write the cookie to a file, so you can ssh in and copy it.
https://www.w3schools.com/php/php_file_create.asp
The bot won’t visit invalid URLs, so just passing it JavaScript won’t work However, invalid URLs will be displayed on error page Input your attack string to encode it, then take the URL
Bot will visit the error page with the displayed script!
Construct malicious script string Submit string to “send link” String is displayed on page
Page complains is not a link At this point, if your cookie script works, you can pull your
Copy URL containing encoded script string Submit URL containing script instead Bot visits link String is displayed on page
Adversary side Server side
Link is accepted Script now pulls cookies from the bot.
Get cookie from
cookie, and
new row à Add name and value
Subsequent targets will begin filtering input If you need help with lab setup, please come to office hours! Make sure to follow the chmod instructions in the spec
transparent or opaque frames to trick a user into clicking on a button or link on another page
are hijacked and routed to another, invisible page
an iframe
<iframe src = http://www.google.com/...> </iframe>
site invisible
www.attacker.site.com
Click here to see cute cats!
iframe: venmo.com/wolfson/send
Send $40 Submit
redirecting typing elsewhere
double click, pop a window up right below the mouse in between clicks