SlideShare une entreprise Scribd logo
1  sur  43
Télécharger pour lire hors ligne
Web Security
                 Gerald Z. Villorente




Lorma Colleges                 San Fernando, La Union
if [ “$SLIDE” -eq “intro” ]; then
   echo “I'm Gerald Z. Villorente”
fi
● Senior Web Developer, Kite Systems Ltd.
  Hong Kong / Philippines
● Drupal Developer, Cable Network

  News (CNN) Travel
  Hong Kong / Atlanta, USA
● System Administrator, InternetJail

  Oregon, USA
● Drupal Phil. Users Group (DPUG) member

● Freelancer
Agenda
●   Security levels

●   Aspect of Data Security

●   Most common Web application threats and
    counter measures

●   Principle of Secure Development

●   Best Practices

●   Tools
What is a Web Application?


• Any application that is served commonly via
  http or https protocol

• Usually running under port 80 or port 443

• Served from a remote computer acting as
  host/server
What is a Web Application?


• Any application that is served commonly via
  http or https protocol

• Usually running under port 80 or port 443

• Served from a remote computer acting as
  host/server
What is a Web Application?


• Any application that is served commonly via
  http or https protocol

• Usually running under port 80 or port 443

• Served from a remote computer acting as
  host/server
What is Web Security?

• A.k.a “Cyber Security”, involves protecting all
  informations by preventing, detecting, and
  responding to attack

• Is a state of being free from damage and being
  compromised

• Is a condition of being protected against danger
  or loss
What is Web Security?

• A.k.a “Cyber Security”, involves protecting all
  informations by preventing, detecting, and
  responding to attack

• Is a state of being free from damage and being
  compromised

• Is a condition of being protected against danger
  or loss
What is Web Security?

• A.k.a “Cyber Security”, involves protecting all
  informations by preventing, detecting, and
  responding to attack

• Is a state of being free from damage and being
  compromised

• Is a condition of being protected against danger
  or loss
Security Levels


• Server level

• Network level

• Application level

• User level
Security Levels


• Server level

• Network level

• Application level

• User level
Security Levels


• Server level

• Network level

• Application level

• User level
Security Levels


• Server level

• Network level

• Application level

• User level
Security Levels
• Server level
 - Ensure you have installed the latest operating
   system security patches.
 - Keep your web server software up-to-date
 - Limit access from the Internet to your servers.
   Use firewall software to block access to any
   port but the following:
    * 80
    * 443 (SSL, only if your application uses it)
    * 22 (SSH, SCP)
    * 21 (not recomended)
• Network level
• Application level
• User level
Security Levels

• Server level
• Network level
 - Place servers that your users do not directly interact
   with (e.g., a back-end database server) in a private
   network that is inaccessible from the Internet. If that
   is not possible, then use firewall software to block
   access from any computer other than your web
   server.
• Application level
• User level
Security Levels
• Server level
• Network level
• Application level
  - Never store passwords in clear text. Instead, use a
    hashing algorithm such as MD5 or SHA-256 to create a
    signature of the user's password for storage.
 - Generate a unique signature for the user based on the
    login and password and store that in the cookie.
 - Carefully check any parameters you pass to SQL
    statements in your application. Validate all user inputs.
 - Purge unused/unnecessary user data from your system
    regularly.
• User level
Security Levels
• Server level
• Network level
• Application level
• User level
 - Protecting yourself is to recognize the risks and
   become familiar with some of the terminology
   associated with them.
 - Keep your personal information in private
 - Use complex password
 - Keep your computer away from viruses, worms,
   keyloggers, trojans, malwares, etc
Aspects of Data Security

• Privacy
  - keeping your information private

• Integrity
  - knowing that the information has not been
    changed

• Authenticity
  - knowing who sent the information
Aspects of Data Security

• Privacy
  - keeping your information private

• Integrity
  - knowing that the information has not been
    changed

• Authenticity
  - knowing who sent the information
Aspects of Data Security

• Privacy
  - keeping your information private

• Integrity
  - knowing that the information has not been
    changed

• Authenticity
  - knowing who sent the information
Aspects of Data Security

• Privacy
  - keeping your information private

• Integrity
  - knowing that the information has not been
    changed

