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

Proposed changes to CSRF Tokens, #9

Merged
merged 4 commits into from
Apr 18, 2014
Merged

Proposed changes to CSRF Tokens, #9

merged 4 commits into from
Apr 18, 2014

Conversation

r3wt
Copy link

@r3wt r3wt commented Apr 18, 2014

This should provide you with all the tools now to setup the token system. I'm not good with js but i determined you were generating the views from userfrosting.js. i will let you figure out how best to handle adding the tokens to the forms, but validating them will be straight forward. simply require_once of models/post.php in a validation script, but make sure that $errors = array(); has been called prior to including it, or the error messages will be overwritten with the blank array.

r3

@alexweissman
Copy link
Member

CSRF attacks rely on tricking the user into submitting a form with malicious data. But, how do we know that the attacker can't trick the user into first loading the form (with the embedded token), attaching the malicious data, and then submitting the form?
According to this: http://halls-of-valhalla.org/beta/articles/cross-site-request-forgery-demystified,47/
CSRF tokens are useless if the site has an XSS vulnerability. So, we also need to make sure that there are no XSS vulnerabilities.

@r3wt
Copy link
Author

r3wt commented Apr 18, 2014

A bit of js should do the trick, barring the victim of said attack doesn't have js disabled in his browser, but then again that would make the entire site useless to said victim.

if (top != self) {top.location.href = self.location.href;}

after adding that to either the main javascript you include on all pages, or to a static js file that is already included anyway, see here for xss filter evasion.

https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet

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