csrf

CSRF实战靶场 --致谢大哥

假装没事ソ 提交于 2020-01-17 16:13:51
0X01无防护GET类型CSRF(伪造添加成员请求) 环境 靶机管理登陆 192.168.1.132 本机 192.168.1.5 首先我们登陆 test账号 然后点击 添加用户 构造出我们的url 然后发送给已经登陆的管理员 管理 点开连接 可以看见我们添加成功 0X02无防护POST类型csrf-伪造出添加成员的请求 你想让受害者执行的页面构造poc 大哥说用burp 然后 发送页面到受害者登陆了的电脑 然他点击 最后看见成功添加 0x03绕过CSRF防护之Referer检查-伪造购买商品请求 这里来讲解一下refer是什么呐??这里给你解释 https://blog.csdn.net/shenqueying/article/details/79426884 那么我们继续组合群 burp POC 然后发给admin 但是出现了这样的结果 why? 这里我们在DVWA上面做过这个 可以将页面名称改为 www.csrf_demo.com.html 然后将其放到外网服务器上面去 然后构造 http://外网ip/www.csrf_demo.com.html 这样referer里面就包含和host相同的值了 这里 我们的外网ip是 http://xxxxx:2017/www.csrf_demo.com.html 然后就会购买成功

Cannot login to website using requests module (Python version 3.5.1)

青春壹個敷衍的年華 提交于 2020-01-17 03:25:38
问题 I am trying to access a website to scrape some information, however I am having trouble posting login information through Python. Here is my code so far: import requests c = requests.Session() url = 'https://subscriber.hoovers.com/H/login/login.html' USERNAME = 'user' PASSWORD = 'pass' c.get(url) csrftoken = c.cookies['csrftoken'] login_data = dict(j_username=USERNAME, j_password=PASSWORD, csrfmiddlewaretoken=csrftoken, next='/') c.post(url, data=login_data, headers=dict(Referer=url)) page =

Django form “takes exactly 1 argument (2 given) ” error - possibly related to CSRF?

杀马特。学长 韩版系。学妹 提交于 2020-01-17 02:26:32
问题 I am attempting a fairly simple form on Django 1.3, and am trying to understand how CSRF works. I think I've followed the three steps detailed on the Django site, but am still unable to make the form work. The form displays when the URL is loaded, however upon hitting the submit button, I get the following error: TypeError at /txt/ txt() takes exactly 1 argument (2 given) Here's the actual code: views.py: from django.http import HttpResponse from django.shortcuts import render_to_response,

Angular resetting csrf token

为君一笑 提交于 2020-01-16 08:28:33
问题 I'm using Angular 6 and having a hard time integrating Django's csrf with Angular's. I found in this thread that Django changes the token on login which, since I can both register and login using post requests with the same new session but not post anything after login seems to make sense. The question becomes how I go about resetting the csrf token on login. The way the csrf is handled now in my Angular app is shown in the below code for my app module: import { BrowserModule } from '@angular

express.js CSURF cookie and header match, returning 403

て烟熏妆下的殇ゞ 提交于 2020-01-16 05:39:30
问题 I have a simple express server setup like: app.use(bodyParser.json()); app.use(cookieParser()); app.use(csurf({ cookie: true })); // routes app.use(Routes imported from another file); The client is currently just a simple form in react. I am loading some initial data before the react app loads and the csrf cookie is being set there. I have a simple function for parsing the csrf cookie client side. I'm proxying the express server in create-react-app so I can't just set a meta tag in the header

Login using python requests doesn't work for pythonanywhere.com

梦想与她 提交于 2020-01-16 05:39:10
问题 I am trying login to the site pythonanywhere.com import requests url='https://www.pythonanywhere.com/login' s = requests.session() values = { 'auth-username': 'username', 'auth-password': 'password'} headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'} u = s.post(url, data=values, headers=headers) But I am getting a <Response [403]> , Csrf verification failed. How do I login to that site? 回答1: You

express.js CSURF cookie and header match, returning 403

狂风中的少年 提交于 2020-01-16 05:39:06
问题 I have a simple express server setup like: app.use(bodyParser.json()); app.use(cookieParser()); app.use(csurf({ cookie: true })); // routes app.use(Routes imported from another file); The client is currently just a simple form in react. I am loading some initial data before the react app loads and the csrf cookie is being set there. I have a simple function for parsing the csrf cookie client side. I'm proxying the express server in create-react-app so I can't just set a meta tag in the header