• Authenticity
  - knowing who sent the information
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Parameter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats


1. Cross-site scripting (XSS)
2. SQL injection
3. Improper error handling
4. Paremeter Tampering
5. Application denial-of-service (DDoS)
6. Remote File Inclusion
7. Form Spoofing



                                          Source: OWASP
Most Common Security Threats
Cross Site Scripting
 - Injecting Javascript or other scripts that will run
  on behalf of other user. This code usually steals cookies
  (authenticated credentials) of the
  person who “sees” the infected web page.

Ex:
<script>alert(“This site has been hacked!”);</script>
Preventions:
1. Filter all foreign data
   - $filter_user_input = htmlentities($post['userinput']);
2. Always assume data to be invalid until it is proved valid.
3. Use BBCode – [b]bold[/b] vs <b>bold</b>

XSS Cheat Sheet
Most Common Security Threats
SQL Injection
  - an attack where an attacker is able to execute
    arbitrary sql code against the database

Ex:
// legit
$sort = 'ASC';
// malicious injection
$sort = '; TRUNCATE USERS';
// actual query
$query = “SELECT * FROM users ORDER BY membership_date
$sort”;

// output query
SELECT * FROM users ORDER BY membership_date; TRUCATE
USERS
Most Common Security Threats
SQL Injection (cont.)

Possible damage:
1. Corrupt data by executing truncate()
2. Alter current data (e.g change admin password)

Vectors:
1. Dynamic queries getting values from unsanitized user-submitted
   data

Prevention(MySQL):
1. Enclose user-submitted values with mysql_real_escape_string()
2. Harden the environment by reducing sql account permissions,
   remove unneeded system stored procedures, and audit
   password strength
Most Common Security Threats




Improper Error Handling
 - errors are not properly handled by system code
Most Common Security Threats
Parameter Tampering
 - based on the manipulation of parameters exchanged
   between client and server in order to modify application
   data, such as user credentials and permissions, price and
   quantity of products, etc. Usually, this information is stored
   in cookies, hidden form fields, or URL Query Strings, and
   is used to increase application functionality and control.

Ex:
http://www.attackbank.com/savepage.asp?nr=147&status=read

Attack
http://www.attackbank.com/savepage.asp?nr=147&status=del
Most Common Security Threats
Denial-of-Service
 - an attack to make a computer resources
   unavailable to its intended users

Resources:
 1. Bandwidth
 2. CPU

Preventions:
 1. Firewall
 2. Router & Switches
 3. Intrusion Prevention Systems (IPS)
 4. DoS Defense System (DDS)
Most Common Security Threats
Remote File Inclusion
- an attack where attacker executes a script of
  his liking from against the target web
  application

Possible Damage:
1. Expose / Modify variable values of the script
   doing the include
