csrf

Rails default CSRF Meta Tags not validating

时间秒杀一切 提交于 2019-12-11 06:50:08
问题 I've just validated a new site a new site that i've written using Rails 3 with the W3C markup validation and i'm getting errors about the CSRF tags that rails generates. "Bad value csrf-param for attribute name on element meta: Keyword csrf-param is not registered." <meta name="csrf-param" content="authenticity_token"/> AND "Bad value csrf-token for attribute name on element meta: Keyword csrf-token is not registered." <meta name="csrf-token" content="{token}"/> I have my DOCTYPE set to <

CSRF protection techniques

烂漫一生 提交于 2019-12-11 06:36:22
问题 Can someone point me to information on how to protect applications from CSRF? Any code related to this. I am using extjs for the UI, Java on the backend and tomcat server. Thanks in advance. 回答1: Use of the session id in the way the dan_waterworth suggests, while easy, is very poor protection. The attacker only needs to capture the session id cookie and then can circumvent the protection for the life of the session. The session id is a cookie so it's submitted with any request. So all an

CSRF攻击

时间秒杀一切 提交于 2019-12-11 05:34:28
转载地址:https://blog.csdn.net/xiaoxinshuaiga/article/details/80766369 1.什么是CSRF攻击? CSRF跨站点请求伪造(Cross—Site Request Forgery) ,跟XSS攻击一样,存在巨大的危害性,你可以这样来理解:攻击者盗用了你的身份,以你的名义发送恶意请求,对服务器来说这个请求是完全合法的,但是却完成了攻击者所期望的一个操作,比如以你的名义发送邮件、发消息,盗取你的账号,添加系统管理员,甚至于购买商品、虚拟货币转账等 2.CSRF攻击过程及原理 用户C打开浏览器,访问受信任网站A,输入用户名和密码请求登录网站A; 在用户信息通过验证后,网站A产生Cookie信息并返回给浏览器,此时用户登录网站A成功,可以正常发送请求到网站A; 用户未退出网站A之前,在同一浏览器中,打开一个TAB页访问网站B; 网站B接收到用户请求后,返回一些攻击性代码,并发出一个请求要求访问第三方站点A; 浏览器在接收到这些攻击性代码后,根据网站B的请求,在用户不知情的情况下携带Cookie信息,向网站A发出请求。网站A并不知道该请求其实是由B发起的,所以会根据用户C的Cookie信息以C的权限处理该请求,导致来自网站B的恶意代码被执行。 3.CSRF攻击实例 受害者 Bob 在银行有一笔存款,通过对银行的网站发送请求 http:

Django outputs CSRF token as object instead of value

好久不见. 提交于 2019-12-11 05:23:01
问题 I am struggling with the CSRF token in a simple POST form in Django. The template generates the following CSRF output instead of outputting the value of the token: <input type='hidden' name='csrfmiddlewaretoken' value='{'csrf_token':django.utils.functional.__proxy__ object at 0x1255690>}' /> I am using {% csrf_token %} in the template, how can I fix this? (I am using Django 1.2) EDIT: the exact form code is: <form name="foo" action="url" method="POST"> {% csrf_token %} <select> {% for key,

VerifyCsrfToken always called when route to API Middleware Laravel 5.2.35

时光毁灭记忆、已成空白 提交于 2019-12-11 04:58:25
问题 I have two similiar Laravel project. This is part code of kernel.php. Both projects have same code. protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, ], 'api' => [ 'throttle:60,1', ], ]; But, VerifyCsrfToken always be called although I put

How to implement CSRFGuard in ExtJs AjaxRequest?

流过昼夜 提交于 2019-12-11 03:36:09
问题 I'm using ExtJs for UI and am doubtful of using CSRFGuard in AjaxRequest of extjs. I'm currently appending the CSRFName and value to the URL of ajax and it is working perfectly fine. Is there any way that the token name and value could be added as header of Ajax so that it need not be written for each and every AjaxRequest. Seeking early response. Thanks 回答1: You could put it in http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Ajax-event-beforerequest and that would apply to every AJAX request

Using just Spring Security CSRF feature

雨燕双飞 提交于 2019-12-11 03:04:29
问题 I'd like to use just the Spring Security's CSRF feature without any of the other authentication/authorization features since those features are provided by a third party provider for me. If this can be done, how do I tell Spring not to look out for any authentication manager with its dependent beans and just intercept all URLs, and add the csrf token. 回答1: I got the CSRF feature working by making the following changes/additions. Also, I used the <form:form> tag in my jsp to leverage the

Error using JSF protected views when opening a new tab

删除回忆录丶 提交于 2019-12-11 02:58:15
问题 I've set up my web application to protect against CSRF by listing individual pages in faces-config, protected-views. This works well when running locally, but after deploying to the server I eventually get these errors when opening a page link: javax.faces.application.ProtectedViewException: JSF1099: Referer [sic] header value http://[redacted]/finance/commitmentregister/search.xhtml?javax.faces.Token=1534344211116 does not appear to be a protected view. Preventing display of viewId /finance

CORS 403 error Angular and Express

我的未来我决定 提交于 2019-12-11 02:33:41
问题 Part of my Express configuration looks like this and runs on different domain app.use(function(req, res, next) { res.setHeader("Access-Control-Allow-Origin", 'http://localhost:3000'); res.setHeader("Access-Control-Allow-Credentials","true"); res.setHeader("Access-Control-Expose-Headers", "Set-Cookie"); res.setHeader("Access-Control-Allow-Headers", "Content-Type, x-xsrf-token, X-Requested-With, Accept, Expires, Last-Modified, Cache-Control"); res.setHeader("Access-Control-Allow-Methods", "GET,

nil.[] in request_forgery_protection when trying to render a form in rails 3

半城伤御伤魂 提交于 2019-12-11 02:18:14
问题 Rails throws a NoMethodError on a page whenever I try to add a form_tag to it, and gives the following error output and stack trace: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.[] ruby/1.9.1/gems/actionpack-3.0.5/lib/action_controller/metal/request_forgery_protection.rb:114:in `form_authenticity_token' ruby/1.9.1/gems/actionpack-3.0.5/lib/abstract_controller/helpers.rb:55:in `form_authenticity_token'