Django CSRF与auth模块

有些话、适合烂在心里 提交于 2020-01-15 21:52:51
目录 Django CSRF与auth模块 CSRF CSRF相关装饰器 auth模块 扩展默认的auth_user表 Django CSRF与auth模块 CSRF FORM表单中怎么通过CSRF校验 只需要在form表单中写一个 {% csrf_token %} ajax通过asrf校验有三种方法 $.ajax({ url:'', type:'post', {#data:{'username':'yang'},#} //第一种方式 自己手动获取 {#data:{'username':'yang','csrfmiddlewaretoken':$('input[name="csrfmiddlewaretoken"]').val()},#} //第二种方式 利用模板语法 {#data:{'username': 'yang', 'csrfmiddlewaretoken':'{{ csrf_token }}'},#} //第三种方式 通用方式 需要引入外部js文件 data:{'username':'yang'}, success:function (data) { alert(data) } }) 第三种需要引入外部js文件,文件中需要书写以下代码 写一个getCookie方法 function getCookie(name) { var cookieValue = null; if

Django学习笔记之安全

落爺英雄遲暮 提交于 2020-01-15 04:26:24
CSRF攻击 CSRF攻击概述 CSRF(Cross Site Request Forgery, 跨站域请求伪造)是一种网络的攻击方式,它在 2007 年曾被列为互联网 20 大安全隐患之一。其他安全隐患,比如 SQL 脚本注入,跨站域脚本攻击等在近年来已经逐渐为众人熟知,很多网站也都针对他们进行了防御。然而,对于大多数人来说,CSRF 却依然是一个陌生的概念。即便是大名鼎鼎的 Gmail, 在 2007 年底也存在着 CSRF 漏洞,从而被黑客攻击而使 Gmail 的用户造成巨大的损失。 CSRF攻击原理 网站是通过 cookie 来实现登录功能的。而 cookie 只要存在浏览器中,那么浏览器在访问这个 cookie 的服务器的时候,就会自动的携带 cookie 信息到服务器上去。那么这时候就存在一个漏洞了,如果你访问了一个别有用心或病毒网站,这个网站可以在网页源代码中插入js代码,使用js代码给其他服务器发送请求(比如ICBC的转账请求)。那么因为在发送请求的时候,浏览器会自动的把 cookie 发送给对应的服务器,这时候相应的服务器(比如ICBC网站),就不知道这个请求是伪造的,就被欺骗过去了。从而达到在用户不知情的情况下,给某个服务器发送了一个请求(比如转账)。 防御CSRF攻击 CSRF攻击的要点就是在向服务器发送请求的时候,相应的 cookie

Django - 安全(九)

孤街浪徒 提交于 2020-01-15 03:33:09
安全 1,CSRF攻击 1,CSRF攻击概述 CSRF(Cross Site Request Forgery, 跨站域请求伪造)是一种网络的攻击方式,它在 2007 年曾被列为互联网 20 大安全隐患之一。其他安全隐患,比如 SQL 脚本注入,跨站域脚本攻击等在近年来已经逐渐为众人熟知,很多网站也都针对他们进行了防御。然而,对于大多数人来说,CSRF 却依然是一个陌生的概念。即便是大名鼎鼎的 Gmail, 在 2007 年底也存在着 CSRF 漏洞,从而被黑客攻击而使 Gmail 的用户造成巨大的损失。 2,CSRF攻击原理 网站是通过cookie来实现登录功能的。而cookie只要存在浏览器中,那么浏览器在访问这个cookie的服务器的时候,就会自动的携带cookie信息到服务器上去。那么这时候就存在一个漏洞了,如果你访问了一个别有用心或病毒网站,这个网站可以在网页源代码中插入js代码,使用js代码给其他服务器发送请求(比如ICBC的转账请求)。那么因为在发送请求的时候,浏览器会自动的把cookie发送给对应的服务器,这时候相应的服务器(比如ICBC网站),就不知道这个请求是伪造的,就被欺骗过去了。从而达到在用户不知情的情况下,给某个服务器发送了一个请求(比如转账)。 3,防御CSRF攻击 CSRF攻击的要点就是在向服务器发送请求的时候