Skip to content

Verification with an asymmetric key of a token signed with a symmetric key #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2015

Conversation

jfromaniello
Copy link
Member

There is a vulnerability in this module when the verification part is expecting a token digitally signed with an asymetric key (RS/ES family) of algorithms but instead the attacker send a token digitally signed with a symmetric algorithm (HS* family).

The issue is because this library has the very same signature to verify both type of tokens (parameter: secretOrPublicKey).

This change adds a new parameter to the verify called algorithms. This can be used to specify a list of supported algorithms, but the default value depends on the secret used: if the secretOrPublicKey contains the string BEGIN CERTIFICATE the default is:

[ 'RS256','RS384','RS512','ES256','ES384','ES512' ]

otherwise is

[ 'HS256','HS384','HS512' ]

…c key

There is a vulnerability in this module when the verification part is expecting a token digitally signed with an asymetric key (RS/ES family) of algorithms but instead the attacker send a token digitally signed with a symmetric algorithm (HS* family).

The issue is because this library has the very same signature to verify both type of tokens (parameter: `secretOrPublicKey`).

This change adds a new parameter to the verify called `algorithms`. This can be used to specify a list of supported algorithms, but the default value depends on the secret used: if the secretOrPublicKey contains the string `BEGIN CERTIFICATE` the default is `[ 'RS256','RS384','RS512','ES256','ES384','ES512' ]` otherwise is `[ 'HS256','HS384','HS512' ]`.
jfromaniello added a commit that referenced this pull request Mar 16, 2015
Verification with an asymmetric key of a token signed with a symmetric key
@jfromaniello jfromaniello merged commit c2bf7b2 into master Mar 16, 2015
@jfromaniello jfromaniello deleted the fix_alg_vuln_on_verify branch March 16, 2015 23:38
@jfromaniello
Copy link
Member Author

published as v4.2.0.

@pose
Copy link
Contributor

pose commented Mar 16, 2015

@jfromaniello Thanks for fixing this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants