SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Cross-Site Scripting
Attacks
on Current Web
Applications
Introduction
 An attacker gets control of the user’s browser

in order to execute a malicious script within
the context of trust of the web application’s site.
 As a result, and if the embedded code is successfully

executed, the attacker might then be able to access,
passively or actively, to any sensitive browser
resource associated to the web application (e.g.,
cookies, session IDs, etc.)
THREATS!!!
 Everything from account

hijacking, changing of
user settings, cookie theft/poisoning, or false
advertising is possible.

 Steal cookies which can then be used to impersonate

customer and have access to their data and privileges.
This is also known as Session Hijacking.
 Redirect the user to another website of their

choosing. Maybe one that may be quite offensive, or one
that attempts to install malware onto users computer;
 Display alternate content on your own website.
History of Attacks
 October 2001, -----Hotmail ---- Remote attacker was

allowed to steal .NET Passport identifiers of
Hotmail’s users by collecting their cookies.

 October 2005, ------ MySpace, utilized by the worm

Samy to propagate itself across MySpace’s user
profiles.

 November 2006,Orkut, was vulnerable to cookie

stealing by simply posting the stealing script into the
attacker’s profile.
Non-Persistent XSS Attack
 User input is reflected immediately

on the page by server-side scripts
without proper sanitization.
 To exploit, the attacker has to

provide the victim with a modified
URL, passing the code to be
inserted as a parameter.
 This attack is done by encoding

data in the URL, thus disguising
the injected code from the user.
Persistent XSS Attacks
Persistent XSS Attacks
 When the data entered by the user are stored

on the server for a certain length of time, the
attack is called "persistent".
 All of the website's users have access to the page

where the harmful code was introduced.
 Commonly found in:

Contact/Feedback
pages, Log viewers, Exception handlers, Chat
applications/Forums, etc.
BACHAA V !!!
Actual Demonstration
No Protection
Data Validation
 Application accepts correct data.
 User data must be validated to ensure it is of the

corrected type, and discarded if it doesn’t pass the
validation process.
 Allow a limited set of special characters.
Preg Match
 Performs a regular expression match.
Output Escaping
 Protects integrity of displayed/output data,
 Should escape the data when presenting it to the

user.
 Prevents the browser from applying any unintended

meaning to any special sequence of characters that
may be found.
htmlspecialchars
Data Sanitization
 Manipulating the data to make sure it is safe.

 Removing any unwanted bits from the data and

normalizing it to the correct form.
htmlentities
 Converts all applicable characters to HTML entities.
 Default value for this argument is ISO-8859-1 in

versions of PHP prior to 5.4.0, and UTF-8 from PHP
5.4.0 onwards.
 ** http://coderstoolbox.net/
Usage of ENT_IGNORE
Available flags constants
ID

Description

ENT_COMPAT

Will convert double-quotes and leave
single-quotes alone.

ENT_QUOTES

Will convert both double and single
quotes.

ENT_NOQUOTES

Will leave both double and single quotes
unconverted.
ID

Flags

FILTER_SANITIZE_EM
AIL

FILTER_SANITIZE_EN
CODED

Remove all characters
except letters, digits
and !#$%&'*+/=?^_`{|}~@.[].

FILTER_FLAG_STRIP_LOW
,
FILTER_FLAG_STRIP_HIG
H,
FILTER_FLAG_ENCODE_L
OW,
FILTER_FLAG_ENCODE_HI
GH

URL-encode string,
optionally strip or
encode special
characters.

Apply addslashes().

FILTER_SANITIZE_MAGIC
_QUOTES
FILTER_SANITIZE_NUMB
ER_FLOAT

Description

FILTER_FLAG_ALLOW_FR
ACTION,
FILTER_FLAG_ALLOW_TH

Remove all characters
except digits, +- and
optionally .,eE.
ID

Flags

FILTER_SANITIZE
_NUMBER_INT

Description

Remove all characters
except digits, plus and
minus sign.

