CVE-2021-39197 json
Cross-Site Request Forgery in better_errors
published 2021-09-07 5 y ago modified 2026-07-08 4 mo ago also GHSA-w3j4-76qw-wwjm , EUVD-2021-2122
- cvss
- 6.3
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.6%
- EPSS 0.6% chance of exploitation in 30 days, percentile 50%
- public exploits
- 0
- none known
Summary
better_errors is an open source replacement for the standard Rails error page with more information rich error pages. It is also usable outside of Rails in any Rack app as Rack middleware. better_errors prior to 2.8.0 did not implement CSRF protection for its internal requests. It also did not enforce the correct "Content-Type" header for these requests, which allowed a cross-origin "simple request" to be made without CORS protection. These together left an application with better_errors enabled open to cross-origin attacks. As a developer tool, better_errors documentation strongly recommends addition only to the `development` bundle group, so this vulnerability should only affect development environments. Please ensure that your project limits better_errors to the `development` group (or the non-Rails equivalent). Starting with release 2.8.x, CSRF protection is enforced. It is recommended that you upgrade to the latest release, or minimally to "~> 2.8.3". There are no known workarounds to mitigate the risk of using older releases of better_errors.
Patch / fix
- rubygems better_errors 2.8.0
- better_errors_project better_errors 2.8.0
Exploit prediction
0.64% chance of exploitation in the next 30 days, higher than 50% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 6.3 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N |
| NVD | 3.1 | 8.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| NVD | 2.0 | 6.8 | AV:N/AC:M/Au:N/C:P/I:P/A:P |
| GitHub | 3.1 | 6.3 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| rubygems | better_errors | <2.8.0 |
2.8.0 |
Affected products
- BetterErrors better_errors
Classification
- Weakness
-
- CWE-352 Cross-Site Request Forgery
References
-
github.com
/BetterErrors/better_errors/pull/474
web, patch, third-party-advisory
-
github.com
/BetterErrors/better_errors/commit/8e8e796bfbde4aa088741823c8a3fc6df2089bb0
web, patch, third-party-advisory
-
github.com
/BetterErrors/better_errors/security/advisories/GHSA-w3j4-76qw-wwjm
web, third-party-advisory
-
github.com
/BetterErrors/better_errors/discussions/507
web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-39197
advisory
-
github.com
/BetterErrors/better_errors
package
-
github.com
/rubysec/ruby-advisory-db/blob/master/gems/better_errors/CVE-2021-39197.yml
web
Sources
- CVE List CVE-2021-39197
- GitHub Advisory GHSA-w3j4-76qw-wwjm
- NVD CVE-2021-39197
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.