Loading HuntDB...

CVE-2024-32877

MEDIUM
Published 2024-05-30T19:52:58.418Z
Actions:

Expert Analysis

Professional remediation guidance

Get tailored security recommendations from our analyst team for CVE-2024-32877. We'll provide specific mitigation strategies based on your environment and risk profile.

CVSS Score

V3.1
4.2
/10
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
Base Score Metrics
Exploitability: N/A Impact: N/A

EPSS Score

v2025.03.14
0.003
probability
of exploitation in the wild

There is a 0.3% chance that this vulnerability will be exploited in the wild within the next 30 days.

Updated: 2025-06-25
Exploit Probability
Percentile: 0.542
Higher than 54.2% of all CVEs

Attack Vector Metrics

Attack Vector
NETWORK
Attack Complexity
HIGH
Privileges Required
NONE
User Interaction
REQUIRED
Scope
UNCHANGED

Impact Metrics

Confidentiality
LOW
Integrity
LOW
Availability
NONE

Description

Yii 2 is a PHP application framework. During internal penetration testing of a product based on Yii2, users discovered a Cross-site Scripting (XSS) vulnerability within the framework itself. This issue is relevant for the latest version of Yii2 (2.0.49.3). This issue lies in the mechanism for displaying function argument values in the stack trace. The vulnerability manifests when an argument's value exceeds 32 characters. For convenience, argument values exceeding this limit are truncated and displayed with an added "...". The full argument value becomes visible when hovering over it with the mouse, as it is displayed in the title attribute of a span tag. However, the use of a double quote (") allows an attacker to break out of the title attribute's value context and inject their own attributes into the span tag, including malicious JavaScript code through event handlers such as onmousemove. This vulnerability allows an attacker to execute arbitrary JavaScript code in the security context of the victim's site via a specially crafted link. This could lead to the theft of cookies (including httpOnly cookies, which are accessible on the page), content substitution, or complete takeover of user accounts. This issue has been addressed in version 2.0.50. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Available Exploits

No exploits available for this CVE.

Related News

No news articles found for this CVE.

Affected Products

GitHub Security Advisories

Community-driven vulnerability intelligence from GitHub

✓ GitHub Reviewed MODERATE

Reflected Cross-site Scripting in yiisoft/yii2 Debug mode

GHSA-qg5r-95m4-mjgj

Advisory Details

During the internal penetration testing of our product based on Yii2, we discovered an XSS vulnerability within the framework itself. This issue is relevant for the latest version of Yii2 (2.0.49.3). ### Conditions for vulnerability reproduction * The framework is in debug mode (YII_DEBUG set to true). * The php.ini setting zend.exception_ignore_args is set to Off (default value). * An attacker induces an exception in the application, leading to a stack trace page being displayed. ### Vulnerability description The issue lies in the mechanism for displaying function argument values in the stack trace. The vulnerability manifests when an argument's value exceeds 32 characters. For convenience, argument values exceeding this limit are truncated and displayed with an added "...". The full argument value becomes visible when hovering over it with the mouse, as it is displayed in the title attribute of a span tag. However, the use of a double quote (") allows an attacker to break out of the title attribute's value context and inject their own attributes into the span tag, including malicious JavaScript code through event handlers such as onmousemove. Demonstration example: http://31.184.254.143/about/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa%22%20onmousemove=alert(1)%20style=%22width:%20100000px;%20height:%20100000px;%20position:%20absolute;%20top:%20-10000px;%20left:%200;%22 ### Impact of the vulnerability This vulnerability allows an attacker to execute arbitrary JavaScript code in the security context of the victim's site via a specially crafted link. This could lead to the theft of cookies (including httpOnly cookies, which are accessible on the page), content substitution, or complete takeover of user accounts. ### Technical analysis and mitigation suggestion Upon analyzing the framework's source code, it was found that data handling for the title attribute is performed in the file framework/web/ErrorHandler.php. The identified problem is related to changes made in the commit https://github.com/yiisoft/yii2/commit/8cc9aeb2f0b2ffe02fb54a817064e9da75512706 , which led to the disabling of encoding for single and double quotes in the htmlEncode method (https://github.com/yiisoft/yii2/blob/8cc9aeb2f0b2ffe02fb54a817064e9da75512706/framework/web/ErrorHandler.php#L183) due to the addition of the ENT_NOQUOTES flag. To address this issue while preserving the functionality intended by the commit, we suggest modifying the htmlEncode method as follows: return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8'); This change will effectively prevent the XSS vulnerability while maintaining the targeted functionality of the previous changes. ### Conclusion Based on the above, we strongly recommend implementing the suggested changes to the project's main code as soon as possible to protect framework users from potential attacks. I am ready to provide further information or assistance, including creating a pull request if necessary.

Affected Packages

Packagist yiisoft/yii2
ECOSYSTEM: ≥2.0.43 <2.0.49.4

CVSS Scoring

CVSS Score

5.0

CVSS Vector

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N

Advisory provided by GitHub Security Advisory Database. Published: June 2, 2024, Modified: July 8, 2024

References

Published: 2024-05-30T19:52:58.418Z
Last Modified: 2024-08-02T02:20:35.655Z
Copied to clipboard!