FILTER_SANITIZE
_SPECIAL_CHARS

FILTER_FLAG_STRIP_LOW,
FILTER_FLAG_STRIP_HIGH,
FILTER_FLAG_ENCODE_HIGH

HTMLescape '"<>& and
characters with ASCII
value less than 32,
optionally strip or
encode other special
characters.

FILTER_SANITIZE
_STRING

FILTER_FLAG_NO_ENCODE_Q
UOTES,
FILTER_FLAG_STRIP_LOW,
FILTER_FLAG_STRIP_HIGH,
FILTER_FLAG_ENCODE_LOW,
FILTER_FLAG_ENCODE_HIGH,
FILTER_FLAG_ENCODE_AMP

Strip tags, optionally
strip or encode special
characters.

FILTER_SANITIZE
_STRIPPED

Alias of "string" filter.
ID

Flags

FILTER_SANITIZE_UR
L

Description

Remove all characters
except letters, digits
and $_.+!*'(),{}|^~[]`<>
#%";/?:@&=.

FILTER_UNSAFE_RA
W

FILTER_FLAG_STRIP_LOW Do nothing, optionally
,
strip or encode special
FILTER_FLAG_STRIP_HIG characters.
H,
FILTER_FLAG_ENCODE_L
OW,
FILTER_FLAG_ENCODE_HI
GH,
FILTER_FLAG_ENCODE_A
MP

FILTER_SANITIZE_FU
LL_SPECIAL_CHARS

FILTER_FLAG_NO_ENCOD
E_QUOTES,

Equivalent to
callinghtmlspecialchar
s() withENT_QUOT
ES set. Encoding
quotes can be disabled
Mod Security(Web Application
Firewall)
 Protects against attacks that target websites.
 csrf_protection
 session_hijacking
 comment_spam
 authentication_tracking
 protocol_violations
 sql_injection_attacks
 xss_attacks
 brute_force, and many more
Default
Information Disclosure
Original Contact Information
Original Code
How to change Contact info
 Go to :
• binariesapacheerror
• Open contact.html.var
Modified Code

Change contact information
Disable Apache Signature and/or Apache
Banner
 ADD in httpd.config of apache to remove apache

version disclosure


ServerTokens ProductOnly

 ServerTokens takes 1 argument, 'Prod', 'Major',

'Minor', 'Min', 'OS', or 'Full'""
Before

After
 ADD/replace/change in php.ini to remove php

version disclosure
 expose_php = Off
 display_errors=Off
 register_globals = Off
Disable Version Disclosure

 Go to :
• binariesapacheerrorinclude

• Open bottom.html

By Default
we see this
Original Bottom.html file
Change
Bottom.html
My customized error page !!
Stopping Sensitive file disclosure
 Turn off automatic indexing.
 Instruct Apache to reject all requests for files

matching a series of regular expressions given below.
 Goto httpd.conf file to deny access to . htaccess files.
Protecting bakup files
 Add in httpd.config
 TheFilesMatchdirective only looks at the last part of

the full filename
Disable Directory Indexing
 Listing of files like see in Windows Explorer as

opposed to a web page.
 Attacker can gain valuable information about your
site.
 Files may may include sensitive information, such as
backup script files htaccess files, or text files with
note.
 Can allow access files outside the web root directory,
leading to the stealing of system files.
How to Disable Directory
Listings in Apache
 Navigate to your Apache config file (httpd.conf)
 Find – “Options FollowSymLinks Indexes”
 Replace by – “Options FollowSymLinks”
 Done
 FollowSymLinks makes Apache follow system

symbolic links (shortcuts, if you would) in your file
system.
 Indexes allows access to open folders within your
file system.
Disable powerful functions in php
 Disable functions that may be useful to an attacker

but not necessary to the application.
 Disable execution of OS commands
 Open php.ini and search “disable_functions”.
 Write “shell_exec “ (without comma in front of
disable_functions).
Other functions
 exec, passthru, shell_exec, system, proc_open,

