Cross-site Scripting Vulnerability in ZendFramework zend-view

zendframework/zend-view Updated 02 Oct 2025

Summary

07/06/2024
MODERATE
Yes i
Moderate
6.1

GHSA-m7hr-j867-3f34: ZendFramework has potential Cross-site Scripting vector in multiple view helpers. Affects zendframework/zend-view across 2 version ranges.

>= 2.0.0, < 2.2.7 >= 2.3.0, < 2.3.1

Fixed in 2.2.7 or 2.3.1, depending on the release line you run. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

ZendFramework is an open-source PHP framework that provides a collection of professional PHP packages. The zend-view package is a component of ZendFramework that offers various view helpers for generating HTML content. These view helpers assist in rendering forms, navigation menus, and other HTML elements. However, a vulnerability has been identified in multiple view helpers of zend-view that can potentially lead to cross-site scripting (XSS) attacks.

Vulnerability Detail

The vulnerability arises from the improper usage of the escapeHtml() view helper instead of the more appropriate escapeHtmlAttr() helper in many Zend Framework 2 view helpers. This issue affects the following components:

  • All Zend\Form view helpers
  • Most Zend\Navigation (aka Zend\View\Helper\Navigation\*) view helpers
  • All "HTML Element" view helpers: htmlFlash(), htmlPage(), htmlQuickTime()
  • Zend\View\Helper\Gravatar

When user data or JavaScript is used to populate HTML attributes, the incorrect usage of escapeHtml() can result in potential XSS attack vectors. An attacker may exploit this vulnerability to inject malicious code into web pages, compromising the security and integrity of the application.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.0.0, < 2.2.7 2.2.7
    composer require zendframework/zend-view:2.2.7
  • >= 2.3.0, < 2.3.1 2.3.1
    composer require zendframework/zend-view:2.3.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If upgrading to a fixed version is not immediately feasible, a temporary workaround can be implemented by manually modifying the affected view helpers to use escapeHtmlAttr() instead of escapeHtml(). Here is an example of how to update the Zend\Form view helper:

// Before
echo $this->formText('name', $value, ['class' => $class]);

// After
echo $this->formText('name', $value, ['class' => $this->escapeHtmlAttr($class)]);

Conclusion

The zend-view package in ZendFramework is vulnerable to cross-site scripting (XSS) attacks due to the improper usage of the escapeHtml() view helper. Upgrading to a fixed version or manually modifying the affected view helpers to use escapeHtmlAttr() can mitigate this vulnerability. It is crucial to address this issue promptly to protect the application from potential security breaches.

See every vulnerability recorded for zendframework/zend-view →

Share this vulnerability

FAQ

ZendFramework is an open-source PHP framework that provides a collection of professional PHP packages. It offers a robust set of tools and components for building web applications.

The zend-view package is a component of ZendFramework that provides various view helpers for generating HTML content. These helpers assist in rendering forms, navigation menus, and other HTML elements.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to the theft of sensitive information or the execution of unauthorized actions.

An attacker can exploit this vulnerability by injecting malicious code into web pages that utilize the vulnerable view helpers. This code can be executed by unsuspecting users, leading to potential data theft or unauthorized actions.

To fix this vulnerability, it is recommended to update the zend-view package to a fixed version that includes the necessary security patches. This will ensure that the appropriate escapeHtmlAttr() helper is used, mitigating the XSS vulnerability.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.0.0, < 2.2.7 2.2.7
    composer require zendframework/zend-view:2.2.7
  • >= 2.3.0, < 2.3.1 2.3.1
    composer require zendframework/zend-view:2.3.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. 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