MULTI-REPRESENTATIONAL
SECURITY ANALYSIS
Eunsuk Kang MIT CSAIL ExCAPE Webinar April 30, 2015Third-Party Authentication
OAuth protocol
Widely adapted, support from major vendors Analyzed formally using verification tools
Empirical study of OAuth providers [Sun & Beznosov, CCS12] Majority of them vulnerable (Google, Facebook,...)
Provably Secure, Practically Vulnerable?
RFC OAuth 2.0, Internet Engineering Task Force
Protocol analysis at the abstract level
Provably Secure, Practically Vulnerable?
Protocol analysis at the abstract levelAgents, messages, and rules at each protocol step
Blame protocol designers?
Can’t predict all manners in which protocol will be used!
Attacks exploiting details absent from model
Unanticipated behavior from browser features e.g. HTTP redirects, hidden forms
Abstractions in System Design
Customer authentication Payment workflow Shopping cart interaction Mobile app API Deployment on HTTP Delivery processingMost systems too complex
Customer authentication Payment workflow Shopping cart interaction Mobile app API Deployment on HTTP Delivery processing
Abstraction vs Security
System designerOne system view/abstraction at a time Exclude details in other views
Customer authentication Payment workflow Shopping cart interaction Mobile app API Deployment on HTTP Delivery processing
Abstraction vs Security
System designerOne system view/abstraction at a time Exclude details in other views
Customer authentication Payment workflow Shopping cart interaction Mobile app API Deployment on HTTP Delivery processing
Abstraction vs Security
AttackerJump between abstractions & combine details
Poirot
A framework for incremental
reasoning of security properties across
multiple abstraction boundaries
MS P MS ⊨ P? Property Verification Engine Analysis Result System Model
Our Framework: Poirot
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultOur Framework: Poirot
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultStart with & analyze an initial model MS
MS P
Our Framework
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultGeneric, reusable models e.g., browser, protocols
Our Framework
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis Result Elaboration of MS with knowledge in MD MD M' = Compose(MS,MD,K) MS M' KProperty Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis Result
Our Framework
M' ⊨ P? M'Re-analyze P & repeat
Key Features
Increment, iterative analysis
Start with an initial model, elaborate, analyze & repeat Find & fix simple attacks first, complex ones later
Explore impact of design alternatives
Reusing domain knowledge
Encoded by domain experts
Reusable across multiple systems Details hidden from user
System Model
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultModeling Approach
Behavior
Trace-based semantics (event traces)
Declarative constraints for specifying behavior
Structure
Components with input/output channels End-to-end dataflow through channels
Inspirations
Architectural description languages Process algebras (CSP)
Structure
Model
Components (C), operations (O), datatypes (D)
D = {CustomerID, ItemID, Cart, Credential, Order}
Customer MyStore
AddItem
Structure
Component
Input & output channels
Each channel typed to an operation
Connection between channels with the same type
Customer MyStore AddItem ShowCart X1 X2 Y1 Y2
Structure
Component states
Encoded as relations Updated by operations
creds ⊆ CustomerID x Credential
cart ⊆ CustomerID x ItemID
orders ⊆ CustomerID x Order
MyStore AddItem
Behavior
Behavior as traces
A stream of events generated through each channel
Behavior of a component ≡ set of all possible traces
beh: C → ℙ(T) MyStore AddItem ShowCart Y1 Y2
Behavior
Interaction
Parallel composition, synchronized on shared operation
⟨addItem1, addItem2, showCart1⟩ ∈ beh(Customer || MyStore)
Customer MyStore AddItem ShowCart X1 X2 Y1 Y2
Behavior
Restricting behavior
Each channel associated with a guard condition Specified as a declarative constraint
Guard on Y1:
∀e ∈ E | (e.cust, e.cred) ∈ p.creds
creds ⊆ CustomerID x Credential
Customer MyStore ShowCart X1 X2 Y1 Y2
AddItem(cust: CustomerID, item: ItemID, cred: Credential)
Dataflow Model
Inter-component data flow
Transmitted as arguments of an operation
v ∈ hasAccess(c, t) if c has access to value v after trace t
Assumptions
c has access to value v if (1) it initially knows v or
(2) it has received an event with v as argument
Can send an event only if it has access to all arguments
Verification
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultAnalysis
Encoding in Alloy
Modeling language based on first-order relational logic
Translation to a SAT formula; solve(M ⋀ ¬P)
Bounded verification (trace length, data values)
Properties
Confidentiality & integrity
More broadly, safety properties
∀ t ∈ T, o: Order, s: MyStore, c: Customer |
o ∈ hasAccess(c, t) (c.id, o) ∈ s.orders(t)
Domain Model Library
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultDomain Model Library
Benefits
Amortized cost; built once, reused multiple times Expertise not required of user
Web-related domain models
Category Models
Component Browser, HTTP server, network endpoint
Feature Encryption, scripting, same-origin policy, cross-site origin requests (CORS), PostMessage Protocol SSL, OAuth, OpenID
Composition Operator
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis ResultComposing Models
Problem
Two partial models, describing different viewpoints With distinct vocabularies
But potentially overlapping in reality
Store model HTTP model Relate? Browser Server HttpReq Customer MyStore AddItem ShowCart M1: M2:
Representations
Formally, every instance of S1 is also an instance of S2
Representation relation (R)
Informally, “represented as” ≅ “deployed as”,
“implemented as”, “encoded as”
(S1, S2) ∈ R
S2 S1
Introduced between a pair of components, operations, datatypes i.e., R = (RC, RO, RD)
Relating Elements
AddItem HttpReq
(AddItem′, HttpReq) ∈ R
=
Representation as a way of describing overlaps
i.e. “AddItem is implemented as a kind of HTTP requests”
HttpReq AddItem'
M1 M2
Mapping Elements
=
Describe how members of the two sets are mapped
AddItem HttpReq
Mapping as a concretization relation
Corresponds to design decisions!
HttpReq(method: Method, url: URL, headers: set Header)
AddItem(customer: CustomerID,
item: ItemID, cred: Credential) HttpReq
Complex Mapping
MyStore OAuth Client
=
i.e. “MyStore is deployed as HTTP server and also participates in OAuth protocol”
Server MyStore'
Server OAuthClient
Behavior Expansion
Types of expansion Channel Addition Dataflow Expansion Alphabet Expansion Effects of compositionPossible introduction of behavior into the system Previously verified properties may no longer hold!
Browser Server HttpReq
Customer MyStore
AddItem
Channel Addition
Customer MyStore AddItem Server Customer [Browser] MyStore AddItem HttpReqComponent obtains channels & generates new events
Customer interacts with other HTTP servers
Allows attacks where attacker sets up malicious pages
Dataflow Expansion
Customer MyStore AddItem
Server HttpReq(Method,
URL, set Header) Customer
[Browser]
MyStore AddItem(CustomerID,
ItemID, Cred)
New types of data flow into component
Server may now receive credentials as headers
Customer → Browser Cred → Header
Alphabet Expansion
Customer MyStore AddItem MyStore [Server] AddItem [HttpReq] Customer BrowserComponent generates new event types
Any HTTP client can invoke AddItem operation Can’t assume how AddItem will be invoked
Common mistake among web developers!
MyStore → Server AddItem → HttpReq
Composition Operator
M′ = compose(M1, M2, K)
with mappings K = (KC, KO, KD)
Two-step procedure
For each pair (S1, S2) appearing in K:
1. Merge Introduce representation relation between S1 & S2
2. Refine Constrain members of S1 & S2 according to K
Merge
1. Introduce representation relation between S1 & S2
Construct S1′ that obtains characteristics (channels,
arguments, fields) of S1 & S2
MyStore → Server Customer → Browser AddItem → HttpReq Customer MyStore AddItem In resulting model M′: (MyStore′, Server) ∈ RC (Customer′, Browser) ∈ RC (AddItem′, HttpReq) ∈ RO Server Customer [Browser] HttpReq MyStore [Server] Browser AddItem [HttpReq]
Refine
2. Constrain members of S1 & S2 according to K
Specified as a declarative constraint
{a: AddItem, c: HttpReq | c.method = “POST” ∧
a.customer ∈ c.url.query ∧ a.item ∈ c.url.query ∧
a.cred ∈ c.headers } ⊆ KO
AddItem
HttpReq
HttpReq(method: Method, url: URL, headers: set Header)
AddItem(customer: CustomerID,
Partial Mappings
Mapping can be partially specified
{a: AddItem, c: HttpReq |
c.method = “POST”} ⊆ KO
AddItem
HttpReq
Analyzer generates mapping that leads to attack! User can leave some design decisions unknown & interactively explore alternative mappings
Case Studies
Two publicly deployed sites
IFTTT End-user service composition
Case Studies
Methodology
Start with an abstract workflow model
Elaborate with domain models & re-analyze Replay attacks on the concrete system
Two publicly deployed sites
IFTTT & HandMe.In
Results
Previously unknown attacks on both sites Confirmed with the developers
Analysis times < 15 seconds Modeling effort: 1~2 weeks
Attack on IFTTT
Authentication on IFTTT
User creates a recipe with trigger & action
Attack on IFTTT
Confidentiality Property
Attack on IFTTT
Login CSRF
Attacker tricks user into signing in under its credentials Relatively minor; may see history of user’s actions
But in combination with IFTTT
Security consequences far greater!
Can leak private data through IFTTT channels
Complex interaction
Attack on IFTTT
User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Blogger [Server] CreateBlog Login Authorize Server (Evil)Attack on IFTTT
1. User visits a page hosted by evil server
User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Server (Evil) Req Google [Server] CreateBlog Login Authorize Blogger [Server]
Attack on IFTTT
2. User gets logged onto Blogger under attacker’s credential User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Google [Server] CreateBlog Login Authorize Server (Evil) Blogger [Server]
Attack on IFTTT
3. User creates a new recipe on IFTTT User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Google [Server] CreateBlog Login Authorize Server (Evil) Blogger [Server]
Attack on IFTTT
4. Blogger authorizes IFTTT to perform
action, but under the attacker’s account! User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Google [Server] CreateBlog Login Authorize Server (Evil) Blogger [Server]
Attack on IFTTT
User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Google [Server] CreateBlog Login Authorize Server (Evil)5. User posts a photo on Facebook
Blogger [Server]
Attack on IFTTT
6. IFTTT is notified of the trigger User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Google [Server] CreateBlog Login Authorize Server (Evil) Blogger [Server]Attack on IFTTT
7. IFTTT creates a new blog on the
attacker’s account,
with the user’s photo!
User [Browser] IFTTT [Server] Facebook [Server] Create Recipe Notify PostPhoto Req Google [Server] CreateBlog Login Authorize Server (Evil) Blogger [Server]
Internet of Things Security
Looking Ahead
Property Composition Operator Verification Engine Domain Model Library System Model Mapping Analysis Result Synthesis:Construct K that satisfies P
K P M' ⊨ P? MS MD M' M'