Skip to content

Implement a mitigation against CSRF attacks#98

Merged
6 commits merged intomasterfrom
anti-csrf
Jan 2, 2018
Merged

Implement a mitigation against CSRF attacks#98
6 commits merged intomasterfrom
anti-csrf

Conversation

@ghost
Copy link

@ghost ghost commented Dec 23, 2017

As raised in #86, password change is prone to CSRF attacks. This PR implements a mitigation based on tokens tied to a user session and an action (see this as WordPress's nonces).

For now, HMAC's key is based on PHPSESSID. This is not the best thing to do (in case of successful session fixation) but using a random value instead won't take too long to implement now.

@ghost ghost self-assigned this Dec 23, 2017
@ghost
Copy link
Author

ghost commented Jan 2, 2018

Polished the PR by using a random per-session HMAC key. Implementation of random_bytes for < PHP 7 is provided by paragonie/random_compat. Waiting for Travis tests to finish and merging…

@ghost ghost merged commit 42b380f into master Jan 2, 2018
@ghost ghost deleted the anti-csrf branch January 2, 2018 18:47
@ghost ghost deleted a comment from Emmafrs Jan 2, 2018
@ghost ghost deleted a comment from Emmafrs Jan 2, 2018
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants