SlideShare a Scribd company logo
BoulderJUG
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
Deconstructing REST
Security
David Blevins
Tomitribe
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
β€œThe nice thing about standards is
you have so many to choose from.”
- Andrew S. Tanenbaum
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Focus Areas
β€’ Beyond Basic Auth
β€’ Theory of OAuth 2.0
β€’ Introduction of JWT
β€’ Google/Facebook style API security
β€’ Stateless vs Stateful Architecture
β€’ HTTP Signatures
β€’ Amazon EC2 style API security
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Baseline
1000 users
x 3 TPS
4 hops
3000 TPS
frontend
12000 TPS
backend
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Basic Auth
(and its problems)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Basic Auth Message
POST /painter/color/object HTTP/1.1
Host: localhost:8443
Authorization: Basic c25vb3B5OnBhc3M=
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 45
{"color":{"b":255,"g":0,"name":"blue","r":0}}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Basic Auth
Password Sent
3000 TPS
(HTTP+SSL)
username+password
Base64
(no auth)
3000 TPS
(LDAP)
12000 TPS
(HTTP)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Basic Auth
Password Sent
3000 TPS
(HTTP+SSL)
username+password
Base64
username+password
Base64
15000 TPS
(LDAP)
Password Sent
12000 TPS
(HTTP)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Basic Auth
Password Sent
3000 TPS
(HTTP+SSL)
username+password
Base64
IP
whitelisting
3000 TPS
(LDAP)
12000 TPS
(HTTP)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
β€œHey, give me all
of Joe’s salary
information.”
β€œI don’t know
who you are,
…
but sure!”
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Latveria Attacks
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Basic Auth - Attacks
Valid
Password Sent
3000 TPS
(HTTP+SSL) IP
whitelisting
9000 TPS
(LDAP)
12000 TPS
(HTTP)
Invalid
Password Sent
6000 TPS
(HTTP+SSL)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
OAuth 2.0
(and its problems)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 - Password Grant
(LDAP)
(Token Store)
POST /oauth2/token
Host: api.superbiz.io
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
grant_type=password&username=snoopy&password=woodstock
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token":"2YotnFZFEjr1zCsicMWpAA",
"expires_in":3600,
"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
}
Verify
Password
Generate
Token
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/object HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 45
{"color":{"r":0,"g":0,"b":255,"name":"blue"}}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/palette HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 45
{"color":{"r":0,"g":255,"b":0,"name":"green"}}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/select HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 44
{"color":{"r":255,"g":0,"b":0,"name":"red"}}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/fill HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 49
{"color":{"r":0,"g":255,"b":255,"name":"yellow"}}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/stroke HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 49
{"color":{"r":255,"g":200,"b":255,"name":"orange"}}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
401
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 - Refresh Grant
(LDAP)
(Token Store)
Verify
Password
Generate
Token
POST /oauth2/token
Host: api.superbiz.io
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
grant_type=refresh_token&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token":"6Fe4jd7TmdE5yW2q0y6W2w",
"expires_in":3600,
"refresh_token":"hyT5rw1QNh5Ttg2hdtR54e",
}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Old pair
β€’ Access Token 2YotnFZFEjr1zCsicMWpAA
β€’ Refresh Token tGzv3JOkF0XG5Qx2TlKWIA
New pair
β€’ Access Token 6Fe4jd7TmdE5yW2q0y6W2w
β€’ Refresh Token hyT5rw1QNh5Ttg2hdtR54e
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/palette HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 6Fe4jd7TmdE5yW2q0y6W2w
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 46
{"color":{"r":0,"g":255,"b":0,"name":"green"}}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/select HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 6Fe4jd7TmdE5yW2q0y6W2w
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 44
{"color":{"r":255,"g":0,"b":0,"name":"red"}}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message
POST /painter/color/fill HTTP/1.1
Host: api.superbiz.io
Authorization: Bearer 6Fe4jd7TmdE5yW2q0y6W2w
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/json
Content-Length: 49
{"color":{"r":0,"g":255,"b":255,"name":"yellow"}}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
What have we achieved?
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
You have more passwords
(at least your devices do)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Term Alert
β€’ Password Grant???
β€’ Logging in
β€’ Token?
β€’ Slightly less crappy password
β€’ Equally crappy HTTP Session ID
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2
Tokens Sent
3000 TPS
(HTTP+SSL)
IP
whitelisting
3000 TPS
(token checks)
Password Sent
1000/daily
(HTTP+SSL)
OAuth 2
(LDAP)
4 hops
12000 TPS
backend
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
β€œWho the heck
is
6Fe4jd7TmdE5y
W2q0y6W2w
???????”
β€œNo idea, dude.
Ask the token
server.”
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2
Tokens Sent
3000 TPS
(HTTP+SSL)
IP
whitelisting
3000 TPS
(token checks)
Password Sent
1000/daily
(HTTP+SSL)
OAuth 2
(LDAP)
12000 TPS
(token checks)
8 hops
24000 TPS
backend
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2
Tokens Sent
3000 TPS
(HTTP+SSL)
IP
whitelisting
3000 TPS
(token checks)
Password Sent
1000/daily
(HTTP+SSL)
OAuth 2
(LDAP)
12000 TPS
(token checks)
8 hops
24000 TPS
backend
55% of all traffic
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2
Tokens Sent
3000 TPS
(HTTP+SSL)
IP
whitelisting
0 TPS
(token checks)
Password Sent
1000/daily
(HTTP+SSL)
OAuth 2
(LDAP)
0 TPS
(token checks)
0 hops
0 TPS
backend
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2
Pointer Pointer
State
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Access Token
Access Pointer?
Access Primary Key?
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
OAuth 2.0
High Frequency Password
Exchange Algorithm?
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Problem: how to detect if a file's
contents have changed?
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Hashing and Signing
Symmetric and Asymmetric
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Hashing Data
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
01010000010001000011011011101000110101001001100001010011110000
00111010101111111111111111000101111101001110111000100010000000000
111111101011100001001100100000101011111001101111111100111011000011
111011001101100100000101011110011001100001011011110101110110001
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
01010000010001000011011011101000110101001001100001010011110000
00111010101111111111111111000101111101001110111000100010000000000
111111101011100001001100100000101011111001101111111100111011000011
111011001101100100000101011110011001100001011011110101110110001
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG More Bits the Better
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Hashing Data
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Hashing Data
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Hashing Data
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Hashing Data
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Eagles beat Patriots 41 to 33
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Eagles beat Patriots 41 to 33
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Eagles beat Patriots 41 to 34
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Protecting the Hash
HMAC (Symmetric)
RSA (Asymmetric)
abc123 abc123
private
public
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG HMAC (Symmetric)
Read &
Write
Read 

