[Bug]: Stored XSS via project name in the analytic AJAX layout (AnalyticController)
Bug Summary
Kanboard 1.2.54 is affected by a stored cross-site scripting vulnerability in the AJAX rendering path used by project Analytics views. A project manager can store an HTML/JavaScript payload in a project name. When a project manager or application administrator opens an Analytics view for that project, the payload is rendered unescaped in the modal title and executes in the viewer's browser.
Description
ProjectEditController::update() accepts a project name and ProjectModel::update() stores it without HTML sanitization. ProjectValidator::validateModification() applies required and maximum-length validation but does not encode or filter HTML.
For all AnalyticController actions, LayoutHelper::analytic() builds a title by concatenating the project name with the analytic-view title:
if (isset($params['project']['name'])) {
$params['title'] = $params['project']['name'].' > '.$params['title'];
}For AJAX requests, app/Template/analytic/layout.php renders the title with raw PHP output:
<?php if ($is_ajax): ?>
<div class="page-header">
<h2><?= $title ?></h2>
</div>
<?php endif ?>The front-end modal inserts the AJAX response through element.innerHTML = html; therefore, attacker-controlled markup in the project name is parsed and executed by the browser.
The affected actions are taskDistribution, userDistribution, cfd, burndown, averageTimeByColumn, leadAndCycleTime, timeComparison, and estimatedVsActualByColumn.
Steps to Reproduce
Log in as a user with the
project-managerrole for a project.Open the project edit page and obtain the CSRF token.
Change the project name to the following payload and save it:
<img src=x onerror=alert(document.domain)>Open Analytics for the same project, for example Task distribution.
Load the analytic view through its AJAX request:
GET /index.php?controller=AnalyticController&action=taskDistribution&project_id=1 HTTP/1.1 Host: TARGET Cookie: KB_SID=<SESSION> X-Requested-With: XMLHttpRequestObserve the unescaped project name in the
<h2>element of the response. When the response is opened through the modal, the payload executes.
Expected Behavior
Project names must be HTML-escaped before being included in the analytic AJAX title. The response should render the payload as text:
<h2><img src=x onerror=alert(document.domain)> > Task distribution</h2>Actual Behavior
The project name is output without escaping:
<h2><img src=x onerror=alert(document.domain)> > Task distribution</h2>The AJAX modal injects the returned HTML using innerHTML, causing the stored JavaScript payload to execute in the browser session of a project manager or application administrator viewing the affected project.
Version
1.2.54
Database
Any Kanboard-supported database backend
PHP Version
No response
Browser
No response
Operating System
No response
Relevant Logs or Error Output
Additional Context
No response
Checklist
- I have searched existing issues to ensure this bug hasn't been reported before.
- I verified that the problem is not caused by a plugin. Please report the issue to the plugin author if applicable.
Source: kanboard/kanboard