# DRUPAL-CONTRIB-2022-002: This module enables you to implement OAuth 2.0 authentication for Drupal.

> Insufficient verification of client secrets in Drupal OAuth module allows bypassing confidentiality checks for certain grant types, potentially exposing data.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 5 Jan 2022

## What is DRUPAL-CONTRIB-2022-002?

DRUPAL-CONTRIB-2022-002 is an authentication bypass vulnerability in drupal/simple_oauth, published on 5 Jan 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

This module enables you to implement OAuth 2.0 authentication for Drupal.

The module doesn't sufficiently verify client secret keys for "confidential" OAuth 2.0 clients when using certain grant types. The token refresh and client credentials grants are not affected.

This vulnerability is mitigated by the fact that the vast majority of OAuth 2.0 clients in the wild are public, not confidential. Furthermore, all affected grant types still require users to authenticate to Drupal during the OAuth flow.

The implicit grant type is insecure for other reasons (and still requires user authentication) and is disabled by default.

Sites at risk of information disclosure would be specifically configured to restrict access based on the OAuth client's confidentiality status and configured scopes, not only traditional Drupal user permissions and roles.

Further mitigation includes [configuring allowed redirect URIs for clients](https://tools.ietf.org/html/rfc6819#section-5.2.3.5). This is an OAuth best practice for guarding against man-in-the-middle attacks on authorization codes, and prevents redirection to imposter clients.

Anyone implementing OAuth 2.0 on their Drupal site is also encouraged to review the [relevant RFCs and Internet-Drafts](https://oauth.net/security/) pertaining to OAuth security.

## Which versions are affected by DRUPAL-CONTRIB-2022-002?


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `drupal/simple_oauth` | Packagist:https://packages.drupal.org/8 | All versions | 4.6.0, 5.0.6 |

## How do I fix DRUPAL-CONTRIB-2022-002?

Apply the vendor's patch.

## Is DRUPAL-CONTRIB-2022-002 being exploited?

There is no known exploitation of DRUPAL-CONTRIB-2022-002 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for DRUPAL-CONTRIB-2022-002 and fix it if it is affected.

What it is: DRUPAL-CONTRIB-2022-002 is an authentication bypass vulnerability in drupal/simple_oauth, published on 5 Jan 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of DRUPAL-CONTRIB-2022-002 in the wild and no public exploit code.

Affected product: drupal/simple_oauth. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/DRUPAL-CONTRIB-2022-002/ (Markdown: https://insights.sbomify.com/DRUPAL-CONTRIB-2022-002/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/DRUPAL-CONTRIB-2022-002

---
From sbomify Insights: https://insights.sbomify.com/DRUPAL-CONTRIB-2022-002/
Summaries are generated and may contain mistakes; the official description above is the record.
