SlideShare una empresa de Scribd logo
1 de 24
SECURITY
CPTR304: INTERNET AUTHORING
HENRY OSBORNE
This presentation examines some attack vectors and
highlights means to mitigate and even eliminate most
attacks.

CPTR304: INTERNET AUTHORING

2
ALL INPUT IS TAINTED
 As a general rule of thumb, the data in all of PHP’s superglobals arrays

should be considered tainted.
 $_SERVER array is not fully safe, because it contains some data provided by

the client.
 Before processing tainted data, it is important to filter it
 Two approaches to filtering data:
 The whitelist approach
 The blacklist approach.
CPTR304: INTERNET AUTHORING

3
WHITELIST VS BLACKLIST FILTERING

 The blacklist approach is the less restrictive form of

filtering that assumes the programmer knows everything
that should not be allowed to pass through.
 Whitelist filtering is much more restrictive, yet it affords the

programmer the ability to accept only the input he expects
to receive.
CPTR304: INTERNET AUTHORING

4
FILTER INPUT
<form method="POST">

Username: <input type="text" name="username" /><br/>
Password: <input type="text" name="password" /><br/>
Favorite color:
<select name="color">
<option>Red</option>

<option>Blue</option>
<option>Yellow</option>
<option>Green</option>
</select><br/>
<input type="submit" />
</form>
CPTR304: INTERNET AUTHORING

5
FILTER INPUT CONT’D
$clean = array();
if (ctype_alpha($_POST[’username’]))
{
$clean[’username’] = $_POST[’username’];
}
if (ctype_alnum($_POST[’password’]))
{

$clean[’password’] = $_POST[’password’];
}
$colors = array(’Red’, ’Blue’, ’Yellow’, ’Green’);
if (in_array($_POST[’color’], $colors))
{
$clean[’color’] = $_POST[’color’];
}

CPTR304: INTERNET AUTHORING

6
FILTER INPUT CONT’D

Filtering with a whitelist approach places the control firmly in
your hands and ensures that your application will not
receive bad data.

CPTR304: INTERNET AUTHORING

7
ESCAPE OUTPUT

Output is anything that leaves your application, bound for a
client. The client, in this case, is anything from a Web
browser to a database server, and just as you should filter
all incoming data, you should escape all outbound data.
Whereas filtering input protects your application from bad or
harmful data, escaping output protects the client and user
from potentially damaging commands.
CPTR304: INTERNET AUTHORING

8
ESCAPE OUTPUT CONT’D

To escape output intended for a Web browser, PHP
provides htmlspecialchars() and
htmlentities(), the latter being the most
exhaustive and, therefore, recommended function for
escaping.
CPTR304: INTERNET AUTHORING

9
$html = array();
$html[’message’] = htmlentities($user_message,
ENT_QUOTES, ’UTF-8’);
echo $html[’message’];

CPTR304: INTERNET AUTHORING

10
WEBSITE SECURITY

CPTR304: INTERNET AUTHORING

11
SPOOFED FORMS
 A common method used by attackers is a spoofed form

submission.
 There are various ways to spoof forms, the easiest of which is to

simply copy a target form and execute it from a different location.
 Spoofing a form makes it possible for an attacker to remove all

client-side restrictions imposed upon the form in order to submit
any and all manner of data to your application.
CPTR304: INTERNET AUTHORING

12
CROSS-SITE SCRIPTING (XSS)

 One of the most common and best known kinds of attacks.
 An XSS attack exploits the user’s trust in the application

and is usually an effort to steal user information, such as
cookies and other personally identifiable data.
 All applications that display input are at risk.
CPTR304: INTERNET AUTHORING

13
CROSS-SITE REQUEST FORGERIES (CSRF)
 An attack that tricks the victim into loading a page that contains a

malicious request.
 It is malicious in the sense that it inherits the identity and privileges

of the victim to perform an undesired function on the victim's
behalf.
 CSRF attacks generally target functions that cause a state change

on the server but can also be used to access sensitive data.
CPTR304: INTERNET AUTHORING

14
DATABASE SECURITY

CPTR304: INTERNET AUTHORING

15
SQL INJECTION

A technique where an attacker creates or alters
existing SQL commands to expose hidden data,
or to override valuable ones, or even to execute
dangerous system level commands on the
database host.
CPTR304: INTERNET AUTHORING

16
SESSION SECURITY

CPTR304: INTERNET AUTHORING

17
SESSION FIXATION

 Manually setting the session identifier through the query

string, forcing the use of a particular session.
 This is most commonly achieved by creating a link to your