& Write
Shared and equal relationship
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG RSA (Asymmetric)
Write
Read
Read
Read
One side has more authority
* the reverse is possible
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Distributed Read-Only Data
Can Write
Read
Read
Read
Data
Encrypted
Hash of Data
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
How many RSA keys does
Susan need to sign
1,000,000
documents?
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
one
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
OAuth 2.0
+
JSon Web Tokens (JWT)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG JSon Web Token
β€’ Pronounced β€œJOT”
β€’ Fancy JSON map
β€’ Base64 URL Encoded
β€’ Digitally Signed (RSA-SHA256, HMAC-SHA512, etc)
β€’ Built-in expiration
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG β€’ { "alg": β€œRS256", "typ": β€œJWT" }
β€’ {
"token-type": "access-token",
"username": "snoopy",
"animal": "beagle",
"iss": "https://demo.superbiz.com/oauth2/token",
"scopes": [
β€œtwitter”, "mans-best-friend"
],
"exp": 1474280963,
"iat": 1474279163,
"jti": "66881b068b249ad9"
}
β€’ DTfSdMzIIsC0j8z3icRdYO1GaMGl6j1I_2DBjiiHW9vmDz8OAw8Jh8DpO32fv
0vICc0hb4F0QCD3KQnv8GVM73kSYaOEUwlW0k1TaElxc43_Ocxm1F5IUNZvzl
LJ_ksFXGDL_cuadhVDaiqmhct098ocefuv08TdzRxqYoEqYNo
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Access Token Now
β€’ header (JSON > Base64 URL Encoded)
β€’ describes how the token signature can be checked
β€’ payload (JSON > Base64 URL Encoded)
β€’ Basically a map of whatever you want to put in it
β€’ Some standard entries such as expiration
β€’ signature (Binary > Base64 URL Encoded
β€’ The actual digital signature
β€’ made exclusively by the /oauth2/token endpoint
β€’ If RSA, can be checked by anyone
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Access Token Previously
β€’ 6Fe4jd7TmdE5yW2q0y6W2w
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Access Token Now
β€’ eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbi
10eXBlIjoiYWNjZXNzLXRva2VuIiwidXNlcm5hbWUiOiJzb
m9vcHkiLCJhbmltYWwiOiJiZWFnbGUiLCJpc3MiOiJodHRw
czovL2RlbW8uc3VwZXJiaXouY29tL29hdXRoMi90b2tlbiI
sInNjb3BlcyI6WyJ0d2l0dGVyIiwibWFucy1iZXN0LWZyaW
VuZCJdLCJleHAiOjE0NzQyODA5NjMsImlhdCI6MTQ3NDI3O
TE2MywianRpIjoiNjY4ODFiMDY4YjI0OWFkOSJ9.DTfSdMz
IIsC0j8z3icRdYO1GaMGl6j1I_2DBjiiHW9vmDz8OAw8Jh8
DpO32fv0vICc0hb4F0QCD3KQnv8GVM73kSYaOEUwlW0k1Ta
Elxc43_Ocxm1F5IUNZvzlLJ_ksFXGDL_cuadhVDaiqmhct0
98ocefuv08TdzRxqYoEqYNo
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Subtle But High Impact
Architectural Change
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
What we had
(quick recap)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Pull User Info
From IDP
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Generate an
Access Token
(pointer)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Insert both
into DB
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Send Access Token (pointer)
to client
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Results
Client Holds Pointer Server Holds State
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
What we can do now
(Hello JWT!)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Pull User Info
From IDP
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Format the data
as JSON
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
RSA-SHA 256
sign JSON private
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Insert only
pointer
into DB
(for revocation)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
(LDAP)
Send Access Token (state)
to client
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Client Holds State Server Holds Pointer
Desired
Results
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 - Password Grant
(LDAP)
(Token ID Store)
POST /oauth2/token
Host: api.superbiz.io
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
grant_type=password&username=snoopy&password=woodstock
Verify
Password
Generate
Signed
Token
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.
eyJ0b2tlbi10eXBlIjoiYWNjZXNzLXRva2VuIiwidXNlcm5hb
WUiOiJzbm9vcHkiLCJhbmltYWwiOiJiZWFnbGUiLCJpc3M
iOiJodHRwczovL2RlbW8uc3VwZXJiaXouY29tL29hdXRoM
i90b2tlbiIsInNjb3BlcyI6WyJ0d2l0dGVyIiwibWFucy1iZXN0
LWZyaWVuZCJdLCJleHAiOjE0NzQyODA5NjMsImlhdCI6M
TQ3NDI3OTE2MywianRpIjoiNjY4ODFiMDY4YjI0OWFkOSJ
9.DTfSdMzIIsC0j8z3icRdYO1GaMGl6j1I_2DBjiiHW9vmDz8
OAw8Jh8DpO32fv0vICc0hb4F0QCD3KQnv8GVM73kSYaO
EUwlW0k1TaElxc43_Ocxm1F5IUNZvzlLJ_ksFXGDL_cuadh
VDaiqmhct098ocefuv08TdzRxqYoEqYNo",
"expires_in":3600,
"refresh_token":"eyJhbGctGzv3JOkF0XG5Qx2TlKWIAkF0X.
eyJ0b2tlbi10eXBlIjoiYWNjZXNzLXRva2VuIiwidXNlcm5hb
WUiOiJzbm9vcHkiLCJhbmltYWwiOiJiZWFnbGUiLCJpc3M
iOiJodHRwczovL",
}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2.0 Message with JWT
POST /painter/color/palette HTTP/1.1

