Skip to content
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

Plugin **extremely unsafe** - allows anyone to create a file anywhere in the filesystem #86

Closed
anton-mellit opened this issue Apr 11, 2020 · 6 comments
Assignees
Labels

Comments

@anton-mellit
Copy link

The field "path" is directly passed to the code that saves the comment file. Anyone can easily overwrite it, say using "Inspect" in Chrome, and save the file anywhere they want.

<input data-grav-field="hidden" data-grav-disabled="false" type="hidden" class="input" name="data[path]" value="/blog/post">

just change value="/blog/post" to something like value="/../../../../".

I think form plugin does not offer an easy way around these kind of problems and I suspect many plugins will turn out to have a similar issue.

@rhukster rhukster added the bug label Apr 12, 2020
@rhukster
Copy link
Member

I didn't write this one so can't speak to the code quality, but that does appear to be very unsafe as you say. I think this plugin has a variety of issues and could do with a thorough re-write. I will probably look at this one issue immediately though.

@rhukster rhukster self-assigned this Apr 12, 2020
@anton-mellit
Copy link
Author

I added a pull request to grav-plugin-form with my workaround. Basically, it allows to set values of fields before the form is processed. I'm new here, I guess there is a better way to expose this functionality, let me know

@NicoHood
Copy link

Any update on this? This sounds important to me.

@rhukster
Copy link
Member

There's really no reason to use this form-based path field to store the data. the current page is enough, and that's already whitelisted via the configuration. I have a fix for this that will be released shortly.

rhukster added a commit that referenced this issue Sep 10, 2020
@rhukster
Copy link
Member

Fixed

@NicoHood
Copy link

NicoHood commented Sep 11, 2020

Thanks for taking a look at it again!

When posting a comment I still get the following error. I am not sure if this is related to my configuration or the code itself.
grafik

Edit: I had to configure or deactivate the email plugin properly. Now everything works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants