<?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: Security with Zend_AMF and Flex &#8211; Part 2: Practise</title>
	<atom:link href="http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/</link>
	<description>An analog guy in a digital world</description>
	<lastBuildDate>Wed, 18 Aug 2010 19:35:56 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Titi</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-1973</link>
		<dc:creator>Titi</dc:creator>
		<pubDate>Wed, 24 Feb 2010 16:19:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-1973</guid>
		<description>Hi Tom
I know that this blog entry is a little bit old but it&#039;s very helpful to me. Do you know if your colleague would agree to show me his flex code ? Because it&#039;s the hardest part for me in the authentication process with zend_amf...

Thanks a lot</description>
		<content:encoded><![CDATA[<p>Hi Tom<br />
I know that this blog entry is a little bit old but it&#8217;s very helpful to me. Do you know if your colleague would agree to show me his flex code ? Because it&#8217;s the hardest part for me in the authentication process with zend_amf&#8230;</p>
<p>Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Skuip</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-1491</link>
		<dc:creator>Skuip</dc:creator>
		<pubDate>Thu, 26 Nov 2009 16:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-1491</guid>
		<description>That means the challenge/signature pair should be remembered forever, because at the moment you decide to delete challenge/signature pair it becomes valid again for any API call.

One thing you maybe can do is to generate challenge by creating a checksum based on the user name, method name and its parameters and repeat the same on the server to check/validate the challenge. It does not prevent any replay attack, but at least he can not change the method or any its parameters.

But I still think it is better to create some incrementing challenge, so you can refuse any challenge that is not bigger than the last one. Maybe use both by generating a challenge and appending it with an incrementing counter. That way you can easily determine if the challenge is new and valid. The extra challenge data may slow the brute-force attempt by the attacker.

A completely different way is to go with public/private key encryption and encrypt something what the server can verify after decryption with its private key. But public key encryption can be quite expensive and I do not have any ready available solutions. And there is the fact that public/private key encryption is not a standard Flash/Flex component. There is an as3crypto library, but who knows how bug free that is.</description>
		<content:encoded><![CDATA[<p>That means the challenge/signature pair should be remembered forever, because at the moment you decide to delete challenge/signature pair it becomes valid again for any API call.</p>
<p>One thing you maybe can do is to generate challenge by creating a checksum based on the user name, method name and its parameters and repeat the same on the server to check/validate the challenge. It does not prevent any replay attack, but at least he can not change the method or any its parameters.</p>
<p>But I still think it is better to create some incrementing challenge, so you can refuse any challenge that is not bigger than the last one. Maybe use both by generating a challenge and appending it with an incrementing counter. That way you can easily determine if the challenge is new and valid. The extra challenge data may slow the brute-force attempt by the attacker.</p>
<p>A completely different way is to go with public/private key encryption and encrypt something what the server can verify after decryption with its private key. But public key encryption can be quite expensive and I do not have any ready available solutions. And there is the fact that public/private key encryption is not a standard Flash/Flex component. There is an as3crypto library, but who knows how bug free that is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-1483</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Mon, 23 Nov 2009 14:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-1483</guid>
		<description>Hi Skuip, thanks for your feedback.
I agree that the problem you describe is possible.

The way I have used this setup, is by also implementing a transaction system: I keep track of all challenge/signature pairs. If I find a duplicate key for a pair during the session, I don&#039;t execute the call, but simply return what was returned previously.

This was not really to prevent such an attack, but rather to prevent an application of submitting twice the same data (while only once was needed). Like a user who is impatient, and refreshes the page, thus submitting the data again.

I haven&#039;t described the transactions in this blogpost, because I only implemented that part later on (and was too busy to blog about it).

Do you think this is a viable solution to the problem you described? I&#039;m open to input, because I would like to keep the setup as secure as possible.</description>
		<content:encoded><![CDATA[<p>Hi Skuip, thanks for your feedback.<br />
I agree that the problem you describe is possible.</p>
<p>The way I have used this setup, is by also implementing a transaction system: I keep track of all challenge/signature pairs. If I find a duplicate key for a pair during the session, I don&#8217;t execute the call, but simply return what was returned previously.</p>
<p>This was not really to prevent such an attack, but rather to prevent an application of submitting twice the same data (while only once was needed). Like a user who is impatient, and refreshes the page, thus submitting the data again.</p>
<p>I haven&#8217;t described the transactions in this blogpost, because I only implemented that part later on (and was too busy to blog about it).</p>
<p>Do you think this is a viable solution to the problem you described? I&#8217;m open to input, because I would like to keep the setup as secure as possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Skuip</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-1481</link>
		<dc:creator>Skuip</dc:creator>
		<pubDate>Mon, 23 Nov 2009 13:59:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-1481</guid>
		<description>I think you got a problem with verifySignature($challenge,$signature). What is preventing a hacker from using the same challenge and signature hashed for an other API call (replay attack)? Probably can solve it by using a challenge that&#039;s incrementing and enforcing that every received challenge is bigger than the last received challenge. That way an attacker can&#039;t reuse a challenge and signature pair.</description>
		<content:encoded><![CDATA[<p>I think you got a problem with verifySignature($challenge,$signature). What is preventing a hacker from using the same challenge and signature hashed for an other API call (replay attack)? Probably can solve it by using a challenge that&#8217;s incrementing and enforcing that every received challenge is bigger than the last received challenge. That way an attacker can&#8217;t reuse a challenge and signature pair.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-766</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Fri, 04 Sep 2009 00:03:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-766</guid>
		<description>I would not recommend storing the password in session. It&#039;s just not secure. Nice try to replace SSL.:)</description>
		<content:encoded><![CDATA[<p>I would not recommend storing the password in session. It&#8217;s just not secure. Nice try to replace SSL.:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seb</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-124</link>
		<dc:creator>seb</dc:creator>
		<pubDate>Fri, 03 Jul 2009 14:35:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-124</guid>
		<description>I mean, since i have an error when the signature isnt good, i can bruteforce the user:pass and then all this is useless. But, this 
technique will indeed generally work.</description>
		<content:encoded><![CDATA[<p>I mean, since i have an error when the signature isnt good, i can bruteforce the user:pass and then all this is useless. But, this<br />
technique will indeed generally work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-120</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Thu, 02 Jul 2009 20:51:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-120</guid>
		<description>Hi Seb,

i don&#039;t believe that with decompiling the flash, that you can do a lot of mischief. It would be possible for you to find out how all the hashing is done, and what the order of the parameters is. But then you would still need the user &amp; password of someone who is known on the server side. If you brute force a user &amp; pass that is not known on the server, then the server won&#039;t be able to verify the validity of the signature. And then a call won&#039;t be allowed.

If you know a user &amp; password, then there&#039;s no need for you to decompile the flash, since you will just be able to log in, and do everything there. As I said before, as soon as the password is discovered, no security will matter.</description>
		<content:encoded><![CDATA[<p>Hi Seb,</p>
<p>i don&#8217;t believe that with decompiling the flash, that you can do a lot of mischief. It would be possible for you to find out how all the hashing is done, and what the order of the parameters is. But then you would still need the user &amp; password of someone who is known on the server side. If you brute force a user &amp; pass that is not known on the server, then the server won&#8217;t be able to verify the validity of the signature. And then a call won&#8217;t be allowed.</p>
<p>If you know a user &amp; password, then there&#8217;s no need for you to decompile the flash, since you will just be able to log in, and do everything there. As I said before, as soon as the password is discovered, no security will matter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seb</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-119</link>
		<dc:creator>seb</dc:creator>
		<pubDate>Thu, 02 Jul 2009 20:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-119</guid>
		<description>What about the flash client side, wich we can decompile and get the signature. Then, we brute force for a user:pass and boom...</description>
		<content:encoded><![CDATA[<p>What about the flash client side, wich we can decompile and get the signature. Then, we brute force for a user:pass and boom&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-90</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Fri, 05 Jun 2009 09:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-90</guid>
		<description>Hey Lasse,

You have probably found a vulnerability in my system yes :)
Perhaps Zend_Session::regenerateId() is a possible solution.
Another solution would be that the challenge is in fact a checksum of the data you want to submit. This way, a hijacker could intercept the call, but he wouldn&#039;t be able to tamper with the data, or the checksum &amp; signature won&#039;t be valid.

Then it doesn&#039;t matter if the attacker can manipulate the data and checksum (challenge). The signature won&#039;t be valid, so the call won&#039;t succeed.

How does that sound? Perhaps this in combination with regenerateId().

Thanks for pointing out the hole. It&#039;s actually quite obvious, but I hadn&#039;t looked at it this way :)</description>
		<content:encoded><![CDATA[<p>Hey Lasse,</p>
<p>You have probably found a vulnerability in my system yes <img src='http://www.encapsulated.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Perhaps Zend_Session::regenerateId() is a possible solution.<br />
Another solution would be that the challenge is in fact a checksum of the data you want to submit. This way, a hijacker could intercept the call, but he wouldn&#8217;t be able to tamper with the data, or the checksum &amp; signature won&#8217;t be valid.</p>
<p>Then it doesn&#8217;t matter if the attacker can manipulate the data and checksum (challenge). The signature won&#8217;t be valid, so the call won&#8217;t succeed.</p>
<p>How does that sound? Perhaps this in combination with regenerateId().</p>
<p>Thanks for pointing out the hole. It&#8217;s actually quite obvious, but I hadn&#8217;t looked at it this way <img src='http://www.encapsulated.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lasse</title>
		<link>http://www.encapsulated.org/blog/2009/04/15/security-with-zend_amf-and-flex-part-2-practise/comment-page-1/#comment-88</link>
		<dc:creator>Lasse</dc:creator>
		<pubDate>Thu, 04 Jun 2009 20:31:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.encapsulated.org/blog/?p=31#comment-88</guid>
		<description>Hello Tom, the specific situation I&#039;m thinking of is: The session has been hijacked and the hijacker has also intercepted the client generated signature and challenge, which he is now able to use, without ever having known the password? Am I mistaken or would that not enable him to make api calls as an authenticated user? Also wouldn&#039;t it be a good idea to do Zend_Session::regenerateId(); on each request, in order to make the chance of session hijacking as low as possible?</description>
		<content:encoded><![CDATA[<p>Hello Tom, the specific situation I&#8217;m thinking of is: The session has been hijacked and the hijacker has also intercepted the client generated signature and challenge, which he is now able to use, without ever having known the password? Am I mistaken or would that not enable him to make api calls as an authenticated user? Also wouldn&#8217;t it be a good idea to do Zend_Session::regenerateId(); on each request, in order to make the chance of session hijacking as low as possible?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