popen, curl_exec, curl_multi_exec, pcntl_exec,
dl".
 If the application needs to execute OS commands,

it should use "pcntl_exec", because it provides
better abstraction of parameters than the others.
References
 http://php.net/manual/en/filter.filters.sanitize.php
 http://www.sitepoint.com/php-security-cross-site-

scripting-attacks-xss/
Emailshubham.sharma3005@gmail.com
Phone- +91-99300-53215

Thank You !!

Weitere ähnliche Inhalte

Was ist angesagt?

Cross site scripting
Cross site scriptingCross site scripting
Cross site scriptingkinish kumar
 
Cross Site Scripting(XSS)
Cross Site Scripting(XSS)Cross Site Scripting(XSS)
Cross Site Scripting(XSS)Nabin Dutta
 
Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Daniel Tumser
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
 
XSS- an application security vulnerability
XSS-   an application security vulnerabilityXSS-   an application security vulnerability
XSS- an application security vulnerabilitySoumyasanto Sen
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defensesMohammed A. Imran
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site ScriptingAli Mattash
 
XSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing toolXSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing toolArjun Jain
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)Ritesh Gupta
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)Manish Kumar
 
Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Irfad Imtiaz
 
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 kumbharSandeep Kumbhar
 
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
 
What is xss, blind xss and xploiting google gadgets
What is xss, blind xss and xploiting google gadgetsWhat is xss, blind xss and xploiting google gadgets
What is xss, blind xss and xploiting google gadgetsZiv Ginsberg
 
Cross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterCross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterMichael Coates
 

Was ist angesagt? (20)

Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Xss
XssXss
Xss
 
Cross Site Scripting(XSS)
Cross Site Scripting(XSS)Cross Site Scripting(XSS)
Cross Site Scripting(XSS)
 
Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
XSS- an application security vulnerability
XSS-   an application security vulnerabilityXSS-   an application security vulnerability
XSS- an application security vulnerability
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defenses
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
 
XSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing toolXSS-Alert-Pentration testing tool
XSS-Alert-Pentration testing tool
 
Xss talk, attack and defense
Xss talk, attack and defenseXss talk, attack and defense
Xss talk, attack and defense
 
Cross site scripting
Cross site scripting Cross site scripting
Cross site scripting
 
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
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
 
Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )
 
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 (cross site scripting)
Xss (cross site scripting)Xss (cross site scripting)
Xss (cross site scripting)
 
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
 
What is xss, blind xss and xploiting google gadgets
What is xss, blind xss and xploiting google gadgetsWhat is xss, blind xss and xploiting google gadgets
What is xss, blind xss and xploiting google gadgets
 
Cross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterCross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning Center
 

Andere mochten auch

Digital Advertising, Privacy and User-tracking Methods
Digital Advertising, Privacy and User-tracking MethodsDigital Advertising, Privacy and User-tracking Methods
Digital Advertising, Privacy and User-tracking MethodsHonza Pav
 
OWF14 - Big Data Track : Take back control of your web tracking Go further by...
OWF14 - Big Data Track : Take back control of your web tracking Go further by...OWF14 - Big Data Track : Take back control of your web tracking Go further by...
OWF14 - Big Data Track : Take back control of your web tracking Go further by...Paris Open Source Summit
 
Online Privacy
Online PrivacyOnline Privacy
Online PrivacyIWMW
 
Internet Privacy
Internet PrivacyInternet Privacy
Internet Privacyrealpeterz
 
Web application attacks
Web application attacksWeb application attacks
Web application attackshruth
 

Andere mochten auch (6)

Digital Advertising, Privacy and User-tracking Methods
Digital Advertising, Privacy and User-tracking MethodsDigital Advertising, Privacy and User-tracking Methods
Digital Advertising, Privacy and User-tracking Methods
 
