Cross-Site Request Forgery (CSRF) in better_errors (CVE-2021-39197)
Summary
Vulnerability in better_errors (CVE-2021-39197). Confidential information can be exposed externally. Exploitable via development. Mitigation: upgrade to 2.8.0 or later.
Original description
The description as published by the source.
Impact
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).
Patches
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".
Workarounds
There are no known workarounds to mitigate the risk of using older releases of better_errors.
References
- Chris Moberly provided an example attack that uses a now-patched vulnerability of webpack-dev-server in conjunction with Better Errors
For more information
If you have any questions or comments about this advisory, please
- Add to the discussion in better_errors
- Open an issue in better_errors
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2021-39197 has been found in better_errors.
Attackers can target a specific entry point like development over the network to misuse the product.
Confidential information can be exposed externally.
What to do: upgrade better_errors to 2.8.0 or later.
If unsure, ask your IT team or search "better_errors CVE-2021-39197" on the vendor's site.
CVE-2021-39197 (better_errors) — CWE-352
Attack vector: remote (network-reachable) / no user interaction
Attack surface: development
Patched: 2.8.0 — apply immediately
Workaround: There are no known workarounds to mitigate the risk of using older releases of better_errors.
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
CSRF (CWE-352) exists in better_errors. Attackers reach the vulnerable code path via development.
Check the vendor advisory for the affected versions of better_errors. Attack surface: development.
Severity: ?. Confidential information can be exposed externally.
Update to 2.8.0.
Workaround: There are no known workarounds to mitigate the risk of using older releases of better_errors.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'better_errors' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'better_errors' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
better_errorsを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply temporary workaround mitigate
There are no known workarounds to mitigate the risk of using older releases of better_errors.パッチが適用されるまでの応急処置として、There are no known workarounds to mitigate the risk of using older releases of better_errors. を実施。回避策の副作用 (機能低下) を確認した上で。
-
3Apply patch patch
Upgrade better_errors to 2.8.0ステージング環境で 2.8.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
4Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
References
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com