GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — [SECURITY] Fix Temporary Directory Hijacking or Information Disclosure Vulnerability by JLLeitschuh · Pull Request #443 · scijava/scijava-common ConversationSecurity Vulnerability FixThis pull request fixes either 1.) Temporary Directory Hijacking Vulnerability, or 2.) Temporary Directory Information Disclosure Vulnerability, which existed in this project. PreambleThe system temporary directory is shared between all users on most unix-like systems (not MacOS, or Windows). Thus, code interacting with the system temporary directory must be careful about file interactions in this directory, and must ensure that the correct file permissions are set. This PR was generated because the following chain of calls was detected in this repository in a way that leaves this project vulnerable. ImpactThis vulnerability can have one of two impacts depending upon which vulnerability it is.
Temporary Directory HijackingThis vulnerability exists because the return value from File tmpDir = File.createTempFile("temp", ".dir"); // Attacker knows the full path of the directory that will be later created // delete the file that was created tmpDir.delete(); // Attacker sees file is deleted and begins a race to create their own directory before the java code. // and makes a directory of the same name // SECURITY VULNERABILITY: Race Condition! - Attacker beats java code and now owns this directory tmpDir.mkdirs(); // This method returns 'false' because it was unable to create the directory. No exception is thrown. // Attacker can write any new files to this directory that they wish. // Attacker can read any files created within this directory. Other Examples
Temporary Directory Information DisclosureThis vulnerability exists because, although the return values of File tmpDir = File.createTempFile("temp", ".dir"); tmpDir.delete(); if (!tmpDir.mkdirs()) { // Guard correctly prevents temporary directory hijacking, but directory contents are everyone-readable. throw new IOException("Failed to create temporary directory"); } Other Examples
The FixThe fix has been to convert the logic above to use the following API that was introduced in Java 1.7. File tmpDir = Files.createTempDirectory("temp dir").toFile(); The API both created the directory securely, ie with a random, non-conflicting name, with directory permissions that only allow the currently executing user to read or write the contents of this directory. ➡️ Vulnerability Disclosure ⬅️👋 Vulnerability disclosure is a super important part of the vulnerability handling process and should not be skipped! This may be completely new to you, and that's okay, I'm here to assist! First question, do we need to perform vulnerability disclosure? It depends!
Vulnerability Disclosure How-ToYou have a few options options to perform vulnerability disclosure. However, I'd like to suggest the following 2 options:
Detecting this and Future VulnerabilitiesThis vulnerability was automatically detected by GitHub's LGTM.com using this CodeQL Query. You can automatically detect future vulnerabilities like this by enabling the free (for open-source) GitHub Action. I'm not an employee of GitHub, I'm simply an open-source security researcher. SourceThis contribution was automatically generated with an OpenRewrite refactoring recipe, which was lovingly hand crafted to bring this security fix to your repository. The source code that generated this PR can be found here: Opting-OutIf you'd like to opt-out of future automated security vulnerability fixes like this, please consider adding a file called This bot will respect the ROBOTS.txt format for future contributions. Alternatively, if this project is no longer actively maintained, consider archiving the repository. CLA RequirementsThis section is only relevant if your project requires contributors to sign a Contributor License Agreement (CLA) for external contributions. It is unlikely that I'll be able to directly sign CLAs. However, all contributed commits are already automatically signed-off.
If signing your organization's CLA is a strict-requirement for merging this contribution, please feel free to close this PR. Sponsorship & SupportThis contribution is sponsored by HUMAN Security Inc. and the new Dan Kaminsky Fellowship, a fellowship created to celebrate Dan's memory and legacy by funding open-source work that makes the world a better (and more secure) place. This PR was generated by Moderne, a free-for-open source SaaS offering that uses format-preserving AST transformations to fix bugs, standardize code style, apply best practices, migrate library versions, and fix common security vulnerabilities at scale. TrackingAll PR's generated as part of this fix are tracked here: JLLeitschuh/security-research#10
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThis fixes either Temporary Directory Hijacking, or Temporary Directory Local Information Disclosure. Weakness: CWE-379: Creation of Temporary File in Directory with Insecure Permissions Severity: High CVSSS: 7.3 Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.UseFilesCreateTempDirectory) Reported-by: Jonathan Leitschuh <[email protected]> Signed-off-by: Jonathan Leitschuh <[email protected]> Bug-tracker: JLLeitschuh/security-research#10 Co-authored-by: Moderne <[email protected]>
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
ctrueden
force-pushed
the
master
branch
3 times, most recently
from
53b6733 to
3dc99c9
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |