16
OWASP Khartoum owasp.org/index.php/Khar Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. 7 TH Meeting University of Ba TOP 10#A4 Insecure Direct Object Reference Obay Osman OWASP Khartoum 15 Sept 2012

OWASP Khartoum Top 10 A4 - 7th meeting

Embed Size (px)

Citation preview

Page 1: OWASP Khartoum   Top 10 A4 - 7th meeting

OWASP Khartoumowasp.org/index.php/Khartoum

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

7TH Meeting Univers i ty o f Bahr i

TOP 10#A4Insecure Direct Object Reference

Obay OsmanOWASP Khartoum

15 Sept 2012

Page 2: OWASP Khartoum   Top 10 A4 - 7th meeting

2

Will talk about…• Definition.

• OWASP’s Rating.

• Scenarios.

• In the wiled.

• Demo time.

• Detection & Protection.

• Warp Up.

• Q & A.

Page 3: OWASP Khartoum   Top 10 A4 - 7th meeting

3

DefinitionA 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.

Page 5: OWASP Khartoum   Top 10 A4 - 7th meeting

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( );...}

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

Attacker:

Page 6: OWASP Khartoum   Top 10 A4 - 7th meeting

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");

../../../../etc/passwd%00

Attacker:

Page 7: OWASP Khartoum   Top 10 A4 - 7th meeting

7

In the wield..- Australian Taxation Office.(a company

tax id)

- 17,000 companies affected.

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

Page 8: OWASP Khartoum   Top 10 A4 - 7th meeting

It is Demo Time..

8

Let ‘s have some fun…

Page 9: OWASP Khartoum   Top 10 A4 - 7th meeting

9

DetectionVerify 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.

Page 10: OWASP Khartoum   Top 10 A4 - 7th meeting

10

DetectionCode 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.

Page 11: OWASP Khartoum   Top 10 A4 - 7th meeting

11

How to Protect YourselfProtect 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.

Page 12: OWASP Khartoum   Top 10 A4 - 7th meeting

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).

Page 13: OWASP Khartoum   Top 10 A4 - 7th meeting

Summary & Conclusion

Page 14: OWASP Khartoum   Top 10 A4 - 7th meeting

OWASP Khartoumowasp.org/index.php/Khartoum

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

A1 –InjectionA2 –Cross-Site Scripting (XSS)A3 –Broken Authentication and Session ManagementA4 –Insecure Direct Object ReferenceA5 –Cross Site Request Forgery (CSRF)A6 –Security Misconfiguration(NEW)A7 –Insecure Cryptographic StorageA8 –Failure to Restrict URL AccessA9 –Insufficient Transport Layer ProtectionA10 –Unvalidated Redirects and Forwards (NEW)

OWASP Top 10 2010:

Page 16: OWASP Khartoum   Top 10 A4 - 7th meeting

Q & A

16