What is a web application?
1) a web application is a software application that is
> hosted on a web server
> accessed using a web browser or HTTP/HTTPS user agent
2) developed in different ways, and with different programming languages (ASP.NET, PHP, JAVA)
3) multi-tiered application
- 3 or more tiers, each with different functions
> presentation (user interface)
> business logic (processing)
> database (database access)
4) uses HTTP protocols
- inclusive of HTTPS (http with encryption)
Web application attacks
What is HTTP?
Hypertext transfer protocol (HTTP)
GET method (HTTP request)
POST method (HTTP request)
What are cookies?
eg : travel itinerary (travel websites), “remember me” login, shopping cart
how do they steal the cookies?
> MITM attacks during transmission
> cross site scripting (XSS) to steal cookie from client
> spyware can read plaintext cookie on device
Types of cookies
1) first-party cookie
- created by the website that the user is currently visiting
2) third-party cookie
- created by a website that the user is not currently visiting
- created by script from other websites embedded in the page by the owner of the current website
- track user preferences, from for eg social media likes
3) session cookie
- used to identify unique visitors and logged-in users
- stored in RAM and deleted when browser is closed
4) persistent cookie
- recorded on computer’s hard drive
- not deleted when browser closes
- may have expiry date
5) secure cookie
- encrypted; used ONLY when browser visits over secure connection
Risk of cookies
1) pose security and privacy risks
- may be stolen and used to impersonate users
- used to tailor advertising (privacy risk)
- can be exploited by attackers
2) to remove cookie risks, disable cookies and delete ALL existing cookies on a client (web browser)
3) if cookies are disabled, some websites may not function properly or will have less features
- “remember me” won’t work
- certain preferences or settings may not be remembered
- unable to maintain login
Session management
session ID :
> piece of data is used in network communications (often over HTTP) to identify a session
> sent back and forth between web server and client
where can the session ID be stored in?
- embedded in the URL (GET)
- stored within the fields of a form and submitted to the application (typically hidden, and submitted with HTTP form POST method)
- in a cookie
Session ID in URL
disadvantages :
- any person using same computer can retrieve URL through browser history
- URL information logged by intermediary systems (other computers in the Internet)
- attack just by modifying URL and session ID
- if client surf new site, URL containing session ID can be sent to new site via HTTP REFERER field
HTTP REFERER : an optional HTTP header field that identifies the address of the web page (i.e., the URI or IRI), from which the resource has been requested
Session ID in hidden post fields
Session ID in cookies
Secure session management (security measures)
1) session ID
- should be random and unpredictable
- long enough so that brute force guessing is not feasible
2) secure transmission
- use encryption (HTTPS) when sending session information
3) length of session validity
- client cancellation
- session time-out
-service-side revocation
4) session verification
- ensure correct session ID length, no unexpected information
5) re-authenticate all significant system actions and re-issue new tokens