Top Banner
detectify SECURITY FOR DEVELOPERS detectify
40

How to steal and modify data using Business Logic flaws - Insecure Direct Object References

Aug 20, 2015

Download

Software

fransrosen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectifySECURITY FOR DEVELOPERS

detectify

Page 2: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Remember the AT&T Hack? #freeweev

Page 3: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

…or how about the Apple Developer site!incident? #down4maint

Page 4: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

What do they have in common?

Page 5: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

What do they have in common?IDOR #wth?

Page 6: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Frans Rosén!@fransrosen!

#hacktheplanet

Page 7: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Co-founder #daytime

Page 8: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Hacked a few #nightime

0x09 in Google Hall of Fame!www.google.com/about/appsecurity/hall-of-fame/

Page 9: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

…a few more #uhere?

Page 10: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

aaand a few more #sorry

Page 11: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

What does it mean? #owasp4“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.”

Page 12: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

I! Insecure D! DirectO! Object R! Reference

Without proper access control exposing unauthorized data, such as a file, directory, or database key.

Page 13: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Eye-ball the URL #waitisover

Page 14: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Eye-ball the URL #waitisover

Ouch.

Page 15: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Update a user #totallylegit

Page 16: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Update a user #totallylegit

Ouch.

Page 17: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Business Impact #obvious

• Keys, Passwords!• Credit Card Data!• User Information / Email!• Invoices / Billing Data!

Page 18: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Business Impact #notsoobviousNumeric IDs for Order Receipts!!“Not found” vs “No access”!!Poll every day, you get analytics!!$$$!

Page 19: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Business Impact #notsoobviousNumeric IDs for email invites = spam.!!!

Found  by  d4d1a179c0f3  https://hackerone.com/reports/1533

Page 20: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Business Impact #evenworse

Change Delivery Address of an order.!!Deleting another user’s information.!!Reclaiming other user’s data. Gift Certificates anyone?

Page 21: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Are you fully protected?

Page 22: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Why so few? #ohnoez1. No secure access model.!!“User X should only have access to A”

“User X that has access to A should only have access to B”!!and so on…

Page 23: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Why so few? #ohnoez2. Numeric IDs.!!Enumerable/Sequential. Decrease value with 1 and try. !!Easy to test. Easy to attack.

Page 24: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Why so few? #ohnoez3. Error messages show and tell.!!“User X cannot view object owned by User Y”!!“No access to this object” !!“Object does not exist”

Page 25: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Why so few? #ohnoez4. Inconsequent ID sources.!!/receipt/view/434!!/receipt/?view=434!!POST /receipt/view/ HTTP/1.1!receipt=434

Page 26: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Why so few? #ohnoez5. Lack of proper code review.!!How to automate this?

Page 27: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Examples! #bringpopcorn

Page 28: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Example – Twitter

Found  by  secgeek  (Ahmed  Aboul-­‐Ela)  https://hackerone.com/reports/27404

Credit Card deletion from other users.!!Sequential IDs when deleting cards.!!Bounty $2,800

Page 29: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Example – OculusRCE through IDOR!!Sequential IDs when updating users.!!Bounty in total $25,000

Found  by  Bitquark  (Jon)  https://bitquark.co.uk/blog/2014/08/31/popping_a_shell_on_the_oculus_developer_portal

Page 30: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Example – SquareUpdate other users / Get user info!!ID as hashes, but visible using Google.!!No check if user was in another company.!!Bounty $3,000

!https://hackerone.com/reports/23126

Page 31: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Example – ZapierGet log-history from other user’s Zaps.!!Contained sensitive information such as OAuth tokens / Credentials,!!No access control for log entries.!!Bounty $3,000

!https://zapier.com/engineering/bug-­‐bounty-­‐program/

Page 32: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Example – getClouderRemove Cloud Scaling for other users.!!No check if user owned the Cloud Scaling setting.!!Bounty $200

Page 33: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Example – WordPressGet all users on a WordPress site.!!.com/?author=1!!WONTFIX by Wordpress

!http://hackertarget.com/wordpress-­‐user-­‐enumeration/

Page 34: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Doing it right. #anyoneoutthere?

Page 35: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Doing it right. #hellyeh1. User ID in Session or Token!!/user/view/me!/user/transactions

Page 36: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Doing it right. #hellyeh2. Make generic access model and stick to it.!!function get($type, $id) { //check access for all objects }!!$user->get(‘transaction’, $id);! // if not owned by user!! ! ! ! ! ! ! ! // then error!!

Page 37: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Doing it right. #hellyeh3. Access model in routes or controllers.!!Stick to it! Easy to miss.!!

Page 38: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Doing it right. #hellyeh4. Code review. Don’t miss this.!!

Page 39: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

Quick repetition #eatsleepraverepeat1. IDORs are bad. Easy to exploit. East to find.!!2. Being actively exploited as we speak. Worth €€€!!3. Generic access model.!!4. Numeric IDs vs Hashes!!5. Review your code.

Page 40: How to steal and modify data using Business Logic flaws - Insecure Direct Object References

detectify

THAT’S ALL FOLKS!!Questions?!

!by Frans Rosén (@fransrosen)

www.detectify.com