Summary
traQ instances using local storage can serve uploaded SVG or HTML files for direct rendering in a browser. If an attacker who can upload files gets another user to open a crafted file URL, JavaScript may run in that user's browser.
traQ instances using local storage can serve uploaded SVG or HTML files for direct rendering in a browser. If an attacker who can upload files gets another user to open a crafted file URL, JavaScript may run in that user's browser.
Affected context
The issue affects traQ instances configured with TRAQ_STORAGE_TYPE=local and versions prior to 3.28.3. It occurs when the /files/{fileId} endpoint returns user-uploaded SVG or HTML content in a way that allows the browser to render it as active content.
The issue affects traQ instances configured with TRAQ_STORAGE_TYPE=local and versions prior to 3.28.3. It occurs when the /files/{fileId} endpoint returns user-uploaded SVG or HTML content in a way that allows the browser to render it as active content.
Exploit preconditions
- Attack surface: The
/files/{fileId}file-retrieval endpoint on a traQ instance using local storage - Required access: The attacker must be able to upload a file
- Trigger point: A victim opens the URL for the uploaded file
- Why exploitation is possible: The file is rendered as active SVG or HTML content in the victim's browser, allowing embedded JavaScript to execute
- Attack surface: The
/files/{fileId}file-retrieval endpoint on a traQ instance using local storage - Required access: The attacker must be able to upload a file
- Trigger point: A victim opens the URL for the uploaded file
- Why exploitation is possible: The file is rendered as active SVG or HTML content in the victim's browser, allowing embedded JavaScript to execute
Why this happens
The application serves user-controlled SVG or HTML in a browser-renderable context without sufficiently preventing active content from running. This is a stored cross-site scripting flaw mapped to CWE-79, where untrusted input is included in content that a browser interprets as executable script or markup.
The application serves user-controlled SVG or HTML in a browser-renderable context without sufficiently preventing active content from running. This is a stored cross-site scripting flaw mapped to CWE-79, where untrusted input is included in content that a browser interprets as executable script or markup.
Potential impact
- Attacker-controlled JavaScript could run in a victim's browser in the context of the traQ site.
- The script may be able to access information available to that browser context or perform actions as the victim, subject to browser and application controls.
- User trust in links to uploaded files could be abused to expose other users to malicious content.
- Attacker-controlled JavaScript could run in a victim's browser in the context of the traQ site.
- The script may be able to access information available to that browser context or perform actions as the victim, subject to browser and application controls.
- User trust in links to uploaded files could be abused to expose other users to malicious content.
General mitigation guidance
Defensive patterns focus on preventing uploaded content from executing in the application's trusted browser context:
- Serve user-uploaded files as downloads rather than rendering active formats inline where practical.
- Use restrictive content types and browser security headers, including policies that limit script execution.
- Sanitize or reject active content when such formats are not required.
- Serve user content from an isolated origin that does not share application credentials.
- Limit upload privileges and apply least privilege to storage and file-serving components.
Defensive patterns focus on preventing uploaded content from executing in the application's trusted browser context:
- Serve user-uploaded files as downloads rather than rendering active formats inline where practical.
- Use restrictive content types and browser security headers, including policies that limit script execution.
- Sanitize or reject active content when such formats are not required.
- Serve user content from an isolated origin that does not share application credentials.
- Limit upload privileges and apply least privilege to storage and file-serving components.
How teams detect issues like this
- Review file-serving code for user-controlled content returned with browser-renderable content types or inline disposition.
- Use static analysis and code review to identify upload and retrieval paths that do not enforce content handling policies.
- Test upload and retrieval behavior with representative active file formats in a controlled environment.
- Enforce policies for approved file types, response headers, and isolated origins; automated security review tools may help flag risky patterns.
- Review file-serving code for user-controlled content returned with browser-renderable content types or inline disposition.
- Use static analysis and code review to identify upload and retrieval paths that do not enforce content handling policies.
- Test upload and retrieval behavior with representative active file formats in a controlled environment.
- Enforce policies for approved file types, response headers, and isolated origins; automated security review tools may help flag risky patterns.

