-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13.json
13 lines (13 loc) · 1.38 KB
/
13.json
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"file_path": "security_data/gpt3_security_vulnerability_scanner-main/Path Traversal/ZipTraversal.java",
"vulnerability": "Vulnerabilities detected:\n1. Unvalidated input: The code does not validate the input from the ZipFile, which could lead to malicious code being executed.\n2. Insecure file permissions: The code does not set secure file permissions on the extracted files, which could lead to unauthorized access.\n3. Insecure directory traversal: The code does not check for directory traversal attacks, which could allow an attacker to access files outside of the intended directory.",
"source code": "import java.util.zip.ZipFile;\nimport java.util.zip.ZipEntry;\n\u22ee\npublic void extract(ZipFile zip) {\n \u22ee\n String toDir = \"/my/target/directory/\";\n Enumeration entries = zip.entries();\n while (entries.hasMoreElements()) {\n ZipEntry zipEntry = entries.nextElement();\n \u22ee\n File file = new File(toDir, zipEntry.getName())\n InputStream istr = zipFile.getInputStream(zipEntry);\n final OutputStream os = Files.newOutputStream(file.toPath());\n bos = new BufferedOutputStream(os);\n IOUtils.copy(bis, bos);\n\t\n }\n}\n",
"language": "java",
"cwe_identifier": null,
"pattern_desc": null,
"line_number": null,
"line_text": null,
"pattern_id": null,
"rule": null,
"label": 1
}