Host: api.superbiz.io

Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbi10eXBlIjoiYWNjZXNzLXR
va2VuIiwidXNlcm5hbWUiOiJzbm9vcHkiLCJhbmltYWwiOiJiZWFnbGUiLCJpc3MiOiJodHRwczovL2RlbW8uc3VwZXJ
iaXouY29tL29hdXRoMi90b2tlbiIsInNjb3BlcyI6WyJ0d2l0dGVyIiwibWFucy1iZXN0LWZyaWVuZCJdLCJleHAiOjE0NzQy
ODA5NjMsImlhdCI6MTQ3NDI3OTE2MywianRpIjoiNjY4ODFiMDY4YjI0OWFkOSJ9.DTfSdMzIIsC0j8z3icRdYO1GaMGl
6j1I_2DBjiiHW9vmDz8OAw8Jh8DpO32fv0vICc0hb4F0QCD3KQnv8GVM73kSYaOEUwlW0k1TaElxc43_Ocxm1F5IUNZ
vzlLJ_ksFXGDL_cuadhVDaiqmhct098ocefuv08TdzRxqYoEqYNo
User-Agent: curl/7.43.0

Accept: */*

Content-Type: application/json

Content-Length: 46



{"color":{"b":0,"g":255,"r":0,"name":"green"}}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 + JWT
Tokens Sent
3000 TPS
(HTTP+SSL)
0.55 TPS
(refresh token checks)
(30 minute expiration)
Password Sent
1000/daily
(HTTP+SSL)
OAuth 2
(LDAP)
4 hops
12000 TPS
backend
3000 TPS
(signature verification)
12000 TPS
(signature verification)(private key)
(public key)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
β€œHey, give me all
of Joe’s salary
information.”
β€œNot a chance!”
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
β€œHey, give me all
of Joe’s salary
information.”
β€œSure thing!”
Every Microservice Has the Gateway's Public Key
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Latveria Attacks
(again)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 + JWT
Valid
Tokens Sent
3000 TPS
(HTTP+SSL)
0.55 TPS
(refresh token checks)
Password Sent
1000/daily
(HTTP+SSL)
(LDAP)
4 hops
12000 TPS
backend
9000 TPS
(signature verification)
12000 TPS
(signature verification)
Invalid
Tokens Sent
6000 TPS
(HTTP+SSL)
(private key)
(public key)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
HTTP Signatures
(Amazon EC2 style API Security)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG HTTP Signatures
β€’ No β€œsecret” ever hits the wire
β€’ Signs the message itself
β€’ Proves identity
β€’ Prevents message tampering
β€’ Symmetric or Asymmetric signatures
β€’ IETF Draft
β€’ https://tools.ietf.org/html/draft-cavage-http-signatures
β€’ Extremely simple
β€’ Does NOT eliminate benefits of JWT
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signing a Message
POST /painter/color/palette HTTP/1.1

Host: api.superbiz.io

Date: Mon, 19 Sep 2016 16:51:35 PDT
Accept: */*

