Authentication¶
Name¶
Authentication
Summary¶
Ensure that uncontrolled entities prove they are whom they claim to be before allowing any further interactions with the system. The goal is to ensure that each entity corroborates their claimed identity by providing a correct credential, e.g. the correct username and password combination or a valid session identifier.
Parent¶
None
Problem¶
- Prevent that uncontrolled entities can spoof other entities in order to request actions in their name
Solution¶
Authentication is one of the most common security measures, therefore correctly integrating it into the system at hand is of paramount importance. Furthermore, authentication is often a prerequisite for other security measures such as authorisation of entities and auditing. Faulty authentication mechanisms are among the most common security (design) flaws according to OWASP's as well as IEEE's1 top 10.
Roles¶
- Subject (: Entity) that requests the
Systemto perform an action - Enforcer (: Enforcement point) ensures the requested action is only performed if the
Subjectis successfully authenticated, this entity must be incorporated into the system - Verifier (: Decision point) verifies the subject's credential against some evidence to determine whether the
Subject's request is allowed - Evidence provider (: Entity) keeps track of the evidence required to verify credentials, this entity can be part of the system or an external dependency
- System (: Entity) contains the business logic corresponding to the requested action
- Registrar (: Entity) handles the
Subject's registration and forwards the evidence to theEvidence provider - Resetter (: Entity) handles the reset of a
Subject's credential, e.g., in case the current credential is lost
Actions¶
- action (: Action) that the
Subjectwants to perform - verify (: Action) the provided credential against the appropriate evidence
- get_evidence (: Action) retrieve the evidence required to verify some credential
- add (: Action) add new evidence corresponding to a credential
- reset (: Action) change the current credential to the newly provided one
- update (: Action) update the credential, and corresponding evidence, to the newly provided values
Data elements¶
- credential (: Data) that the
Subjectprovides to authenticate itself- Tags: Secret, Untampered
- principal (: Data) identifies a
Subjectas it is known to theSystem- Tags: Identifier, Untampered
- The principal can be part of the credential or can be derived from it by the
Verifier, possibly using the evidence retrieved from theEvidence provider.
- evidence (: Data) against which the
Verifiercompares the received credential- Tags: Untampered[, Secret]
- reply (: Data) from the
Systemtriggered by the requested action (optional) - error (: Data) message informing the receiving entity its request was not granted
Behaviour¶
A subject that wants to perform an action requiring authentication boils down to seven interactions, of which the last one is optional depending on the desired action.
- The
Subjectinteracts with the system'sEnforcerto request the action providing its credential along with any further arguments required by the action. - The
Enforcerforwards the credential to theVerifierfor verification and blocks the action request awaiting an answer. - The
Verifierrequests the evidence needed to verify the credential from theEvidence provider. - The
Verifierreceives the requested evidence from theEvidence provider, if available, and verifies the credential using this evidence. The exact verification depends on the nature of the selected credential and evidence. - The
Verifierinforms theEnforcerof the result of the verification by sending the credential for which the verification was performed along with the outcome. - If the verification was successful, the
Enforcerforwards the requested action to the protectedSystem. Otherwise, theSubjectis informed of the authentication failure. - The
Systemmay reply to theSubject, for example, to provide the result of the action or to confirm the request was successfully received. This reply does not need to pass through theEnforcer. (Optional)