OWF14 - Big Data Track : Take back control of your web tracking Go further by...
OWF14 - Big Data Track : Take back control of your web tracking Go further by...OWF14 - Big Data Track : Take back control of your web tracking Go further by...
OWF14 - Big Data Track : Take back control of your web tracking Go further by...
 
Online Privacy
Online PrivacyOnline Privacy
Online Privacy
 
Internet Privacy
Internet PrivacyInternet Privacy
Internet Privacy
 
Web Browsers
Web BrowsersWeb Browsers
Web Browsers
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 

Ähnlich wie Secure coding | XSS Attacks on current Web Applications

Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP ApplicationsAditya Mooley
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encodingEoin Keary
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application SecurityRob Ragan
 
logout.php Session Data after Logout Username Email . $_.docx
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docxsmile790243
 
Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application FirewallPort80 Software
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Jay Nagar
 
Web Application Security - Folio3
Web Application Security - Folio3Web Application Security - Folio3
Web Application Security - Folio3Folio3 Software
 
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009ClubHack
 
Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Susam Pal
 
Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Sean Jackson
 
Application Security
Application SecurityApplication Security
Application Securitynirola
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Jeremiah Grossman
 
Application security 101
Application security 101Application security 101
Application security 101Vlad Garbuz
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017SamsonMuoki
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalRich Helton
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Application Security Vulnerabilities: OWASP Top 10  -2007Application Security Vulnerabilities: OWASP Top 10  -2007
Application Security Vulnerabilities: OWASP Top 10 -2007Vaibhav Gupta
 

Ähnlich wie Secure coding | XSS Attacks on current Web Applications (20)

Secure Coding
Secure Coding Secure Coding
Secure Coding
 
Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP Applications
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
logout.php Session Data after Logout Username Email . $_.docx
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docx
 
4.Xss
4.Xss4.Xss
4.Xss
 
Web Security
Web SecurityWeb Security
Web Security
 
Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application Firewall
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
 
Web Application Security - Folio3
Web Application Security - Folio3Web Application Security - Folio3
Web Application Security - Folio3
 
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
 
Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)
 
Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Owasp top 10_openwest_2019
Owasp top 10_openwest_2019
 
Application Security
Application SecurityApplication Security
Application Security
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008
 
Application security 101
Application security 101Application security 101
Application security 101
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Application Security Vulnerabilities: OWASP Top 10  -2007Application Security Vulnerabilities: OWASP Top 10  -2007
Application Security Vulnerabilities: OWASP Top 10 -2007
 
Lets Make our Web Applications Secure
Lets Make our Web Applications SecureLets Make our Web Applications Secure
Lets Make our Web Applications Secure
 

Mehr von n|u - The Open Security Community

Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...n|u - The Open Security Community
 

Mehr von n|u - The Open Security Community (20)

Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)
 
Osint primer
Osint primerOsint primer
Osint primer
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
Nmap basics
Nmap basicsNmap basics
Nmap basics
 
Metasploit primary
Metasploit primaryMetasploit primary
Metasploit primary
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Introduction to TLS 1.3
Introduction to TLS 1.3Introduction to TLS 1.3
Introduction to TLS 1.3
 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
 
Talking About SSRF,CRLF
Talking About SSRF,CRLFTalking About SSRF,CRLF
Talking About SSRF,CRLF
 
Building active directory lab for red teaming
Building active directory lab for red teamingBuilding active directory lab for red teaming
Building active directory lab for red teaming
 
Owning a company through their logs
Owning a company through their logsOwning a company through their logs
Owning a company through their logs
 
Introduction to shodan
Introduction to shodanIntroduction to shodan
Introduction to shodan
 
Cloud security
Cloud security Cloud security
Cloud security
 
Detecting persistence in windows
Detecting persistence in windowsDetecting persistence in windows
Detecting persistence in windows
 
Frida - Objection Tool Usage
Frida - Objection Tool UsageFrida - Objection Tool Usage
Frida - Objection Tool Usage
 
