SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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 2015Ajin 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 MechanismsSam Bowne
 
Reality Check: Security in the Cloud
Reality Check: Security in the CloudReality Check: Security in the Cloud
Reality Check: Security in the CloudAlert Logic
 
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 TenSecurity Innovation
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applicationsSatish 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 MetulaAlphageeks
 
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 ADBlueHat 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 applicationsKaran 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" researchAsaf 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 CloudAlert Logic
 
Android Security
Android SecurityAndroid Security
Android SecurityArqum Ahmad
 
Extracting Credentials From Windows
Extracting Credentials From WindowsExtracting Credentials From Windows
Extracting Credentials From WindowsNetSPI
 
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, AppSecDroidConTLV
 
Thick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseThick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseScott Sutherland
 

Tendances (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
 

Similaire à Defending Web Apps with First Principles

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 2012fxKinAnx
 
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 SafeThuan Ng
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 sebaSebastien 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 DataPrecisely
 
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 DataPrecisely
 
00. introduction to app sec v3
00. introduction to app sec v300. introduction to app sec v3
00. introduction to app sec v3Eoin Keary
 
IBM Security Identity & Access Manager
IBM Security Identity & Access ManagerIBM Security Identity & Access Manager
IBM Security Identity & Access ManagerIBM Sverige
 
Advanced Threats In The Enterprise
Advanced Threats In The EnterpriseAdvanced Threats In The Enterprise
Advanced Threats In The EnterprisePriyanka 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 worldMadhu 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 ApplicationsAlert 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 RisksSantosh Satam
 
Developing Secure Web Apps
Developing Secure Web AppsDeveloping Secure Web Apps
Developing Secure Web AppsMark Garratt
 
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 ApplicationsDenim 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-2017TriNimbus
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applicationsNiyas 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 AttacksZoho 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 PracticesMariaDB plc
 

Similaire à Defending Web Apps with First Principles (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
 

Plus de 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-abdullaOWASP-Qatar Chapter
 
Securing the channel - Tarkay Jamaan
Securing the channel - Tarkay JamaanSecuring the channel - Tarkay Jamaan
Securing the channel - Tarkay JamaanOWASP-Qatar Chapter
 
Secure management of credentials - Zouheir Abdulla
Secure  management of credentials -   Zouheir AbdullaSecure  management of credentials -   Zouheir Abdulla
Secure management of credentials - Zouheir AbdullaOWASP-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 GuptaOWASP-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
 
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 UmmerOWASP-Qatar Chapter
 

Plus 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
 

Dernier

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Dernier (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Defending Web Apps with First Principles

  • 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

Notes de l'éditeur

  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/