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 Description
FILTER_SANITIZE_EM
AIL
Remove all characters
except letters, digits
and !#$%&'*+-
/=?^_`{|}~@.[].
FILTER_SANITIZE_EN
CODED
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.
FILTER_SANITIZE_MAGIC
_QUOTES
Apply addslashes().
FILTER_SANITIZE_NUMB
ER_FLOAT
FILTER_FLAG_ALLOW_FR
ACTION,
FILTER_FLAG_ALLOW_TH
Remove all characters
except digits, +- and
optionally .,eE.
ID Flags Description
FILTER_SANITIZE
_NUMBER_INT
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
HTML-
escape '"<>& 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 Description
FILTER_SANITIZE_UR
L
Remove all characters
except letters, digits
and $-
_.+!*'(),{}|^~[]`<>
#%";/?:@&=.
FILTER_UNSAFE_RA
W
FILTER_FLAG_STRIP_LOW
,
FILTER_FLAG_STRIP_HIG
H,
FILTER_FLAG_ENCODE_L
OW,
FILTER_FLAG_ENCODE_HI
GH,
FILTER_FLAG_ENCODE_A
MP
Do nothing, optionally
strip or encode special
characters.
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
Change contact information
Modified Code
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/
Thank You !!
Email-
shubham.sharma3005@gmail.com
Phone- +91-99300-53215

Weitere ähnliche Inhalte

Was ist angesagt?

XSS And SQL Injection Vulnerabilities
XSS And SQL Injection VulnerabilitiesXSS And SQL Injection Vulnerabilities
XSS And SQL Injection VulnerabilitiesMindfire Solutions
 
Secure Code Warrior - Local storage
Secure Code Warrior - Local storageSecure Code Warrior - Local storage
Secure Code Warrior - Local storageSecure Code Warrior
 
Types of sql injection attacks
Types of sql injection attacksTypes of sql injection attacks
Types of sql injection attacksRespa Peter
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10bilcorry
 
Erikeldridge Yos V9
Erikeldridge Yos V9Erikeldridge Yos V9
Erikeldridge Yos V9JH Lee
 
Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009mirahman
 
Secure Code Warrior - Cookies and sessions
Secure Code Warrior - Cookies and sessionsSecure Code Warrior - Cookies and sessions
Secure Code Warrior - Cookies and sessionsSecure Code Warrior
 
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Jayasree Veliyath
 
Web application attacks
Web application attacksWeb application attacks
Web application attackshruth
 
Secure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scriptingSecure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scriptingSecure Code Warrior
 
Hacking 101 (Session 2)
Hacking 101  (Session 2)Hacking 101  (Session 2)
Hacking 101 (Session 2)Nitroxis Sprl
 
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo) Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo) Nitroxis Sprl
 
Web application attack Presentation
Web application attack PresentationWeb application attack Presentation
Web application attack PresentationKhoa Nguyen
 

Was ist angesagt? (20)

XSS And SQL Injection Vulnerabilities
XSS And SQL Injection VulnerabilitiesXSS And SQL Injection Vulnerabilities
XSS And SQL Injection Vulnerabilities
 
S8-Session Managment
S8-Session ManagmentS8-Session Managment
S8-Session Managment
 
Secure Code Warrior - Local storage
Secure Code Warrior - Local storageSecure Code Warrior - Local storage
Secure Code Warrior - Local storage
 
Types of sql injection attacks
Types of sql injection attacksTypes of sql injection attacks
Types of sql injection attacks
 
Ultimate xss
Ultimate xssUltimate xss
Ultimate xss
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
Erikeldridge Yos V9
Erikeldridge Yos V9Erikeldridge Yos V9
Erikeldridge Yos V9
 
Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009
 
T04505103106
T04505103106T04505103106
T04505103106
 
Secure Code Warrior - Cookies and sessions
Secure Code Warrior - Cookies and sessionsSecure Code Warrior - Cookies and sessions
Secure Code Warrior - Cookies and sessions
 
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 
Secure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scriptingSecure Code Warrior - Cross site scripting
Secure Code Warrior - Cross site scripting
 
Hacking 101 (Session 2)
Hacking 101  (Session 2)Hacking 101  (Session 2)
Hacking 101 (Session 2)
 
Session7-XSS & CSRF
Session7-XSS & CSRFSession7-XSS & CSRF
Session7-XSS & CSRF
 
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo) Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
 
Session4-Authentication
Session4-AuthenticationSession4-Authentication
Session4-Authentication
 
S5-Authorization
S5-AuthorizationS5-Authorization
S5-Authorization
 
Web application attack Presentation
Web application attack PresentationWeb application attack Presentation
Web application attack Presentation
 

Ähnlich wie Secure Coding

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
 
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
 
The Cross Site Scripting Guide
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting GuideDaisuke_Dan
 
Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Sean Jackson
 
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
 
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
 
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
 
Application security 101
Application security 101Application security 101
Application security 101Vlad Garbuz
 
Securing Java EE Web Apps
Securing Java EE Web AppsSecuring Java EE Web Apps
Securing Java EE Web AppsFrank Kim
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017SamsonMuoki
 
Application Security
Application SecurityApplication Security
Application Securitynirola
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalRich Helton
 
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 ScriptingInMobi Technology
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptSilverGold16
 

Ähnlich wie Secure Coding (20)

Secure coding | XSS Attacks on current Web Applications
Secure coding | XSS Attacks on current Web ApplicationsSecure coding | XSS Attacks on current Web Applications
Secure coding | XSS Attacks on current Web Applications
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
XSS
XSSXSS
XSS
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
Web Security
Web SecurityWeb Security
Web Security
 
4.Xss
4.Xss4.Xss
4.Xss
 
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
 
The Cross Site Scripting Guide
The Cross Site Scripting GuideThe Cross Site Scripting Guide
The Cross Site Scripting Guide
 
Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Owasp top 10_openwest_2019
Owasp top 10_openwest_2019
 
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
 
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 )
 
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
 
Application security 101
Application security 101Application security 101
Application security 101
 
Securing Java EE Web Apps
Securing Java EE Web AppsSecuring Java EE Web Apps
Securing Java EE Web Apps
 
Secure Software Engineering
Secure Software EngineeringSecure Software Engineering
Secure Software Engineering
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017
 
Application Security
Application SecurityApplication Security
Application Security
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
 
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
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
 

Kürzlich hochgeladen

Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...SUHANI PANDEY
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...tanu pandey
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 

Kürzlich hochgeladen (20)

Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 

Secure Coding

  • 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 Description FILTER_SANITIZE_EM AIL Remove all characters except letters, digits and !#$%&'*+- /=?^_`{|}~@.[]. FILTER_SANITIZE_EN CODED 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. FILTER_SANITIZE_MAGIC _QUOTES Apply addslashes(). FILTER_SANITIZE_NUMB ER_FLOAT FILTER_FLAG_ALLOW_FR ACTION, FILTER_FLAG_ALLOW_TH Remove all characters except digits, +- and optionally .,eE.
  • 27. ID Flags Description FILTER_SANITIZE _NUMBER_INT 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 HTML- escape '"<>& 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 Description FILTER_SANITIZE_UR L Remove all characters except letters, digits and $- _.+!*'(),{}|^~[]`<> #%";/?:@&=. FILTER_UNSAFE_RA W FILTER_FLAG_STRIP_LOW , FILTER_FLAG_STRIP_HIG H, FILTER_FLAG_ENCODE_L OW, FILTER_FLAG_ENCODE_HI GH, FILTER_FLAG_ENCODE_A MP Do nothing, optionally strip or encode special characters. 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.