Content-Type: application/json

Content-Length: 46



{"color":{"b":0,"g":255,"r":0,"name":"green"}}
Take the full http
message
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signing a Message
POST /painter/color/palette HTTP/1.1

Host: api.superbiz.io

Date: Mon, 19 Sep 2016 16:51:35 PDT
Accept: */*

Content-Type: application/json

Content-Length: 46



{"color":{"b":0,"g":255,"r":0,"name":"green"}}
Select the parts

you want to protect
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signing a Message
(request-target): POST /painter/color/palette

host: api.superbiz.io

date: Mon, 19 Sep 2016 16:51:35 PDT
content-length: 46
Create a 

Signing String
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signing a Message
(request-target): POST /painter/color/palette

host: api.superbiz.io

date: Mon, 19 Sep 2016 16:51:35 PDT
content-length: 46
Aj2FGgCdGhIp6LFXjxSxBsSwTp9i
C7t7nmRZs-hrYcQ
Hash the string

(sha256 shown)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signing a Message
Aj2FGgCdGhIp6LFXjxSxBsSwTp9i
C7t7nmRZs-hrYcQ
Encrypt the hash

(hmac shown)
j050ZC4iWDW40nVx2oVwBEymX
zwvsgm+hKBkuw04b+w=
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signing a Message
Signature
keyId=β€œorange-1234",
algorithm="hmac-sha256",
headers="(request-target) host date content-length”,
signature="j050ZC4iWDW40nVx2oVwBEymXzwvsgm+hKBkuw04b+w="

Put it all together
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signed Message
POST /painter/color/palette HTTP/1.1

Host: api.superbiz.io

Authorization: Signature keyId=β€œorange-1234",
algorithm="hmac-sha256",
headers="(request-target) host date content-length”,
signature="j050ZC4iWDW40nVx2oVwBEymXzwvsgm+hKBkuw04b+w="

Date: Mon, 19 Sep 2016 16:51:35 PDT
Accept: */*

