XSS

Work in Progress

Summary

Premise

  • user can set some string, which gets reflected in the reply HTML
  • instead replace the string with a script
  • script gets run on the clientside

Attack

  • attacker tricks user to click on malicious link, with the script embedded
  • browser sends request to legitimate site + payload
  • server responds with HTML with the script
  • browser executes the attacker’s script under the same origin

Attacker’s goal

Defense

  • input-validation by the server before responding
  • escape script characters, ie. <, >
  • use HttpOnly cookies, prevent Javascript from accessing session data

Concept

Cross Site Scripting(XSS)

  • exploits client’s trust of the server
  • types:
    • reflection - non-persistent
    • stored - script saved on server(persistent)