Summary
lakeFS Web UI renders Markdown repository objects as HTML without adequately sanitizing the resulting content, allowing stored cross-site scripting. A user with write access to a repository branch may commit a malicious Markdown file, causing scripts to run in the authenticated sessions of users who view the file or related repository pages.
Affected context
The vulnerability occurs in lakeFS deployments where the Web UI renders Markdown files from repository objects as HTML without effective output sanitization. It is relevant when a user can write objects to a repository branch and other users can open those objects or browse repository and directory pages that display a malicious README.md.
Exploit preconditions
- Attack surface: lakeFS Web UI Markdown rendering
- Required access: Write access to a repository branch or another path that permits committing Markdown objects
- Trigger point: A victim opens the malicious Markdown file or navigates to a repository or directory where it is rendered
- Why exploitation is possible: Repository-controlled Markdown is converted to browser-rendered HTML without reliably neutralizing active script content
Why this happens
The underlying bug is insufficient output encoding and sanitization when converting untrusted Markdown into HTML.
Because repository contributors can control the Markdown content, treating the rendered result as trusted browser markup allows attacker-supplied scripts to execute in the origin of the lakeFS Web UI.
This maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Potential impact
- An attacker-controlled script may execute in another user's authenticated browser session
- Sensitive information available to the Web UI may be exposed
- Unauthorized actions may be performed with the victim's permissions
- Repository data or configuration may be altered through victim-assisted requests
- Other users may be targeted through malicious repository or directory README content
General mitigation guidance
Mitigation generally focuses on treating all repository-authored Markdown as untrusted content.
Common defensive patterns include:
- Sanitize rendered HTML with a well-maintained allowlist that excludes scripts, event handlers, dangerous URLs, and active browser content
- Prefer secure Markdown rendering modes that produce inert text or strictly constrained HTML
- Apply context-appropriate output encoding and avoid inserting unsanitized HTML into the DOM
- Use a restrictive Content Security Policy as defense in depth
- Limit repository write permissions and review changes to user-facing documentation files
- Keep authenticated sessions, cookies, and privileged browser actions protected with appropriate origin and browser security controls
- Provide an administrative control to disable Markdown rendering where safe rendering cannot be guaranteed
How teams detect issues like this
Organizations can detect related risks through:
- Static analysis rules for unsanitized Markdown-to-HTML rendering and unsafe DOM insertion
- Code review checks for direct use of HTML rendering APIs, innerHTML-like sinks, and incomplete sanitization allowlists
- Security tests containing harmless markup and script-like control characters to verify that rendered output remains inert
- Browser-based tests that confirm repository-controlled content cannot execute in authenticated UI contexts
- Policy enforcement requiring approved sanitization libraries, restrictive Content Security Policy headers, and review of user-controlled content flows
- Monitoring for unexpected script execution, unusual authenticated UI requests, or suspicious changes to README and Markdown objects

