Skip to content

Instantly share code, notes, and snippets.

@securitytube
Created January 21, 2015 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save securitytube/e56bfe1315cd0681dc10 to your computer and use it in GitHub Desktop.
Save securitytube/e56bfe1315cd0681dc10 to your computer and use it in GitHub Desktop.
Referer based CSRF Check
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