csrf

codeigniter csrf error on form submission

风流意气都作罢 提交于 2019-12-06 11:35:33
问题 I have a form using codeigniter brackets echo form_open('signup'); echo form_close(); and when i submit it i get the following error An Error Was Encountered The action you have requested is not allowed. NOT always but often... even when the hidden inputfield exist inside the form: <div style="display:none"> <input type="hidden" value="token name is here" name="csrf_token_name"> </div> this also happens on a similar form(signin) EDIT: html generated via form <form accept-charset="utf-8"

CSRF Protection in ExpressJS

人盡茶涼 提交于 2019-12-06 11:09:49
From http://sporcic.org/2012/10/csrf-with-nodejs-and-express-3 : app.use(express.csrf()); app.use(function(req, res, next){ res.locals.token = req.session._csrf; next(); }); app.use(app.router); To make use of above protection, does it mean I should put hidden _csrf hidden input in ALL of my forms including admin-only pages? One option is to add a hidden input field to all your forms as you mention. But according to the Express docs on csrf: The default value function checks req.body generated by the bodyParser() middleware, req.query generated by query() , and the "X-CSRF-Token" header field.

Session Id placement: Form Hidden Field vs. HTTPOnly Cookie

杀马特。学长 韩版系。学妹 提交于 2019-12-06 10:59:24
问题 What are the advantages and disadvantages of placing session id in a hidden form input vs a cookie? Is it correct to put CSRF-Tag in a hidden form input field and session id in an httpOnly cookie? Which is more secure? 回答1: I don't think that one is inherently less secure than the other. Security is generally built in layers. By asserting that choice A can be more secure than choice B, when both choices play on the same vertical, you are asserting that security stops there. This is completely

CSRF token without cookies in PHP

萝らか妹 提交于 2019-12-06 10:05:43
I am looking for a way to add a CSRF token to an application I'm making. The caveat is, the application does not currently use cookies or sessions. I would love to find a way to introduce a CSRF token without having to: Introduce state in my application. Use session or cookie ( $_SESSION / $_COOKIE ) storage Is this at all a possibility, or am I stuck creating new state in my application. You can, but it's not going to be very secure. Here's an example BUT DO NOT USE THIS, IT IS PROBABLY A BAD IDEA : // Do this somewhere define('CSRF_SALT', '4dedMj4CWgBMNhRsoTpJlokwB5wTz7UsmF8Mq4uzFIbv');

Spring Security, Stateless REST service and CSRF

让人想犯罪 __ 提交于 2019-12-06 07:54:43
I have a REST service, built using Java, Spring-boot and using Spring Security with Basic Access Authentication. There are no Views, no JSP etc, no 'login', just stateless services which can be called from a React app hosted separately. I've read a variety of documentation about CSRF protection, but can't decide whether I should be using spring-security CSRF config, or just disabling it? If I disable the csrf protection I can call the service with curl using my basic auth like this: curl -H "authorization:Basic c35sdfsdfjpzYzB0dDFzaHA=" -H "content-type:application/json" -d '{"username":"user"

Login with PHP curl and CSRF token

老子叫甜甜 提交于 2019-12-06 07:45:18
I want login from a PHP script to another website but I always get this reply: 403 Error: CSRF token mismatch I extract the CSRF token from a hidden field on website but it seems it is wrong. This is my code: $username = "testuser"; $password = "testpass"; $path = "c:\\test\\"; $url="http://itw.me/login"; $field='_csrf'; $html=file_get_contents( $url ); libxml_use_internal_errors( true ); $dom=new DOMDocument; $dom->validateOnParse=false; $dom->recover=true; $dom->formatOutput=false; $dom->loadHTML( $html ); libxml_clear_errors(); $xpath=new DOMXPath( $dom ); $col=$xpath->query('//input[@name=

CSRF validation using Tomcat 6 without using external packages

风流意气都作罢 提交于 2019-12-06 07:24:45
CSRF protection for a JSF based web app and Tomcat6 backend without using any external packages. Kindly help. BalusC JSF has already builtin protection against CSRF by the javax.faces.ViewState hidden field which is to be linked with the state of the component tree in the server side. If this hidden field is missing or contains a wrong value, then JSF simply won't process the POST request. On JSF 1.x the key is only a bit too easy to guess, see also JSF impl issue 812 and JSF spec issue 869 . This is fixed in JSF 2.1. Your major concern should be XSS . A succesful XSS attack can form a source

Tons of false positives from Django's CSRF middleware?

烈酒焚心 提交于 2019-12-06 06:26:20
问题 I'm getting tons of false positives from Django's contrib CSRF middleware. Just from normal use of the site there will be a lot of cases where the CSRF just starts blocking requests as suspected forgery attacks. Does anyone else have issues like this? I'm using the SVN branch of Django so have the latest version of the CSRF middleware. How could I diagnose these issues? Update: I see these false positives on my production and dev sites. They happen sporadically. My site uses sub-domains and

Protecting prototype.js based XHR requests against CSRF

核能气质少年 提交于 2019-12-06 05:15:13
问题 Django has been updated to 1.3, and in fact ever since 1.2.5, it has extended the scheme to pass a Cross Site Request Forgery protection token to XMLHttpRequests. The Django folks helpfully provide an example for jQuery to apply a specific header to every XHR. Prototype (and thus Scriptaculous) have to comply to this scheme, yet I can't find a way to tell prototype to add the X-CSRFToken header. The best would be to do it once in a way that applies it across the app (like for jQuery). Is

is putting token in URL secure to prevent CSRF attacks in PHP applications?

时光怂恿深爱的人放手 提交于 2019-12-06 04:36:09
问题 I want to use a token to prevent CSRF attacks on my website (written with PHP). I've used it in forms and it works well. But logout link is not a form; It is only a hyperlink. Is it secure if I put the token in the query string like this: <a href="logout.php?token=9ae328eea8a72172a2426131a6a41adb">Logout</a> If it has any problem, what is your suggestions and solutions ? 回答1: I think one of main disadvantages of using CSRF-token in GET requests is possibility of incompetent user to easily