Summary
backpack/crud is vulnerable to Cross-Site Scripting (XSS)
Workarounds
Alternatively (if you don’t want to run composer update), you can manually look inside your error views in “resources/views/errors” and output e($exception->getMessage()) instead of $exception->getMessage(). That’s all there is to the fix, really.
What the maintainers have done about this
Acted as soon as our team found it (last week of March 2022):
- Pushed patches to 5.x, 4.1 and 4.0;
- Made it easy to apply the fix to existing projects, using a new
php artisan backpack:fixcommand; - Kept the specific circumstances a secret; as far as they know, only the maintainer's team knows about the niche case where this exploit is possible;
- Emailed all our licensed users, to have a chance to fix their projects before it’s public;
- Sent an email blast to our 25.000+ strong Security Newsletter;
- Made this public with a blog post and soon a CVE, after our community has had a reasonable chance to fix their projects;
- Will continue to monitor this and remind paying users to apply this fix if they haven’t;
For more information
If you have any questions or comments about this advisory:
- Open an issue in backpack/crud
- Email us at [email protected]
PS. You can read this blog post for more information.
Impact
It’s a “moderate” vulnerability… but being an admin panel, take this seriously. It’s difficult… but an attacker could conduct a targeted phishing campaign, in order to trick your users or admins to click a malicious link, which under very specific circumstances could give them information... or even admin access. It’s unlikely, but that’s not good enough in admin panels - It should be made impossible. That’s why you are bothered with this.
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
If you don’t have custom error views, the views provided by Backpack would output the exception message without escaping it, which made an attack possible using Reflected XSS, in some very specific circumstances (that we will not disclose). To fix those error views in Backpack 4.x and 5.x, please run:
composer update backpack/crud
php artisan backpack:fix
The problem has been patched in:
- v4.0.63
- v4.1.69
- v5.0.13
IMPORTANT! Running a composer update should get you the patched version, but you also need to run php artisan backpack:fix afterwards, to patch your published error views, if necessary.
Frequently Asked Questions
- What is CVE-2022-31114? CVE-2022-31114 is a medium-severity cross-site scripting (XSS) vulnerability in backpack/crud (composer), affecting versions >= 5.0.0, < 5.0.13. It is fixed in 5.0.13, 4.1.69, 4.0.63. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- Which versions of backpack/crud are affected by CVE-2022-31114? backpack/crud (composer) versions >= 5.0.0, < 5.0.13 is affected.
- Is there a fix for CVE-2022-31114? Yes. CVE-2022-31114 is fixed in 5.0.13, 4.1.69, 4.0.63. Upgrade to this version or later.
- Is CVE-2022-31114 exploitable, and should I be worried? Whether CVE-2022-31114 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2022-31114 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2022-31114?
- Upgrade
backpack/crudto 5.0.13 or later - Upgrade
backpack/crudto 4.1.69 or later - Upgrade
backpack/crudto 4.0.63 or later
- Upgrade