Summary
Cotonti 1.0.0's Personal File Storage module contains a stored cross-site scripting flaw in folder titles.
Authenticated users can save HTML or JavaScript in a folder title that is later rendered without escaping, causing script execution when other users view the folder listing.
Affected context
The vulnerability appears in Cotonti's Personal File Storage (PFS) module where folder metadata is managed and displayed.
It surfaces when folder titles (pff_title) are imported using a generic "TXT" filter that does not enforce HTML stripping or encoding, and later rendered into templates without proper escaping.
Any deployment that allows authenticated users to create or rename folders, especially where folders can be public or visible to other users, is exposed to this issue.
Exploit preconditions
- Attack surface: Web interface for managing PFS folders in Cotonti.
- Required access: Authenticated user account with permission to create or edit PFS folders.
- User interaction: A victim (including admins or other users) must visit a page that lists or displays the malicious folder title.
- Trigger point: The stored folder title is assigned to
PFF_ROW_TITLEinpfs.main.phpand rendered via{PFF_ROW_TITLE}inpfs.tplwithouthtmlspecialchars()or equivalent encoding. - Why exploitation is possible: Untrusted input is accepted without HTML sanitization and later injected into an HTML context without escaping, allowing arbitrary script execution in the browser.
Why this happens
This vulnerability stems from improper neutralization of user-supplied input before it is included in web pages, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
The import routine uses the "TXT" filter with tag checking disabled, meaning HTML tags and script content are accepted as-is for pff_title.
On output, the template binding assigns this value directly to PFF_ROW_TITLE and the template engine emits {PFF_ROW_TITLE} without HTML-encoding.
The combination of permissive input handling and missing contextual output encoding creates a persistent XSS sink where attacker-controlled content executes in other users' browsers.
Potential impact
- An attacker-controlled script may execute in the browser of any user viewing the affected PFS folder listing.
- Attackers could potentially hijack user sessions via stolen cookies or tokens (subject to cookie flags and browser protections).
- Malicious scripts could perform unauthorized actions on behalf of the victim using their authenticated session (CSRF-like behavior via XSS).
- Users could be phished or tricked through UI manipulation, fake dialogs, or injected forms.
- Administrative interfaces, if browsed while the payload runs, could be abused to alter configuration or create additional backdoors.
General mitigation guidance
Effective mitigation centers on enforcing strict output encoding for all untrusted data and narrowing the trust boundary of user-controlled fields.
Common defensive patterns include:
- Applying context-appropriate HTML encoding (for example, using
htmlspecialchars()or an equivalent) whenever user-controlled data is injected into HTML content. - Ensuring the input filtering pipeline does not rely solely on "safe" text filters; instead, design the system so that all user input is considered untrusted and is encoded on output.
- Introducing a standard templating practice or helper API that automatically escapes variables by default, requiring explicit opt-out for truly safe content.
- Avoiding storage of "trusted HTML" in the same fields used for normal user-supplied text; if rich content is necessary, segregate it and treat it with additional review and controls.
- Applying least-privilege design to features exposed to authenticated users so that compromise of one user account minimizes impact on others.
How teams detect issues like this
Detection strategies focus on identifying unescaped output paths and overly permissive input handling:
- Use static analysis or linters to flag direct echoing or template injection of variables that originate from request parameters or database fields without passing through an encoding function.
- During code review, look for patterns where user inputs are imported with generic filters (like a "TXT" filter) and later used in templates without explicit escaping.
- Implement security-focused unit and integration tests that inject benign XSS payload markers into text fields and verify they are rendered as escaped text rather than executed markup.
- Leverage application security testing tools (DAST and SAST) that can detect reflected and stored XSS by fuzzing input points and monitoring responses.
- Enforce security coding guidelines in CI/CD pipelines to block merges when new unescaped sinks or dangerous patterns are introduced.

