Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2022-31114

CVE-2022-31114: Backpack CRUD XSS Vulnerability

CVE-2022-31114 is a cross-site scripting flaw in Backpack CRUD that enables phishing attacks to gain unauthorized access. This post covers the technical details, affected versions, security impact, and mitigation.

Published:

CVE-2022-31114 Overview

CVE-2022-31114 is a cross-site scripting (XSS) vulnerability affecting backpack/crud, a Laravel package that provides Create, Read, Update, and Delete (CRUD) operations for the Backpack administration panel framework. The flaw exists in error view templates that output exception messages without proper escaping. An attacker can craft a malicious link that, under specific circumstances, executes script content in the context of a targeted user or administrator session. Successful exploitation requires user interaction through a phishing campaign or social engineering. The issue is tracked as [CWE-79] (Improper Neutralization of Input During Web Page Generation).

Critical Impact

Targeted phishing combined with this XSS flaw could expose session information or grant attacker access to administrative functionality in Backpack-powered admin panels.

Affected Products

  • backpack/crud versions prior to 5.0.13
  • backpack/crud versions prior to 4.1.69
  • backpack/crud versions prior to 4.0.63

Discovery Timeline

  • 2026-06-03 - CVE-2022-31114 published to NVD
  • 2026-06-03 - Last updated in NVD database

Technical Details for CVE-2022-31114

Vulnerability Analysis

The vulnerability resides in error view templates shipped with the Backpack CRUD package. These templates render the exception message returned by Laravel's exception handler directly into HTML output. Because the message is emitted using $exception->getMessage() rather than the escaped form e($exception->getMessage()), attacker-controlled content reflected through an exception can break out of the surrounding HTML context. This produces a reflected XSS condition exploitable through a crafted URL.

Root Cause

The root cause is missing output encoding in the Blade templates located under resources/views/errors. Laravel's e() helper applies htmlspecialchars encoding to neutralize HTML control characters. The vulnerable templates omit this helper when echoing exception messages, allowing raw HTML and JavaScript to reach the browser when an exception incorporates user-supplied input.

Attack Vector

Exploitation requires user interaction. An attacker constructs a URL that triggers an exception whose message includes attacker-controlled markup, then delivers the link through phishing or another social engineering channel. When an administrator clicks the link, the error page renders the unescaped payload in the authenticated admin context. The script can read session data, issue authenticated requests, or pivot toward administrative functionality.

No verified public exploit code is available. Refer to the GitHub Security Advisory GHSA-m8xx-3x29-84h8 for vendor technical details.

Detection Methods for CVE-2022-31114

Indicators of Compromise

  • Web server access logs showing requests to Backpack admin routes that return 4xx or 5xx error pages with unusual query parameters containing HTML tags or JavaScript syntax.
  • Outbound requests from administrator browsers to attacker-controlled domains following access to a Backpack admin URL.
  • Unexpected session activity or privilege changes in the Backpack admin panel shortly after an administrator clicked an external link.

Detection Strategies

  • Inspect Laravel error views under resources/views/errors for any direct use of $exception->getMessage() without the e() escape helper.
  • Review web application firewall (WAF) logs for requests containing encoded script payloads targeting Backpack routes.
  • Audit installed Composer dependencies to identify backpack/crud versions below 5.0.13, 4.1.69, or 4.0.63.

Monitoring Recommendations

  • Enable Content Security Policy (CSP) reporting to surface inline script execution attempts on admin endpoints.
  • Correlate admin login sessions with referrer headers and external link clicks to identify phishing-driven access.
  • Forward web server, application, and authentication logs to a centralized analytics platform for cross-source correlation.

How to Mitigate CVE-2022-31114

Immediate Actions Required

  • Upgrade backpack/crud to version 5.0.13, 4.1.69, or 4.0.63 depending on the major release in use.
  • Run composer update backpack/crud and verify the installed version with composer show backpack/crud.
  • Notify administrators about phishing risk and instruct them to avoid clicking unsolicited links targeting the admin panel.

Patch Information

The maintainers released fixes in backpack/crud 5.0.13, 4.1.69, and 4.0.63. The patches apply the e() escaping helper to exception output in the affected error views. Full advisory details are available in the Laravel Backpack CRUD Security Advisory.

Workarounds

  • Manually edit error view templates under resources/views/errors and replace any occurrence of $exception->getMessage() with e($exception->getMessage()).
  • Deploy a WAF rule that strips or blocks HTML control characters in query parameters routed to admin error handlers.
  • Implement a strict Content Security Policy that disallows inline script execution on Backpack admin routes.
bash
# Upgrade backpack/crud to a patched release
composer require backpack/crud:^5.0.13
composer show backpack/crud | grep versions

# Manual workaround: locate unescaped exception output
grep -rn '$exception->getMessage()' resources/views/errors

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.