Description
An unrestricted file upload vulnerability in the Add New Assets function of Strapi 4.1.12 allows attackers to conduct XSS attacks via a crafted PDF file. NOTE: the project documentation suggests that a user with the Media Library "Create (upload)" permission is supposed to be able to upload PDF files containing JavaScript, and that all files in a public assets folder are accessible to the outside world (unless the filename begins with a dot character). The administrator can choose to allow only image, video, and audio files (i.e., not PDF) if desired.
Remediation
References
https://docs.strapi.io/dev-docs/configurations/public-assets
https://docs.strapi.io/user-docs/users-roles-permissions/configuring-administrator-roles
https://github.com/bypazs/strapi
https://github.com/strapi/strapi/blob/d9277d616b4478a3839e79e47330a4aaf167a2f1/packages/core/content-type-builder/admin/src/components/AllowedTypesSelect/index.js#L14
https://github.com/strapi/strapi/blob/d9277d616b4478a3839e79e47330a4aaf167a2f1/packages/core/upload/admin/src/components/MediaLibraryInput/index.js#L33
https://grimthereaperteam.medium.com/strapi-v4-1-12-unrestricted-file-upload-b993bfd07e4e
Related Vulnerabilities
CVE-2022-25893 Vulnerability in npm package vm2
CVE-2023-22894 Vulnerability in npm package @strapi/strapi
CVE-2021-41182 Vulnerability in maven package org.webjars.npm:jquery-ui
CVE-2021-21277 Vulnerability in npm package angular-expressions
CVE-2023-47323 Vulnerability in maven package org.silverpeas.core:silverpeas-core-web