Drupal.theme.progressBar() does not escape output correctly

Created on 7 March 2024, 12 months ago
Updated 18 April 2024, 10 months ago

Problem/Motivation

Originally reported to the Drupal Security Team. We discussed internally and we could find no way to exploit this remotely - the progress bar is controlled from JavaScript or server side PHP - so we agreed this can be fixed in public.

Thanks to Tom Konda for reporting this originally.

Steps to reproduce

You can see this vulnerability by:
1. A developer write following JavaScript code. (This code is based on batch.js)
2. Display any page which loads this library.
3. An alert dialog is appeared.

  // This value is assumed to be retrieved from drupalSettings.
  const paramFromDrupalSettings = `"><img src="#" onerror="alert('XSS');" /></div><div id="mal`;

  const $xssTest = $('#target');
  const pb = new Drupal.ProgressBar(paramFromDrupalSettings);
  $xssTest.empty();
  $xssTest.append(pb.element);

Proposed resolution

Escape the ID in Drupal.theme.progressBar().

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.2

Component
Theme 

Last updated 3 days ago

Created by

🇬🇧United Kingdom longwave UK

Live updates comments and jobs are added and updated live.
  • Security improvements

    It makes Drupal less vulnerable to abuse or misuse. Note, this is the preferred tag, though the Security tag has a large body of issues tagged to it. Do NOT publicly disclose security vulnerabilities; contact the security team instead. Anyone (whether security team or not) can apply this tag to security improvements that do not directly present a vulnerability e.g. hardening an API to add filtering to reduce a common mistake in contributed modules.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024