secure by default web applications with apache sling ... · secure by default web applications with...

40
http://robert.muntea.nu @rombert Secure by Default Web Applications With Apache Sling Secure by Default Web Applications With Apache Sling Robert Munteanu, Adobe Systems ApacheCon Core 2016

Upload: trinhthien

Post on 13-May-2018

258 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Secure by Default Web Applications With Apache Sling

Secure by Default Web Applications With Apache Sling

Robert Munteanu, Adobe SystemsApacheCon Core 2016

Page 2: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Who I am

$DAYJOB Adobe Experience

Manager Apache Sling Apache Jackrabbit Apache Felix

Open Source Apache Sling MantisBT Mylyn Connector for

MantisBT Mylyn Connector for Review

Board

Page 3: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Purpose of the talk

Scope

Cost Schedule

Page 4: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Purpose of the talk

Scope

Cost Schedule

Page 5: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Purpose of the talk

Scope

Cost Schedule

Page 6: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Agenda

● Apache Sling● Demo application review● Threat model● Security with Apache Sling● Demo● Conclusion● Q&A

Page 7: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Brief History

2007Incubation

2009TLP

2015Version 8

200xPre-Apache

Page 8: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Code Statistics

Page 9: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Contributor activity

Page 10: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Value proposition

● Content-oriented ● RESTful● Lightweight● Integrated authentication and authorization● OSGi-powered● Scripting inside● Easily deployable

Page 11: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Content-Oriented

Blog posts

Images

Users and Groups

Page 12: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Content-Oriented

Server-side templates and scripts

Configurations

Page 13: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – RESTful

$ http localhost:8080/content/↵ blog/posts/hello_world.html

jsonxmltxtpdfphp3

Page 14: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – RESTful

Page 15: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Persistence via JCR

Page 16: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling – Topologies

Standalone High Availability

Page 17: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Agenda

● Apache Sling● Demo application review● Threat model● Security with Apache Sling● Demo● Conclusion● Q&A

Page 18: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Demo App – main page

Page 19: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Demo App – Article Page

Page 20: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Demo App – Submitting comments

Page 21: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Agenda

● Apache Sling● Demo application review● Threat model● Security with Apache Sling● Demo● Conclusion● Q&A

Page 22: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat modelling

“Threat modeling is an engineering technique you can use to help you identify threats, attacks, vulnerabilities, and countermeasures that could affect your application”

Threat Modeling Web Applications on MSDN

Page 23: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Assets

Page 24: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Assets

● Availability● Content● User Credentials● Ability to execute code on server● Ability to execute code in the browser context

Page 25: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Trust Levels

Page 26: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Trust Levels

1. Anonymous

2. Author

3. Administrator

Page 27: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Threats

OWASP

Page 28: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Threats

1. Denial of Service

2. Defacement / Deletion

3. Leaking credentials

4. SQL/Shell Injection

5. Stored/Reflected XSS

Page 29: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Threat Modelling - Mitigation

Page 30: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Agenda

● Apache Sling● Demo application review● Threat model● Security with Apache Sling● Demo● Conclusion● Q&A

Page 31: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling Security – Natural layering of ACEs

Page 32: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling Security – Security applied at the lowest level

$ http --auth bob:bob localhost:8080/content/blog/posts/new_blog_post 'jcr\:title=New post'

Page 33: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling Security – Context-aware templating language

<div class="comment clearfix"> <img class="avatar img-rounded pull-left" src="${resource.valueMap['authorAvatar']}"/> <h3>${resource.valueMap['jcr:title']}</h3> <p>${resource.valueMap['jcr:description']}</p></div>

Page 34: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling Security – Injection-safe APIs

Children of/content/blog/posts

Page 35: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Apache Sling Security – Injection-safe APIs

Children of/content/blog/comments/hello_world

Page 36: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Agenda

● Apache Sling● Demo application review● Threat model● Security with Apache Sling● Demo● Conclusion● Q&A

Page 37: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Demo Application – Actual demo!!!!1oneone

Page 38: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Conclusions – Security

● Aim to be “Secure by Default”● Build a threat model for your application● Look for components that eliminate problems altogether

Page 39: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Conclusions – Apache Sling

● Simple to be “Secure by Default”● Eventing, Thread Pooling, Job Management, Caching● Scripting: Groovy, Scala, JSP, Sightly, Java, Ruby, Thymeleaf● Flexible resource rendering with resource types● Very extensible due to being internally powered by OSGi – most extension points available to clients

Page 40: Secure by Default Web Applications With Apache Sling ... · Secure by Default Web Applications With Apache Sling Robert Munteanu, ... TLP 2015 Version 8 200x ... _Cheat_Sheet

http://robert.muntea.nu @rombert

Resources

● Apache Sling – https://sling.apache.org ● Apache Jackrabbit

● https://jackrabbit.apache.org● http://jackrabbit.apache.org/oak/

● OWASP - https://www.owasp.org ● https://www.owasp.org/index.php/OWASP_Top_Ten

_Cheat_Sheet● https://www.owasp.org/index.php/Application_Thre

at_Modeling