Mukezh

Session XSS

Feb 7th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. Java Script is used for making webpages a little more interactive , it could also be used for making games.
  2.  
  3. JavaScript can change all the HTML elements in the page
  4. JavaScript can change all the HTML attributes in the page
  5. JavaScript can change all the CSS styles in the page
  6. JavaScript can remove existing HTML elements and attributes
  7. JavaScript can add new HTML elements and attributes
  8. JavaScript can react to all existing HTML events in the page
  9. JavaScript can create new HTML events in the page
  10.  
  11. Basic syntax:
  12.  
  13. <script></script>
  14. e.g Giving popup--> <script>alert('hello')</script>
  15.  
  16.  
  17. <!DOCTYPE html>
  18. <html>
  19. <head>
  20. <title>JavasScript</title>
  21. </head>
  22. <body>
  23.  
  24. <button onclick="alert('hello world!')">Click me!</button>
  25. </body>
  26. </html>
  27.  
  28. DOM
  29.  
  30. <p id="cali">Hello World!</p>
  31. <button id="jingle">Change text</button>
  32.  
  33. <script>
  34. document.getElementById("jingle").onclick = function(){
  35. document.getElementById("cali").innerHTML="Hello Hackers"
  36. }
  37. </script>
  38. ___________________
  39. Cross Site Scripting (XSS)
  40.  
  41. It is an attack in which hackers are able to execute javascript code on a web site, It is of three types
  42. ->XSS Reflected
  43. ->XSS Stored
  44. ->DOM(Document object model) based XSS
  45.  
  46.  
  47. This attack can be used by hacker to execute javascript code in victim browser to hijack user sessions,deface website, insert content, etc
  48.  
  49.  
  50. XSS Payloads
  51. = = ==========
  52. <h1>hello</h1>
  53. <script>alert("hacked")</script>
  54. <script>alert(document.cookie)</script>
  55. <iframe src="http://www.lucideus.com"></iframe>
  56. <input onfocus=javascript:alert(1) autofocus>
  57.  
  58. cheatsheet
  59. https://gist.github.com/kurobeats/9a613c9ab68914312cbb415134795b45
  60.  
  61. Broken Authentication and Session Management
  62.  
  63. In broken authentication or session management hackers make an attempt to steal account from another users, Attackers/hacker uses leaks and flaws in the authentication or session management Functions.
  64.  
  65. like weak credentials or defualt login credentials
  66.  
  67. Why this attack occurs
  68.  
  69. ->User credentials are not protected when stored using hashing or encryption
  70. ->Credentials can be guessed or overwritten through weak management functions e.g(Hacker is able to guess session id , or change password)
  71. ->Session id's are exposed in the url
  72. ->Session id's don't time out
  73. ->passwords,credentials,session-ids are sent over in unencrypted form
  74.  
  75.  
  76.  
  77.  
  78. dom->Document Object Model-> Environment Code:
  79. <!DOCTYPE html>
  80. <html>
  81. <head>
  82. <title>DOM Based XSS</title>
  83. </head>
  84. <body>
  85. <form>
  86. <h1 id=greeting></h1>
  87. <h1>Enter your name</h1>
  88.  
  89. <input type="text" name="person" onkeyup="displayGreeting(person.value)" value=""></input>
  90.  
  91. </form>
  92. <script type="text/javascript">
  93. function displayGreeting(name){
  94. if (name!=''){
  95. document.getElementById('greeting').innerHTML="hello ,"+name+ "!";
  96. }
  97. }
  98. </script>
  99. </body>
  100. </html>
Add Comment
Please, Sign In to add comment