{"id":"CVE-2022-46178","aliases":["CVE-2022-46178","GHSA-9p62-x3c5-hr5p"],"related":[],"kind":"vulnerability","state":"published","title":"Path Traversal In MeterSpere allows file upload to any path","summary":"MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.1 allow users to upload a file, but do not validate the file name, which may lead to upload file to any path. The vulnerability has been fixed in v2.5.1. There are no workarounds.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.1 allow users to upload a file, but do not validate the file name, which may lead to upload file to any path. The vulnerability has been fixed in v2.5.1. There are no workarounds.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nMeterSphere allow users to upload file, but not check the file name, may lead to upload file to any path if the file name in upload request is falsified.\n\n### Details\n\nMetersphere's [`FileUtils.java`](https://github.com/metersphere/metersphere/blob/v2.5.0/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/FileUtils.java#L57) didn't check the filePath.\n\n```java\n    public static void createFile(String filePath, byte[] fileBytes) {\n        File file = new File(filePath);\n        if (file.exists()) {\n            file.delete();\n        }\n        try {\n            File dir = file.getParentFile();\n            if (!dir.exists()) {\n                dir.mkdirs();\n            }\n            file.createNewFile();\n        } catch (Exception e) {\n            LogUtil.error(e);\n        }\n\n        try (InputStream in = new ByteArrayInputStream(fileBytes); OutputStream out = new FileOutputStream(file)) {\n            final int MAX = 4096;\n            byte[] buf = new byte[MAX];\n            for (int bytesRead = in.read(buf, 0, MAX); bytesRead != -1; bytesRead = in.read(buf, 0, MAX)) {\n                out.write(buf, 0, bytesRead);\n            }\n        } catch (IOException e) {\n            LogUtil.error(e);\n            MSException.throwException(Translator.get(\"upload_fail\"));\n        }\n    }\n```\n\n### Patches\n\nThe vulnerability has been fixed in [v2.5.1](https://github.com/metersphere/metersphere/releases/tag/v2.5.1).\n\nhttps://github.com/metersphere/metersphere/commit/3a890eeeb8a6b0887927c876a73bdb3a99a82138 : add validation for file name.\n\n### Workarounds\n\nIt is recommended to upgrade the version to [v2.5.1](https://github.com/metersphere/metersphere/releases/tag/v2.5.1).\n\n### For more information\n\nIf you have any questions or comments about this advisory, please [open an issue](https://github.com/metersphere/metersphere/issues).","format":"markdown","source":"ghsa"},{"lang":"es","text":"MeterSphere es una plataforma integral de pruebas continuas de código abierto que cubre gestión de pruebas, pruebas de interfaz, pruebas de UI y pruebas de rendimiento. Las versiones anteriores a la 2.5.1 permiten a los usuarios cargar un archivo, pero no validan el nombre del archivo, lo que puede llevar a cargar el archivo en cualquier ruta. La vulnerabilidad se ha solucionado en v2.5.1. No hay workarounds.","source":"nvd"}],"published":"2022-12-29T18:09:38.842Z","modified":"2026-06-17T05:11:22.400Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L","score":7.4,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L","score":7.4,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L","score":7.4,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< v2.5.1","status":"affected"}],"vendor":"metersphere","product":"metersphere","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.5.1"}],"ecosystem":"Maven","package":"io.metersphere:metersphere","purl":"pkg:maven/io.metersphere/metersphere","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.5.1"}],"vendor":"metersphere","product":"metersphere","cpe":"cpe:2.3:a:metersphere:metersphere:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/metersphere/metersphere/security/advisories/GHSA-9p62-x3c5-hr5p","tags":["exploit","patch","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-46178","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/metersphere/metersphere","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/metersphere/metersphere/blob/v2.5.0/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/FileUtils.java#L5","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/metersphere/metersphere/releases/tag/v2.5.1","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-10T19:41:18.164Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-46178","url":"https://www.cve.org/CVERecord?id=CVE-2022-46178","licence":"CVE Terms of Use","modified":"2025-04-10T19:41:30.356Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9p62-x3c5-hr5p","url":"https://github.com/advisories/GHSA-9p62-x3c5-hr5p","licence":"CC-BY-4.0","modified":"2023-11-08T04:10:56.132Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-46178","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-46178","licence":"Public domain","modified":"2026-06-17T05:11:22.400Z"}],"updatedAt":"2026-11-25T22:58:17.930Z","epss":{"score":0.00751,"percentile":0.56249,"date":"2026-12-02T12:00:21.000Z"}}