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.
6365 vulnerabilities reference this CWE, most recent first.
GHSA-M2M8-7FQQ-X2JF
Vulnerability from github – Published: 2023-07-11 15:31 – Updated: 2024-04-04 05:56WebsiteGuide v0.2 is vulnerable to Remote Command Execution (RCE) via image upload.
{
"affected": [],
"aliases": [
"CVE-2023-37656"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-07-11T14:15:09Z",
"severity": "CRITICAL"
},
"details": "WebsiteGuide v0.2 is vulnerable to Remote Command Execution (RCE) via image upload.",
"id": "GHSA-m2m8-7fqq-x2jf",
"modified": "2024-04-04T05:56:40Z",
"published": "2023-07-11T15:31:17Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-37656"
},
{
"type": "WEB",
"url": "https://github.com/mizhexiaoxiao/WebsiteGuide/issues/12"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-M2PC-3Q4Q-W6JR
Vulnerability from github – Published: 2026-08-25 17:38 – Updated: 2026-08-25 17:38Summary
The Reachy Mini daemon exposes the “/api/media/sounds/upload” endpoint without authentication and file validation mechanisms.
An attacker can use this endpoint to upload malicious files into the file system that will propagate in future attacks.
Compromise Chain: Unauthenticated to Full Root Access
This issue is part of a full compromise chain allowing an unauthenticated user to gain root access on the Reachy’s operating system:
- Unrestricted File Upload in Media Sounds Upload API \<= current finding
- Bluetooth Authentication Bypass
- Bluetooth Directory Traversal
Description
The root cause of the issue is at the handler located in “src/daemon/app/routers/media.py” file at the “upload_sound” method:
@router.post("/sounds/upload")
async def upload_sound(
file: UploadFile = File(...),
) -> dict[str, str]:
"""Upload a sound file to the daemon's temporary sound directory.
The file is saved to ``/tmp/reachy_mini_sounds/<original_filename>``.
If a file with the same name already exists it is overwritten.
Returns:
JSON with the absolute *path* of the saved file on the daemon.
"""
if not file.filename:
raise HTTPException(status_code=400, detail="Filename is required")
# Reject path traversal
filename = Path(file.filename).name
if not filename or filename in (".", ".."):
raise HTTPException(status_code=400, detail="Invalid filename")
os.makedirs(SOUNDS_TMP_DIR, exist_ok=True)
dest = os.path.join(SOUNDS_TMP_DIR, filename)
content = await file.read()
with open(dest, "wb") as f:
f.write(content)
return {"status": "ok", "path": dest}
This endpoint lacks multiple defence mechanisms:
- No authentication mechanism.
- No file extension validation.
- No file content/size validation.
Additionally, the daemon is bound to the 0.0.0.0 network interfaces (a.k.a. all network interfaces) by default along with permissive CORS ( allow_origins=[“*”] ) meaning the following API endpoint is exposed to every network interface the daemon is connected to.
PoC
- Start the daemon in simulation mode (command depends on the installed environment):
.venv/bin/mjpython -m reachy_mini.daemon.app.main --sim --no-media
- After that check that the media upload API endpoint is activated and you can upload a wav file:
curl -X POST http://<daemon_domain>:<daemon_port>/api/media/sounds/upload \
-F "file=@/path/to/your/file.wav"
- Now attempt to create a “.sh” file containing a script and upload it:
curl -X POST http://<daemon_domain>:<daemon_port>/api/media/sounds/upload \
-F "file=@/path/to/your/script.sh"
- Now error message will be received and you will see that the script file was successfully uploaded to disk.
Impact
Due to this issue, an attacker can upload malicious files instead of the intended sounds files, harming the integrity of the stored data and allowing an attacker to propagate a foothold in cases another vulnerabilities would arise.
Fix suggestion
Perform the following check on the API endpoint:
- Validate that the file extension contains only desired extensions (allow-list approach).
- Validate that the uploaded file’s content matches the desired extension (Magic numbers, and known file structure per file type).
- Enforce authentication on the file upload endpoint.
Credit
The vulnerability was discovered by Natan Nehorai of the JFrog Vulnerability Research team.
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "reachy-mini"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.8.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-55419"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": true,
"github_reviewed_at": "2026-08-25T17:38:43Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "## Summary\n\nThe Reachy Mini daemon exposes the \u201c/api/media/sounds/upload\u201d endpoint without authentication and file validation mechanisms. \nAn attacker can use this endpoint to upload malicious files into the file system that will propagate in future attacks.\n\n## Compromise Chain: Unauthenticated to Full Root Access\n\nThis issue is part of a full compromise chain allowing an unauthenticated user to gain root access on the Reachy\u2019s operating system:\n\n1. Unrestricted File Upload in Media Sounds Upload API \\\u003c= current finding \n2. Bluetooth Authentication Bypass \n3. Bluetooth Directory Traversal\n\n\n## Description\n\nThe root cause of the issue is at the handler located in \u201c***src/daemon/app/routers/media.py***\u201d file at the \u201cupload\\_sound\u201d method:\n\n```py\n@router.post(\"/sounds/upload\")\nasync def upload_sound(\n file: UploadFile = File(...),\n) -\u003e dict[str, str]:\n \"\"\"Upload a sound file to the daemon\u0027s temporary sound directory.\n The file is saved to ``/tmp/reachy_mini_sounds/\u003coriginal_filename\u003e``.\n If a file with the same name already exists it is overwritten.\n Returns:\n JSON with the absolute *path* of the saved file on the daemon.\n \"\"\"\n if not file.filename:\n raise HTTPException(status_code=400, detail=\"Filename is required\")\n # Reject path traversal\n filename = Path(file.filename).name\n if not filename or filename in (\".\", \"..\"):\n raise HTTPException(status_code=400, detail=\"Invalid filename\")\n os.makedirs(SOUNDS_TMP_DIR, exist_ok=True)\n dest = os.path.join(SOUNDS_TMP_DIR, filename)\n content = await file.read()\n with open(dest, \"wb\") as f:\n f.write(content)\n return {\"status\": \"ok\", \"path\": dest}\n```\n\nThis endpoint lacks multiple defence mechanisms:\n\n1. No authentication mechanism. \n2. No file extension validation. \n3. No file content/size validation.\n\nAdditionally, the daemon is bound to the 0.0.0.0 network interfaces (a.k.a. all network interfaces) by default along with permissive CORS ( allow\\_origins=\\[\u201c\\*\u201d\\] ) meaning the following API endpoint is exposed to every network interface the daemon is connected to.\n\n# PoC\n\n1. Start the daemon in simulation mode (command depends on the installed environment):\n\n```shell\n .venv/bin/mjpython -m reachy_mini.daemon.app.main --sim --no-media\n```\n\n2. After that check that the media upload API endpoint is activated and you can upload a wav file:\n\n```shell\ncurl -X POST http://\u003cdaemon_domain\u003e:\u003cdaemon_port\u003e/api/media/sounds/upload \\\n -F \"file=@/path/to/your/file.wav\"\n```\n\n3. Now attempt to create a \u201c.sh\u201d file containing a script and upload it:\n\n```shell\ncurl -X POST http://\u003cdaemon_domain\u003e:\u003cdaemon_port\u003e/api/media/sounds/upload \\\n -F \"file=@/path/to/your/script.sh\"\n```\n\n4. Now error message will be received and you will see that the script file was successfully uploaded to disk.\n\n# Impact\n\nDue to this issue, an attacker can upload malicious files instead of the intended sounds files, harming the integrity of the stored data and allowing an attacker to propagate a foothold in cases another vulnerabilities would arise.\n\n## Fix suggestion\n\nPerform the following check on the API endpoint:\n\n1. Validate that the file extension contains only desired extensions (allow-list approach). \n2. Validate that the uploaded file\u2019s content matches the desired extension (Magic numbers, and known file structure per file type). \n3. Enforce authentication on the file upload endpoint.\n\n## Credit\n\nThe vulnerability was discovered by Natan Nehorai of the JFrog Vulnerability Research team.",
"id": "GHSA-m2pc-3q4q-w6jr",
"modified": "2026-08-25T17:38:43Z",
"published": "2026-08-25T17:38:43Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/pollen-robotics/reachy_mini/security/advisories/GHSA-m2pc-3q4q-w6jr"
},
{
"type": "WEB",
"url": "https://github.com/pollen-robotics/reachy_mini/commit/984c7723b3ec5da63f4e0a2bcf9f120ceb563e04"
},
{
"type": "PACKAGE",
"url": "https://github.com/pollen-robotics/reachy_mini"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "reachy_mini Allows Unrestricted Upload of File with Dangerous Type"
}
GHSA-M2QV-8RFQ-VRG4
Vulnerability from github – Published: 2022-05-14 02:18 – Updated: 2022-05-14 02:18CScms 4.1 allows arbitrary file upload by (for example) adding the php extension to the default filetype list (gif, jpg, png), and then providing a .php pathname within fileurl JSON data.
{
"affected": [],
"aliases": [
"CVE-2018-16731"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-09-08T15:29:00Z",
"severity": "CRITICAL"
},
"details": "CScms 4.1 allows arbitrary file upload by (for example) adding the php extension to the default filetype list (gif, jpg, png), and then providing a .php pathname within fileurl JSON data.",
"id": "GHSA-m2qv-8rfq-vrg4",
"modified": "2022-05-14T02:18:32Z",
"published": "2022-05-14T02:18:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-16731"
},
{
"type": "WEB",
"url": "https://github.com/AvaterXXX/CScms/blob/master/CScms_up.md"
},
{
"type": "WEB",
"url": "https://www.patec.cn/newsshow.php?cid=24\u0026id=123"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-M2QX-G49W-3PP8
Vulnerability from github – Published: 2022-05-24 19:10 – Updated: 2022-05-24 19:10An unrestricted file upload vulnerability in the web interface of FortiPortal 6.0.0 through 6.0.4, 5.3.0 through 5.3.5, 5.2.0 through 5.2.5, and 4.2.2 and earlier may allow a low-privileged user to potentially tamper with the underlying system's files via the upload of specifically crafted files.
{
"affected": [],
"aliases": [
"CVE-2021-32594"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-08-04T14:15:00Z",
"severity": "HIGH"
},
"details": "An unrestricted file upload vulnerability in the web interface of FortiPortal 6.0.0 through 6.0.4, 5.3.0 through 5.3.5, 5.2.0 through 5.2.5, and 4.2.2 and earlier may allow a low-privileged user to potentially tamper with the underlying system\u0027s files via the upload of specifically crafted files.",
"id": "GHSA-m2qx-g49w-3pp8",
"modified": "2022-05-24T19:10:01Z",
"published": "2022-05-24T19:10:01Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-32594"
},
{
"type": "WEB",
"url": "https://fortiguard.com/advisory/FG-IR-21-092"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-M2V5-59CM-CC6Q
Vulnerability from github – Published: 2025-04-17 18:31 – Updated: 2026-04-01 18:34Unrestricted Upload of File with Dangerous Type vulnerability in rockgod100 Theme File Duplicator allows Using Malicious Files. This issue affects Theme File Duplicator: from n/a through 1.3.
{
"affected": [],
"aliases": [
"CVE-2025-27282"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-04-17T16:15:34Z",
"severity": "CRITICAL"
},
"details": "Unrestricted Upload of File with Dangerous Type vulnerability in rockgod100 Theme File Duplicator allows Using Malicious Files. This issue affects Theme File Duplicator: from n/a through 1.3.",
"id": "GHSA-m2v5-59cm-cc6q",
"modified": "2026-04-01T18:34:46Z",
"published": "2025-04-17T18:31:14Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-27282"
},
{
"type": "WEB",
"url": "https://patchstack.com/database/wordpress/plugin/theme-file-duplicator/vulnerability/wordpress-theme-file-duplicator-plugin-1-3-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-M327-462Q-R35C
Vulnerability from github – Published: 2022-04-09 00:00 – Updated: 2022-04-14 00:00AeroCMS v0.0.1 was discovered to contain an arbitrary file upload vulnerability via the Post Image function under the Admin panel. This vulnerability allows attackers to execute arbitrary code via a crafted PHP file.
{
"affected": [],
"aliases": [
"CVE-2022-27061"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-04-08T09:15:00Z",
"severity": "HIGH"
},
"details": "AeroCMS v0.0.1 was discovered to contain an arbitrary file upload vulnerability via the Post Image function under the Admin panel. This vulnerability allows attackers to execute arbitrary code via a crafted PHP file.",
"id": "GHSA-m327-462q-r35c",
"modified": "2022-04-14T00:00:27Z",
"published": "2022-04-09T00:00:29Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-27061"
},
{
"type": "WEB",
"url": "https://drive.google.com/file/d/1PdF7gTUt_QuU2ObS9YUVew6orHaho-QF/view?usp=sharing"
},
{
"type": "WEB",
"url": "https://github.com/D4rkP0w4r/AeroCMS-Unrestricted-File-Upload-POC"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.com/files/166659/AeroCMS-0.0.1-Shell-Upload.html"
}
],
"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-M34M-7F6X-5PMQ
Vulnerability from github – Published: 2024-05-17 09:31 – Updated: 2024-05-17 09:31Unrestricted Upload of File with Dangerous Type vulnerability in 8theme XStore Core.This issue affects XStore Core: from n/a through 5.3.8.
{
"affected": [],
"aliases": [
"CVE-2024-33556"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-05-17T07:16:01Z",
"severity": "HIGH"
},
"details": "Unrestricted Upload of File with Dangerous Type vulnerability in 8theme XStore Core.This issue affects XStore Core: from n/a through 5.3.8.",
"id": "GHSA-m34m-7f6x-5pmq",
"modified": "2024-05-17T09:31:00Z",
"published": "2024-05-17T09:31:00Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-33556"
},
{
"type": "WEB",
"url": "https://patchstack.com/database/vulnerability/et-core-plugin/wordpress-xstore-core-plugin-5-3-5-limited-arbitrary-file-upload-vulnerability?_s_id=cve"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-M34P-FGJW-89X9
Vulnerability from github – Published: 2026-03-03 18:31 – Updated: 2026-03-04 18:31The Applications component of Nokia IMPACT version through 19.11.2.10-20210118042150283 allows an authenticated user to arbitrarily upload server-side executable files via the /ui/rest-proxy/application fileupload parameter. This can occur during the adding of a new application, or during the editing of an existing one.
{
"affected": [],
"aliases": [
"CVE-2021-35485"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-03-03T18:16:20Z",
"severity": "HIGH"
},
"details": "The Applications component of Nokia IMPACT version through 19.11.2.10-20210118042150283 allows an authenticated user to arbitrarily upload server-side executable files via the /ui/rest-proxy/application fileupload parameter. This can occur during the adding of a new application, or during the editing of an existing one.",
"id": "GHSA-m34p-fgjw-89x9",
"modified": "2026-03-04T18:31:49Z",
"published": "2026-03-03T18:31:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-35485"
},
{
"type": "WEB",
"url": "https://www.gruppotim.it/it/footer/red-team/2021/Motive-Impact-CVE-2021-35485.html"
},
{
"type": "WEB",
"url": "https://www.nokia.com/networks/solutions/impact-iot-platform"
},
{
"type": "WEB",
"url": "https://www.nokia.com/notices/responsible-disclosure"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-M37Q-25F6-V3P9
Vulnerability from github – Published: 2023-10-17 03:32 – Updated: 2024-04-04 08:42IBM Security Verify Privilege On-Premises 11.5 could allow a remote authenticated attacker to execute arbitrary commands on the system by sending a specially crafted request. IBM X-Force ID: 221681.
{
"affected": [],
"aliases": [
"CVE-2022-22375"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-10-17T02:15:10Z",
"severity": "HIGH"
},
"details": "\nIBM Security Verify Privilege On-Premises 11.5 could allow a remote authenticated attacker to execute arbitrary commands on the system by sending a specially crafted request. IBM X-Force ID: 221681.\n\n",
"id": "GHSA-m37q-25f6-v3p9",
"modified": "2024-04-04T08:42:19Z",
"published": "2023-10-17T03:32:43Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-22375"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/221681"
},
{
"type": "WEB",
"url": "https://www.ibm.com/support/pages/node/7047202"
}
],
"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-M394-X673-978P
Vulnerability from github – Published: 2025-12-15 21:30 – Updated: 2025-12-19 00:31Webutler v3.2 contains a remote code execution vulnerability that allows authenticated administrators to upload PHP files with system command execution. Attackers can upload a PHAR file with embedded system commands to the media browser and execute arbitrary commands by accessing the uploaded file.
{
"affected": [],
"aliases": [
"CVE-2023-53885"
],
"database_specific": {
"cwe_ids": [
"CWE-434"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-12-15T21:15:51Z",
"severity": "HIGH"
},
"details": "Webutler v3.2 contains a remote code execution vulnerability that allows authenticated administrators to upload PHP files with system command execution. Attackers can upload a PHAR file with embedded system commands to the media browser and execute arbitrary commands by accessing the uploaded file.",
"id": "GHSA-m394-x673-978p",
"modified": "2025-12-19T00:31:41Z",
"published": "2025-12-15T21:30:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-53885"
},
{
"type": "WEB",
"url": "https://webutler.de/en"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/51660"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/webutler-v-remote-code-execution-via-arbitrary-file-upload"
}
],
"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"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/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"
}
]
}
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.