-
Notifications
You must be signed in to change notification settings - Fork 43
Protocols
This page describes how the following supported protocols are determined by EsPReSSO, as defined.
Figures for OAuth were taken from Christoph Nickel - Sicherheitsanalyse von OAuth 2.0 mittels Web Angriffen auf bestehende Implementierungen.
The message is checked at the beginning of the OAuth detection for the parameters redirect_uri
, scope
, client_id
, client_secret
and response_type
. If one or more of the parameters is present the algorithm proceeds. The checks are then divided into three parts:
- Authorization Code Flow: If the parameters
grant_type
orresponse_type
are present, the algorithm proceeds. If the previous message has status-code 302 and the current message contains the parameterresponse_type
with the valuecode
, the message is marked as OAuth ACG Request. If the parametercode
exists, the message is classified as OAuth ACG Code. If the parametergrant_type
exists with the valueauthorization_code
, the message is marked as OAuth ACG Token Request.
- Implicit Flow: If the parameters
access_token
orresponse_type
are present, the algorithm proceeds. If the previous message had the status-code 302 and the current message contains the parameterresponse_type
with the valuetoken
, the message is marked as OAuth Implicit Grant Request. If the response of the message matches the regular expressionLocation:.*?#.*?access_token=.*?&?
, the message is marked as OAuth Implicit Token, otherwise it is marked as OAuth (IF).
A depiction of the Implicit Flow is seen in the diagram below.
- Other Flows:
The parameter
grant_type
is evaluated for the following values and marked as:-
OAuth Access Token Request with the value
authorization_code
. -
OAuth Refresh Token Request with the value
refresh_token
. -
OAuth Resource Owner Password Credentials Grant with the value
password
. -
OAuth Client Credentials Grant with the value
client_credentials
. -
OAuth Extension JWT Grant with the value
urn:ietf:params:oauth:grant-type:jwtbearer
. -
OAuth Extension SAML Grant with the value
urn:oasis:names:tc:SAML:2.0:cm:bearer
.
-
OAuth Access Token Request with the value
Figures were taken from Julian Krautwald's Master's Thesis Single Sign-On – OpenID Connect(ing) people
The method for checking OpenID Connect is divided into two parts, which divides up the HTTP 302 and 200 messages, and looks for a number of parameters.
The messages are split up as follows:
-
If the parameter
response_type
contains the valuecode
and the valueid_token
ortoken
, the message is marked as OpenID Connect Hybrid Flow. -
If the message has the HTTP status code 302 and the response location matches the regular expressions
^Location:.*?response_type=code.*?$
and^Location:.*?&?scope=[a-zA-Z+]*?openid[a-zA-Z+]*?&?.*?$
, the message is marked as OpenID Connect ACF Request. If the next message contains the parameterresponse_type=code
andscope=openid
, the message is also marked as OpenID Connect ACF Request.
- If the parameter
response_type=id_token
exists in a message with a 302 status-code, the message is marked as an OpenID Connect Implicit Flow Request. If the subsequent message has a parameter namedid_token
, it is marked as OpenID Connect Implicit Flow Response. If the following message contains the parameter access_token, the message is marked as the OpenID Connect Implicit Flow Access Token.
The other parameters are split and classified as follows:
-
If the regular expression
"\\/\\.well-known\\/openid-configuration|\\/\\.well-known\\/webfinger"
is found, the message is classified as an OpenID Connect Discovery Flow. -
If the parameters
code
and/orstate
are present along with the parameterscope
, the message is marked as OpenID Connect / OAuth. Additionally, ifscope
is set toopenid
, the message is only marked as OpenID Connect.
- Hybrid Flow is comparable to the flows before, but its hybrid (OAuth + OIDC).
response_type=code id_token token
response_type=code token
response_type=code id_token
- Maybe the order of the values can vary.
- Identify OpenID Connect Hybrid Flow:
-
response_type
must containcode
AND (eitherid_token
ortoken
or both).
-
The message host must contain facebook.com
and if found, the URL is then checked for /ping?
. If both of these elements are found, the message is marked as a Facebook Connect Ping Request.
To determine additional information regarding the message, the message is then checked for the following parameters: app_id
, domain
, origin
, and/or sdk
. If one of these parameters is found, the message will be marked as Facebook Connect.
If the signed_request
parameters is found, the message is marked as a Facebook Connect Authentication Response.
If the parameter response_type
contains the value signed request
, the message is marked as a Facebook Connect Authentication Request.
Below is an depiction of the protocol taken from Jacek Rzeniewicz - Log Me In with Facebook: Security Analysis of Facebook Connect.
The message must contain live.com
, live.net
, or contoso.com
.
If the scope
parameter is present in the message and contains the values wl.basic
, wl.offline_access
, or wl.signin
, the message is identified as Microsoft Account with OAuth. If the scope
contains the openid
and is assigned with a value, the message is marked as a Microsoft Account.
If any of the previous elements have not yet allowed the EsPReSSO scanner to identify the message, the parameter wa
is looked for by the scanner. If it present and set to wsignin1.0
, the message is marked as Microsoft Account WS-Federation.
To determine SAML messages, the messages must contain the parameter SAMLRequest
for the request and SAMLResponse
for the responses. EsPReSSO decodes the messages in reverse order of the standard SAML Encoding.
The DTD-Attacker sends the SAMLRequests using the encoding shown below. If the tester makes any changes to the ´SAMLRequest´, the standard encoding needs to be taken into consideration.
SAMLRequest
Encoding:
-
GET
:SAMLRequest=URL-Encoding(Base64-Encode(deflate((XML)))
-
POST
:SAMLRequest=Base64-Encoding(deflate((XML))
Decoding:
-
GET
:SAMLRequest=URL-Decode(Base64-Decode(inflate(XML)))
-
POST
:SAMLRequest=Base64-Decode(inflate(XML))
If the parameter openid.mode
contains the values checkid_setup
for the OpenID Request or id_res
, it is classified as an OpenID message.
If the openid.mode
parameter contains the value associate
, the message is assigned as an OpenID Association message.
The OpenID 2.0 Token is determined by the parameters openid.sig
and openid.claimed_id
. If openid.claimed_id
is not present, the message is marked as an OpenID 1.0 Token.
Figures for BrowserID were taken from Henning Thiel - Praktische Sicherheitsanalyse des Mozilla Single Sign-on Protokolls BrowserID.
For BrowserID to be recognized, the following attributes must be met:
- The message must contain persona.org.
-
Cookie
with valuebrowserid_state
is set.
OR
-
GET
orPOST
parameter with nameassertion
is set.-
assertion
contains a JWT that must be decoded.
-
-
POST
JSON object with the following content:{"pubkey":"{\"algorithm\":\"DS\",\"y\":\"6dd39e08cbecbab...\",\"p\":\"ff600483db6abfc5b...\",\"q\":\"e21e04f911d1ed799...\",\"g\":\"c52a4a0ff3b7e61...\"}","duration":3600,"email":"ssoanonym2@gmail.com"}:
-
POST
JSON object with the following content:{"assertion":"eyJhbGciOiJSUzI1NiJ9.eyJwdWJsaWMta2V5I....eyJleHAiOjE0NDA0OTI3Nj....F69xoO8wAv2LOW...","ephemeral":true,"csrf":"siVxypVsfcdJZAZCMxhwHQ: ="}