# GHSA-h6mp-mc7g-mg49: scheb/two-factor-bundle bypass two-factor authentication with unverified JWT trusted device token

> An attacker can bypass two-factor authentication by generating trusted device cookies using a vulnerable JWT library, allowing unauthorized access to user accounts.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 May 2024

## What is GHSA-h6mp-mc7g-mg49?

GHSA-h6mp-mc7g-mg49 is an authentication bypass vulnerability in scheb/two-factor-bundle, published on 21 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Before version 3.7 the bundle is vulnerable to a [security issue in JWT](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/), which can be exploited by an attacker to generate trusted device cookies on their own, effectively by-passing two-factor authentication.

## Which versions are affected by GHSA-h6mp-mc7g-mg49?

2 open source packages ship an affected version, including scheb/two-factor-bundle.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `scheb/two-factor-bundle` | Packagist | From 3.0.0 | 3.7.0 |
| `scheb/two-factor-bundle` | Packagist | From 3.0.0 | 3.7.0 |

## How do I fix GHSA-h6mp-mc7g-mg49?

Upgrade scheb/two-factor-bundle to 3.7.0 or later.

## Is GHSA-h6mp-mc7g-mg49 being exploited?

There is no known exploitation of GHSA-h6mp-mc7g-mg49 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-h6mp-mc7g-mg49 and fix it if it is affected.

What it is: GHSA-h6mp-mc7g-mg49 is an authentication bypass vulnerability in scheb/two-factor-bundle, published on 21 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-h6mp-mc7g-mg49 in the wild and no public exploit code.

Affected packages and fixed versions:
- scheb/two-factor-bundle (Packagist): affected from 3.0.0; fixed in 3.7.0
- scheb/two-factor-bundle (Packagist): affected from 3.0.0; fixed in 3.7.0

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/GHSA-h6mp-mc7g-mg49/ (Markdown: https://insights.sbomify.com/GHSA-h6mp-mc7g-mg49/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-h6mp-mc7g-mg49

---
From sbomify Insights: https://insights.sbomify.com/GHSA-h6mp-mc7g-mg49/
Summaries are generated and may contain mistakes; the official description above is the record.
