Created
January 21, 2015 09:23
-
-
Save securitytube/e56bfe1315cd0681dc10 to your computer and use it in GitHub Desktop.
Referer based CSRF Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param = self.request.get("ch10") | |
referer = self.request.referer | |
xreferer = self.request.headers.get('X-Referer') | |
domain = "pentesteracademylab.appspot.com" | |
domain1 = domain2 = '' | |
if referer: | |
domain1 = referer.replace('http://', '').split('/')[0] | |
if xreferer: | |
domain2 = str(xreferer).replace('http://', '').split('/')[0] | |
if param == flag and domain1 == domain and domain2 == domain : | |
cid = "success" | |
self.response.headers.add_header("Set-Cookie", "cid-csrf10="+cid) | |
self.redirect("/lab/webapp/csrf/10") | |
return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment