Stored Cross-Site Scripting (XSS) in ThingsBoard
Description
ThingsBoard in versions prior to v4.2.1 allows an authenticated user to upload malicious SVG images via the "Image Gallery", leading to a Stored Cross-Site Scripting (XSS) vulnerability. The exploit can be triggered when any user accesses the public API endpoint of the malicious SVG images, or if the malicious images are embedded in an iframe element, during a widget creation, deployed to any page of the platform (e.g., dashboards), and accessed during normal operations. The vulnerability resides in the ImageController, which fails to restrict the execution of JavaScript code when an image is loaded by the user's browser. This vulnerability can lead to the execution of malicious code in the context of other users' sessions, potentially compromising their accounts and allowing unauthorized actions.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
org.thingsboard:applicationMaven | < 4.2.1 | 4.2.1 |
Affected products
1- Range: 0
Patches
1b2ae6f92d122added Content-Security-Policy header to download image api to prevent malicious code injection
1 file changed · +1 −0
application/src/main/java/org/thingsboard/server/controller/ImageController.java+1 −0 modified@@ -300,6 +300,7 @@ private ResponseEntity<ByteArrayResource> downloadIfChanged(ImageCacheKey cacheK tbImageService.putETag(cacheKey, descriptor.getEtag()); var result = ResponseEntity.ok() .header("Content-Type", descriptor.getMediaType()) + .header("Content-Security-Policy", "default-src 'none'") .eTag(descriptor.getEtag()); if (!cacheKey.isPublic()) { result
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- github.com/thingsboard/thingsboard/commit/b2ae6f92d12206ea185a2e882945a6b69234bf03ghsapatchWEB
- advisory.checkmarx.net/advisory/CVE-2025-34281/mitrethird-party-advisory
- github.com/advisories/GHSA-fpq4-r87v-g246ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-34281ghsaADVISORY
- advisory.checkmarx.net/advisory/CVE-2025-3261ghsaWEB
- advisory.checkmarx.net/advisory/CVE-2025-34281ghsaWEB
- github.com/thingsboard/thingsboard/pull/13927ghsaWEB
- github.com/thingsboard/thingsboard/releases/tag/v4.2.1ghsarelease-notesWEB
- www.vulncheck.com/advisories/thingsboard-svg-image-stored-xssghsaWEB
News mentions
0No linked articles in our index yet.