An open API service providing security vulnerability metadata for many open source software ecosystems.

GSA_kwCzR0hTQS12MzNqLXYzeDQtNDJxZ84ABI-4

Moderate

Regex literal in Hurl files are not escaped when exported to HTML, allowing injections

Affected Packages Affected Versions Fixed Versions
cargo:hurl <= 6.1.1 7.0.0
0 Dependent packages
3 Dependent repositories
114,544 Downloads total

Affected Version Ranges

All affected versions

1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 2.0.0, 2.0.1, 3.0.0, 3.0.1, 4.0.0, 4.1.0, 4.2.0, 4.3.0, 5.0.0, 5.0.1, 6.0.0, 6.1.0, 6.1.1

All unaffected versions

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

References: