# GHSA-3Q6C-WFXW-7HJ6: Reflected XSS in news module search via double URL decoding of the q parameter

- Database: GitHub
- Severity: CVSS 6.1 (Medium)
- Published: 2026-10-02
- Modified: 2026-10-02

## Tracked as

- [CVE-2026-94599](https://cve.now/CVE-2026-94599.md): NukeViet reflected XSS in news module search

## Affected versions

- nukeviet/nukeviet (Packagist): from 4.5.00, through 4.6.01

## Description

### Impact

This is a reflected Cross-Site Scripting (XSS) vulnerability in the search function of the `news` module.
It is caused by the search keyword being URL-decoded after it has already been sanitized (CWE-174: Double Decoding of the Same Data).

The `q` parameter is read with `$nv_Request->get_title()`, which neutralizes `'`, `"`, `<` and `>`.
During that filtering, `%XX` sequences are resolved once more, so a value such as `%2522` becomes the literal text `%22` and passes the filter untouched.
`modules/news/funcs/search.php` then called `urldecode()` on the filtered value, turning `%22` into a real `"` after all sanitization had run.
The resulting raw keyword was passed to `search_theme()` and `search_result_theme()` and printed without escaping into:

- the `value="{KEY}"` attribute of the search input (attribute breakout, e.g. `autofocus onfocus=...`);
- the `<strong>{KEY}</strong>` element of the "no results" message (full tag injection, e.g. `<svg onload=...>`).

Both the `default` and `mobile_default` themes are affected.

Proof of concept (the `autofocus` attribute makes the payload fire on page load without further interaction):

```
https://example.com/search/?q=%252522%252520autofocus%252520onfocus%25253D%252522alert(document.domain)
```

An unauthenticated attacker can craft such a link and send it to any visitor.
When the victim opens it, arbitrary JavaScript runs in the origin of the NukeViet site.
Session cookies are `HttpOnly`, so they cannot be read directly.
However, the script can perform any same-origin action on behalf of the victim, including reading CSRF tokens and submitting forms.
If the victim is a logged-in administrator, this can be used to perform administrative actions in the admin panel.
The default Content Security Policy allows `'unsafe-inline'`, so it does not mitigate the attack.

Any site with the `news` module enabled is affected.

Affected versions: `>= 4.5.00, <= 4.6.01`.
The vulnerable `urldecode()` call was introduced in commit `76ee0a8b9` (April 2021).

### Patches

The vulnerability has been fixed in NukeViet `4.6.02`.
Users should upgrade to `4.6.02` or later.

The fix removes the extra `urldecode()` and the ad hoc filtering, and uses the output of `get_title()` directly.
That output is already decoded and HTML-escaped, so it is safe both for SQL (via `dblikeescape()`) and for output in templates.
The keyword length is still limited by `NV_MAX_SEARCH_LENGTH`.

### Workarounds

If upgrading is not possible right away, apply the patch manually in `modules/news/funcs/search.php` by replacing:

```php
$key = $nv_Request->get_title('q', 'get', '');
$key = str_replace(["'", '"', '<', '>', '&#039;', '&quot;', '&lt;', '&gt;'], '', $key);
$key = str_replace('+', ' ', urldecode($key));
$key = trim(nv_substr($key, 0, NV_MAX_SEARCH_LENGTH));
$keyhtml = nv_htmlspecialchars($key);
```

with:

```php
$key = nv_substr($nv_Request->get_title('q', 'get', ''), 0, NV_MAX_SEARCH_LENGTH);
```

and replacing every use of `$dbkeyhtml` / `$_dbkeyhtml` with `$dbkey` / `$_dbkey` in the same file.

As a temporary mitigation, a WAF rule can reject requests to the `news` search page whose `q` parameter contains `%25` (an encoded `%`), which blocks the multi-encoded payloads.

### References

- Fix commit: https://github.com/nukeviet/nukeviet/commit/de6b594b2bed0b6976293eec3815230e1f3ffe63
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'): https://cwe.mitre.org/data/definitions/79.html
- CWE-174: Double Decoding of the Same Data: https://cwe.mitre.org/data/definitions/174.html
- OWASP: Double Encoding: https://owasp.org/www-community/Double_Encoding

## References

- https://github.com/nukeviet/nukeviet/security/advisories/GHSA-3q6c-wfxw-7hj6

Page: https://cve.now/GHSA-3Q6C-WFXW-7HJ6
