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

Mitigation for POST requests from malicious forms #1969

Closed
wants to merge 2 commits into from

Conversation

takluyver
Copy link
Member

In discussion on gh-1830, I found that HTML forms in Firefox do not send an Origin header. You can therefore submit a POST request with an empty body to trigger certain actions, such as starting a kernel, avoiding the origin check we do.

This mitigates that for creating files and starting kernels, by requiring a JSON body, even if there's no data. I cannot currently find a way to create a JSON body in a request sent from a form.

The other cases I've found are interrupting and restarting kernels. This does not affect those cases, but they are only possible if you have a kernel ID.

In discussion on jupytergh-1830, I found that HTML forms in Firefox do not send
an Origin header. You can therefore submit a POST request with an empty
body to trigger certain actions, such as starting a kernel, avoiding the
origin check we do.

This mitigates that for creating files and starting kernels, by
requiring a JSON body, even if there's no data. I cannot currently find
a way to create a JSON body in a request sent from a form.

The other cases I've found are interrupting and restarting kernels. This
does not affect those cases, but they are only possible if you have a
kernel ID.
@takluyver
Copy link
Member Author

This doesn't feel like a proper fix, though, so I'd like to work out something better. Maybe we should block any requests without Origin set, and force scripts to use the token to bypass origin checks.

@takluyver
Copy link
Member Author

@gnestor gnestor added this to the 4.3.1 milestone Dec 13, 2016
@minrk
Copy link
Member

minrk commented Dec 21, 2016

Merged xsrf patch

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

Successfully merging this pull request may close these issues.

3 participants