OSQuery - Monitoring System Process
OSQuery - Monitoring System ProcessOSQuery - Monitoring System Process
OSQuery - Monitoring System Process
 
DevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -SecurityDevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -Security
 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
 
Linux for hackers
Linux for hackersLinux for hackers
Linux for hackers
 
Android Pentesting
Android PentestingAndroid Pentesting
Android Pentesting
 

Kürzlich hochgeladen

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Kürzlich hochgeladen (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

Secure coding | XSS Attacks on current Web Applications

  • 2. Introduction  An attacker gets control of the user’s browser in order to execute a malicious script within the context of trust of the web application’s site.  As a result, and if the embedded code is successfully executed, the attacker might then be able to access, passively or actively, to any sensitive browser resource associated to the web application (e.g., cookies, session IDs, etc.)
  • 3. THREATS!!!  Everything from account hijacking, changing of user settings, cookie theft/poisoning, or false advertising is possible.  Steal cookies which can then be used to impersonate customer and have access to their data and privileges. This is also known as Session Hijacking.  Redirect the user to another website of their choosing. Maybe one that may be quite offensive, or one that attempts to install malware onto users computer;  Display alternate content on your own website.
  • 4. History of Attacks  October 2001, -----Hotmail ---- Remote attacker was allowed to steal .NET Passport identifiers of Hotmail’s users by collecting their cookies.  October 2005, ------ MySpace, utilized by the worm Samy to propagate itself across MySpace’s user profiles.  November 2006,Orkut, was vulnerable to cookie stealing by simply posting the stealing script into the attacker’s profile.
  • 5.
  • 7.  User input is reflected immediately on the page by server-side scripts without proper sanitization.  To exploit, the attacker has to provide the victim with a modified URL, passing the code to be inserted as a parameter.  This attack is done by encoding data in the URL, thus disguising the injected code from the user.
  • 8.
  • 10. Persistent XSS Attacks  When the data entered by the user are stored on the server for a certain length of time, the attack is called "persistent".  All of the website's users have access to the page where the harmful code was introduced.  Commonly found in: Contact/Feedback pages, Log viewers, Exception handlers, Chat applications/Forums, etc.
  • 11.
  • 15. Data Validation  Application accepts correct data.  User data must be validated to ensure it is of the corrected type, and discarded if it doesn’t pass the validation process.  Allow a limited set of special characters.
  • 16. Preg Match  Performs a regular expression match.
  • 17. Output Escaping  Protects integrity of displayed/output data,  Should escape the data when presenting it to the user.  Prevents the browser from applying any unintended meaning to any special sequence of characters that may be found.
  • 19.
  • 20. Data Sanitization  Manipulating the data to make sure it is safe.  Removing any unwanted bits from the data and normalizing it to the correct form.
  • 21.
  • 22.
  • 23. htmlentities  Converts all applicable characters to HTML entities.  Default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.  ** http://coderstoolbox.net/
  • 25. Available flags constants ID Description ENT_COMPAT Will convert double-quotes and leave single-quotes alone. ENT_QUOTES Will convert both double and single quotes. ENT_NOQUOTES Will leave both double and single quotes unconverted.
  • 26. ID Flags FILTER_SANITIZE_EM AIL FILTER_SANITIZE_EN CODED Remove all characters except letters, digits and !#$%&'*+/=?^_`{|}~@.[]. FILTER_FLAG_STRIP_LOW , FILTER_FLAG_STRIP_HIG H, FILTER_FLAG_ENCODE_L OW, FILTER_FLAG_ENCODE_HI GH URL-encode string, optionally strip or encode special characters. Apply addslashes(). FILTER_SANITIZE_MAGIC _QUOTES FILTER_SANITIZE_NUMB ER_FLOAT Description FILTER_FLAG_ALLOW_FR ACTION, FILTER_FLAG_ALLOW_TH Remove all characters except digits, +- and optionally .,eE.
  • 27. ID Flags FILTER_SANITIZE _NUMBER_INT Description Remove all characters except digits, plus and minus sign. FILTER_SANITIZE _SPECIAL_CHARS FILTER_FLAG_STRIP_LOW, FILTER_FLAG_STRIP_HIGH, FILTER_FLAG_ENCODE_HIGH HTMLescape '"<>& and characters with ASCII value less than 32, optionally strip or encode other special characters. FILTER_SANITIZE _STRING FILTER_FLAG_NO_ENCODE_Q UOTES, FILTER_FLAG_STRIP_LOW, FILTER_FLAG_STRIP_HIGH, FILTER_FLAG_ENCODE_LOW, FILTER_FLAG_ENCODE_HIGH, FILTER_FLAG_ENCODE_AMP Strip tags, optionally strip or encode special characters. FILTER_SANITIZE _STRIPPED Alias of "string" filter.
  • 28. ID Flags FILTER_SANITIZE_UR L Description Remove all characters except letters, digits and $_.+!*'(),{}|^~[]`<> #%";/?:@&=. FILTER_UNSAFE_RA W FILTER_FLAG_STRIP_LOW Do nothing, optionally , strip or encode special FILTER_FLAG_STRIP_HIG characters. H, FILTER_FLAG_ENCODE_L OW, FILTER_FLAG_ENCODE_HI GH, FILTER_FLAG_ENCODE_A MP FILTER_SANITIZE_FU LL_SPECIAL_CHARS FILTER_FLAG_NO_ENCOD E_QUOTES, Equivalent to callinghtmlspecialchar s() withENT_QUOT ES set. Encoding quotes can be disabled
  • 29. Mod Security(Web Application Firewall)  Protects against attacks that target websites.  csrf_protection  session_hijacking  comment_spam  authentication_tracking  protocol_violations  sql_injection_attacks  xss_attacks  brute_force, and many more
  • 30.
  • 33. How to change Contact info  Go to : • binariesapacheerror • Open contact.html.var
  • 35. Disable Apache Signature and/or Apache Banner  ADD in httpd.config of apache to remove apache version disclosure  ServerTokens ProductOnly  ServerTokens takes 1 argument, 'Prod', 'Major', 'Minor', 'Min', 'OS', or 'Full'""
  • 37.  ADD/replace/change in php.ini to remove php version disclosure  expose_php = Off  display_errors=Off  register_globals = Off
  • 38.
  • 39. Disable Version Disclosure  Go to : • binariesapacheerrorinclude • Open bottom.html By Default we see this
  • 43. Stopping Sensitive file disclosure  Turn off automatic indexing.  Instruct Apache to reject all requests for files matching a series of regular expressions given below.  Goto httpd.conf file to deny access to . htaccess files.
  • 44. Protecting bakup files  Add in httpd.config  TheFilesMatchdirective only looks at the last part of the full filename
  • 45. Disable Directory Indexing  Listing of files like see in Windows Explorer as opposed to a web page.  Attacker can gain valuable information about your site.  Files may may include sensitive information, such as backup script files htaccess files, or text files with note.  Can allow access files outside the web root directory, leading to the stealing of system files.
  • 46. How to Disable Directory Listings in Apache  Navigate to your Apache config file (httpd.conf)  Find – “Options FollowSymLinks Indexes”  Replace by – “Options FollowSymLinks”  Done
  • 47.  FollowSymLinks makes Apache follow system symbolic links (shortcuts, if you would) in your file system.  Indexes allows access to open folders within your file system.
  • 48.
  • 49. Disable powerful functions in php  Disable functions that may be useful to an attacker but not necessary to the application.  Disable execution of OS commands  Open php.ini and search “disable_functions”.  Write “shell_exec “ (without comma in front of disable_functions).
  • 50.
  • 51. Other functions  exec, passthru, shell_exec, system, proc_open, popen, curl_exec, curl_multi_exec, pcntl_exec, dl".  If the application needs to execute OS commands, it should use "pcntl_exec", because it provides better abstraction of parameters than the others.