Slide 1

Slide 1 text

We Will Call Him aNgine or How and why we made one more access control framework Oleg Broslavsky, Denis Kolegov, Nikita Oleksov, Positive Technologies

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

OMG! WHY?

Slide 4

Slide 4 text

You need access control if your app has: • different users • different levels of access to resources or actions • …? M8, U Need It 3v3rywh3r3!

Slide 5

Slide 5 text

Nope! Why Your Own?

Slide 6

Slide 6 text

Environment-specific: • django-access-control / flask-ACL Oth3rs STUFF

Slide 7

Slide 7 text

Environment-specific: • django-access-control / flask-ACL • STAPL-DSL / FACPL (Java) Oth3rs STUFF

Slide 8

Slide 8 text

Environment-specific: • django-access-control / flask-ACL • STAPL-DSL / FACPL (Java) • Casbin (Golang) Oth3rs STUFF

Slide 9

Slide 9 text

Environment-specific: • django-access-control / flask-ACL • STAPL-DSL / FACPL (Java) • Casbin (Golang) + Lots of custom solutions for distinct applications Oth3rs STUFF

Slide 10

Slide 10 text

Environment-specific: • django-access-control / flask-ACL • STAPL-DSL / FACPL (Java) • Casbin (Golang) + Lots of custom solutions for distinct applications Oth3rs STUFF © Standards (xkcd #927)

Slide 11

Slide 11 text

So What Kind of Access Control?

Slide 12

Slide 12 text

Oth3rs STUFF

Slide 13

Slide 13 text

ABAC Attribute-based access control • policies can use any type of attributes • provides dynamic, context-aware and risk-intelligent access control • most strict and technically accurate description ABAC th3 b3st! Attractiveness: 10 Strength: 1 Intellect: >9000

Slide 14

Slide 14 text

We Already Have a Standard!

Slide 15

Slide 15 text

XACML – "eXtensible Access Control Markup Language“ Intended to be cross-platform standard XACML was not an 3scap3

Slide 16

Slide 16 text

XACML was not an 3scap3 Permit only if the physician treated the owner of the patient data. view patient-data physician Permit if the physician treated the owner of the patient data. Deny otherwise XACML – "eXtensible Access Control Markup Language“ Intended to be cross-platform standard

Slide 17

Slide 17 text

But architecture is gr3at!

Slide 18

Slide 18 text

So What?

Slide 19

Slide 19 text

We Want MOAR Languages!

Slide 20

Slide 20 text

W3 wanna dat tool! Generated automatically Selected from supported subset Described in developed languages Implemented once for the runtime, provided with framework

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

N33d more DSLs! ALFA IDL

Slide 23

Slide 23 text

interface Entity { abstract id: String; } interface UrlEntity <: Entity { path: String; } interface Subject <: Entity { name: String; role: String; abstract ip: String; } Show m3 th3m… • Described using universal Interface Definition Language • Very basic types of attributes • Attributes can be marked as “dynamic” • Interfaces can be inherited

Slide 24

Slide 24 text

interface Subject <:Entity { level: Number; `ldap:"(&(uid={ID})(objectClass=user))"` roles: [String]; tags: [String]; `json:"corporate_units"` } Looks lik3 Go? • PIP can be generated automatically • Uses previously defined interfaces and specified location of attributes • Struct tags could be used to specify attribute location

Slide 25

Slide 25 text

policy getMotd { target clause action == "GET" and entity.path == "/motd" apply denyUnlessPermit rule r1 { permit target clause subject.role in ["user", "admin"] } } Mor3 acronyms! ALFA, the Abbreviated Language For Authorization (actually an extension of the ALFA language named ALFAScript)

Slide 26

Slide 26 text

We hav3 a …. ALFA

Slide 27

Slide 27 text

We hav3 a …. ALFA IDL

Slide 28

Slide 28 text

We hav3 a …. ALFA IDL

Slide 29

Slide 29 text

We hav3 a …. s AN ALFA IDL

Slide 30

Slide 30 text

Boring sch3m3s tim3…

Slide 31

Slide 31 text

R3ally concr3t3 * CST contains all syntax-specific tokens and delimiters, e.g. parentheses and quotes {"type": "Program", "body": [{ "type": "VariableDeclaration", "kind": "var", "declarations": [{ "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "AST" }, "init": { "type": "Literal", "value": "is a tree" } }] ]} } var AST = “is a tree”; Keyword Identifier Equals String Literal Semicolon

Slide 32

Slide 32 text

Add som3 abstractn3ss * UST is an AST with even more generalized and unified information about representing structures Class Declaration Field Declaration Method Declaration Identifier Type Reference Identifier Block Modifiers … … Parents Fields Methods Name Type Type Name

Slide 33

Slide 33 text

Kinda w3b {%- macro gen_class(class_) -%} class {{ class_|name }}( {%- set comma = joiner(",") -%} {%- for cls in class_.parents -%} {{ comma() }}{{ cls|name }} {%- endfor -%} ): {% filter indent(4, True) -%} {{ gen_init(class_.constructor, class_) ~ '\n' }} {% for prop in class_.fields|select("abstract") -%} {{ gen_property(prop) ~ '\n'}} {% endfor %} {% for method in class_.methods -%} {{ gen_method(method) ~ '\n'}} {% endfor %} {% endfilter %} {%- endmacro -%}

Slide 34

Slide 34 text

Back to th3 structur3

Slide 35

Slide 35 text

3v3rybody lov3s LUA Policy in ALFA Script Lua as an inner language for policy rules Language-specific LuaJIT to run intermediate rules

Slide 36

Slide 36 text

Nobody s33s th3 cod3 local function getMotd(ctx, actions, handlers) -- target begin if not ctx.entity.path or not ctx.action then return actions.indeterminate end if not ( ctx.action == "GET" and ctx.entity.path == "/motd" ) then return actions.notapplicable end -- target end -- r1 rule begin local function r1(ctx, actions, handlers) if not ctx.subject.role then return actions.indeterminate end if ( __iselement({"user", "admin"}, ctx.subject.role) ) then return actions.permit end return actions.notapplicable end -- r1 rule end policy getMotd { target clause action == "GET" and entity.path == "/motd" apply denyUnlessPermit rule r1 { permit target clause subject.role in ["user", "admin"] } }

Slide 37

Slide 37 text

K3k, PEP • PEP translates the request from application logic to formal interface • Use ANTLR for parsing requests • Provided parsers for the most common request (SQL, HTML, files) Interface Request { subject: Subject; entity: [Entity]; action: Action; env: Environment; }

Slide 38

Slide 38 text

Thx God w3 hav3 w3b-frameworks # Check whether the request is allowed in the current # access policy. def is_allowed(self, request, username): # Build request context ctx = RequestCtx( subject=Subject(name=username, request=request), entities=[ UrlEntity(path=request.path) ], action=request.method.upper(), ) # Resolve static entities attributes to_eval = self.PIP.create_ctx(ctx) # Get the decision from PDP response = self.PDP.evaluate(to_eval) # Allow access only for decision permit return response == Decision.Permit ui_1 | 192.168.10.1 - - [22/Jun/2017:15:39:48 +0000] "GET /motd HTTP/1.1" 200 "http://zndemo:9090/motd" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" "-"

Slide 39

Slide 39 text

Final structur3 ALFA Write policy rules Adapt existing parsers Describe entities Provide dynamic attributes if necessary

Slide 40

Slide 40 text

• ALFA Script gives more convenient way to describe policy • Lua provides decent speed and portability • IDL-described interfaces allow to be translated to almost all languages due to its simplicity aNgine := ABAC + Engine s AN

Slide 41

Slide 41 text

3v3rybody lov3s opensourc3 https://github.com/PositiveTechnologies/angine https://github.com/PositiveTechnologies/aule DEMO: https://goo.gl/bdcbLM

Slide 42

Slide 42 text

Thank you! ptsecurity.com