# GHSA-gvpp-6jrj-5pqc: Zend-Form vulnerable to Cross-site Scripting

> Attackers can execute arbitrary scripts in victim browsers via XSS in Zend Framework view helpers due to improper HTML attribute escaping.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 7 Jun 2024

## What is GHSA-gvpp-6jrj-5pqc?

GHSA-gvpp-6jrj-5pqc is a cross-site scripting vulnerability in zendframework/zend-form, published on 7 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Many Zend Framework 2 view helpers were using the escapeHtml() view helper in order to escape HTML attributes, instead of the more appropriate escapeHtmlAttr(). In situations where user data and/or JavaScript is used to seed attributes, this can lead to potential cross site scripting (XSS) attack vectors.

Vulnerable view helpers include:

- 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`

## Which versions are affected by GHSA-gvpp-6jrj-5pqc?

4 open source packages ship an affected version, including zendframework/zend-form.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `zendframework/zend-form` | Packagist | From 2.0.0 | 2.2.7 |
| `zendframework/zend-form` | Packagist | From 2.0.0 | 2.2.7 |
| `zendframework/zend-form` | Packagist | From 2.3.0 | 2.3.1 |
| `zendframework/zend-form` | Packagist | From 2.3.0 | 2.3.1 |

## How do I fix GHSA-gvpp-6jrj-5pqc?

Upgrade zendframework/zend-form to a fixed version for your release line: 2.2.7 or 2.3.1.

## Is GHSA-gvpp-6jrj-5pqc being exploited?

There is no known exploitation of GHSA-gvpp-6jrj-5pqc in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-gvpp-6jrj-5pqc and fix it if it is affected.

What it is: GHSA-gvpp-6jrj-5pqc is a cross-site scripting vulnerability in zendframework/zend-form, published on 7 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-gvpp-6jrj-5pqc in the wild and no public exploit code.

Affected packages and fixed versions:
- zendframework/zend-form (Packagist): affected from 2.0.0; fixed in 2.2.7
- zendframework/zend-form (Packagist): affected from 2.0.0; fixed in 2.2.7
- zendframework/zend-form (Packagist): affected from 2.3.0; fixed in 2.3.1
- zendframework/zend-form (Packagist): affected from 2.3.0; fixed in 2.3.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-gvpp-6jrj-5pqc/ (Markdown: https://insights.sbomify.com/GHSA-gvpp-6jrj-5pqc/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-gvpp-6jrj-5pqc

---
From sbomify Insights: https://insights.sbomify.com/GHSA-gvpp-6jrj-5pqc/
Summaries are generated and may contain mistakes; the official description above is the record.
