SlideShare a Scribd company logo
Defending Web Applications:
  Going back to the First
         Principles

    Presented by Jason Lam
          Sept 2012

     Web App Security - © 2012 SANS
CASE 1




Web App Security - © 2012 SANS
Leaky Website
                                 Credit
                                 Card




DMZ            Inside
Web App Security - © 2012 SANS
Scenario

• Lots of complains from customers
  about compromised cards
• Anti-virus scan is negative
• Database storing cards shows no sign
  of compromise
• Upon close inspection, an odd process
  was found on one of the server
• Entry point – Web server

         Web App Security - © 2012 SANS
Step 1 – SQL Injection

                                   Credit
                                   Card




  Web App Security - © 2012 SANS
Step 1 – SQL Injection

• SELECT field FROM table WHERE
  name = 'userinput'
• User input is ' OR 1 = 1 ;--
• User input spills into control
  structure
• User input control the database
  execution
        Web App Security - © 2012 SANS
Step 2 – Gain OS Access

                                    Credit
                                    Card




   Web App Security - © 2012 SANS
Step 2 – Gain OS Access

• Example - MS SQL Server provides
  xp_cmdshell()
• Execute OS level command on
  database server
• Need to be 'sa' user


       Web App Security - © 2012 SANS
Step 3 – Attack Other Hosts

                                      Credit
                                      Card




     Web App Security - © 2012 SANS
Step 3 – Attack Other Hosts

• Once attacker owns the database
  server, attacks other hosts
• Download tools from Internet
  – Nmap, Nessus, Metaspolit....
• Firewall probably allows outbound
  access

         Web App Security - © 2012 SANS
Counter Measure
         Input Filtering
• Common mitigation – Filter ' ; "
• More aggressive – Filter SELECT,
  FROM.....




        Web App Security - © 2012 SANS
(Input Filtering) But.......

• What if I don't need to use ' for
  attack?
  – Think of numeric type
• What if I need to allow all SQL
  keywords?
• Input Filtering isn't a
  comprehensive solution
        Web App Security - © 2012 SANS
Counter Measure
     Parameterized Query
• sql = "SELECT field FROM table
  WHERE name = @userinput"
• Then, define @userinput
• Database and Platform has a
  chance to distinguish between user
  input and control structure

        Web App Security - © 2012 SANS
Counter Measure
   Limiting Database Access
• Databases don't generally surf the
  Internet
• Why allow open access to the
  Internet?




        Web App Security - © 2012 SANS
Counter Measure
      Database permission
• Reduce the account privilege level
  on the database
• Using dba or sa account for web
  app is unsafe
• Reduce permission level on a table
  and row basis

        Web App Security - © 2012 SANS
Counter Measure
              IPS
• Intrusion prevention system can
  detect on tell-tale sign of SQL
  injection
• Can detect irregular access
  outbound from Database
• Need configuration

        Web App Security - © 2012 SANS
(IPS) But.......

• What if obfuscation is used?
• Eg. Encoding
• Does IPS know all of the SQL
  injection cases?
• Does IPS know all the evasion
  techniques?

        Web App Security - © 2012 SANS
CASE 2




Web App Security - © 2012 SANS
Twitter

• Twitter employee has a Yahoo mail
  account
• Reset the password by answering
  secret questions
• Twitter password in mailbox
• Admin interface location easy to
  guess
        Web App Security - © 2012 SANS
Twitter 2




Web App Security - © 2012 SANS
Twitter 3




Web App Security - © 2012 SANS
Web App Security - © 2012 SANS
Counter Measure
    No Password via Email
• Password should never be sent via
  Email
• Email stays forever
• If you hash, you should NOT have
  original password


        Web App Security - © 2012 SANS
Counter Measure
   Isolated Admin Interface
• Do not allow "inline" administration
• Use a second channel for admin
  (eg IPSec VPN)
• Make admin interface available to
  internal network only


        Web App Security - © 2012 SANS
CASE 3




Web App Security - © 2012 SANS
Good VS Evil

• Federal government contract firm
  got website defaced
• User registration data from an
  affiliating website published
