Temp Dir Info Disclosure: Final pass and add documentation

This commit is contained in:
Jonathan Leitschuh
2021-01-23 18:12:56 -05:00
committed by Jonathan Leitschuh
parent bc12e994b0
commit 13fed0e9b6
15 changed files with 152 additions and 19 deletions

View File

@@ -1 +0,0 @@
Security/CWE/CWE-200/TempDirLocalInformationDisclosure1.ql

View File

@@ -1 +0,0 @@
Security/CWE/CWE-200/TempDirLocalInformationDisclosure2.ql

View File

@@ -0,0 +1 @@
Security/CWE/CWE-200/TempDirLocalInformationDisclosureFromMethodCall.ql

View File

@@ -7,8 +7,8 @@ edges
| Test.java:75:38:75:73 | getProperty(...) : String | Test.java:76:33:76:53 | toPath(...) |
| Test.java:80:38:80:73 | getProperty(...) : String | Test.java:81:31:81:51 | toPath(...) |
| Test.java:85:38:85:73 | getProperty(...) : String | Test.java:86:26:86:46 | toPath(...) |
| Test.java:98:38:98:73 | getProperty(...) : String | Test.java:99:31:99:51 | toPath(...) |
| Test.java:103:38:103:73 | getProperty(...) : String | Test.java:104:33:104:53 | toPath(...) |
| Test.java:99:38:99:73 | getProperty(...) : String | Test.java:100:31:100:51 | toPath(...) |
| Test.java:104:38:104:73 | getProperty(...) : String | Test.java:105:33:105:53 | toPath(...) |
nodes
| Files.java:10:33:10:68 | getProperty(...) : String | semmle.label | getProperty(...) : String |
| Files.java:15:17:15:23 | tempDir | semmle.label | tempDir |
@@ -26,10 +26,10 @@ nodes
| Test.java:81:31:81:51 | toPath(...) | semmle.label | toPath(...) |
| Test.java:85:38:85:73 | getProperty(...) : String | semmle.label | getProperty(...) : String |
| Test.java:86:26:86:46 | toPath(...) | semmle.label | toPath(...) |
| Test.java:98:38:98:73 | getProperty(...) : String | semmle.label | getProperty(...) : String |
| Test.java:99:31:99:51 | toPath(...) | semmle.label | toPath(...) |
| Test.java:103:38:103:73 | getProperty(...) : String | semmle.label | getProperty(...) : String |
| Test.java:104:33:104:53 | toPath(...) | semmle.label | toPath(...) |
| Test.java:99:38:99:73 | getProperty(...) : String | semmle.label | getProperty(...) : String |
| Test.java:100:31:100:51 | toPath(...) | semmle.label | toPath(...) |
| Test.java:104:38:104:73 | getProperty(...) : String | semmle.label | getProperty(...) : String |
| Test.java:105:33:105:53 | toPath(...) | semmle.label | toPath(...) |
#select
| Files.java:10:33:10:68 | getProperty(...) | Files.java:10:33:10:68 | getProperty(...) : String | Files.java:15:17:15:23 | tempDir | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Files.java:10:33:10:68 | getProperty(...) | system temp directory |
| Test.java:53:38:53:73 | getProperty(...) | Test.java:53:38:53:73 | getProperty(...) : String | Test.java:54:9:54:20 | tempDirChild | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:53:38:53:73 | getProperty(...) | system temp directory |
@@ -39,5 +39,5 @@ nodes
| Test.java:75:38:75:73 | getProperty(...) | Test.java:75:38:75:73 | getProperty(...) : String | Test.java:76:33:76:53 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:75:38:75:73 | getProperty(...) | system temp directory |
| Test.java:80:38:80:73 | getProperty(...) | Test.java:80:38:80:73 | getProperty(...) : String | Test.java:81:31:81:51 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:80:38:80:73 | getProperty(...) | system temp directory |
| Test.java:85:38:85:73 | getProperty(...) | Test.java:85:38:85:73 | getProperty(...) : String | Test.java:86:26:86:46 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:85:38:85:73 | getProperty(...) | system temp directory |
| Test.java:98:38:98:73 | getProperty(...) | Test.java:98:38:98:73 | getProperty(...) : String | Test.java:99:31:99:51 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:98:38:98:73 | getProperty(...) | system temp directory |
| Test.java:103:38:103:73 | getProperty(...) | Test.java:103:38:103:73 | getProperty(...) : String | Test.java:104:33:104:53 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:103:38:103:73 | getProperty(...) | system temp directory |
| Test.java:99:38:99:73 | getProperty(...) | Test.java:99:38:99:73 | getProperty(...) : String | Test.java:100:31:100:51 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:99:38:99:73 | getProperty(...) | system temp directory |
| Test.java:104:38:104:73 | getProperty(...) | Test.java:104:38:104:73 | getProperty(...) : String | Test.java:105:33:105:53 | toPath(...) | Local information disclosure vulnerability from $@ due to use of file or directory readable by other local users. | Test.java:104:38:104:73 | getProperty(...) | system temp directory |

View File

@@ -0,0 +1 @@
Security/CWE/CWE-200/TempDirLocalInformationDisclosureFromSystemProperty.ql

View File

@@ -87,6 +87,7 @@ public class Test {
}
void safeFileCreateTempFilesCreateFile() throws IOException {
// Clear permissions intentions by setting the 'OWNER_READ' and 'OWNER_WRITE' permissions.
File tempDirChild = new File(System.getProperty("java.io.tmpdir"), "/child-create-file.txt");
Files.createFile(
tempDirChild.toPath(),
@@ -96,11 +97,11 @@ public class Test {
void vulnerableFileCreateDirectory() throws IOException {
File tempDirChild = new File(System.getProperty("java.io.tmpdir"), "/child-create-directory");
Files.createDirectory(tempDirChild.toPath());
Files.createDirectory(tempDirChild.toPath()); // Creates with permissions 'drwxr-xr-x'
}
void vulnerableFileCreateDirectories() throws IOException {
File tempDirChild = new File(System.getProperty("java.io.tmpdir"), "/child-create-directories/child");
Files.createDirectories(tempDirChild.toPath());
Files.createDirectories(tempDirChild.toPath()); // Creates with permissions 'drwxr-xr-x'
}
}