-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a path traversal sanitizer #915
base: main
Are you sure you want to change the base?
Add a path traversal sanitizer #915
Conversation
Awesome work, thanks! Initially I liked the idea of an allow list for directories. But on a second thought, if the fuzzer is able to access a file that's a few directories up from the current directory, then most likely path traversal is possible. This saves us the complexity of matching the files on the allow list, and the user of providing those, and not forgetting to enable this sanitizer. The second aspect that is missing in this PR is to guide the fuzzer towards path traversal, which is difficult to achieve with an allow list. Since you have not opened a branch in this repo, I have added my suggestions in the comments, instead of pushing my changes directly, so apologies for that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I ran the format script format.sh
before committing my changes locally, so now every line is different!
sanitizers/src/main/java/com/code_intelligence/jazzer/sanitizers/FilePathTraversal.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Peter Samarin <[email protected]>
Co-authored-by: Peter Samarin <[email protected]>
@oetr thank you so much for your review of this and improvements. I like them quite a bit. I agree that there needs to be a customizable More generally, I'm concerned about using a relative path as the Note that the As one issue, let's say the working directory is
Similar is true if the fuzzer is able to generate an input that has the application writing to an absolute path: These two examples might disappear if we change the initialization of TARGET to:
The (less important) problem with that solution then, is that a reproducing blob would only successfully reproduce if Jazzer were running in the same location on the file system in some cases (right?). If I ran Jazzer in Docker in a specific location, and then tried to run it locally in a different working directory, the blob wouldn't reproduce...I think? |
Getting the paths right is always more difficult than it looks :)
This should work from any location. This will error out if the location cannot be resolved relative to CWD, but then it means that the target is user-set, so the user's responsible for fixing it. WDYT? |
@oetr K. I think I implemented the above. Let me know what you think. |
@tballison Awesome job, thank you! From my point of view, following points should be addressed before we can release this:
If you like, we can merge this PR "as-is" (after squash+rebase), and I can take over and do the rest. You will certainly get the credit for this bug detector in the release notes 🚀 |
@oetr go forth! Let me not hinder you any further! 🤣 |
This adds a FilePathTraversal sanitizer.
Harnesses set directories under which the application may read and write files via an environment variable.
This does not currently handle symlinks.