# Document Gallery <= 5.1.1 - Reflected Cross-Site Scripting via 'mime_types' Parameter

- **ID:** WPSEC-2026-1958
- **Plugin:** Document Gallery (`document-gallery`), https://wordpress.org/plugins/document-gallery/
- **Affected versions:** all versions before 5.1.2
- **Fixed in:** 5.1.2 (Update to 5.1.2 or later.)
- **Severity:** Medium 6.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)
- **Weakness:** CWE-79
- **Usage among sites WPSec scans:** plugin Medium, affected versions Medium (as of 2026-10-29)
- **Attack surface analysis:** https://attacksurface.wpsec.com/plugin/document-gallery
- **Fix released:** 2026-10-28
- **Published:** 2026-10-29
- **URL:** https://wpsec.com/vuln/WPSEC-2026-1958/

## Description

The Document Gallery plugin for WordPress is vulnerable to Reflected Cross-Site Scripting via the 'mime_types' value of the dg_generate_gallery AJAX action in all versions up to, and including, 5.1.1, due to the value not being sanitized and the gallery data being printed into a single-quoted HTML attribute without escaping in an HTML response. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that execute if they can successfully trick a user into performing an action such as clicking on a link.

## References

- https://wpsec.com/vuln/WPSEC-2026-1958/
- https://plugins.svn.wordpress.org/document-gallery/tags/5.1.2/
- https://wordpress.org/plugins/document-gallery/

Source: WPSec, https://wpsec.com/vuln/WPSEC-2026-1958/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Free to use, share and adapt, also commercially, if you credit WPSec and link to this advisory.
