Bug 2088544 (CVE-2022-29217) - CVE-2022-29217 python-jwt: Key confusion through non-blocklisted public key formats
Summary: CVE-2022-29217 python-jwt: Key confusion through non-blocklisted public key f...
Keywords:
Status: NEW
Alias: CVE-2022-29217
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On: 2088555 2088556 2088557 2089226 2089227 2089229 2095894 2095895 2088546 2088547 2088548 2088549 2088550 2088551 2088552 2088553 2088554 2089144 2089145 2089146 2089147 2089149 2089230 2089231 2095893 2095896 2095897 2098090 2098091 2098092 2207679 2258843
Blocks: 2088545
TreeView+ depends on / blocked
 
Reported: 2022-05-19 16:44 UTC by Guilherme de Almeida Suckevicz
Modified: 2024-01-17 16:44 UTC (History)
75 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A vulnerability was found in python-jwt. This issue happens when PyJWT supports multiple different JWT signing algorithms. This flaw allows an attacker submitting the JWT token to choose the used signing algorithm, leading to key confusion through non-blocklisted public key formats.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Guilherme de Almeida Suckevicz 2022-05-19 16:44:21 UTC
PyJWT supports multiple different JWT signing algorithms. With JWT, an attacker submitting the JWT token can choose the used signing algorithm.

The PyJWT library requires that the application chooses what algorithms are supported. The application can specify "jwt.algorithms.get_default_algorithms()" to get support for all algorithms. They can also specify a single one of them (which is the usual use case if calling jwt.decode directly. However, if calling jwt.decode in a helper function, all algorithms might be enabled.)

For example, if the user chooses "none" algorithm and the JWT checker supports that, there will be no signature checking. This is a common security issue with some JWT implementations.

PyJWT combats this by requiring that the if the "none" algorithm is used, the key has to be empty. As the key is given by the application running the checker, attacker cannot force "none" cipher to be used.

Similarly with HMAC (symmetric) algorithm, PyJWT checks that the key is not a public key meant for asymmetric algorithm i.e. HMAC cannot be used if the key begins with "ssh-rsa". If HMAC is used with a public key, the attacker can just use the publicly known public key to sign the token and the checker would use the same key to verify.

From PyJWT 2.0.0 onwards, PyJWT supports ed25519 asymmetric algorithm. With ed25519, PyJWT supports public keys that start with "ssh-", for example "ssh-ed25519".

Reference:
https://github.com/jpadilla/pyjwt/security/advisories/GHSA-ffqj-6fqr-9h24

Comment 1 Guilherme de Almeida Suckevicz 2022-05-19 16:50:09 UTC
Created cascadia-code-fonts tracking bugs for this issue:

Affects: fedora-all [bug 2088547]


Created jetbrains-mono-fonts tracking bugs for this issue:

Affects: fedora-all [bug 2088548]


Created openstack-keystone tracking bugs for this issue:

Affects: openstack-rdo [bug 2088555]


Created openstack-mistral tracking bugs for this issue:

Affects: openstack-rdo [bug 2088556]


Created openstack-vitrage tracking bugs for this issue:

Affects: openstack-rdo [bug 2088557]


Created picard tracking bugs for this issue:

Affects: fedora-all [bug 2088549]


Created python-PyGithub tracking bugs for this issue:

Affects: fedora-all [bug 2088550]


Created python-adal tracking bugs for this issue:

Affects: fedora-all [bug 2088551]


Created python-ibm-cloud-sdk-core tracking bugs for this issue:

Affects: fedora-all [bug 2088552]


Created python-jwt tracking bugs for this issue:

Affects: fedora-all [bug 2088546]


Created python-oauthlib tracking bugs for this issue:

Affects: fedora-all [bug 2088553]


Created python-twilio tracking bugs for this issue:

Affects: fedora-all [bug 2088554]

Comment 18 Paul Wouters 2023-01-24 21:12:31 UTC
why was a bug filed for python-twilio for this? It seems a bug in python-jwt and python-twilio has no requires for python-jwt ?

It also seems questionable that other packages listed above like "cascadia-code-fonts" were affected ?

Comment 19 Guilherme de Almeida Suckevicz 2023-01-25 14:17:22 UTC
Hi, if these packages do not depend on python-jwt it's probably a false positive from our scanner tool.

Running the tool again I can't even find these packages on the list anymore.

Feel free to close the tracker bugs related to these packages as NOTABUG.


Note You need to log in before you can comment on or make changes to this bug.