Content-Type: application/json

Content-Length: 46



{"color":{"b":0,"g":255,"r":0,"name":"green"}}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signature Auth
Password Sent
0 TPS
(HTTP)
Signature (no auth)
3000 TPS
(LDAP or Keystore)
12000 TPS
(HTTP)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signature Auth
Password Sent
0 TPS
(HTTP)
Signature Signature
3000 TPS
(LDAP or Keystore)
12000 TPS
(HTTP)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
β€œHey, give me all
of Joe’s salary
information.”
β€œHey, Larry!
Sure!”
Issue Returns
(bad)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
OAuth 2.0 Proof-of-Possession
(JWT + HTTP Signatures)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
Key Value
Identity Information
(JWT)
Key ID
Proof Of Identity
(HTTP Signature)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
{ "alg": β€œRS256", "typ": β€œJWT" }
{ "token-type": "access-token",
"username": "snoopy",
"iss": "https://demo.superbiz.com/oauth2/token",
"scopes": ["twitter”, "mans-best-friend"],
"exp": 1474280963,
"iat": 1474279163,
"jti": "66881b068b249ad9"
}
DTfSdMzIIsC0j8z3icRdYO1GaMGl6j1I_2DBjiiHW9vmDz8OAw8Jh8DpO32fv0vICc
0hb4F0QCD3KQnv8GVM73kSYaOEUwlW0k1TaElxc43_Ocxm1F5IUNZvzlLJ_ksF
XGDL_cuadhVDaiqmhct098ocefuv08TdzRxqYoEqYNo
Access Token
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
{ "alg": β€œRS256", "typ": β€œJWT" }
{ "token-type": "pop",
"cnf":{ "kid": "green-1234" }
"username": "snoopy",
"iss": "https://demo.superbiz.com/oauth2/token",
"scopes": ["twitter”, "mans-best-friend"],
"exp": 1474280963,
"iat": 1474279163,
"jti": "66881b068b249ad9"
}
DTfSdMzIIsC0j8z3icRdYO1GaMGl6j1I_2DBjiiHW9vmDz8OAw8Jh8DpO32fv0vICc
0hb4F0QCD3KQnv8GVM73kSYaOEUwlW0k1TaElxc43_Ocxm1F5IUNZvzlLJ_ksF
XGDL_cuadhVDaiqmhct098ocefuv08TdzRxqYoEqYNo
Access Token
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 - Password Grant
(LDAP)
(Token ID Store)
POST /oauth2/token
Host: api.superbiz.io
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
grant_type=password&username=snoopy&password=woodstock
Verify
Password
Generate
Signed
Token
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc
3MiOiJodHRwczovL3NlcnZlci5leGFtcGxlLmNvbSIsImV4cCI6M
TMxMTI4MTk3MCwiaWF0IjoxMzExMjgwOTcwLCJjbmYiOnsia2",
"token_type":"pop",
"expires_in":3600,
"refresh_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc
3MiOiJodHRwczovL2FzZGZhc2RzZGZzZXJ2ZXIuZXhhbXBsZS5
jb20iLCJleHAiOjEzMTEyODE5NzAsImlhdCI6MTMxMTI4MDk3M",
"key":"eyJrdHkiOiJvY3QiLCJ1c2UiOiJzaWciLCJraWQiOiJvcmFuZ
2UteXlqOUQwZWgiLCJrIjoiVlotMFFHTFoyUF9SUFVTVzEwQ0l1
MFdNeVhxLU5EMnBtRFl6QTBPVEtXVEhscDVpYWM1SzRWZWlS
ci1fQk9vWEo0WDJmU1R0NG5Id29fcXV0YTdqSkpLVDRQRVd5W
WFuQlNGc2kwRFc3b3dULUhFeEFHRHlKdEhVdE53NXhzczhOajZ
PeE5QdjZyUk9FLWtldmhMMndCOWNxZ2RJc2NidkRocmFzMzljd
2ZzIiwiYWxnIjoiSFMyNTYifQ"
}
Generate
HMAC
Key
(Key Store)
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG JSON Web Key (encoded)
eyJrdHkiOiJvY3QiLCJ1c2UiOiJzaWciLCJraWQiOiJvcmFuZ2Ut
eXlqOUQwZWgiLCJrIjoiVlotMFFHTFoyUF9SUFVTVzEwQ0l1M
FdNeVhxLU5EMnBtRFl6QTBPVEtXVEhscDVpYWM1SzRWZ
WlSci1fQk9vWEo0WDJmU1R0NG5Id29fcXV0YTdqSkpLVDRQ
RVd5WWFuQlNGc2kwRFc3b3dULUhFeEFHRHlKdEhVdE53N
XhzczhOajZPeE5QdjZyUk9FLWtldmhMMndCOWNxZ2RJc2Nid
kRocmFzMzljd2ZzIiwiYWxnIjoiSFMyNTYifQ
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG JSON Web Key (decoded)
{ "kty": "oct",
"use": "sig",
"kid": "orange-1234",
"k": "VZ-0QGLZ2P_RPUSW10CIu0WMyXq-ND2pmDYzA0OTKW
THlp5iac5K4VeiRr-_BOoXJ4X2fSTt4nHwo_quta7j
JJKT4PEWyYanBSFsi0DW7owT-HExAGDyJtHUtNw5xs
s8Nj6OxNPv6rROE-kevhL2wB9cqgdIscbvDhras39c
wfs",
"alg": "HS256"
}
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Signed OAuth 2.0 Message
POST /painter/color/palette HTTP/1.1

Host: api.superbiz.io

Authorization: Signature keyId=β€œorange-1234", algorithm="hmac-sha256",
headers="content-length host date (request-target)”,
signature="j050ZC4iWDW40nVx2oVwBEymXzwvsgm+hKBkuw04b+w="
Bearer:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbi10eXBlIjoiYWNjZXNzLXRva2VuIiwidXNlcm5h
bWUiOiJzbm9vcHkiLCJhbmltYWwiOiJiZWFnbGUiLCJpc3MiOiJodHRwczovL2RlbW8uc3VwZXJiaXouY29t
L2
9hdXRoMi90b2tlbiIsInNjb3BlcyI6WyJ0d2l0dGVyIiwibWFucy1iZXN0LWZyaWVuZCJdLCJleHAiOjE0NzQyO
DA5NjMsImlhdCI6MTQ3NDI3OTE2MywianRpIjoiNjY4ODFiMDY4YjI0OWFkOSJ9.DTfSdMzIIsC0j8z3icRdY
O1GMGl6j1I_2DBjiiHW9vmDz8OAw8Jh8DpO32fv0vICc0hb4F0QCD3KQnv8GVM73kSYaOEUwlW0k1TaEl
xc43_Ocxm1F5IUNZvzlLJ_ksFXGDL_cuadhVDaiqmhct098ocefuv08TdzRxqYoEqYNo

Date: Mon, 19 Sep 2016 16:51:35 PDT
Accept: */*

Content-Type: application/json

Content-Length: 46



{"color":{"b":0,"g":255,"r":0,"name":"green"}}
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG OAuth 2 + JWT + Signatures
Tokens+Signatures Sent
3000 TPS
(HTTP safe)
0.55 TPS
(refresh token checks)
Password Sent
1000/daily
(HTTP+TLS)
OAuth 2
(LDAP)
4 hops
12000 TPS
backend
3000 TPS
(signature verification)
12000 TPS
(signature verification)
#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG
https://tools.ietf.org/html/draft-ietf-oauth-pop-key-distribution
Specification Reference
@dblevins @tomitribe#RESTSecurity @dblevins @tomitribetribestream.io/boulderjug2018
BoulderJUG Observations
β€’ HTTP Signatures the only HTTP friendly approach
β€’ Signatures does not solve the β€œIdentity Load” problem
β€’ OAuth 2 with JWT significantly improves IDP load
β€’ Plain OAuth 2
β€’ HTTP Session-like implications
β€’ OAuth 2 with JWT
β€’ Signed cookie
β€’ Signing key to the future
Thank You
Slides & Gateway Sign-up
https://tribestream.io/boulderjug2018
#RESTSecurity
Boulder JUG

More Related Content

PDF
2018 Denver JUG Deconstructing and Evolving REST Security
PDF
2018 jPrime Deconstructing and Evolving REST Security
PDF
2018 colombia deconstruyendo y evolucionando la seguridad en servicios rest
PDF
2018 SDJUG Deconstructing and Evolving REST Security
PDF
2017 dev nexus_deconstructing_rest_security
PDF
2016 JavaOne Deconstructing REST Security
PDF
2017 Devoxx MA Deconstructing and Evolving REST Security
PDF
Deconstructing and Evolving REST security
2018 Denver JUG Deconstructing and Evolving REST Security
2018 jPrime Deconstructing and Evolving REST Security
2018 colombia deconstruyendo y evolucionando la seguridad en servicios rest
2018 SDJUG Deconstructing and Evolving REST Security
2017 dev nexus_deconstructing_rest_security
2016 JavaOne Deconstructing REST Security
2017 Devoxx MA Deconstructing and Evolving REST Security
Deconstructing and Evolving REST security

What's hot (10)

PDF
2018 ecuador deconstruyendo y evolucionando la seguridad en servicios rest
PDF
2018 IterateConf Deconstructing and Evolving REST Security
PDF
Deconstructing and Evolving REST Security
PPTX
Introduction to the Emerging JSON-Based Identity and Security Protocols
PPTX
Understanding gRPC Authentication Methods
PDF
Side-Channels on the Web: Attacks and Defenses
PDF
Hidden Features in HTTP
PDF
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
PPTX
Past, Present and Future of Data Processing in Apache Hadoop
PPTX
Build your own Blockchain with the right tool for your application
2018 ecuador deconstruyendo y evolucionando la seguridad en servicios rest
2018 IterateConf Deconstructing and Evolving REST Security
Deconstructing and Evolving REST Security
Introduction to the Emerging JSON-Based Identity and Security Protocols
Understanding gRPC Authentication Methods
Side-Channels on the Web: Attacks and Defenses
Hidden Features in HTTP
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
Past, Present and Future of Data Processing in Apache Hadoop
Build your own Blockchain with the right tool for your application
Ad

Similar to 2018 Boulder JUG Deconstructing and Evolving REST Security (20)

PDF
2018 JavaLand Deconstructing and Evolving REST Security
PDF
2017 JavaOne Deconstructing and Evolving REST Security
PDF
2018 Madrid JUG Deconstructing REST Security
PDF
Stateless Microservice Security via JWT and MicroProfile - Mexico
PDF
Stateless Microservice Security via JWT and MicroProfile - ES
PDF
Stateless Microservice Security via JWT and MicroProfile - Guatemala
PDF
2019 ITkonekt Stateless REST Security with MicroProfile JWT
PDF
Seguridad en microservicios via micro profile jwt
PDF
Dublin JUG Stateless Microservice Security via JWT, TomEE and MicroProfile
PDF
CSU33012-I-microservices.pdf
PPTX
RESTful web services with Groovy on Grails by Vugar Suleymanov
PDF
gRPC vs REST: let the battle begin!
PPTX
HyperLedger LightningTalk BjoernSimon
PPTX
HyperLedger Lightning-Talk BjoernSimon
PPTX
OpenStack Toronto Meetup - Keystone 101
PDF
Automating Cloud Operations - Everything you wanted to know about cURL and RE...
PDF
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
PPTX
Blockchain in the Food Supply Chain (v2)
PPTX
Secure Authorization for your Printer: The OAuth Device Flow (DevSum 2018)
PDF
Centralise legacy auth at the ingress gateway, SREday
2018 JavaLand Deconstructing and Evolving REST Security
2017 JavaOne Deconstructing and Evolving REST Security
2018 Madrid JUG Deconstructing REST Security
Stateless Microservice Security via JWT and MicroProfile - Mexico
Stateless Microservice Security via JWT and MicroProfile - ES
Stateless Microservice Security via JWT and MicroProfile - Guatemala
2019 ITkonekt Stateless REST Security with MicroProfile JWT
Seguridad en microservicios via micro profile jwt
Dublin JUG Stateless Microservice Security via JWT, TomEE and MicroProfile
CSU33012-I-microservices.pdf
RESTful web services with Groovy on Grails by Vugar Suleymanov
gRPC vs REST: let the battle begin!
HyperLedger LightningTalk BjoernSimon
HyperLedger Lightning-Talk BjoernSimon
OpenStack Toronto Meetup - Keystone 101
Automating Cloud Operations - Everything you wanted to know about cURL and RE...
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
Blockchain in the Food Supply Chain (v2)
Secure Authorization for your Printer: The OAuth Device Flow (DevSum 2018)
Centralise legacy auth at the ingress gateway, SREday
Ad

More from David Blevins (8)

PDF
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
PDF
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
PDF
2017 JCP EC: Configuration JSR
PDF
2015 JavaOne EJB/CDI Alignment
PDF
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat
PDF
2011 JavaOne EJB with Meta Annotations
PDF
2011 JavaOne Apache TomEE Java EE 6 Web Profile
PDF
2011 JavaOne Fun with EJB 3.1 and OpenEJB
DevNexus 2020 - Jakarta Messaging 3.x, Redefining JMS
2019 JJUG CCC Stateless Microservice Security with MicroProfile JWT
2017 JCP EC: Configuration JSR
2015 JavaOne EJB/CDI Alignment
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on Tomcat
2011 JavaOne EJB with Meta Annotations
2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Fun with EJB 3.1 and OpenEJB

Recently uploaded (20)

PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
Internet___Basics___Styled_ presentation
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PDF
The Internet -By the Numbers, Sri Lanka Edition
Β 
PDF
Paper PDF World Game (s) Great Redesign.pdf
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPT
tcp ip networks nd ip layering assotred slides
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
Introduction to Information and Communication Technology
PPTX
innovation process that make everything different.pptx
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
international classification of diseases ICD-10 review PPT.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Internet___Basics___Styled_ presentation
Introuction about ICD -10 and ICD-11 PPT.pptx
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
The Internet -By the Numbers, Sri Lanka Edition
Β 
Paper PDF World Game (s) Great Redesign.pdf
Cloud-Scale Log Monitoring _ Datadog.pdf
Job_Card_System_Styled_lorem_ipsum_.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
The New Creative Director: How AI Tools for Social Media Content Creation Are...
SAP Ariba Sourcing PPT for learning material
presentation_pfe-universite-molay-seltan.pptx
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
tcp ip networks nd ip layering assotred slides
Introuction about WHO-FIC in ICD-10.pptx
QR Codes Qr codecodecodecodecocodedecodecode
Introduction to Information and Communication Technology
innovation process that make everything different.pptx
An introduction to the IFRS (ISSB) Stndards.pdf

2018 Boulder JUG Deconstructing and Evolving REST Security