Sep 25, 2026·5 min read·3 visits
A stored cross-site scripting vulnerability in code16 Sharp allows authenticated users to inject arbitrary JavaScript via the 'srcdoc' attribute of an 'iframe' in rich-text fields. This bypasses backend sanitization because web browsers decode HTML entities within this attribute before execution.
A stored cross-site scripting (XSS) vulnerability was identified in the content-management and administrative framework code16 Sharp. The flaw stems from an overly permissive HTML sanitization configuration that whitelists the 'srcdoc' attribute on HTML 'iframe' tags. When processed and stored, browsers render the content of this attribute by decoding nested HTML entities, converting sanitized elements back into executable code.
The administrative and content-management framework code16 Sharp for Laravel utilizes a rich-text editor allowing content creators to format and structure HTML. To prevent security issues, the framework employs an HTML sanitizer on incoming submissions before storing them in the persistent database layer.
However, in versions prior to 9.22.5, the backend sanitization rules explicitly allowed the 'srcdoc' attribute on 'iframe' elements. This configuration creates a critical parsing vector due to the structural differences between how server-side libraries sanitize raw HTML and how client-side user agents render the nested documents of iframes.
Because the input is persistently stored, any user with permission to edit a rich-text field can introduce malicious scripts. When another administrative user views the edited content within the Sharp interface, the script executes, creating a significant privilege escalation risk.
The root cause of this vulnerability lies in the improper neutralization of input within nested browser rendering contexts (CWE-79). When a server-side HTML sanitizer processes an iframe with a 'srcdoc' attribute, it attempts to protect the page by HTML-encoding active tag markers inside the attribute. For example, the string <script> becomes <script>.
While this sanitization is sufficient for typical attribute contexts, the 'srcdoc' attribute defines the content of an embedded HTML document. Web browsers natively process this attribute by applying a standard decoding pass. During this pass, the browser converts all HTML entities (such as < and >) back into their literal characters before executing the DOM parser inside the frame.
Consequently, the browser reverses the safety measures applied by the sanitizer. The safe, encoded string is normalized back into an active script block inside the document. The browser then executes the script in the context of the parent domain unless isolated by a strict sandbox configuration.
The configuration error was located within the backend formatting class at src/Utils/Sanitization/FormatsSanitizedValue.php. The sanitizer instances whitelisted several attributes on iframe elements, including the vulnerable 'srcdoc' attribute.
Below is the relevant code before the remediation was applied:
private function sanitizer(): HtmlSanitizer
{
return (new HtmlSanitizer())
// ...
->allowAttribute('srcdoc', 'iframe') // The vulnerable configuration
// ...
}The fix, implemented in commit ec509a22c808a5bd9dfad6a0a85c92ce6f411e21, removes 'srcdoc' from the allowed properties. Below is the patch details:
File: src/Utils/Sanitization/FormatsSanitizedValue.php
@@ -49,7 +49,6 @@ private function sanitizer(): HtmlSanitizer
'referrerpolicy',
'sandbox',
'src',
- 'srcdoc',
'width',
'height',
'id',Additionally, the patch hardens data attributes (specifically 'data-html-content') to ensure they are only preserved if the RAW_HTML option is enabled in the rich-text field's toolbar. This prevents alternative bypass paths using unescaped data tags.
An attacker with authenticated access to edit rich-text fields within the admin panel constructs a payload targeting the nested parsing behavior of the iframe. This payload consists of an iframe tag whose 'srcdoc' attribute contains encoded scripting elements.
<iframe srcdoc="<script>alert('Stored XSS')</script>"></iframe>When the application processes this payload, the backend sanitizer evaluates the input. Because 'srcdoc' is whitelisted, the parser accepts the attribute without stripping it. The application saves the sanitized markup to the database.
Upon retrieval, the application renders the raw iframe within the DOM. The browser processes the 'srcdoc' attribute, decodes the HTML entities, and executes the payload inside the frame, bypassing standard sanitization filters.
A successful attack allows arbitrary JavaScript to execute in the security context of the victim's session. Since code16 Sharp is a Laravel-based administrative and content-management framework, the typical user of this interface holds elevated privileges (e.g., content managers, editors, and administrators).
The executing script can perform actions on behalf of the victim. This includes hijacking active sessions via cookie extraction (unless protected by HttpOnly flags), reading sensitive data exposed in the administrative console, or silently performing state-changing operations such as creating new administrative accounts, modifying application configurations, or deploying malicious templates.
The primary remediation strategy is upgrading the code16/sharp package to version 9.22.5 or higher. This permanently removes 'srcdoc' from the whitelist of the underlying sanitizer.
If upgrading immediately is not possible, a temporary workaround can be achieved via a global Laravel middleware or custom validation rules. This layer should analyze incoming editor fields and remove 'srcdoc' attributes using an XML/HTML DOM parser before storing the content.
public function sanitizeIncomingContent(string $content): string
{
// Temporary regular expression to strip the srcdoc attribute if DOM parsing is unavailable
return preg_replace('/<iframe\b[^>]*\bsrcdoc\s*=\s*(["\'])(.*?)\1/is', '<iframe>', $content);
}For defense-in-depth, configure a Content Security Policy (CSP) header that restricts iframe generation (frame-src 'self') and limits script execution domains to trusted sources.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
sharp code16 | < 9.22.5 | 9.22.5 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-79 |
| Attack Vector | Network (N) |
| CVSS Score | 7.3 |
| EPSS Score | 0.0021 |
| EPSS Percentile | 10.08% |
| Exploit Status | poc |
| KEV Status | Not Listed |
CVE-2026-61825 is a high-severity, stored Cross-Site Scripting (XSS) vulnerability identified in code16/sharp, a Laravel-based administrative framework. The flaw resides within the administrative backend's rich-text and markdown editor field formatter. By bypassing HTML sanitization via crafted elements containing the data-html-content attribute or iframe srcdoc execution parameters, lower-privileged users can inject and execute arbitrary JavaScript code.
CVE-2026-57440 is a high-severity stored Cross-Site Scripting (XSS) vulnerability affecting the EmbedVideo extension for MediaWiki. When the extension is configured with consent requirements disabled ($wgEmbedVideoRequireConsent = false), video URLs and service IDs are parsed and inserted directly into the 'src' attribute of a generated iframe element without sanitization or context-aware escaping. This allows an attacker with editing privileges to inject arbitrary JavaScript and execute malicious commands in the context of other users' sessions.
A critical logical vulnerability in the FriendsOfFlarum OAuth (fof/oauth) extension allows unauthenticated remote attackers to perform complete account takeover, including administrative profiles. This vulnerability is caused by a failure to verify the email verification status returned by third-party identity providers such as Discord before asserting that the email is trusted and matching it to existing local accounts.
A critical sanitizer bypass vulnerability exists in the xhtml-purifier Node.js library prior to version 0.4.3. Due to a lack of HTML entity encoding during the attribute re-serialization phase, unauthenticated remote attackers can break out of double-quoted attribute contexts to inject arbitrary script handlers, resulting in Cross-Site Scripting.
CVE-2026-61741 is a critical XML External Entity (XXE) injection vulnerability in the http4s-scala-xml library. The vulnerability allows remote, unauthenticated attackers to perform arbitrary local file disclosure, execute server-side request forgery (SSRF) attacks, or cause denial of service via recursive entity expansion. The vulnerability stems from the use of an unconfigured SAXParserFactory, which enables external entity resolution by default.
A critical DNS rebinding vulnerability in DBHub (associated with GHSA-fm8p-53ww-hf6w) allows unauthenticated remote attackers to execute arbitrary SQL queries against local and internal databases. By exploiting a relative origin validation check within the HTTP transport middleware, an attacker can bypass same-origin protections via DNS rebinding. This allows malicious external websites to send JSON-RPC commands to the local DBHub service to read, write, and exfiltrate database contents. The issue affects all versions of DBHub prior to 0.22.5.