SlideShare una empresa de Scribd logo
1 de 41
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

Más contenido relacionado

La actualidad más candente

Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
Satish b
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From Windows
NetSPI
 

La actualidad más candente (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 a Defending Web Applications: first-principles- Jason Lam

Similar a 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
 

Más de 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
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

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

Notas del editor

  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/