CVE-2024-32877: Reflected Cross-site Scripting in yiisoft/yii2 Debug mode

yiisoft/yii2 Updated 02 Oct 2025

Summary

02/06/2024
Yes i
Moderate
4.2

CVE-2024-32877: Reflected Cross-site Scripting in yiisoft/yii2 Debug mode. Affects yiisoft/yii2 versions >= 2.0.43, < 2.0.49.4. Fixed in 2.0.49.4. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Yii2 is a popular PHP framework used for developing web applications. It provides a wide range of features and functionalities to simplify the development process. However, the framework is vulnerable to a reflected cross-site scripting (XSS) attack when it is in debug mode. This vulnerability affects the latest version of Yii2 (2.0.49.3).

Vulnerability Detail

The vulnerability occurs when the framework is in debug mode and an exception is induced in the application, resulting in a stack trace page being displayed. The issue lies in the mechanism for displaying function argument values in the stack trace. If an argument's value exceeds 32 characters, it is truncated and displayed with an added "...". However, an attacker can exploit this by injecting their own attributes, including malicious JavaScript code, into the span tag using a double quote ("). This allows the attacker to execute arbitrary JavaScript code in the victim's site, potentially leading to cookie theft, content substitution, or complete takeover of user accounts.

How To Fix

Minimum fixed version

2.0.49.4

This is the first release that contains the fix.

composer require yiisoft/yii2:2.0.49.4

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is recommended to apply the suggested fix as soon as possible.

Conclusion

In conclusion, the Yii2 framework is vulnerable to a reflected cross-site scripting (XSS) attack when it is in debug mode. This can allow an attacker to execute arbitrary JavaScript code in the victim's site, potentially leading to serious security breaches. It is highly recommended to apply the suggested fix as soon as possible to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for yiisoft/yii2 →

Share this vulnerability

FAQ

This vulnerability allows an attacker to execute arbitrary JavaScript code in the security context of the victim's site. This can lead to the theft of cookies, content substitution, or complete takeover of user accounts.

The vulnerability affects the latest version of Yii2 (2.0.49.3).

No, there is no known workaround for this vulnerability. It is recommended to apply the suggested fix as soon as possible.

You can use Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. It analyzes your composer.lock file and provides real-time alerts for open-source vulnerabilities.

For further assistance or support on vulnerability remediation, you can contact info@devnack.com.

Related vulnerabilities

Recent vulnerabilities recorded for yiisoft/yii2.

How To Fix

Minimum fixed version

2.0.49.4

This is the first release that contains the fix.

composer require yiisoft/yii2:2.0.49.4

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback