# CVE-2021-41274: Authentication Bypass by CSRF Weakness

> A CSRF vulnerability in solidus_auth_devise allows attackers to take over user accounts if specific Rails forgery protection settings are used.

- **Severity:** Critical 9.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 17 Nov 2021
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-xm34-v85h-9pg2

## What is CVE-2021-41274?

CVE-2021-41274 is a critical vulnerability in solidusio solidus_auth_devise, published on 17 Nov 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

solidus_auth_devise provides authentication services for the Solidus webstore framework, using the Devise gem. In affected versions solidus_auth_devise is subject to a CSRF vulnerability that allows user account takeover. All applications using any version of the frontend component of `solidus_auth_devise` are affected if `protect_from_forgery` method is both: Executed whether as: A `before_action` callback (the default) or A `prepend_before_action` (option `prepend: true` given) before the `:load_object` hook in `Spree::UserController` (most likely order to find). Configured to use `:null_session` or `:reset_session` strategies (`:null_session` is the default in case the no strategy is given, but `rails --new` generated skeleton use `:exception`). Users should promptly update to `solidus_auth_devise` version `2.5.4`. Users unable to update should if possible, change their strategy to `:exception`. Please see the linked GHSA for more workaround details.

Weakness: CWE-352 (Cross-Site Request Forgery)

## Which versions are affected by CVE-2021-41274?

2 open source packages ship an affected version, including solidus_auth_devise. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `solidus_auth_devise` | RubyGems | From 1.0.0 | 2.5.4 |
| `solidus_auth_devise` | RubyGems | From 1.0.0 | 2.5.4 |

Products: Nebulab Solidus Auth Devise.

## How do I fix CVE-2021-41274?

Upgrade solidus_auth_devise to 2.5.4 or later.

## Is CVE-2021-41274 being exploited?

There is no known exploitation of CVE-2021-41274 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-41274 and fix it if it is affected.

What it is: CVE-2021-41274 is a critical vulnerability in solidusio solidus_auth_devise, published on 17 Nov 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-41274 in the wild and no public exploit code.

Affected packages and fixed versions:
- solidus_auth_devise (RubyGems): affected from 1.0.0; fixed in 2.5.4
- solidus_auth_devise (RubyGems): affected from 1.0.0; fixed in 2.5.4

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/CVE-2021-41274/ (Markdown: https://insights.sbomify.com/CVE-2021-41274/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-41274
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-41274
- OSV: https://osv.dev/vulnerability/CVE-2021-41274

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-41274/
Summaries are generated and may contain mistakes; the official description above is the record.