2. Expose stored credentials (e.g
   username/password from a web app
   configuration file

Vector:
User-controllable value of variable called by
include() or require()
Most Common Security Threats


Remote File Inclusion

Preventions(PHP):
 1. Disable register_globals
 2. Disable allow_url_open
 3. Disable allow_url_include
 4. Do not include from a dynamic variable with
    user controllable value
Most Common Security Threats

Form Spoofing
 - an attack where an HTML form is mimicked or
   copied and then submitted from a location
   different from original

Possible Damage:
 1. Bypass client-side validation
 2. Mass data insertion resulting to flood (e.g
    guestbook, forum, etc.)
Most Common Security Threats

Form Spoofing

Vectors:
 1. No forms tokens present, thus all request
    thrown to the accepting script is considered
    valid

Preventions:
 1. Tokenize the form
 2. (Optional) Check referrer
The Principles of Secure
            Development

1. Input Validation
2. Output Validation
3. Error Handling
4. Authentication and Authorisation
5. Session Management
6. Secure Communications
7. Secure Storage
8. Secure Resource Access
Know your tools

●   Each language is different and has different
    strengths and weaknesses

     * PHP
     * Python
     * .NET
     * ASP
     * Ruby
     * Scala
     * Java
Best Practices


1. Never ever use WAMP, XAMP stack in
   production
2. Avoid spaghetti code
3. Don't re-invent the wheel
4. Naming conventions
5. Use case-sensitive
6. Secure the filesystem
if [ “$SLIDE” -eq “end” ]; then
   echo -n “Any question? [Y/n]”
   read QTN

     if [ "$QTN" == "N" -o "$QTN" == "n" ]; then
        echo "Thank You!"
        exit 1
     elif [ "$QTN" == "Y" -o "$QTN" == "y" ]; then
        echo “Ok I'll try to answer them.”
     else
        echo “Email me if you have. Thanks”
     fi
fi

      f70c89933a2f18cfd69af64ed32e9141 - f25d38b18f6da9feff9a76e0cfe6c245

Contenu connexe

Tendances

Tendances (20)

Top 10 mobile security risks - Khổng Văn Cường
Top 10 mobile security risks - Khổng Văn CườngTop 10 mobile security risks - Khổng Văn Cường
Top 10 mobile security risks - Khổng Văn Cường
 
NewsBytes - Nullhyd
NewsBytes - Nullhyd NewsBytes - Nullhyd
NewsBytes - Nullhyd
 
News Bytes - December 2015
News Bytes - December 2015News Bytes - December 2015
News Bytes - December 2015
 
Cyber security[1118]
Cyber security[1118]Cyber security[1118]
Cyber security[1118]
 
Lessons learned from 2017 cybersecurity incidents, 2018 and beyond
Lessons learned from 2017 cybersecurity incidents, 2018 and beyondLessons learned from 2017 cybersecurity incidents, 2018 and beyond
Lessons learned from 2017 cybersecurity incidents, 2018 and beyond
 
Introduction to Web Server Security
Introduction to Web Server SecurityIntroduction to Web Server Security
Introduction to Web Server Security
 
Wannacry & Petya ransomware
Wannacry & Petya ransomwareWannacry & Petya ransomware
Wannacry & Petya ransomware
 
How to Take the Ransom Out of Ransomware
How to Take the Ransom Out of RansomwareHow to Take the Ransom Out of Ransomware
How to Take the Ransom Out of Ransomware
 
WannaCry Ransomware Attack: What to Do Now
WannaCry Ransomware Attack: What to Do NowWannaCry Ransomware Attack: What to Do Now
WannaCry Ransomware Attack: What to Do Now
 
Network security
Network securityNetwork security
Network security
 
Cisco Web and Email Security Overview
Cisco Web and Email Security OverviewCisco Web and Email Security Overview
Cisco Web and Email Security Overview
 
Network security
Network securityNetwork security
Network security
 
Cyber Attack Methodologies
Cyber Attack MethodologiesCyber Attack Methodologies
Cyber Attack Methodologies
 
Centralized Patch Management - Proven Security Approach for Ransomware Protec...
Centralized Patch Management - Proven Security Approach for Ransomware Protec...Centralized Patch Management - Proven Security Approach for Ransomware Protec...
Centralized Patch Management - Proven Security Approach for Ransomware Protec...
 
Cyber security fundamentals
Cyber security fundamentalsCyber security fundamentals
Cyber security fundamentals
 
Cyber Attack Analysis : Part I DDoS
Cyber Attack Analysis : Part I DDoSCyber Attack Analysis : Part I DDoS
Cyber Attack Analysis : Part I DDoS
 
How to stay protected against ransomware
How to stay protected against ransomwareHow to stay protected against ransomware
How to stay protected against ransomware
 
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer ProtectionOwasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
 
Information Security Engineering
Information Security EngineeringInformation Security Engineering
Information Security Engineering
 
Wajug: Cyber war, Cyber Attacks and Ethical Hacking - Frédéric de Pauw - Dece...
Wajug: Cyber war, Cyber Attacks and Ethical Hacking - Frédéric de Pauw - Dece...Wajug: Cyber war, Cyber Attacks and Ethical Hacking - Frédéric de Pauw - Dece...
Wajug: Cyber war, Cyber Attacks and Ethical Hacking - Frédéric de Pauw - Dece...
 

En vedette

Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5
Jim Manico
 
Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009
mirahman
 
Web Server Web Site Security
Web Server Web Site SecurityWeb Server Web Site Security
Web Server Web Site Security
Steven Cahill
 
Tutorial 09 - Security on the Internet and the Web
Tutorial 09 - Security on the Internet and the WebTutorial 09 - Security on the Internet and the Web
Tutorial 09 - Security on the Internet and the Web
dpd
 

En vedette (20)

Introduction to web security @ confess 2012
Introduction to web security @ confess 2012Introduction to web security @ confess 2012
Introduction to web security @ confess 2012
 
Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5Top Ten Proactive Web Security Controls v5
Top Ten Proactive Web Security Controls v5
 
Security in Web 2.0, Social Web and Cloud
Security in Web 2.0, Social Web and CloudSecurity in Web 2.0, Social Web and Cloud
Security in Web 2.0, Social Web and Cloud
 
Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009Php & Web Security - PHPXperts 2009
Php & Web Security - PHPXperts 2009
 
Cisco Study: State of Web Security
Cisco Study: State of Web Security Cisco Study: State of Web Security
Cisco Study: State of Web Security
 
Web Security
Web SecurityWeb Security
Web Security
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
 
Modern Web Security
Modern Web SecurityModern Web Security
Modern Web Security
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security Risks
 
Introduction to Web security
Introduction to Web securityIntroduction to Web security
Introduction to Web security
 
Web Server Web Site Security
Web Server Web Site SecurityWeb Server Web Site Security
Web Server Web Site Security
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Extreme security in web servers
Extreme security in  web serversExtreme security in  web servers
Extreme security in web servers
 
DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity
 
Web Security
Web SecurityWeb Security
Web Security
 
Tutorial 09 - Security on the Internet and the Web
Tutorial 09 - Security on the Internet and the WebTutorial 09 - Security on the Internet and the Web
Tutorial 09 - Security on the Internet and the Web
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
 
網頁安全 Web security 入門 @ Study-Area
網頁安全 Web security 入門 @ Study-Area網頁安全 Web security 入門 @ Study-Area
網頁安全 Web security 入門 @ Study-Area
 
Web security
Web securityWeb security
Web security
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 

Similaire à Web Security

Port of seattle security presentation david morris
Port of seattle security presentation   david morrisPort of seattle security presentation   david morris
Port of seattle security presentation david morris
Emily2014
 
RSA Conference 2010 San Francisco
RSA Conference 2010 San FranciscoRSA Conference 2010 San Francisco
RSA Conference 2010 San Francisco
Aditya K Sood
 
Enterprise mobileapplicationsecurity
Enterprise mobileapplicationsecurityEnterprise mobileapplicationsecurity
Enterprise mobileapplicationsecurity
Venkat Alagarsamy
 
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
Joomla Security Simplified — Seven Easy Steps For a More Secure WebsiteJoomla Security Simplified — Seven Easy Steps For a More Secure Website
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
Imperva Incapsula
 
Security Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training ProgramSecurity Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training Program
OpenDNS
 

Similaire à Web Security (20)

Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelines
 
OWASP Top Ten in Practice
OWASP Top Ten in PracticeOWASP Top Ten in Practice
OWASP Top Ten in Practice
 
VAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptxVAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptx
 
Top web apps security vulnerabilities
Top web apps security vulnerabilitiesTop web apps security vulnerabilities
Top web apps security vulnerabilities
 
Port of seattle security presentation david morris
Port of seattle security presentation   david morrisPort of seattle security presentation   david morris
Port of seattle security presentation david morris
 
ASP.NET security vulnerabilities
ASP.NET security vulnerabilitiesASP.NET security vulnerabilities
ASP.NET security vulnerabilities
 
Security concepts
Security conceptsSecurity concepts
Security concepts
 
RSA Conference 2010 San Francisco
RSA Conference 2010 San FranciscoRSA Conference 2010 San Francisco
RSA Conference 2010 San Francisco
 
How to Destroy a Database
How to Destroy a DatabaseHow to Destroy a Database
How to Destroy a Database
 
Enterprise mobileapplicationsecurity
Enterprise mobileapplicationsecurityEnterprise mobileapplicationsecurity
Enterprise mobileapplicationsecurity
 
Invited Talk - Cyber Security and Open Source
Invited Talk - Cyber Security and Open SourceInvited Talk - Cyber Security and Open Source
Invited Talk - Cyber Security and Open Source
 
Penetration Testing Basics
Penetration Testing BasicsPenetration Testing Basics
Penetration Testing Basics
 
RIoT (Raiding Internet of Things) by Jacob Holcomb
RIoT  (Raiding Internet of Things)  by Jacob HolcombRIoT  (Raiding Internet of Things)  by Jacob Holcomb
RIoT (Raiding Internet of Things) by Jacob Holcomb
 
VAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptxVAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptx
 
Security in the cloud protecting your cloud apps
Security in the cloud   protecting your cloud appsSecurity in the cloud   protecting your cloud apps
Security in the cloud protecting your cloud apps
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
 
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
Joomla Security Simplified — Seven Easy Steps For a More Secure WebsiteJoomla Security Simplified — Seven Easy Steps For a More Secure Website
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
 
Realities of Security in the Cloud
Realities of Security in the CloudRealities of Security in the Cloud
Realities of Security in the Cloud
 
Security Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training ProgramSecurity Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training Program
 

Plus de Gerald Villorente

BITS 2015: The Beauty of Drupal
BITS 2015: The Beauty of DrupalBITS 2015: The Beauty of Drupal
BITS 2015: The Beauty of Drupal
Gerald Villorente
 
Consistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and ChefConsistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and Chef
Gerald Villorente
 
Drush Deployment Manager: Deployment Made Easy
Drush Deployment Manager: Deployment Made EasyDrush Deployment Manager: Deployment Made Easy
Drush Deployment Manager: Deployment Made Easy
Gerald Villorente
 

Plus de Gerald Villorente (20)

Of Docker and Drupal
Of Docker and DrupalOf Docker and Drupal
Of Docker and Drupal
 
Introduction to Kalabox
Introduction to KalaboxIntroduction to Kalabox
Introduction to Kalabox
 
Drupal Development : Tools, Tips, and Tricks
Drupal Development : Tools, Tips, and TricksDrupal Development : Tools, Tips, and Tricks
Drupal Development : Tools, Tips, and Tricks
 
Drupal 101 V-0.1
Drupal 101 V-0.1Drupal 101 V-0.1
Drupal 101 V-0.1
 
BITS 2015: The Beauty of Drupal
BITS 2015: The Beauty of DrupalBITS 2015: The Beauty of Drupal
BITS 2015: The Beauty of Drupal
 
Introduction to Drupal 7
Introduction to Drupal 7Introduction to Drupal 7
Introduction to Drupal 7
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
Consistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and ChefConsistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and Chef
 
Drush Deployment Manager: Deployment Made Easy
Drush Deployment Manager: Deployment Made EasyDrush Deployment Manager: Deployment Made Easy
Drush Deployment Manager: Deployment Made Easy
 
Consistent Development Environment using Vagrant and Chef
Consistent Development Environment using Vagrant and ChefConsistent Development Environment using Vagrant and Chef
Consistent Development Environment using Vagrant and Chef
 
Why Drupal is Rockstar?
Why Drupal is Rockstar?Why Drupal is Rockstar?
Why Drupal is Rockstar?
 
DevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal DeploymentDevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal Deployment
 
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and VagrantDrupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
 
Drupal
DrupalDrupal
Drupal
 
Best Practices: Drupal Development
Best Practices: Drupal DevelopmentBest Practices: Drupal Development
Best Practices: Drupal Development
 
Drupal Deployment and Essential Development Tools - 2nd Edition
Drupal Deployment and Essential Development Tools - 2nd EditionDrupal Deployment and Essential Development Tools - 2nd Edition
Drupal Deployment and Essential Development Tools - 2nd Edition
 
Drupal Deployment and Essential Development Tools
Drupal Deployment and Essential Development ToolsDrupal Deployment and Essential Development Tools
Drupal Deployment and Essential Development Tools
 
Setting Up Cross-Browser Testing Environment (Debian-based System)
Setting Up Cross-Browser Testing Environment  (Debian-based System)Setting Up Cross-Browser Testing Environment  (Debian-based System)
Setting Up Cross-Browser Testing Environment (Debian-based System)
 
Git: Git'ing the Basic
Git: Git'ing the BasicGit: Git'ing the Basic
Git: Git'ing the Basic
 
Anatomy of Drupal
Anatomy of DrupalAnatomy of Drupal
Anatomy of Drupal
 

Web Security

  • 1. Web Security Gerald Z. Villorente Lorma Colleges San Fernando, La Union
  • 2. if [ “$SLIDE” -eq “intro” ]; then echo “I'm Gerald Z. Villorente” fi ● Senior Web Developer, Kite Systems Ltd. Hong Kong / Philippines ● Drupal Developer, Cable Network News (CNN) Travel Hong Kong / Atlanta, USA ● System Administrator, InternetJail Oregon, USA ● Drupal Phil. Users Group (DPUG) member ● Freelancer
  • 3. Agenda ● Security levels ● Aspect of Data Security ● Most common Web application threats and counter measures ● Principle of Secure Development ● Best Practices ● Tools
  • 4. What is a Web Application? • Any application that is served commonly via http or https protocol • Usually running under port 80 or port 443 • Served from a remote computer acting as host/server
  • 5. What is a Web Application? • Any application that is served commonly via http or https protocol • Usually running under port 80 or port 443 • Served from a remote computer acting as host/server
  • 6. What is a Web Application? • Any application that is served commonly via http or https protocol • Usually running under port 80 or port 443 • Served from a remote computer acting as host/server
  • 7. What is Web Security? • A.k.a “Cyber Security”, involves protecting all informations by preventing, detecting, and responding to attack • Is a state of being free from damage and being compromised • Is a condition of being protected against danger or loss
  • 8. What is Web Security? • A.k.a “Cyber Security”, involves protecting all informations by preventing, detecting, and responding to attack • Is a state of being free from damage and being compromised • Is a condition of being protected against danger or loss
  • 9. What is Web Security? • A.k.a “Cyber Security”, involves protecting all informations by preventing, detecting, and responding to attack • Is a state of being free from damage and being compromised • Is a condition of being protected against danger or loss
  • 10. Security Levels • Server level • Network level • Application level • User level
  • 11. Security Levels • Server level • Network level • Application level • User level
  • 12. Security Levels • Server level • Network level • Application level • User level
  • 13. Security Levels • Server level • Network level • Application level • User level
  • 14. Security Levels • Server level - Ensure you have installed the latest operating system security patches. - Keep your web server software up-to-date - Limit access from the Internet to your servers. Use firewall software to block access to any port but the following: * 80 * 443 (SSL, only if your application uses it) * 22 (SSH, SCP) * 21 (not recomended) • Network level • Application level • User level
  • 15. Security Levels • Server level • Network level - Place servers that your users do not directly interact with (e.g., a back-end database server) in a private network that is inaccessible from the Internet. If that is not possible, then use firewall software to block access from any computer other than your web server. • Application level • User level
  • 16. Security Levels • Server level • Network level • Application level - Never store passwords in clear text. Instead, use a hashing algorithm such as MD5 or SHA-256 to create a signature of the user's password for storage. - Generate a unique signature for the user based on the login and password and store that in the cookie. - Carefully check any parameters you pass to SQL statements in your application. Validate all user inputs. - Purge unused/unnecessary user data from your system regularly. • User level
  • 17. Security Levels • Server level • Network level • Application level • User level - Protecting yourself is to recognize the risks and become familiar with some of the terminology associated with them. - Keep your personal information in private - Use complex password - Keep your computer away from viruses, worms, keyloggers, trojans, malwares, etc
  • 18. Aspects of Data Security • Privacy - keeping your information private • Integrity - knowing that the information has not been changed • Authenticity - knowing who sent the information
  • 19. Aspects of Data Security • Privacy - keeping your information private • Integrity - knowing that the information has not been changed • Authenticity - knowing who sent the information
  • 20. Aspects of Data Security • Privacy - keeping your information private • Integrity - knowing that the information has not been changed • Authenticity - knowing who sent the information
  • 21. Aspects of Data Security • Privacy - keeping your information private • Integrity - knowing that the information has not been changed • Authenticity - knowing who sent the information
  • 22. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Parameter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 23. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 24. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 25. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 26. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 27. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 28. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 29. Most Common Security Threats 1. Cross-site scripting (XSS) 2. SQL injection 3. Improper error handling 4. Paremeter Tampering 5. Application denial-of-service (DDoS) 6. Remote File Inclusion 7. Form Spoofing Source: OWASP
  • 30. Most Common Security Threats Cross Site Scripting - Injecting Javascript or other scripts that will run on behalf of other user. This code usually steals cookies (authenticated credentials) of the person who “sees” the infected web page. Ex: <script>alert(“This site has been hacked!”);</script> Preventions: 1. Filter all foreign data - $filter_user_input = htmlentities($post['userinput']); 2. Always assume data to be invalid until it is proved valid. 3. Use BBCode – [b]bold[/b] vs <b>bold</b> XSS Cheat Sheet
  • 31. Most Common Security Threats SQL Injection - an attack where an attacker is able to execute arbitrary sql code against the database Ex: // legit $sort = 'ASC'; // malicious injection $sort = '; TRUNCATE USERS'; // actual query $query = “SELECT * FROM users ORDER BY membership_date $sort”; // output query SELECT * FROM users ORDER BY membership_date; TRUCATE USERS
  • 32. Most Common Security Threats SQL Injection (cont.) Possible damage: 1. Corrupt data by executing truncate() 2. Alter current data (e.g change admin password) Vectors: 1. Dynamic queries getting values from unsanitized user-submitted data Prevention(MySQL): 1. Enclose user-submitted values with mysql_real_escape_string() 2. Harden the environment by reducing sql account permissions, remove unneeded system stored procedures, and audit password strength
  • 33. Most Common Security Threats Improper Error Handling - errors are not properly handled by system code
  • 34. Most Common Security Threats Parameter Tampering - based on the manipulation of parameters exchanged between client and server in order to modify application data, such as user credentials and permissions, price and quantity of products, etc. Usually, this information is stored in cookies, hidden form fields, or URL Query Strings, and is used to increase application functionality and control. Ex: http://www.attackbank.com/savepage.asp?nr=147&status=read Attack http://www.attackbank.com/savepage.asp?nr=147&status=del
  • 35. Most Common Security Threats Denial-of-Service - an attack to make a computer resources unavailable to its intended users Resources: 1. Bandwidth 2. CPU Preventions: 1. Firewall 2. Router & Switches 3. Intrusion Prevention Systems (IPS) 4. DoS Defense System (DDS)
  • 36. Most Common Security Threats Remote File Inclusion - an attack where attacker executes a script of his liking from against the target web application Possible Damage: 1. Expose / Modify variable values of the script doing the include 2. Expose stored credentials (e.g username/password from a web app configuration file Vector: User-controllable value of variable called by include() or require()
  • 37. Most Common Security Threats Remote File Inclusion Preventions(PHP): 1. Disable register_globals 2. Disable allow_url_open 3. Disable allow_url_include 4. Do not include from a dynamic variable with user controllable value
  • 38. Most Common Security Threats Form Spoofing - an attack where an HTML form is mimicked or copied and then submitted from a location different from original Possible Damage: 1. Bypass client-side validation 2. Mass data insertion resulting to flood (e.g guestbook, forum, etc.)
  • 39. Most Common Security Threats Form Spoofing Vectors: 1. No forms tokens present, thus all request thrown to the accepting script is considered valid Preventions: 1. Tokenize the form 2. (Optional) Check referrer
  • 40. The Principles of Secure Development 1. Input Validation 2. Output Validation 3. Error Handling 4. Authentication and Authorisation 5. Session Management 6. Secure Communications 7. Secure Storage 8. Secure Resource Access
  • 41. Know your tools ● Each language is different and has different strengths and weaknesses * PHP * Python * .NET * ASP * Ruby * Scala * Java
  • 42. Best Practices 1. Never ever use WAMP, XAMP stack in production 2. Avoid spaghetti code 3. Don't re-invent the wheel 4. Naming conventions 5. Use case-sensitive 6. Secure the filesystem
  • 43. if [ “$SLIDE” -eq “end” ]; then echo -n “Any question? [Y/n]” read QTN if [ "$QTN" == "N" -o "$QTN" == "n" ]; then echo "Thank You!" exit 1 elif [ "$QTN" == "Y" -o "$QTN" == "y" ]; then echo “Ok I'll try to answer them.” else echo “Email me if you have. Thanks” fi fi f70c89933a2f18cfd69af64ed32e9141 - f25d38b18f6da9feff9a76e0cfe6c245