application and appending the session identifier that the
attacker wishes to give any user clicking the link.
<a href="http://example.org/index.php?PHPSESSID=1234">Click here</a>
CPTR304: INTERNET AUTHORING

18
SESSION HIJACKING

Any means by which an attacker gains a user’s valid
session identifier (rather than providing one of his
own).

CPTR304: INTERNET AUTHORING

19
FILE SYSTEM SECURITY

CPTR304: INTERNET AUTHORING

20
REMOTE CODE INJECTION

A remote code injection attack occurs when an attacker is
able to cause your application to execute PHP code of their
choosing.

CPTR304: INTERNET AUTHORING

21
COMMAND INJECTION

The injection and execution of arbitrary system commands.
 exec(), system() and passthru() functions

CPTR304: INTERNET AUTHORING

22
Despite the many ways your applications can be attacked,
four simple words can sum up most solutions to Web
application security problems (though not all): filter input,
escape output.

CPTR304: INTERNET AUTHORING

23
SECURITY
http://www.php.net/manual/en/security.php

CPTR304: INTERNET AUTHORING

24

Más contenido relacionado

La actualidad más candente

Types of sql injection attacks
Types of sql injection attacksTypes of sql injection attacks
Types of sql injection attacksRespa Peter
 
E Com Security solutions hand book on Web application security best practices
E Com Security solutions hand book on Web application security best practicesE Com Security solutions hand book on Web application security best practices
E Com Security solutions hand book on Web application security best practicesDolly Juhu
 
Internal penetration test_hitchhackers_guide
Internal penetration test_hitchhackers_guideInternal penetration test_hitchhackers_guide
Internal penetration test_hitchhackers_guideDarin Fredde
 
Session3 data-validation-sql injection
Session3 data-validation-sql injectionSession3 data-validation-sql injection
Session3 data-validation-sql injectionzakieh alizadeh
 
Prevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguagePrevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguageIRJET Journal
 
Practical Approach towards SQLi ppt
Practical Approach towards SQLi pptPractical Approach towards SQLi ppt
Practical Approach towards SQLi pptAhamed Saleem
 

La actualidad más candente (11)

Types of sql injection attacks
Types of sql injection attacksTypes of sql injection attacks
Types of sql injection attacks
 
E Com Security solutions hand book on Web application security best practices
E Com Security solutions hand book on Web application security best practicesE Com Security solutions hand book on Web application security best practices
E Com Security solutions hand book on Web application security best practices
 
Vulnerabilities in Web Applications
Vulnerabilities in Web ApplicationsVulnerabilities in Web Applications
Vulnerabilities in Web Applications
 
Internal penetration test_hitchhackers_guide
Internal penetration test_hitchhackers_guideInternal penetration test_hitchhackers_guide
Internal penetration test_hitchhackers_guide
 
Sql injection
Sql injectionSql injection
Sql injection
 
Session3 data-validation-sql injection
Session3 data-validation-sql injectionSession3 data-validation-sql injection
Session3 data-validation-sql injection
 
Session4-Authentication
Session4-AuthenticationSession4-Authentication
Session4-Authentication
 
S5-Authorization
S5-AuthorizationS5-Authorization
S5-Authorization
 
Owasp first5 presentation
Owasp first5 presentationOwasp first5 presentation
Owasp first5 presentation
 
Prevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguagePrevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host Language
 
Practical Approach towards SQLi ppt
Practical Approach towards SQLi pptPractical Approach towards SQLi ppt
Practical Approach towards SQLi ppt
 

Similar a Website Security

Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionDaniel Owens
 
Web Exploitation Security
Web Exploitation SecurityWeb Exploitation Security
Web Exploitation SecurityAman Singh
 
Pci compliance writing secure code
Pci compliance   writing secure codePci compliance   writing secure code
Pci compliance writing secure codeMiva
 
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...Rana sing
 
Final review ppt
Final review pptFinal review ppt
Final review pptRana sing
 
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 2008abhijitapatil
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application SecurityRob Ragan
 
Application of Machine Learning in Cybersecurity
Application of Machine Learning in CybersecurityApplication of Machine Learning in Cybersecurity
Application of Machine Learning in CybersecurityPratap Dangeti
 
Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP ApplicationsAditya Mooley
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10bilcorry
 

Similar a Website Security (20)

Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental Edition
 
Secure Software Engineering
Secure Software EngineeringSecure Software Engineering
Secure Software Engineering
 
Attques web
Attques webAttques web
Attques web
 
