<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Prevent form post request from another domain in PHP</title>
	<atom:link href="http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/feed" rel="self" type="application/rss+xml" />
	<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html</link>
	<description>Useful Tutorials, Scripts , Tips, and Resources for all PHP and Ajax beginners and experts .</description>
	<lastBuildDate>Tue, 07 Feb 2012 08:10:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ihor Filakhtov</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-4875</link>
		<dc:creator>Ihor Filakhtov</dc:creator>
		<pubDate>Sat, 05 Dec 2009 14:16:58 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-4875</guid>
		<description>This is bad idea...
Someone can use hiding HTTP-referer function, or can use another PHP-script to set fake-referer.</description>
		<content:encoded><![CDATA[<p>This is bad idea&#8230;<br />
Someone can use hiding HTTP-referer function, or can use another PHP-script to set fake-referer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adeel</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-4678</link>
		<dc:creator>Adeel</dc:creator>
		<pubDate>Mon, 12 Oct 2009 01:02:02 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-4678</guid>
		<description>hello,

 do web hosting have some kind of security that they prevent the posting from other domain?
 
 like i have a web hosting and url is http://somedomain.com/mypage.php

 now if someone trying to post the data form http://someotherdomain.com

will web hosting stop that post ? or i can able to receive it?

thank you</description>
		<content:encoded><![CDATA[<p>hello,</p>
<p> do web hosting have some kind of security that they prevent the posting from other domain?</p>
<p> like i have a web hosting and url is <a href="http://somedomain.com/mypage.php" rel="nofollow">http://somedomain.com/mypage.php</a></p>
<p> now if someone trying to post the data form <a href="http://someotherdomain.com" rel="nofollow">http://someotherdomain.com</a></p>
<p>will web hosting stop that post ? or i can able to receive it?</p>
<p>thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam IT</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-4607</link>
		<dc:creator>Sam IT</dc:creator>
		<pubDate>Tue, 22 Sep 2009 02:17:54 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-4607</guid>
		<description>First of all, there&#039;s no point to fight over 100% or 0%, there&#039;s no 100% way to prevent spam. If your browser can view the page and submit a valid form so can they.

I think the programmer should do everything he/she can to prevent it.

Referrer check COULD and will help against some spammers.

So does a cookie/session, I would just add a key to the session on the same page in which the form is displayed to make sure the form was actually displayed then check if it exists on submit. Pretty simple and useful!</description>
		<content:encoded><![CDATA[<p>First of all, there&#8217;s no point to fight over 100% or 0%, there&#8217;s no 100% way to prevent spam. If your browser can view the page and submit a valid form so can they.</p>
<p>I think the programmer should do everything he/she can to prevent it.</p>
<p>Referrer check COULD and will help against some spammers.</p>
<p>So does a cookie/session, I would just add a key to the session on the same page in which the form is displayed to make sure the form was actually displayed then check if it exists on submit. Pretty simple and useful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: griffin</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-3614</link>
		<dc:creator>griffin</dc:creator>
		<pubDate>Thu, 26 Feb 2009 06:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-3614</guid>
		<description>Misleading post. A very dangerous and unprofessional advice. You must warn your readers in the post itself.</description>
		<content:encoded><![CDATA[<p>Misleading post. A very dangerous and unprofessional advice. You must warn your readers in the post itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-2510</link>
		<dc:creator>Oliver</dc:creator>
		<pubDate>Sun, 21 Sep 2008 06:55:59 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-2510</guid>
		<description>captcha is one extra thing the visitor has to do. it goes against the basics of user experience to require them to fill in a field that has nothing to do with what they&#039;re actually trying to achieve.</description>
		<content:encoded><![CDATA[<p>captcha is one extra thing the visitor has to do. it goes against the basics of user experience to require them to fill in a field that has nothing to do with what they&#8217;re actually trying to achieve.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1530</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Mon, 21 Jul 2008 16:13:30 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1530</guid>
		<description>Why don&#039;t you guys use image captcha? this concept has been used since the year 2000 to protect automatic post or bruteforce attack, even this comment form i&#039;m posting right now is using captcha spam protection. but it is text based captcha wont achieve 100% protection.</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t you guys use image captcha? this concept has been used since the year 2000 to protect automatic post or bruteforce attack, even this comment form i&#8217;m posting right now is using captcha spam protection. but it is text based captcha wont achieve 100% protection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1379</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Thu, 03 Jul 2008 16:44:39 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1379</guid>
		<description>@Joost - All the best for the developing full proof soloution for token alternator and hope to get the good soultion against session fixation...

if you find the better solution don&#039;t forget to post that here as well..</description>
		<content:encoded><![CDATA[<p>@Joost &#8211; All the best for the developing full proof soloution for token alternator and hope to get the good soultion against session fixation&#8230;</p>
<p>if you find the better solution don&#8217;t forget to post that here as well..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joost Pluijmers</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1378</link>
		<dc:creator>Joost Pluijmers</dc:creator>
		<pubDate>Thu, 03 Jul 2008 14:32:06 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1378</guid>
		<description>Iam currently developing a fool proof token alternator. This means that within a set time frame a new token is generated for the site, how is this different? Because this token system won&#039;t break the active sessions. Iam creating some sort of window algorithm for it, where within this window you get assigned a new token.

Iam planning to use this as a seed for HMAC, per-page keys and maybe even session id&#039;s. This just guarantees several things:
- The request really comes from my domain.
- Nearly eliminates brute force attacks.
- Replay attacks will also be gone due to page-keys.

Now I just need to figure out a good solution against session fixation. ;)</description>
		<content:encoded><![CDATA[<p>Iam currently developing a fool proof token alternator. This means that within a set time frame a new token is generated for the site, how is this different? Because this token system won&#8217;t break the active sessions. Iam creating some sort of window algorithm for it, where within this window you get assigned a new token.</p>
<p>Iam planning to use this as a seed for HMAC, per-page keys and maybe even session id&#8217;s. This just guarantees several things:<br />
- The request really comes from my domain.<br />
- Nearly eliminates brute force attacks.<br />
- Replay attacks will also be gone due to page-keys.</p>
<p>Now I just need to figure out a good solution against session fixation. <img src='http://roshanbh.com.np/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arty</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1370</link>
		<dc:creator>arty</dc:creator>
		<pubDate>Wed, 02 Jul 2008 19:20:23 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1370</guid>
		<description>I also would suggest a pool of several tokens for a single user. If a user uses tabs he makes his old generated forms useless if you just overwrite your old token. So give the user about 5-10 tokens as max and delete them if they are used.</description>
		<content:encoded><![CDATA[<p>I also would suggest a pool of several tokens for a single user. If a user uses tabs he makes his old generated forms useless if you just overwrite your old token. So give the user about 5-10 tokens as max and delete them if they are used.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joost Pluijmers</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1284</link>
		<dc:creator>Joost Pluijmers</dc:creator>
		<pubDate>Wed, 25 Jun 2008 07:49:34 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1284</guid>
		<description>The best protection against form forgery is an appliance of HMAC. You know your going to serve a form, so why not put an encrypted token in an hidden field? When the form gets submitted you validate that against the token saved in the session for that user. Simple yet effective.

Using this method you can also expire the actual submitted form. So brute forcing the key will be useless as well.

The only real way this method gets cracked is if the users session id gets compromised.</description>
		<content:encoded><![CDATA[<p>The best protection against form forgery is an appliance of HMAC. You know your going to serve a form, so why not put an encrypted token in an hidden field? When the form gets submitted you validate that against the token saved in the session for that user. Simple yet effective.</p>
<p>Using this method you can also expire the actual submitted form. So brute forcing the key will be useless as well.</p>
<p>The only real way this method gets cracked is if the users session id gets compromised.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1280</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Tue, 24 Jun 2008 18:46:23 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1280</guid>
		<description>Thanks tedivm and other friends for commenting...I&#039;ll surely update date post with the best method</description>
		<content:encoded><![CDATA[<p>Thanks tedivm and other friends for commenting&#8230;I&#8217;ll surely update date post with the best method</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tedivm</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1278</link>
		<dc:creator>tedivm</dc:creator>
		<pubDate>Tue, 24 Jun 2008 18:00:36 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1278</guid>
		<description>If an intruder already has the session id then its game over, they can steal that session. What your suggesting is the equivalent of stealing someones key but picking the lock anyways.

So lets think about this- how can the attacker get the session id? The easiest method would be to just sniff it, but that would require that they either be in the immediate area (in the case of wireless) or that they somehow break into a computer or router between the website your defending and the computer itself. Of course, both these methods are completely thwarted by a little thing called SSL.

Outside of that it gets a little more difficult, especially if some simple steps are taken in the program itself (tying the session id to an ip address and browser string, for instance).

In the future, before posting things like this, you may want to consider doing actual research. Most of the stuff I (and others) have brought up are pretty fundamental to PHP security and you could have easily found this information had you actually looked.</description>
		<content:encoded><![CDATA[<p>If an intruder already has the session id then its game over, they can steal that session. What your suggesting is the equivalent of stealing someones key but picking the lock anyways.</p>
<p>So lets think about this- how can the attacker get the session id? The easiest method would be to just sniff it, but that would require that they either be in the immediate area (in the case of wireless) or that they somehow break into a computer or router between the website your defending and the computer itself. Of course, both these methods are completely thwarted by a little thing called SSL.</p>
<p>Outside of that it gets a little more difficult, especially if some simple steps are taken in the program itself (tying the session id to an ip address and browser string, for instance).</p>
<p>In the future, before posting things like this, you may want to consider doing actual research. Most of the stuff I (and others) have brought up are pretty fundamental to PHP security and you could have easily found this information had you actually looked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1276</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Tue, 24 Jun 2008 16:39:41 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1276</guid>
		<description>@tedivm - Ok I agree that your idea is somewhat ok but not 100% secure.Form name, session id , user name everything is visible to intruder. Do you think it is 100% secure ? 

A intruder can easily view the source of the form see the name as well as he can look at the cookie to view the session id and guess the token with a few effort and with staying in that site he can easily post the value of token from a faked form...


 </description>
		<content:encoded><![CDATA[<p>@tedivm &#8211; Ok I agree that your idea is somewhat ok but not 100% secure.Form name, session id , user name everything is visible to intruder. Do you think it is 100% secure ? </p>
<p>A intruder can easily view the source of the form see the name as well as he can look at the cookie to view the session id and guess the token with a few effort and with staying in that site he can easily post the value of token from a faked form&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tedivm</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1273</link>
		<dc:creator>tedivm</dc:creator>
		<pubDate>Tue, 24 Jun 2008 09:05:28 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1273</guid>
		<description>Where did you hear that there was not a 100% reliable way of preventing cross site forgery? Did you bother doing any research at all before coming up with this post?

A rather simple way to prevent them is to require a posted variable (called a token) with each form that can&#039;t be easily guessed by the site attempting the hack. A simple way to generate the token could be to create an md5 out of the session id and the form name (or the user name and form name).</description>
		<content:encoded><![CDATA[<p>Where did you hear that there was not a 100% reliable way of preventing cross site forgery? Did you bother doing any research at all before coming up with this post?</p>
<p>A rather simple way to prevent them is to require a posted variable (called a token) with each form that can&#8217;t be easily guessed by the site attempting the hack. A simple way to generate the token could be to create an md5 out of the session id and the form name (or the user name and form name).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Soren</title>
		<link>http://roshanbh.com.np/2008/06/prevent-form-post-request-another-domain.html/comment-page-1#comment-1272</link>
		<dc:creator>Soren</dc:creator>
		<pubDate>Mon, 23 Jun 2008 21:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/?p=134#comment-1272</guid>
		<description>Its trivial to send HTTP_REFERER for the spambot programs, so &quot;not 100% reliable&quot; is more like 0% reliable.

For real solutions, look at eg. the wikipedia page: http://en.wikipedia.org/wiki/Cross-site_request_forgery#Prevention</description>
		<content:encoded><![CDATA[<p>Its trivial to send HTTP_REFERER for the spambot programs, so &#8220;not 100% reliable&#8221; is more like 0% reliable.</p>
<p>For real solutions, look at eg. the wikipedia page: <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery#Prevention" rel="nofollow">http://en.wikipedia.org/wiki/Cross-site_request_forgery#Prevention</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/19 queries in 0.014 seconds using disk: basic
Object Caching 405/405 objects using disk: basic

Served from: roshanbh.com.np @ 2012-02-09 06:34:05 -->
