SlideShare uma empresa Scribd logo
1 de 16
Insecure Direct Object Reference


                                Obay Osman
                                 OWASP Khartoum
                                  15 Sept 2012




                                      Copyright © The OWASP Foundation
Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.
Will talk about…
• Definition.
• OWASP’s Rating.
• Scenarios.
• In the wiled.
• Demo time.
• Detection & Protection.
• Warp Up.
• Q & A.
                            2
Definition
A direct object reference occurs when a
  developer exposes a reference to an
  internal implementation object, such as
  a file, directory, or database key.
  Without an access control check or
  other protection.
Attackers can manipulate these references
  to access unauthorized data.


                                            3
OWASP Risk Rating #




                      4
Simple Attack Scenario
//BAD - DON'T USE --- Reference to DB key
public void displayInfo(){
 String query = "SELECT * FROM accts WHERE account = ?";
PreparedStatementpstmt=connection.prepareStatement(query , …
    );
pstmt.setString( 1, request.getParameter("acct"));
ResultSetresults = pstmt.executeQuery( );
...
}




Attacker:
http://example.com/app/accountInfo?acct=notmyacct

                                                               5
Simple Attack Scenario
//BAD - DON'T USE --- Reference to file
<select name="language">
<option value="fr">Français</option>
…..
</select>

 … require_once ($_REQUEST['language’]."lang.php");




Attacker:
../../../../etc/passwd%00

                                                      6
In the wield..
- Australian Taxation Office.(a company tax id)
  - 17,000 companies affected.

Methodologies: Parameter Tampering,
  Path Traversal, Null Byte Injection…




                                                  7
Let ‘s have some fun…




                        8
Detection
Verify that all object references have
  appropriate defenses:
1.Direct references:
verify the user is authorized to access the
  exact resource they have requested.
2.Indirect references:
the mapping to the direct reference must
  be limited to values authorized for the
  current user.
                                              9
Detection
Code review of the application can quickly
  verify whether either approach is
  implemented safely.
Testing is also effective for identifying
 direct object references and whether
 they are safe.
Automated tools typically do not look for
 such flaws because they cannot
 recognize what requires protection or
 what is safe or unsafe.
                                             10
How to Protect Yourself
Protect each user accessible object (e.g.,
  object number, filename):
1.Use per user or session indirect object
  references.
2.Check access of direct object reference
  from an untrusted source, to ensure the
  user is authorized for the requested
  object.

                                             11
OWASP’s Recommendation
OWASP’s ESAPI includes both sequential
 and random access reference maps that
 developers can use to eliminate direct
 object references.
OWASP’s ESAPI Access Control API.
Meet all requirements defined in OWASP’s
  ASVS areas V4 (Access Control).


                                           12
OWASP Top 10 2010:
A1 –Injection
A2 –Cross-Site Scripting (XSS)
A3 –Broken Authentication and Session Management
A4 –Insecure Direct Object Reference
A5 –Cross Site Request Forgery (CSRF)
A6 –Security Misconfiguration(NEW)
A7 –Insecure Cryptographic Storage
A8 –Failure to Restrict URL Access
A9 –Insufficient Transport Layer Protection
A10 –Unvalidated Redirects and Forwards (NEW)
                                                 Copyright © The OWASP Foundation
           Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.
Ref.
• OWASP Top 10-2007 on Insecure Dir Object
  References
• ASVS requirements areas for Access control (V4)
• OWASP Authentication Cheat Sheet
• ESAPI Access Control API
• ESAPI Access Reference Raps
• OWASP Development Guide: Chapter on
  authentication
• OWASP Testing Guide: Chapter on Authentication
16

Mais conteúdo relacionado

Mais procurados

Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101Jannis Kirschner
 
security misconfigurations
security misconfigurationssecurity misconfigurations
security misconfigurationsMegha Sahu
 
The Complete Web Application Security Testing Checklist
The Complete Web Application Security Testing ChecklistThe Complete Web Application Security Testing Checklist
The Complete Web Application Security Testing ChecklistCigital
 
Security misconfiguration
Security misconfigurationSecurity misconfiguration
Security misconfigurationMicho Hayek
 
Introduction to Security Testing
Introduction to Security TestingIntroduction to Security Testing
Introduction to Security TestingvodQA
 
Security workshop - Lets get our hands dirty!!
Security workshop - Lets get our hands dirty!!Security workshop - Lets get our hands dirty!!
Security workshop - Lets get our hands dirty!!Manjyot Singh
 
OWASP Khartoum - Top 10 A6 - 8th meeting - Security Misconfiguration
OWASP Khartoum - Top 10 A6 - 8th meeting - Security MisconfigurationOWASP Khartoum - Top 10 A6 - 8th meeting - Security Misconfiguration
OWASP Khartoum - Top 10 A6 - 8th meeting - Security MisconfigurationOWASP Khartoum
 
Web application security: Threats & Countermeasures
Web application security: Threats & CountermeasuresWeb application security: Threats & Countermeasures
Web application security: Threats & CountermeasuresAung Thu Rha Hein
 
OWASP Serbia - A6 security misconfiguration
OWASP Serbia - A6 security misconfigurationOWASP Serbia - A6 security misconfiguration
OWASP Serbia - A6 security misconfigurationNikola Milosevic
 
3. backup file artifacts - mazin ahmed
3. backup file artifacts - mazin ahmed3. backup file artifacts - mazin ahmed
3. backup file artifacts - mazin ahmedRashid Khatmey
 
Web application security
Web application securityWeb application security
Web application securityKapil Sharma
 
Security hole #5 application security science or quality assurance
Security hole #5 application security   science or quality assuranceSecurity hole #5 application security   science or quality assurance
Security hole #5 application security science or quality assuranceTjylen Veselyj
 

Mais procurados (20)

Owasp Top 10-2013
Owasp Top 10-2013Owasp Top 10-2013
Owasp Top 10-2013
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
 
Step by step guide for web application security testing
Step by step guide for web application security testingStep by step guide for web application security testing
Step by step guide for web application security testing
 
security misconfigurations
security misconfigurationssecurity misconfigurations
security misconfigurations
 
Security testing
Security testingSecurity testing
Security testing
 
The Complete Web Application Security Testing Checklist
The Complete Web Application Security Testing ChecklistThe Complete Web Application Security Testing Checklist
The Complete Web Application Security Testing Checklist
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
 
Security misconfiguration
Security misconfigurationSecurity misconfiguration
Security misconfiguration
 
Introduction to Security Testing
Introduction to Security TestingIntroduction to Security Testing
Introduction to Security Testing
 
Security workshop - Lets get our hands dirty!!
Security workshop - Lets get our hands dirty!!Security workshop - Lets get our hands dirty!!
Security workshop - Lets get our hands dirty!!
 
OWASP Khartoum - Top 10 A6 - 8th meeting - Security Misconfiguration
OWASP Khartoum - Top 10 A6 - 8th meeting - Security MisconfigurationOWASP Khartoum - Top 10 A6 - 8th meeting - Security Misconfiguration
OWASP Khartoum - Top 10 A6 - 8th meeting - Security Misconfiguration
 
Web application security: Threats & Countermeasures
Web application security: Threats & CountermeasuresWeb application security: Threats & Countermeasures
Web application security: Threats & Countermeasures
 
Introduction to security testing raj
Introduction to security testing rajIntroduction to security testing raj
Introduction to security testing raj
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
2 . web app s canners
2 . web app s canners2 . web app s canners
2 . web app s canners
 
Owasp first5 presentation
Owasp first5 presentationOwasp first5 presentation
Owasp first5 presentation
 
OWASP Serbia - A6 security misconfiguration
OWASP Serbia - A6 security misconfigurationOWASP Serbia - A6 security misconfiguration
OWASP Serbia - A6 security misconfiguration
 
3. backup file artifacts - mazin ahmed
3. backup file artifacts - mazin ahmed3. backup file artifacts - mazin ahmed
3. backup file artifacts - mazin ahmed
 
Web application security
Web application securityWeb application security
Web application security
 
Security hole #5 application security science or quality assurance
Security hole #5 application security   science or quality assuranceSecurity hole #5 application security   science or quality assurance
Security hole #5 application security science or quality assurance
 

Semelhante a Insecure Direct Object Reference Detection and Protection

Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Braindev Kyiv
 
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request ForgeryOWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request ForgeryOWASP Khartoum
 
OWASP Khartoum Top 10 A3 - 6th meeting
OWASP Khartoum   Top 10 A3 - 6th meetingOWASP Khartoum   Top 10 A3 - 6th meeting
OWASP Khartoum Top 10 A3 - 6th meetingOWASP Khartoum
 
OWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.pptOWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.pptjangomanso
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Application Security Vulnerabilities: OWASP Top 10  -2007Application Security Vulnerabilities: OWASP Top 10  -2007
Application Security Vulnerabilities: OWASP Top 10 -2007Vaibhav Gupta
 
OWASP App Sec US - 2010
OWASP App Sec US - 2010OWASP App Sec US - 2010
OWASP App Sec US - 2010Aditya K Sood
 
Security Testing - Zap It
Security Testing - Zap ItSecurity Testing - Zap It
Security Testing - Zap ItManjyot Singh
 
Security testing zap it
Security testing   zap itSecurity testing   zap it
Security testing zap itvodqancr
 
OWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web MalwareOWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web MalwareAditya K Sood
 
WIA - Introduction to web application penetration testing
WIA - Introduction to web application penetration testingWIA - Introduction to web application penetration testing
WIA - Introduction to web application penetration testingKatherine Cancelado
 
OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017
OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017
OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017Philippe Gamache
 
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017 OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017 Philippe Gamache
 
Top web apps security vulnerabilities
Top web apps security vulnerabilitiesTop web apps security vulnerabilities
Top web apps security vulnerabilitiesAleksandar Bozinovski
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxjohnpragasam1
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxazida3
 

Semelhante a Insecure Direct Object Reference Detection and Protection (20)

Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
 
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request ForgeryOWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
 
OWASP Khartoum Top 10 A3 - 6th meeting
OWASP Khartoum   Top 10 A3 - 6th meetingOWASP Khartoum   Top 10 A3 - 6th meeting
OWASP Khartoum Top 10 A3 - 6th meeting
 
OWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.pptOWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.ppt
 
OWASP Top10 2010
OWASP Top10 2010OWASP Top10 2010
OWASP Top10 2010
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Application Security Vulnerabilities: OWASP Top 10  -2007Application Security Vulnerabilities: OWASP Top 10  -2007
Application Security Vulnerabilities: OWASP Top 10 -2007
 
Owasp top 10
Owasp top 10Owasp top 10
Owasp top 10
 
OWASP App Sec US - 2010
OWASP App Sec US - 2010OWASP App Sec US - 2010
OWASP App Sec US - 2010
 
OWASP -Top 5 Jagjit
OWASP -Top 5 JagjitOWASP -Top 5 Jagjit
OWASP -Top 5 Jagjit
 
Security Testing - Zap It
Security Testing - Zap ItSecurity Testing - Zap It
Security Testing - Zap It
 
Security testing zap it
Security testing   zap itSecurity testing   zap it
Security testing zap it
 
OWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web MalwareOWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web Malware
 
WIA - Introduction to web application penetration testing
WIA - Introduction to web application penetration testingWIA - Introduction to web application penetration testing
WIA - Introduction to web application penetration testing
 
OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017
OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017
OWASP Top 10 Proactive Controls 2016 - PHP Québec August 2017
 
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017 OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
OWASP Top 10 Proactive Controls 2016 - NorthEast PHP 2017
 
Owasp top 10_-_2010 presentation
Owasp top 10_-_2010 presentationOwasp top 10_-_2010 presentation
Owasp top 10_-_2010 presentation
 
OWASP Top Ten in Practice
OWASP Top Ten in PracticeOWASP Top Ten in Practice
OWASP Top Ten in Practice
 
Top web apps security vulnerabilities
Top web apps security vulnerabilitiesTop web apps security vulnerabilities
Top web apps security vulnerabilities
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 

Mais de OWASP Khartoum

Cryptocurrency, a deep dive
Cryptocurrency, a deep diveCryptocurrency, a deep dive
Cryptocurrency, a deep diveOWASP Khartoum
 
Usable Security: Tips for Daily Life
Usable Security: Tips for Daily LifeUsable Security: Tips for Daily Life
Usable Security: Tips for Daily LifeOWASP Khartoum
 
SSH - From Zero to Hero
SSH - From Zero to HeroSSH - From Zero to Hero
SSH - From Zero to HeroOWASP Khartoum
 
OWASP Khartoum Cyber Security Session
OWASP Khartoum Cyber Security SessionOWASP Khartoum Cyber Security Session
OWASP Khartoum Cyber Security SessionOWASP Khartoum
 
Computer forensic 101 - OWASP Khartoum
Computer forensic 101 - OWASP KhartoumComputer forensic 101 - OWASP Khartoum
Computer forensic 101 - OWASP KhartoumOWASP Khartoum
 
Welcome to OWASP World
Welcome to OWASP WorldWelcome to OWASP World
Welcome to OWASP WorldOWASP Khartoum
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)OWASP Khartoum
 

Mais de OWASP Khartoum (8)

Cryptocurrency, a deep dive
Cryptocurrency, a deep diveCryptocurrency, a deep dive
Cryptocurrency, a deep dive
 
Usable Security: Tips for Daily Life
Usable Security: Tips for Daily LifeUsable Security: Tips for Daily Life
Usable Security: Tips for Daily Life
 
API IN(SECURITY)
API IN(SECURITY)API IN(SECURITY)
API IN(SECURITY)
 
SSH - From Zero to Hero
SSH - From Zero to HeroSSH - From Zero to Hero
SSH - From Zero to Hero
 
OWASP Khartoum Cyber Security Session
OWASP Khartoum Cyber Security SessionOWASP Khartoum Cyber Security Session
OWASP Khartoum Cyber Security Session
 
Computer forensic 101 - OWASP Khartoum
Computer forensic 101 - OWASP KhartoumComputer forensic 101 - OWASP Khartoum
Computer forensic 101 - OWASP Khartoum
 
Welcome to OWASP World
Welcome to OWASP WorldWelcome to OWASP World
Welcome to OWASP World
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 

Insecure Direct Object Reference Detection and Protection

  • 1. Insecure Direct Object Reference Obay Osman OWASP Khartoum 15 Sept 2012 Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.
  • 2. Will talk about… • Definition. • OWASP’s Rating. • Scenarios. • In the wiled. • Demo time. • Detection & Protection. • Warp Up. • Q & A. 2
  • 3. Definition A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, or database key. Without an access control check or other protection. Attackers can manipulate these references to access unauthorized data. 3
  • 5. Simple Attack Scenario //BAD - DON'T USE --- Reference to DB key public void displayInfo(){ String query = "SELECT * FROM accts WHERE account = ?"; PreparedStatementpstmt=connection.prepareStatement(query , … ); pstmt.setString( 1, request.getParameter("acct")); ResultSetresults = pstmt.executeQuery( ); ... } Attacker: http://example.com/app/accountInfo?acct=notmyacct 5
  • 6. Simple Attack Scenario //BAD - DON'T USE --- Reference to file <select name="language"> <option value="fr">Français</option> ….. </select> … require_once ($_REQUEST['language’]."lang.php"); Attacker: ../../../../etc/passwd%00 6
  • 7. In the wield.. - Australian Taxation Office.(a company tax id) - 17,000 companies affected. Methodologies: Parameter Tampering, Path Traversal, Null Byte Injection… 7
  • 8. Let ‘s have some fun… 8
  • 9. Detection Verify that all object references have appropriate defenses: 1.Direct references: verify the user is authorized to access the exact resource they have requested. 2.Indirect references: the mapping to the direct reference must be limited to values authorized for the current user. 9
  • 10. Detection Code review of the application can quickly verify whether either approach is implemented safely. Testing is also effective for identifying direct object references and whether they are safe. Automated tools typically do not look for such flaws because they cannot recognize what requires protection or what is safe or unsafe. 10
  • 11. How to Protect Yourself Protect each user accessible object (e.g., object number, filename): 1.Use per user or session indirect object references. 2.Check access of direct object reference from an untrusted source, to ensure the user is authorized for the requested object. 11
  • 12. OWASP’s Recommendation OWASP’s ESAPI includes both sequential and random access reference maps that developers can use to eliminate direct object references. OWASP’s ESAPI Access Control API. Meet all requirements defined in OWASP’s ASVS areas V4 (Access Control). 12
  • 13.
  • 14. OWASP Top 10 2010: A1 –Injection A2 –Cross-Site Scripting (XSS) A3 –Broken Authentication and Session Management A4 –Insecure Direct Object Reference A5 –Cross Site Request Forgery (CSRF) A6 –Security Misconfiguration(NEW) A7 –Insecure Cryptographic Storage A8 –Failure to Restrict URL Access A9 –Insufficient Transport Layer Protection A10 –Unvalidated Redirects and Forwards (NEW) Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.
  • 15. Ref. • OWASP Top 10-2007 on Insecure Dir Object References • ASVS requirements areas for Access control (V4) • OWASP Authentication Cheat Sheet • ESAPI Access Control API • ESAPI Access Reference Raps • OWASP Development Guide: Chapter on authentication • OWASP Testing Guide: Chapter on Authentication
  • 16. 16

Notas do Editor

  1. Access Control Attacks
  2. A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, or database key. Without an access control check or other protection, attackers can manipulate these references to access unauthorized data.
  3. The application uses unverified data in a SQL call that is accessing account information
  4. Such code can be attacked using a string like &quot;../../../../etc/passwd%00&quot; using null byte injection
  5. Australian Taxation Office’s GST Start Up Assistance site in 2000, where a legitimate but hostile user simply changed the ABN (a company tax id) present in the URL. The user farmed around 17,000 company details from the system, and then e-mailed each system. This was a major embarrassment to the Government of the 17,000 companies with details of his attack.
  6. The best way to find out if an application is vulnerable to insecure direct object references is to verify that allobject references have appropriate defenses. To achieve this, consider:1.For direct references to restricted resources, the application needs to verify the user is authorized to access the exact resource they have requested.2.If the reference is an indirect reference, the mapping to the direct reference must be limited to values authorized for the current user.Code review of the application can quickly verify whether either approach is implemented safely. Testing is also effective for identifying direct object references and whether they are safe. Automated tools typically do not look for such flaws because they cannot recognize what requires protection or what is safe or unsafe.
  7. Preventing insecure direct object references requires selecting an approach for protecting each user accessible object (e.g., object number, filename):1.Use per user or session indirect object references. This prevents attackers from directly targeting unauthorized resources. For example, instead of using the resource’s database key, a drop down list of six resources authorized for the current user could use the numbers 1 to 6 to indicate which value the user selected. The application has to map the per-user indirect reference back to the actual database key on the server. OWASP’s ESAPIincludes both sequential and random access reference maps that developers can use to eliminate direct object references. 2.Check access. Each use of a direct object reference from an untrustedsource must include an access control check to ensure the user is authorized for the requested object.