Web Exploitation Security
Web Exploitation SecurityWeb Exploitation Security
Web Exploitation Security
 
Pci compliance writing secure code
Pci compliance   writing secure codePci compliance   writing secure code
Pci compliance writing secure code
 
Aw36294299
Aw36294299Aw36294299
Aw36294299
 
UNIT 5 (2).pptx
UNIT 5 (2).pptxUNIT 5 (2).pptx
UNIT 5 (2).pptx
 
Hacking
HackingHacking
Hacking
 
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
 
Final review ppt
Final review pptFinal review ppt
Final review ppt
 
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
 
Netdefender
NetdefenderNetdefender
Netdefender
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
Application of Machine Learning in Cybersecurity
Application of Machine Learning in CybersecurityApplication of Machine Learning in Cybersecurity
Application of Machine Learning in Cybersecurity
 
RAZORPOINT SECURITY GLOSSARY
RAZORPOINT SECURITY GLOSSARYRAZORPOINT SECURITY GLOSSARY
RAZORPOINT SECURITY GLOSSARY
 
Network security
Network securityNetwork security
Network security
 
Net Defender
Net DefenderNet Defender
Net Defender
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 
Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP Applications
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 

Más de Henry Osborne

Android Fundamentals
Android FundamentalsAndroid Fundamentals
Android FundamentalsHenry Osborne
 
Open Source Education
Open Source EducationOpen Source Education
Open Source EducationHenry Osborne
 
Security Concepts - Linux
Security Concepts - LinuxSecurity Concepts - Linux
Security Concepts - LinuxHenry Osborne
 
Networking Basics with Linux
Networking Basics with LinuxNetworking Basics with Linux
Networking Basics with LinuxHenry Osborne
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in LinuxHenry Osborne
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 CanvasHenry Osborne
 
HTML5 Multimedia Support
HTML5 Multimedia SupportHTML5 Multimedia Support
HTML5 Multimedia SupportHenry Osborne
 
Information Architecture
Information ArchitectureInformation Architecture
Information ArchitectureHenry Osborne
 
XML and Web Services
XML and Web ServicesXML and Web Services
XML and Web ServicesHenry Osborne
 
Elements of Object-oriented Design
Elements of Object-oriented DesignElements of Object-oriented Design
Elements of Object-oriented DesignHenry Osborne
 
Database Programming
Database ProgrammingDatabase Programming
Database ProgrammingHenry Osborne
 
PHP Strings and Patterns
PHP Strings and PatternsPHP Strings and Patterns
PHP Strings and PatternsHenry Osborne
 
PHP Functions & Arrays
PHP Functions & ArraysPHP Functions & Arrays
PHP Functions & ArraysHenry Osborne
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and EventsHenry Osborne
 
Establishing a Web Presence
Establishing a Web PresenceEstablishing a Web Presence
Establishing a Web PresenceHenry Osborne
 

Más de Henry Osborne (20)

Android Fundamentals
Android FundamentalsAndroid Fundamentals
Android Fundamentals
 
Open Source Education
Open Source EducationOpen Source Education
Open Source Education
 
Security Concepts - Linux
Security Concepts - LinuxSecurity Concepts - Linux
Security Concepts - Linux
 
Networking Basics with Linux
Networking Basics with LinuxNetworking Basics with Linux
Networking Basics with Linux
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
 
HTML5 Multimedia Support
HTML5 Multimedia SupportHTML5 Multimedia Support
HTML5 Multimedia Support
 
Information Architecture
Information ArchitectureInformation Architecture
Information Architecture
 
Interface Design
Interface DesignInterface Design
Interface Design
 
Universal Usability
Universal UsabilityUniversal Usability
Universal Usability
 
XML and Web Services
XML and Web ServicesXML and Web Services
XML and Web Services
 
Elements of Object-oriented Design
Elements of Object-oriented DesignElements of Object-oriented Design
Elements of Object-oriented Design
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
 
OOP in PHP
OOP in PHPOOP in PHP
OOP in PHP
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
 
PHP Strings and Patterns
PHP Strings and PatternsPHP Strings and Patterns
PHP Strings and Patterns
 
PHP Functions & Arrays
PHP Functions & ArraysPHP Functions & Arrays
PHP Functions & Arrays
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and Events
 
Establishing a Web Presence
Establishing a Web PresenceEstablishing a Web Presence
Establishing a Web Presence
 

Último

Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 

Último (20)

Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 