• CEO's Email posted online
• Hacking group known to support
  Wikileak
        Web App Security - © 2012 SANS
1st   Step - SQL Injection

http://www.hbgaryfederal.com/pages.php
?pageNav=2&page=27
• Use a customized 3rd party CMS
  system
• At mercy of 3rd party patching
• SQL injection allows backend
  database read access
          Web App Security - © 2012 SANS
2nd   Step – Crack Password

• CMS system store password in hash
• Straight single MD5, no salt
• Rainbow Table – pre-computed
  hash list
• CEO & COO used simple passwords


         Web App Security - © 2012 SANS
3rd   Step – Systems Jump

• Same username + password on
  related system
• CEO & COO used credentials on
  multiple systems
  – Email
  – Twitter
  – LinkedIn
         Web App Security - © 2012 SANS
3rd   Step (cont'd) – SSH Jump

• Support website on Linux box, SSH
  direct access from Internet
• COO shared password between
  sites
• SSH accepts password
  authentication
• COO is a regular user (non root)
         Web App Security - © 2012 SANS
Step 4 – Local System
       Privilege Elevation
• Local privilege escalation exploit
• Purged data




         Web App Security - © 2012 SANS
Step 5 – Mail Retreival

• Google App Mail
• CEO account happened to be
  administrator
• Able to access Email for whole
  organization (thru reset password)
• CEO of sister company's Email was
  accessed
• CEO's Email posted online

         Web App Security - © 2012 SANS
Step 6 – Getting Personal

• Sister company's CEO also runs a
  security website with friends
• Email revealed another person who
  has root access to the website
• Two potential root passwords
• Host is firewalled and does not
  allow direct root login
        Web App Security - © 2012 SANS
Step 6 (cont'd) – Getting
           Personal



• Social engineering
• Firewall circumvented
• SSH password reset
  (changeme123)

        Web App Security - © 2012 SANS
Step 7 – Revenge At Personal
            Level
• Credential database at the personal
  security site was stolen
• MD5 single pass no salt hash
• Site defaced
• Credentials of users posted online


        Web App Security - © 2012 SANS
Counter Measure:
  Unique Complex Password
• Do not share password between
  sites
• Use 1Password, KeePass –
  Password Manager
• User education
• Rotate password often
• Password complexity rule
       Web App Security - © 2012 SANS
Counter Measures:
     Strong authentication
• Use key authentication for SSH
• Password + key will be required to
  login
• You may have the password, key is
  harder to steal


        Web App Security - © 2012 SANS
Counter Measures:
     Parameterized Query
• sql = "SELECT field FROM table
  WHERE name = @userinput"
• Then, define @userinput
• Database and Platform has a
  chance to distinguish between user
  input and control structure

        Web App Security - © 2012 SANS
Counter Measures: Password
          Storage
• Iterative hash (hashing multiple
  times)
• Salted hash




        Web App Security - © 2012 SANS
Counter Measures:
        Privilege Account
• Avoid using privileged account for
  day to day operations
• Do CEO and COO generally need to
  be administrators or root?
• Segregation of duties


        Web App Security - © 2012 SANS
Questions & Answers




 Web App Security - © 2012 SANS

More Related Content

What's hot

Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Ajin Abraham
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense MechanismsCh 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
Reality Check: Security in the Cloud
Reality Check: Security in the CloudReality Check: Security in the Cloud
Reality Check: Security in the Cloud
Alert Logic
 
Web hackingtools cf-summit2014
Web hackingtools cf-summit2014Web hackingtools cf-summit2014
Web hackingtools cf-summit2014
ColdFusionConference
 
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Security Innovation
 
How to Test for The OWASP Top Ten
 How to Test for The OWASP Top Ten How to Test for The OWASP Top Ten
How to Test for The OWASP Top Ten
Security Innovation
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
Satish b
 
Do You Write Secure Code? by Erez Metula
Do You Write Secure Code? by Erez MetulaDo You Write Secure Code? by Erez Metula
Do You Write Secure Code? by Erez Metula
Alphageeks
 
Android system security
Android system securityAndroid system security
Android system security
Chong-Kuan Chen
 
BlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure AD
BlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure ADBlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure AD
BlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure AD
BlueHat Security Conference
 
Core defense mechanisms against security attacks on web applications
Core defense mechanisms against security attacks on web applicationsCore defense mechanisms against security attacks on web applications
Core defense mechanisms against security attacks on web applications
Karan Nagrecha
 
The presentation on my "Shadow Admins" research
The presentation on my "Shadow Admins" researchThe presentation on my "Shadow Admins" research
The presentation on my "Shadow Admins" research
Asaf Hecht
 
From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...
From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...
From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...
Imperva Incapsula
 
CSS 17: NYC - Realities of Security in the Cloud
CSS 17: NYC - Realities of Security in the CloudCSS 17: NYC - Realities of Security in the Cloud
CSS 17: NYC - Realities of Security in the Cloud
Alert Logic
 
Android Security
Android SecurityAndroid Security
Android Security
Arqum Ahmad
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
NetSPI
 
VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...
VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...
VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...
VMworld
 
Android App Hacking - Erez Metula, AppSec
Android App Hacking - Erez Metula, AppSecAndroid App Hacking - Erez Metula, AppSec
Android App Hacking - Erez Metula, AppSec
DroidConTLV
 
Sql injection
Sql injectionSql injection
Sql injection
The Avi Sharma
 
Thick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseThick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash Course
Scott Sutherland
 

What's hot (20)

Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
Hacking Samsung's Tizen: The OS of Everything - Hack In the Box 2015
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense MechanismsCh 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
 
Reality Check: Security in the Cloud
Reality Check: Security in the CloudReality Check: Security in the Cloud
Reality Check: Security in the Cloud
 
Web hackingtools cf-summit2014
Web hackingtools cf-summit2014Web hackingtools cf-summit2014
Web hackingtools cf-summit2014
 
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
 
How to Test for The OWASP Top Ten
 How to Test for The OWASP Top Ten How to Test for The OWASP Top Ten
How to Test for The OWASP Top Ten
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
Do You Write Secure Code? by Erez Metula
Do You Write Secure Code? by Erez MetulaDo You Write Secure Code? by Erez Metula
Do You Write Secure Code? by Erez Metula
 
Android system security
Android system securityAndroid system security
Android system security
 
BlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure AD
BlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure ADBlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure AD
BlueHat Seattle 2019 || I'm in your cloud: A year of hacking Azure AD
 
Core defense mechanisms against security attacks on web applications
Core defense mechanisms against security attacks on web applicationsCore defense mechanisms against security attacks on web applications
Core defense mechanisms against security attacks on web applications
 
The presentation on my "Shadow Admins" research
The presentation on my "Shadow Admins" researchThe presentation on my "Shadow Admins" research
The presentation on my "Shadow Admins" research
 
From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...
From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...
From 1000/day to 1000/sec: The Evolution of Incapsula's BIG DATA System [Surg...
 
CSS 17: NYC - Realities of Security in the Cloud
CSS 17: NYC - Realities of Security in the CloudCSS 17: NYC - Realities of Security in the Cloud
CSS 17: NYC - Realities of Security in the Cloud
 
Android Security
Android SecurityAndroid Security
Android Security
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
 
VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...
VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...
VMworld 2013: Enhancing Workplace Mobility and BYOD with the VMware Mobile Se...
 
Android App Hacking - Erez Metula, AppSec
Android App Hacking - Erez Metula, AppSecAndroid App Hacking - Erez Metula, AppSec
Android App Hacking - Erez Metula, AppSec
 
Sql injection
Sql injectionSql injection
Sql injection
 
Thick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseThick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash Course
 

Similar to Defending Web Applications: first-principles- Jason Lam

Net scaler appfw customer technical presentation dec 2012f
Net scaler appfw customer technical presentation dec 2012fNet scaler appfw customer technical presentation dec 2012f
Net scaler appfw customer technical presentation dec 2012f
xKinAnx
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
IBM Security
 
Make your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeMake your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More Safe
Thuan Ng
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
Sebastien Deleersnyder
 
Controlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and DataControlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and Data
Precisely
 
Expand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and DataExpand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and Data
Precisely
 
00. introduction to app sec v3
00. introduction to app sec v300. introduction to app sec v3
00. introduction to app sec v3
Eoin Keary
 
IBM Security Identity & Access Manager
IBM Security Identity & Access ManagerIBM Security Identity & Access Manager
IBM Security Identity & Access Manager
IBM Sverige
 
Advanced Threats In The Enterprise
Advanced Threats In The EnterpriseAdvanced Threats In The Enterprise
Advanced Threats In The Enterprise
Priyanka Aash
 
Web & Cloud Security in the real world
Web & Cloud Security in the real worldWeb & Cloud Security in the real world
Web & Cloud Security in the real world
Madhu Akula
 
CSS 17: NYC - Protecting your Web Applications
CSS 17: NYC - Protecting your Web ApplicationsCSS 17: NYC - Protecting your Web Applications
CSS 17: NYC - Protecting your Web Applications
Alert Logic
 
Wrong slides! Please check description for correct deck
Wrong slides! Please check description for correct deck Wrong slides! Please check description for correct deck
Wrong slides! Please check description for correct deck
Benedek Menesi
 
Mobile Threats and Owasp Top 10 Risks
Mobile Threats  and Owasp Top 10 RisksMobile Threats  and Owasp Top 10 Risks
Mobile Threats and Owasp Top 10 Risks
Santosh Satam
 
Developing Secure Web Apps
Developing Secure Web AppsDeveloping Secure Web Apps
Developing Secure Web Apps
Mark Garratt
 
OWASP Mobile TOP 10 2014
OWASP Mobile TOP 10 2014OWASP Mobile TOP 10 2014
OWASP Mobile TOP 10 2014
Islam Azeddine Mennouchi
 
Top Strategies to Capture Security Intelligence for Applications
Top Strategies to Capture Security Intelligence for ApplicationsTop Strategies to Capture Security Intelligence for Applications
Top Strategies to Capture Security Intelligence for Applications
Denim Group
 
Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017
TriNimbus
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
Niyas Nazar
 
Protecting Windows Passwords and Preventing Windows Computer / Password Attacks
Protecting Windows Passwords and Preventing Windows Computer / Password AttacksProtecting Windows Passwords and Preventing Windows Computer / Password Attacks
Protecting Windows Passwords and Preventing Windows Computer / Password Attacks
Zoho Corporation
 
Database Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesDatabase Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 

Similar to Defending Web Applications: first-principles- Jason Lam (20)

Net scaler appfw customer technical presentation dec 2012f
Net scaler appfw customer technical presentation dec 2012fNet scaler appfw customer technical presentation dec 2012f
Net scaler appfw customer technical presentation dec 2012f
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
 
Make your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeMake your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More Safe
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
 
Controlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and DataControlling Access to IBM i Systems and Data
Controlling Access to IBM i Systems and Data
 
Expand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and DataExpand Your Control of Access to IBM i Systems and Data
Expand Your Control of Access to IBM i Systems and Data
 
00. introduction to app sec v3
00. introduction to app sec v300. introduction to app sec v3
00. introduction to app sec v3
 
IBM Security Identity & Access Manager
IBM Security Identity & Access ManagerIBM Security Identity & Access Manager
IBM Security Identity & Access Manager
 
Advanced Threats In The Enterprise
Advanced Threats In The EnterpriseAdvanced Threats In The Enterprise
Advanced Threats In The Enterprise
 
Web & Cloud Security in the real world
Web & Cloud Security in the real worldWeb & Cloud Security in the real world
Web & Cloud Security in the real world
 
CSS 17: NYC - Protecting your Web Applications
CSS 17: NYC - Protecting your Web ApplicationsCSS 17: NYC - Protecting your Web Applications
CSS 17: NYC - Protecting your Web Applications
 
Wrong slides! Please check description for correct deck
Wrong slides! Please check description for correct deck Wrong slides! Please check description for correct deck
Wrong slides! Please check description for correct deck
 
Mobile Threats and Owasp Top 10 Risks
Mobile Threats  and Owasp Top 10 RisksMobile Threats  and Owasp Top 10 Risks
Mobile Threats and Owasp Top 10 Risks
 
Developing Secure Web Apps
Developing Secure Web AppsDeveloping Secure Web Apps
Developing Secure Web Apps
 
OWASP Mobile TOP 10 2014
OWASP Mobile TOP 10 2014OWASP Mobile TOP 10 2014
OWASP Mobile TOP 10 2014
 
Top Strategies to Capture Security Intelligence for Applications
Top Strategies to Capture Security Intelligence for ApplicationsTop Strategies to Capture Security Intelligence for Applications
Top Strategies to Capture Security Intelligence for Applications
 
Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017Web App Security Presentation by Ryan Holland - 05-31-2017
Web App Security Presentation by Ryan Holland - 05-31-2017
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
 
Protecting Windows Passwords and Preventing Windows Computer / Password Attacks
Protecting Windows Passwords and Preventing Windows Computer / Password AttacksProtecting Windows Passwords and Preventing Windows Computer / Password Attacks
Protecting Windows Passwords and Preventing Windows Computer / Password Attacks
 
Database Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesDatabase Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best Practices
 

More from OWASP-Qatar Chapter

Introduction to Session Management Dana Al-abdulla
Introduction to Session Management   Dana Al-abdullaIntroduction to Session Management   Dana Al-abdulla
Introduction to Session Management Dana Al-abdulla
OWASP-Qatar Chapter
 
Securing the channel - Tarkay Jamaan
Securing the channel - Tarkay JamaanSecuring the channel - Tarkay Jamaan
Securing the channel - Tarkay Jamaan
OWASP-Qatar Chapter
 
Secure management of credentials - Zouheir Abdulla
Secure  management of credentials -   Zouheir AbdullaSecure  management of credentials -   Zouheir Abdulla
Secure management of credentials - Zouheir Abdulla
OWASP-Qatar Chapter
 
Owasp qatar presentation top 10 changes 2013 - Tarun Gupta
Owasp qatar presentation   top 10 changes 2013 - Tarun GuptaOwasp qatar presentation   top 10 changes 2013 - Tarun Gupta
Owasp qatar presentation top 10 changes 2013 - Tarun Gupta
OWASP-Qatar Chapter
 
Implementing a comprehensive application security progaram - Tawfiq
Implementing a comprehensive application security progaram - Tawfiq Implementing a comprehensive application security progaram - Tawfiq
Implementing a comprehensive application security progaram - Tawfiq
OWASP-Qatar Chapter
 
You installed what Thierry Sans
You installed what  Thierry SansYou installed what  Thierry Sans
You installed what Thierry Sans
OWASP-Qatar Chapter
 
Sql injection to enterprise Owned - K.K. Mookhey
Sql injection to enterprise Owned  - K.K. Mookhey Sql injection to enterprise Owned  - K.K. Mookhey
Sql injection to enterprise Owned - K.K. Mookhey
OWASP-Qatar Chapter
 
Application Security TRENDS – Lessons Learnt- Firosh Ummer
Application Security TRENDS – Lessons Learnt- Firosh UmmerApplication Security TRENDS – Lessons Learnt- Firosh Ummer
Application Security TRENDS – Lessons Learnt- Firosh Ummer
OWASP-Qatar Chapter
 

More from OWASP-Qatar Chapter (8)

Introduction to Session Management Dana Al-abdulla
Introduction to Session Management   Dana Al-abdullaIntroduction to Session Management   Dana Al-abdulla
Introduction to Session Management Dana Al-abdulla
 
Securing the channel - Tarkay Jamaan
Securing the channel - Tarkay JamaanSecuring the channel - Tarkay Jamaan
Securing the channel - Tarkay Jamaan
 
Secure management of credentials - Zouheir Abdulla
Secure  management of credentials -   Zouheir AbdullaSecure  management of credentials -   Zouheir Abdulla
Secure management of credentials - Zouheir Abdulla
 
Owasp qatar presentation top 10 changes 2013 - Tarun Gupta
Owasp qatar presentation   top 10 changes 2013 - Tarun GuptaOwasp qatar presentation   top 10 changes 2013 - Tarun Gupta
Owasp qatar presentation top 10 changes 2013 - Tarun Gupta
 
Implementing a comprehensive application security progaram - Tawfiq
Implementing a comprehensive application security progaram - Tawfiq Implementing a comprehensive application security progaram - Tawfiq
Implementing a comprehensive application security progaram - Tawfiq
 
You installed what Thierry Sans
You installed what  Thierry SansYou installed what  Thierry Sans
You installed what Thierry Sans
 
Sql injection to enterprise Owned - K.K. Mookhey
Sql injection to enterprise Owned  - K.K. Mookhey Sql injection to enterprise Owned  - K.K. Mookhey
Sql injection to enterprise Owned - K.K. Mookhey
 
Application Security TRENDS – Lessons Learnt- Firosh Ummer
Application Security TRENDS – Lessons Learnt- Firosh UmmerApplication Security TRENDS – Lessons Learnt- Firosh Ummer
Application Security TRENDS – Lessons Learnt- Firosh Ummer
 

Recently uploaded

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

Defending Web Applications: first-principles- Jason Lam

  • 1. Defending Web Applications: Going back to the First Principles Presented by Jason Lam Sept 2012 Web App Security - © 2012 SANS
  • 2. CASE 1 Web App Security - © 2012 SANS
  • 3. Leaky Website Credit Card DMZ Inside Web App Security - © 2012 SANS
  • 4. Scenario • Lots of complains from customers about compromised cards • Anti-virus scan is negative • Database storing cards shows no sign of compromise • Upon close inspection, an odd process was found on one of the server • Entry point – Web server Web App Security - © 2012 SANS
  • 5. Step 1 – SQL Injection Credit Card Web App Security - © 2012 SANS
  • 6. Step 1 – SQL Injection • SELECT field FROM table WHERE name = 'userinput' • User input is ' OR 1 = 1 ;-- • User input spills into control structure • User input control the database execution Web App Security - © 2012 SANS
  • 7. Step 2 – Gain OS Access Credit Card Web App Security - © 2012 SANS
  • 8. Step 2 – Gain OS Access • Example - MS SQL Server provides xp_cmdshell() • Execute OS level command on database server • Need to be 'sa' user Web App Security - © 2012 SANS
  • 9. Step 3 – Attack Other Hosts Credit Card Web App Security - © 2012 SANS
  • 10. Step 3 – Attack Other Hosts • Once attacker owns the database server, attacks other hosts • Download tools from Internet – Nmap, Nessus, Metaspolit.... • Firewall probably allows outbound access Web App Security - © 2012 SANS
  • 11. Counter Measure Input Filtering • Common mitigation – Filter ' ; " • More aggressive – Filter SELECT, FROM..... Web App Security - © 2012 SANS
  • 12. (Input Filtering) But....... • What if I don't need to use ' for attack? – Think of numeric type • What if I need to allow all SQL keywords? • Input Filtering isn't a comprehensive solution Web App Security - © 2012 SANS
  • 13. Counter Measure Parameterized Query • sql = "SELECT field FROM table WHERE name = @userinput" • Then, define @userinput • Database and Platform has a chance to distinguish between user input and control structure Web App Security - © 2012 SANS
  • 14. Counter Measure Limiting Database Access • Databases don't generally surf the Internet • Why allow open access to the Internet? Web App Security - © 2012 SANS
  • 15. Counter Measure Database permission • Reduce the account privilege level on the database • Using dba or sa account for web app is unsafe • Reduce permission level on a table and row basis Web App Security - © 2012 SANS
  • 16. Counter Measure IPS • Intrusion prevention system can detect on tell-tale sign of SQL injection • Can detect irregular access outbound from Database • Need configuration Web App Security - © 2012 SANS
  • 17. (IPS) But....... • What if obfuscation is used? • Eg. Encoding • Does IPS know all of the SQL injection cases? • Does IPS know all the evasion techniques? Web App Security - © 2012 SANS
  • 18. CASE 2 Web App Security - © 2012 SANS
  • 19. Twitter • Twitter employee has a Yahoo mail account • Reset the password by answering secret questions • Twitter password in mailbox • Admin interface location easy to guess Web App Security - © 2012 SANS
  • 20. Twitter 2 Web App Security - © 2012 SANS
  • 21. Twitter 3 Web App Security - © 2012 SANS
  • 22. Web App Security - © 2012 SANS
  • 23. Counter Measure No Password via Email • Password should never be sent via Email • Email stays forever • If you hash, you should NOT have original password Web App Security - © 2012 SANS
  • 24. Counter Measure Isolated Admin Interface • Do not allow "inline" administration • Use a second channel for admin (eg IPSec VPN) • Make admin interface available to internal network only Web App Security - © 2012 SANS
  • 25. CASE 3 Web App Security - © 2012 SANS
  • 26. Good VS Evil • Federal government contract firm got website defaced • User registration data from an affiliating website published • CEO's Email posted online • Hacking group known to support Wikileak Web App Security - © 2012 SANS
  • 27. 1st Step - SQL Injection http://www.hbgaryfederal.com/pages.php ?pageNav=2&page=27 • Use a customized 3rd party CMS system • At mercy of 3rd party patching • SQL injection allows backend database read access Web App Security - © 2012 SANS
  • 28. 2nd Step – Crack Password • CMS system store password in hash • Straight single MD5, no salt • Rainbow Table – pre-computed hash list • CEO & COO used simple passwords Web App Security - © 2012 SANS
  • 29. 3rd Step – Systems Jump • Same username + password on related system • CEO & COO used credentials on multiple systems – Email – Twitter – LinkedIn Web App Security - © 2012 SANS
  • 30. 3rd Step (cont'd) – SSH Jump • Support website on Linux box, SSH direct access from Internet • COO shared password between sites • SSH accepts password authentication • COO is a regular user (non root) Web App Security - © 2012 SANS
  • 31. Step 4 – Local System Privilege Elevation • Local privilege escalation exploit • Purged data Web App Security - © 2012 SANS
  • 32. Step 5 – Mail Retreival • Google App Mail • CEO account happened to be administrator • Able to access Email for whole organization (thru reset password) • CEO of sister company's Email was accessed • CEO's Email posted online Web App Security - © 2012 SANS
  • 33. Step 6 – Getting Personal • Sister company's CEO also runs a security website with friends • Email revealed another person who has root access to the website • Two potential root passwords • Host is firewalled and does not allow direct root login Web App Security - © 2012 SANS
  • 34. Step 6 (cont'd) – Getting Personal • Social engineering • Firewall circumvented • SSH password reset (changeme123) Web App Security - © 2012 SANS
  • 35. Step 7 – Revenge At Personal Level • Credential database at the personal security site was stolen • MD5 single pass no salt hash • Site defaced • Credentials of users posted online Web App Security - © 2012 SANS
  • 36. Counter Measure: Unique Complex Password • Do not share password between sites • Use 1Password, KeePass – Password Manager • User education • Rotate password often • Password complexity rule Web App Security - © 2012 SANS
  • 37. Counter Measures: Strong authentication • Use key authentication for SSH • Password + key will be required to login • You may have the password, key is harder to steal Web App Security - © 2012 SANS
  • 38. Counter Measures: Parameterized Query • sql = "SELECT field FROM table WHERE name = @userinput" • Then, define @userinput • Database and Platform has a chance to distinguish between user input and control structure Web App Security - © 2012 SANS
  • 39. Counter Measures: Password Storage • Iterative hash (hashing multiple times) • Salted hash Web App Security - © 2012 SANS
  • 40. Counter Measures: Privilege Account • Avoid using privileged account for day to day operations • Do CEO and COO generally need to be administrators or root? • Segregation of duties Web App Security - © 2012 SANS
  • 41. Questions & Answers Web App Security - © 2012 SANS

Editor's Notes

  1. This screenshot demonstrates the administrative interface login. The URL is http://admin.twitter.com/admin, and there is BASIC authentication scheme (over HTTPS).This screenshot was taken from http://www.nowhereelse.fr/admin-twitter-hacker-19410/
  2. This screenshot shows the menu of the twitter administrative interface. This screenshot was taken from http://www.nowhereelse.fr/admin-twitter-hacker-19410/