CVE-2023-44393: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (CWE-79)
value: Piwigo is an open source photo gallery application. Prior to version 14.0.0beta4, a reflected cross-site scripting (XSS) vulnerability is in the` /admin.php?page=plugins&tab=new&installstatus=ok&plugin_id=[here]` page. This vulnerability can be exploited by an attacker to inject malicious HTML and JS code into the HTML page, which could then be executed by admin users when they visit the URL with the payload. The vulnerability is caused by the insecure injection of the `plugin_id` value from the URL into the HTML page. An attacker can exploit this vulnerability by crafting a malicious URL that contains a specially crafted `plugin_id` value. When a victim who is logged in as an administrator visits this URL, the malicious code will be injected into the HTML page and executed. This vulnerability can be exploited by any attacker who has access to a malicious URL. However, only users who are logged in as administrators are affected. This is because the vulnerability is only present on the `/admin.php?page=plugins&tab=new&installstatus=ok&plugin_id=[here]` page, which is only accessible to administrators. Version 14.0.0.beta4 contains a patch for this issue.
CWE description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
CVSS v3 base score: 6.1
Published: 2023-10-09T15:15Z
Repository: https://github.com/Piwigo/Piwigo
Language: PHP
Files changed: admin/plugins_new.php
Commit date: 2023-10-06 15:13:04 +0200
Commit message: fixes GHSA-qg85-957m-7vgg providing plugin_id in URL is useless since Piwigo 12

Diff: diff --git a/admin/plugins_new.php b/admin/plugins_new.php
index 991c499481..811b0e6c9c 100644
--- a/admin/plugins_new.php
+++ b/admin/plugins_new.php
@@ -45,15 +45,15 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
 if (isset($_GET['installstatus']))
 {
   switch ($_GET['installstatus'])
   {
     case 'ok':
-      $activate_url = get_root_url().'admin.php?page=plugins'
-        . '&amp;plugin=' . $_GET['plugin_id']
-        . '&amp;pwg_token=' . get_pwg_token()
-        . '&amp;action=activate'
-        . '&amp;filter=deactivated';
+      // since Piwigo 12, you need to be on the page of installed plugins to active a plugin with
+      // a JS action, no need to provide plugin_id in URL, just link to the page of installed
+      // plugins, filtered on deactivated plugins. The webmaster will have to find its newly
+      // installed plugin and click on the activation switch.
+      $activate_url = get_root_url().'admin.php?page=plugins&amp;filter=deactivated';
 
       $page['infos'][] = l10n('Plugin has been successfully copied');
       $page['infos'][] = '<a href="'. $activate_url . '">' . l10n('Activate it now') . '</a>';
 
       if (isset($plugins->fs_plugins[$_GET['plugin_id']]))

Vulnerable code:       $activate_url = get_root_url().'admin.php?page=plugins'
        . '&amp;plugin=' . $_GET['plugin_id']
        . '&amp;pwg_token=' . get_pwg_token()
        . '&amp;action=activate'
        . '&amp;filter=deactivated';
Fixed code:       // since Piwigo 12, you need to be on the page of installed plugins to active a plugin with
      // a JS action, no need to provide plugin_id in URL, just link to the page of installed
      // plugins, filtered on deactivated plugins. The webmaster will have to find its newly
      // installed plugin and click on the activation switch.
      $activate_url = get_root_url().'admin.php?page=plugins&amp;filter=deactivated';