Website Security

  • 2. This presentation examines some attack vectors and highlights means to mitigate and even eliminate most attacks. CPTR304: INTERNET AUTHORING 2
  • 3. ALL INPUT IS TAINTED  As a general rule of thumb, the data in all of PHP’s superglobals arrays should be considered tainted.  $_SERVER array is not fully safe, because it contains some data provided by the client.  Before processing tainted data, it is important to filter it  Two approaches to filtering data:  The whitelist approach  The blacklist approach. CPTR304: INTERNET AUTHORING 3
  • 4. WHITELIST VS BLACKLIST FILTERING  The blacklist approach is the less restrictive form of filtering that assumes the programmer knows everything that should not be allowed to pass through.  Whitelist filtering is much more restrictive, yet it affords the programmer the ability to accept only the input he expects to receive. CPTR304: INTERNET AUTHORING 4
  • 5. FILTER INPUT <form method="POST"> Username: <input type="text" name="username" /><br/> Password: <input type="text" name="password" /><br/> Favorite color: <select name="color"> <option>Red</option> <option>Blue</option> <option>Yellow</option> <option>Green</option> </select><br/> <input type="submit" /> </form> CPTR304: INTERNET AUTHORING 5
  • 6. FILTER INPUT CONT’D $clean = array(); if (ctype_alpha($_POST[’username’])) { $clean[’username’] = $_POST[’username’]; } if (ctype_alnum($_POST[’password’])) { $clean[’password’] = $_POST[’password’]; } $colors = array(’Red’, ’Blue’, ’Yellow’, ’Green’); if (in_array($_POST[’color’], $colors)) { $clean[’color’] = $_POST[’color’]; } CPTR304: INTERNET AUTHORING 6
  • 7. FILTER INPUT CONT’D Filtering with a whitelist approach places the control firmly in your hands and ensures that your application will not receive bad data. CPTR304: INTERNET AUTHORING 7
  • 8. ESCAPE OUTPUT Output is anything that leaves your application, bound for a client. The client, in this case, is anything from a Web browser to a database server, and just as you should filter all incoming data, you should escape all outbound data. Whereas filtering input protects your application from bad or harmful data, escaping output protects the client and user from potentially damaging commands. CPTR304: INTERNET AUTHORING 8
  • 9. ESCAPE OUTPUT CONT’D To escape output intended for a Web browser, PHP provides htmlspecialchars() and htmlentities(), the latter being the most exhaustive and, therefore, recommended function for escaping. CPTR304: INTERNET AUTHORING 9
  • 10. $html = array(); $html[’message’] = htmlentities($user_message, ENT_QUOTES, ’UTF-8’); echo $html[’message’]; CPTR304: INTERNET AUTHORING 10
  • 12. SPOOFED FORMS  A common method used by attackers is a spoofed form submission.  There are various ways to spoof forms, the easiest of which is to simply copy a target form and execute it from a different location.  Spoofing a form makes it possible for an attacker to remove all client-side restrictions imposed upon the form in order to submit any and all manner of data to your application. CPTR304: INTERNET AUTHORING 12
  • 13. CROSS-SITE SCRIPTING (XSS)  One of the most common and best known kinds of attacks.  An XSS attack exploits the user’s trust in the application and is usually an effort to steal user information, such as cookies and other personally identifiable data.  All applications that display input are at risk. CPTR304: INTERNET AUTHORING 13
  • 14. CROSS-SITE REQUEST FORGERIES (CSRF)  An attack that tricks the victim into loading a page that contains a malicious request.  It is malicious in the sense that it inherits the identity and privileges of the victim to perform an undesired function on the victim's behalf.  CSRF attacks generally target functions that cause a state change on the server but can also be used to access sensitive data. CPTR304: INTERNET AUTHORING 14
  • 16. SQL INJECTION A technique where an attacker creates or alters existing SQL commands to expose hidden data, or to override valuable ones, or even to execute dangerous system level commands on the database host. CPTR304: INTERNET AUTHORING 16
  • 18. SESSION FIXATION  Manually setting the session identifier through the query string, forcing the use of a particular session.  This is most commonly achieved by creating a link to your application and appending the session identifier that the attacker wishes to give any user clicking the link. <a href="http://example.org/index.php?PHPSESSID=1234">Click here</a> CPTR304: INTERNET AUTHORING 18
  • 19. SESSION HIJACKING Any means by which an attacker gains a user’s valid session identifier (rather than providing one of his own). CPTR304: INTERNET AUTHORING 19
  • 20. FILE SYSTEM SECURITY CPTR304: INTERNET AUTHORING 20
  • 21. REMOTE CODE INJECTION A remote code injection attack occurs when an attacker is able to cause your application to execute PHP code of their choosing. CPTR304: INTERNET AUTHORING 21
  • 22. COMMAND INJECTION The injection and execution of arbitrary system commands.  exec(), system() and passthru() functions CPTR304: INTERNET AUTHORING 22
  • 23. Despite the many ways your applications can be attacked, four simple words can sum up most solutions to Web application security problems (though not all): filter input, escape output. CPTR304: INTERNET AUTHORING 23

