Modes of attacks on web applications
● Attack the connection between browser and web server
○ Steal password
○ Hijack existing connection
● Attack the server
○ Inject code that does bad things
● Attack the browser
○ Inject code that does bad things
● Breach the browser, attack the client machine
● Fool the user (phishing)
Security Defenses
● Isolation in browsers
○ Web app run in isolated sandbox
● Cryptography
Same-Origin Policy
● General idea: separate content with different trust levels into different frames, restrict communication between frames
● One frame can access content in another frame only if they both came from the same origin
● Origin is
○ Protocol
○ Domain name ○ Port
● Access applies to DOM resource, cookies, XMLHttpRequest/AJAX requests
● Doesn't apply: <script> tags
○ Javascript executes with full privileges of the enclosing frame.
○ Protect information from unauthorized viewing
○ Detect changes
○ Determine origin of information
● Web development frameworks
○ Use patterns that help, avoid dangerous ones
same-origin policy is too restrictive
● There are times when it is useful for frames with different origins to
communicate
○ Example: Sub-domains of same organization
○ Web fonts
○ Content distribution network
HTML5 feature: Access-Control-Allow-Origin
● Access-Control-Allow-Origin header in HTTP response:
Access-Control-Allow-Origin:
http://foo.com
Access-Control-Allow-Methods: PUT, DELETE
HTML5 postMessage - safe messaging
● Sender (from domain a.com) to an embedded frame of different domain
Created By
Metadata
Favourited By
Comments
Wanjofu, 16:51 3 Jun 21
Cool things guys... keep them coming
Add a Comment
Related Cheat Sheets