owasp

CSRF (Cross-site request forgery) attack example and prevention in PHP

百般思念 提交于 2019-11-26 15:43:42
I have an website where people can place a vote like this: http://mysite.com/vote/25 This will place a vote on item 25. I want to only make this available for registered users, and only if they want to do this. Now I know when someone is busy on the website, and someone gives them a link like this: http://mysite.com/vote/30 then the vote will be places for him on the item without him wanting to do this. I have read the explanation on the OWASP website , but i don't really understand it Is this an example of CSRF, and how can I prevent this. The best thing i can think off is adding something to

What is “X-Content-Type-Options=nosniff”?

人走茶凉 提交于 2019-11-26 15:37:28
I am doing some penetration testing on my localhost with OWASP ZAP, and it keeps reporting this message: The Anti-MIME-Sniffing header X-Content-Type-Options was not set to 'nosniff' This check is specific to Internet Explorer 8 and Google Chrome. Ensure each page sets a Content-Type header and the X-CONTENT-TYPE-OPTIONS if the Content-Type header is unknown I have no idea what this means, and I couldn't find anything online. I have tried adding: <meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" /> but the I still get the alert. What is the

Can local storage ever be considered secure? [closed]

落爺英雄遲暮 提交于 2019-11-26 14:06:39
I'm required to develop a web application that will function offline for long periods. In order for this to be viable I cannot avoid saving sensitive data (personal data but not the kind of data you would only store hashed) in local storage. I accept that this is not recommended practice, but given little choice I'm doing the following to secure the data: encyrypting everything going into local storage using the stanford javascript crypto library and AES-256 the user password is the encryption key and is not stored on the device serving all content (when online) from a single trusted server

Why is it common to put CSRF prevention tokens in cookies?

可紊 提交于 2019-11-26 10:58:56
I'm trying to understand the whole issue with CSRF and appropriate ways to prevent it. (Resources I've read, understand, and agree with: OWASP CSRF Prevention CHeat Sheet , Questions about CSRF .) As I understand it, the vulnerability around CSRF is introduced by the assumption that (from the webserver's point of view) a valid session cookie in an incoming HTTP request reflects the wishes of an authenticated user. But all cookies for the origin domain are magically attached to the request by the browser, so really all the server can infer from the presence of a valid session cookie in a

PHP $_SERVER[&#39;HTTP_HOST&#39;] vs. $_SERVER[&#39;SERVER_NAME&#39;], am I understanding the man pages correctly?

心不动则不痛 提交于 2019-11-26 06:02:55
I did a lot of searching and also read the PHP $_SERVER docs . Do I have this right regarding which to use for my PHP scripts for simple link definitions used throughout my site? $_SERVER['SERVER_NAME'] is based on your web server's config file (Apache2 in my case), and varies depending on a few directives: (1) VirtualHost, (2) ServerName, (3) UseCanonicalName, etc. $_SERVER['HTTP_HOST'] is based on the request from the client. Therefore, it would seem to me that the proper one to use in order to make my scripts as compatible as possible would be $_SERVER['HTTP_HOST'] . Is this assumption

CSRF (Cross-site request forgery) attack example and prevention in PHP

天涯浪子 提交于 2019-11-26 04:36:12
问题 I have an website where people can place a vote like this: http://mysite.com/vote/25 This will place a vote on item 25. I want to only make this available for registered users, and only if they want to do this. Now I know when someone is busy on the website, and someone gives them a link like this: http://mysite.com/vote/30 then the vote will be places for him on the item without him wanting to do this. I have read the explanation on the OWASP website, but i don\'t really understand it Is

What is “X-Content-Type-Options=nosniff”?

£可爱£侵袭症+ 提交于 2019-11-26 04:32:12
问题 I am doing some penetration testing on my localhost with OWASP ZAP, and it keeps reporting this message: The Anti-MIME-Sniffing header X-Content-Type-Options was not set to \'nosniff\' This check is specific to Internet Explorer 8 and Google Chrome. Ensure each page sets a Content-Type header and the X-CONTENT-TYPE-OPTIONS if the Content-Type header is unknown I have no idea what this means, and I couldn\'t find anything online. I have tried adding: <meta content=\"text/html; charset=UTF-8; X

Can local storage ever be considered secure? [closed]

£可爱£侵袭症+ 提交于 2019-11-26 03:48:23
问题 I\'m required to develop a web application that will function offline for long periods. In order for this to be viable I cannot avoid saving sensitive data (personal data but not the kind of data you would only store hashed) in local storage. I accept that this is not recommended practice, but given little choice I\'m doing the following to secure the data: encyrypting everything going into local storage using the stanford javascript crypto library and AES-256 the user password is the

PHP $_SERVER[&#39;HTTP_HOST&#39;] vs. $_SERVER[&#39;SERVER_NAME&#39;], am I understanding the man pages correctly?

给你一囗甜甜゛ 提交于 2019-11-26 03:25:59
问题 I did a lot of searching and also read the PHP $_SERVER docs. Do I have this right regarding which to use for my PHP scripts for simple link definitions used throughout my site? $_SERVER[\'SERVER_NAME\'] is based on your web server\'s config file (Apache2 in my case), and varies depending on a few directives: (1) VirtualHost, (2) ServerName, (3) UseCanonicalName, etc. $_SERVER[\'HTTP_HOST\'] is based on the request from the client. Therefore, it would seem to me that the proper one to use in

Why is it common to put CSRF prevention tokens in cookies?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 02:15:50
问题 I\'m trying to understand the whole issue with CSRF and appropriate ways to prevent it. (Resources I\'ve read, understand, and agree with: OWASP CSRF Prevention CHeat Sheet, Questions about CSRF.) As I understand it, the vulnerability around CSRF is introduced by the assumption that (from the webserver\'s point of view) a valid session cookie in an incoming HTTP request reflects the wishes of an authenticated user. But all cookies for the origin domain are magically attached to the request by