Notas del editor

  1. $_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server.
  2. This form contains three input elements: username, password, and colour. For this example, username should contain only alphabetic characters, password should contain only alphanumeric characters, and colour should contain any of “Red,” “Blue,” “Yellow,” or “Green.”It is possible to implement some client-side validation code using JavaScript to enforce these rules, but it is not always possible to force users to use only your form and, thus, your client-side rules. Therefore, server-side filtering is important for security, while client-side validation is important for usability.
  3. To filter the input received with this form, start by initializing a blank array. It is important to use a name that sets this array apart as containing only filtered data; this example uses the name $clean. Later in your code, when encountering the variable $clean[’username’], you can be certain that this value has been filtered. If, however,you see $_POST[’username’] used, you cannot be certain that the data is trustworthy. Thus, discard the variable and use the one from the $clean array instead.ctype_alnum — Check for alphanumeric character(s)ctype_alpha — Check for alphabetic character(s)in_array — Checks if a value exists in an array
  4. If, for example, someone tries to pass a username or color that is not allowed to the processing script, the worst that can happen is that the $clean array will not contain a value for username or color. If username is required, then simply display an error message to the user and ask them to provide correct data. You should force the user to provide correct information rather than trying to clean and sanitize it on your own. If you attempt to sanitize the data, you may end up with bad data, and you’ll run into the same problems that result with the use of blacklists.
  5. Escaping output should not be regarded as part of the filtering process, however. These two steps, while equally important, serve distinct and different purposes. Filtering ensures the validity of data coming into the application; escaping protects you and your users from potentially harmful attacks.Output must be escaped because clients—Web browsers, database servers, and so on—often take action when encountering special characters. For Web browsers, these special characters form HTML tags; for database servers, they may include quotation marks and SQL keywords. Therefore, it is necessary to know the intended destination of output and to escape accordingly.Escaping output intended for a database will not suffice when sending that same output to a Web browser—data must be escaped according to its destination.
  6. ENT_QUOTES - Will convert both double and single quotes.
  7. Website security refers to the security of the elements of a website through which an attacker can interface with your application. These vulnerable points of entry include forms and URLs, which are the most likely and easiest candidates for a potential attack.
  8. An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by your browser and used with that site. These scripts can even rewrite the content of the HTML page.
  9. Whereas an XSS attack exploits the user’s trust in an application, a forged request exploits an application’s trust in a user, since the request appears to be legitimate and it is difficult for the application to determine whether the user intended for it to take place.
  10. Databases are cardinal components of any web based application by enabling websites to provide varying dynamic content. Since very sensitive or secret information can be stored in a database, you should strongly consider protecting your databases.To retrieve or to store any information you need to connect to the database, send a legitimate query, fetch the result, and close the connection. 
  11. Many web developers are unaware of how SQL queries can be tampered with, and assume that an SQL query is a trusted command. It means that SQL queries are able to circumvent access controls, thereby bypassing standard authentication and authorization checks, and sometimes SQL queries even may allow access to host operating system level commands.http://www.php.net/manual/en/security.database.sql-injection.php
  12. While the user accesses your site through this session, they may provide sensitive information or even login credentials. If the user logs in while using the provided session identifier, the attacker may be able to “ride” on the same session and gain access to the user’s account. This is why session fixation is sometimes referred to as “session riding.”Since the purpose of the attack is to gain a higher level of privilege, the points at which the attack should be blocked are clear: every time a user’s access level changes, it is necessary to regenerate the session identifier. PHP makes this a simple task with session_regenerate_id().
  13. PHP is subject to the security built into most server systems with respect to permissions on a file and directory basis. This allows you to control which files in the filesystem may be read. Care should be taken with any files which are world readable to ensure that they are safe for reading by all users who have access to that filesystem.Since PHP was designed to allow user level access to the filesystem, it&apos;s entirely possible to write a PHP script that will allow you to read system files such as /etc/passwd, modify your ethernet connections, send massive printer jobs out, etc. This has some obvious implications, in that you need to ensure that the files that you read from and write to are the appropriate ones.