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

Fix potential CSRF circumvention with custom HTTP methods #76

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

MarkusBauer
Copy link
Contributor

Attackers might be able to circumvent CakePHPs CSRF/request body protection, if the controller method does not check that the request is actually POST but uses the request body data. This issue was already patched in CakePHP 3, this PR backports the fix to CakePHP 2.

The upstream PR contains other, not so relevant changes to the CSRF token and the upstream commit refactors some unit tests. These changes are not necessary to fix this issue and are not ported.

Upstream patch: cakephp/cakephp@0f818a2
Upstream PR: cakephp/cakephp#7742

@MarkusBauer MarkusBauer mentioned this pull request Jul 22, 2024
@MarkusBauer
Copy link
Contributor Author

Just to clarify this: this is a backport of a CakePHP 3 improvement which is security-relevant in CakePHP 3. I have not tested if CakePHP 2 is actually vulnerable (and I'm not 100% convinced that it ever was).

@kamilwylegala
Copy link
Owner

Thank you for your contribution. Merging.

@kamilwylegala kamilwylegala merged commit c0fb45e into kamilwylegala:master Jul 24, 2024
5 checks passed
@MarkusBauer MarkusBauer deleted the fix-csrf-issue branch July 24, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants