# GHSA-v33j-v3x4-42qg: Regex literal in Hurl files are not escaped when exported to HTML, allowing injections

> Hurl CLI fails to escape regex literals in HTML exports, allowing attackers to inject malicious scripts that execute when the generated HTML is viewed.

- **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:** 11 Jun 2025

## What is GHSA-v33j-v3x4-42qg?

GHSA-v33j-v3x4-42qg is a cross-site scripting vulnerability in hurl, published on 11 Jun 2025. 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

Given this Hurl file:

regex.hurl:

```
GET https://foo.com
HTTP 200
[Asserts]
jsonpath "$.body" matches /<img src="" onerror="alert('Hi!')">/
```

When exported to HTML:

```
$ hurlfmt --out html regex.hurl
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">https://foo.com</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
<span class="line"><span class="section-header">[Asserts]</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.body"</span> <span class="predicate-type">matches</span> <span class="regex">/<img src="" onerror="alert('Hi!')">/</span></span>
</span></span><span class="line"></span>
</code></pre>
```

The regex literal `/<img src="" onerror="alert('Hi!')">/` is not escaped:

`<span class="regex">/<img src="" onerror="alert('Hi!')">/</span></span>`

When opened in a browser, the code is run without user interaction:

![regex](https://github.com/user-attachments/assets/9c20a2ff-900f-4420-b38b-1e7648749119)

## Which versions are affected by GHSA-v33j-v3x4-42qg?

2 open source packages ship an affected version, including hurl.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `hurl` | crates.io | All versions | 7.0.0 |
| `hurl` | crates.io | All versions | 7.0.0 |

## How do I fix GHSA-v33j-v3x4-42qg?

Upgrade hurl to 7.0.0 or later.

## Is GHSA-v33j-v3x4-42qg being exploited?

There is no known exploitation of GHSA-v33j-v3x4-42qg in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-v33j-v3x4-42qg and fix it if it is affected.

What it is: GHSA-v33j-v3x4-42qg is a cross-site scripting vulnerability in hurl, published on 11 Jun 2025. 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-v33j-v3x4-42qg in the wild and no public exploit code.

Affected packages and fixed versions:
- hurl (crates.io): affected all versions; fixed in 7.0.0
- hurl (crates.io): affected all versions; fixed in 7.0.0

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-v33j-v3x4-42qg/ (Markdown: https://insights.sbomify.com/GHSA-v33j-v3x4-42qg/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-v33j-v3x4-42qg

---
From sbomify Insights: https://insights.sbomify.com/GHSA-v33j-v3x4-42qg/
Summaries are generated and may contain mistakes; the official description above is the record.