Role considerations¶
Evidence provider¶
The evidence is crucial in making an authentication decision and should be adequately protected to ensure the integrity of the authentication process. An attacker that can tamper with the used evidence might alter this to match some credential the attacker possesses. Leaked evidence might provide attackers sufficient information to determine valid credentials, or decrease the size of the space of possibly valid credentials.
More concretely, the Evidence provider might store the evidence, in which case the necessary measures to avoid undetected tampering and leaking of the evidence are warranted.
In case the Evidence provider is an uncontrolled entity additional security measures are likely necessary to ensure the trustworthiness of the received evidence.
Resource usage (Enforcer, Verifier, Evidence provider)¶
An attacker might attempt to break the authentication by trying a large amount of different credentials (in a short time), with the goal that at least one of them is valid. While the chance of such an attack being successful can be decreased by enforcing appropriate credentials (cf. Selection of credential and evidence), it does not completely go away if an attacker can try a virtually unlimited number of credentials. Furthermore, flooding a system with a large number of, possibly bogus, authentication requests within a short time is likely to impact the processing of valid requests, possibly crashing the authentication mechanisms completely.
Therefore, it should be prevented that a Subject can directly absorb excessive resources from the Enforcer, or indirectly from the Verifier or Evidence provider.
The Verifier has to process each request passed on by the Enforcer, with help of the Evidence provider.
Consequently, the limited resources available for these entities should be taken into consideration when determining which requests the Enforcer passes on and which not.
For example, if the Enforcer is too lenient with the amount requests it passes on to the Verifier it might not be able to retrieve the required evidence fast enough from the Evidence provider, e.g. due to slow retrieval by the Evidence provider or because of network delays between these entities.
Subject registration (Registrar)¶
The main purpose of subject registration is that, upon completion, the Subject possesses its credential and the Evidence provider has the corresponding evidence.
This can be achieved in multiple ways:
- the
Subjectprovides the credential and theRegistrardetermines the corresponding evidence, e.g.Subjectchooses a password andRegistrarcalculates corresponding hash value; - the
Registrardetermines credential as well as evidence, and transmits credential to theSubject, e.g.Registrargenerates a password for theSubject; or - the
Subjectdetermines both credential and evidence, and transmits this to the system, e.g.Subjectgenerates a public-private key pair and transmits the public key to theRegistrar.
In some cases a mixture of the above ways is possible.
For instance, the Registrar determines an initial credential and corresponding evidence and transmits the credential to the Subject.
After authenticating with the initial credential, the Subject then has to provide a new credential which will be used in future.
In such cases, additional measures are required to ensure that the initial credential (and corresponding evidence) is indeed replaced by one chosen by the Subject.
For example, for a new system administration account a default password might be set, e.g. root as username and password.
After logging in for the first time, the Subject should change this default password root to a more appropriate one.
The Registrar should ensure with sufficient certainty that the registering Subject is the actual owner of the registered identity.
For example, when providing an email address as part of the registration information it should be verified the Subject actually has access to that email account, e.g. by sending an email containing a verification token the Subject must provide to finalise the registration.
In case the Subject provides any input data additional security measures should be considered.
Credential change (Evidence provider)¶
In case credentials are used over a long period of time it should not be assumed that the credential will remain secret indefinitely. For example, the secrecy of a subject's password may be broken by the breach of the password database in another system or a cryptographic key might be compromised, requiring it is replaced by a new one. Consequently, one should make sure that subjects can easily change credentials, and the corresponding evidence, should the need arise. Therefore, it should be avoided that credentials are hard-coded in, for example, source code itself as this makes them very hard to change.
Note that changing a credential has to be considered a sensitive action which requires (re-)authenticating the requesting entity with the current credential before performing the change.1 As with regular authentication attempts care should be taken to avoid that attackers can absorb excessive resources by, for example, attempting to re-authenticate a large number of times (cf. Resource usage).
Credential reset (Resetter)¶
Subjects might lose their credential at some point, e.g. human users can forget their password or a cryptographic key can be lost when (part of) a system fails.
In such cases a secure recovery mechanism can allow Subjects to reset their credential, and corresponding evidence.
When designing such functionality
- ensure to authenticate the
Subjectthrough different means than used when verifying a credential, e.g. by interacting through a side-channel such as email or phone; - be aware that the new credential is likely transmitted over an uncontrolled channel; and
- ensure that attackers cannot absorb excessive resources from the
Resetteror, indirectly, theEvidence provider.
While authenticating through a side channel, a Subject is typically provided with some reset token which the Subject can subsequently use to identify itself to the system and reset its credential.
For example, a unique URL could be emailed to the email address the Subject provided on registration.
Care should be taken in selecting these tokens as they should not be easy to guess or enumerate by an attacker.
Furthermore, such a token should be valid only a limited amount of time, e.g. in the order of minutes.
Error messages (Enforcer, Resetter)¶
Improper error messages provided to the Subject may leak information about the available credentials in the system.3
For example, during a credential reset procedure an error messages should not indicate whether it was caused because the intended account does not exist or due to the fact that the authentication information provided through the side-channel was incorrect.
Such error messages would allow an attacker to determine information that can be used in further attacks, e.g. which accounts exist in the system.
In general error messages should be identical irrelevant whether the cause was
- an incorrect credential for a known
Subject; or - a credential for an unknown
Subject.
Sensitive actions (Enforcer)¶
If the Subject requests some sensitive action to be executed, it is advised to to enforce (re-)authentication based on the credential and evidence set via the subject registration (or through a successful credential reset procedure).1
For example, if a Subject requests to change the password for his or her account that Subject should first be able to produce the current password.
In such cases authentication using a temporary credential, e.g. a session token, should be be considered insufficient and the ownership of a claimed identity should be verified against the registered evidence, e.g. username and password.
This helps in preventing, for example, that attackers take full control of a legitimate identity by obtaining a valid session identifier and lock to original entity out, e.g. by changing the password.
Log authentication failures (Verifier)¶
It is advised to log at least all authentication failures and notify administrators when appropriate, e.g. in case of repeated failures.3 This allows, for example, to detect brute force attacks. Care should be taken to not include sensitive data in the log entries and that the integrity of the logs is preserved while stored.
Data considerations¶
Selection of credential and evidence¶
Care should be taken to select an appropriate credential and corresponding evidence. Generally three types of credential2 are distinguished:
- something you know, e.g. a password;
- something you have, e.g. a cryptographic key; or
- something you are, e.g. biometric data.
Depending on the required level of security multiple factors can be combined, i.e. multi-factor authentication (MFA).
For example, a Subject can be required to provide a password (something it knows) as well as a one-time code generated using a mobile app (something it has).
One should be careful to make assumptions on whether a potential credential is unique to a single Subject or can be shared among several Subjects1.
For example, an IP address can be shared by multiple Subjects (over time).
Furthermore, easily available information such as an IP address of MAC address can easily be spoofed by an attacker, thwarting the authentication.
Credential¶
Appropriate measures should be taken to ensure that any credentials remain secret and that any tampering can be detected.
The applies to credentials while at rest as well as when they are
transmitted.
An attacker can use a any leaked credential to authenticate as another Subject using its claimed identity.
In case an attacker can modify a credential this might cause a Subject's authentication attempts to fail, thereby denying the Subject access to the system.
Furthermore, an attacker that can change a credential the system knows for some Subject may succeed in authenticating as this Subject, thereby gaining unauthorised access to the system.
Principal¶
The principal serves as identifier for the System when processing the requested action.
Consequently, care should be taken that an attacker cannot tamper with it, either while transmitted between
entities of at rest in the Evidence provider.
An attacker that can modify the credential might, for example, be able to requests actions that are processed using the principal of another Subject.
Evidence¶
As the evidence kept by the Evidence provider is crucial to the Verifier to allow or deny authentication attempts it should be protected against unauthorised modifications.
Any tampering with evidence either while stored in the Evidence provider or transmitted between the entities should be detected.
For example, an attacker might change the stored evidence to one matching a credential it possesses and in this manner gain access to the account of another Subject.
Credential scope¶
In order to limit the impact of compromised credentials the scope in which credentials are valid can be limited. For instance, one should use different (types of) credentials for more sensitive/privileged accounts than general access ones, even if the same entity fulfils these roles.
Implementations¶
- Password-based authentication
- Verifiable token-based authentication
- Opaque token-based authentication
- Obscure token-based access control
References¶
-
I. Arce et al., ‘Avoiding the Top 10 Software Security Design Flaws’, IEEE, 2014. [Online]. Available: https://cybersecurity.ieee.org/blog/2015/11/13/avoiding-the-top-10-security-flaws/ ↩↩↩↩
-
P. A. Grassi, M. Garcia, and J. L. Fenton, ‘Digital Identity Guidelines’, NIST, 800-63-3, Jun. 2017.[Online]. Available: https://doi.org/10.6028/NIST.SP.800-63-3 ↩
-
E. Keary, J. Manico, T. Goosen, P. Krawczyk, S. Neuhaus, and M. Aude Morales, ‘Authentication Cheat Sheet’, OWASP Cheat Sheet Series. https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html ↩↩