Stored Cross-Site Scripting (XSS) in SimplCommerce News Module Admin Interface
Description
Stored cross-site scripting (XSS) in NewsItemApiController In SimplCommerce prior to commit 6142d3b5 allows an authenticated administrator to execute arbitrary JavaScript via the ShortContent and FullContent fields, which are stored without HTML sanitization and rendered unencoded via @Html.Raw()
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
1- Range: < commit 6142d3b5
Patches
Vulnerability mechanics
Root cause
"Missing HTML sanitization on ShortContent and FullContent fields in NewsItemApiController allows stored cross-site scripting."
Attack vector
An authenticated administrator sends a POST or PUT request to the news item API endpoint with malicious JavaScript embedded in the `ShortContent` or `FullContent` fields. The server stores the unsanitized payload in the database. When any user (including other administrators or visitors) views the news item, the view renders the content using `@Html.Raw()`, which emits the raw HTML without encoding, causing the attacker's script to execute in the victim's browser. The attack requires an admin account but no special network position beyond HTTP access to the API.
Affected code
The vulnerability resides in `NewsItemApiController` (`src/Modules/SimplCommerce.Module.News/Areas/News/Controllers/NewsItemApiController.cs`). The `Post` and `Put` actions assign `model.ShortContent` and `model.FullContent` directly to the entity without sanitization, and the stored values are later rendered via `@Html.Raw()` in views, enabling stored XSS.
What the fix does
The patch adds a reference to the `Ganss.Xss` namespace and instantiates an `HtmlSanitizer` instance in the controller. In both the `Post` and `Put` methods, the `ShortContent` and `FullContent` values are now passed through `_htmlSanitizer.Sanitize()` before being stored. This strips or encodes dangerous HTML elements and attributes, preventing malicious script injection while preserving safe markup. The companion commit [patch_id=6351302] adds the `HtmlSanitizer` NuGet package dependency to the project file.
Preconditions
- authAttacker must be an authenticated administrator with access to the news item API endpoints.
- networkAttacker must be able to send HTTP POST or PUT requests to the news item controller.
- configThe application must render the stored ShortContent or FullContent fields using @Html.Raw() in a view.
Generated on Jun 17, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2News mentions
0No linked articles in our index yet.