<?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: Why Do We Have Same-Host Restrictions?</title> <atom:link href="http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/feed/" rel="self" type="application/rss+xml" /><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/</link> <description>Living in a state of accord.</description> <lastBuildDate>Tue, 07 Feb 2012 01:07:58 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173394</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Wed, 01 Oct 2008 08:46:00 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173394</guid> <description>I don&#039;t really buy the XSS threat theory as that&#039;s like shutting the gate after the horse has bolted.  Most if not all  XSS attacks attack the site that they got the JavaScript into directly, not a third party site. Cross site request forgery is a problem with images, iframes, forms etc - there&#039;s no benefit to security by limiting AJAX requests because the same things could have been done by scripting form tags or just with images.
So far all I can see is that if site A using JavaScript to send a request to site B, the cookies shouldn&#039;t be sent to site B.  This prevents the user from being logged in so any information returned would be public.  That just leaves the access to intranet resources problem which seems to be the best explanation.
ddoctor - you&#039;re completely right but I was thinking more in terms of what standards define rather than best practices etc.  In other words, not what might go wrong if people write insecure code but what vulnerabilities would cross-site XmlHttpRequests open up in browsers if it were part of a specification.</description> <content:encoded><![CDATA[<p>I don&#8217;t really buy the XSS threat theory as that&#8217;s like shutting the gate after the horse has bolted.  Most if not all  XSS attacks attack the site that they got the JavaScript into directly, not a third party site. Cross site request forgery is a problem with images, iframes, forms etc &#8211; there&#8217;s no benefit to security by limiting AJAX requests because the same things could have been done by scripting form tags or just with images.</p><p>So far all I can see is that if site A using JavaScript to send a request to site B, the cookies shouldn&#8217;t be sent to site B.  This prevents the user from being logged in so any information returned would be public.  That just leaves the access to intranet resources problem which seems to be the best explanation.</p><p>ddoctor &#8211; you&#8217;re completely right but I was thinking more in terms of what standards define rather than best practices etc.  In other words, not what might go wrong if people write insecure code but what vulnerabilities would cross-site XmlHttpRequests open up in browsers if it were part of a specification.</p> ]]></content:encoded> </item> <item><title>By: Andrew Herron</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173393</link> <dc:creator>Andrew Herron</dc:creator> <pubDate>Wed, 01 Oct 2008 05:51:38 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173393</guid> <description>There&#039;s a fairly good explanation in this article:
http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/
Basically what Philip said.  Hacker x sneaks JavaScript onto some popular site that displays user-generated content and doesn&#039;t whitelist properly.  JavaScript creates a small iFrame to load gmail.com and like most people, you don&#039;t normally log out for convenience.  Without same-origin the hacker would have access to your entire mail account :)
iFrames aren&#039;t really AJAX requests though.  JSON should work just fine, because it&#039;s doing a HTTP request to site B and then translating it into JavaScript on the client side, completely routing around the same-origin policy.  This, of course, leads to other variations of XSS attacks.
http://en.wikipedia.org/wiki/JSON#Cross-site_request_forgery</description> <content:encoded><![CDATA[<p>There&#8217;s a fairly good explanation in this article:<br
/> <a
href="http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/" rel="nofollow">http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/</a></p><p>Basically what Philip said.  Hacker x sneaks JavaScript onto some popular site that displays user-generated content and doesn&#8217;t whitelist properly.  JavaScript creates a small iFrame to load gmail.com and like most people, you don&#8217;t normally log out for convenience.  Without same-origin the hacker would have access to your entire mail account :)</p><p>iFrames aren&#8217;t really AJAX requests though.  JSON should work just fine, because it&#8217;s doing a HTTP request to site B and then translating it into JavaScript on the client side, completely routing around the same-origin policy.  This, of course, leads to other variations of XSS attacks.<br
/> <a
href="http://en.wikipedia.org/wiki/JSON#Cross-site_request_forgery" rel="nofollow">http://en.wikipedia.org/wiki/JSON#Cross-site_request_forgery</a></p> ]]></content:encoded> </item> <item><title>By: ddoctor</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173391</link> <dc:creator>ddoctor</dc:creator> <pubDate>Tue, 30 Sep 2008 22:42:53 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173391</guid> <description>Also, with option 2, you shouldn&#039;t just do a simple proxy of the request - its insecure. Instead, the client should issue a HTTP request to its server using a &quot;command&quot; that&#039;s a cohesive part of the normal API your web server exposes to the site. If the server requires external data to serve this request it can.
I know that you know this argument, because you gave it to me when I was working with the RedDot integration. :)
Remember that a request from a client cannot be trusted, so you should never blindly do /anything/ the client tells you to - i.e. no simple proxies. Doing this can directly compromise the server.
The other thing to remember is that 3rd-party services are also untrusted. Sanitize information from them, as you would user input. You wouldn&#039;t rely on client-side validation for a form - same goes when validating external sources.</description> <content:encoded><![CDATA[<p>Also, with option 2, you shouldn&#8217;t just do a simple proxy of the request &#8211; its insecure. Instead, the client should issue a HTTP request to its server using a &#8220;command&#8221; that&#8217;s a cohesive part of the normal API your web server exposes to the site. If the server requires external data to serve this request it can.</p><p>I know that you know this argument, because you gave it to me when I was working with the RedDot integration. :)</p><p>Remember that a request from a client cannot be trusted, so you should never blindly do /anything/ the client tells you to &#8211; i.e. no simple proxies. Doing this can directly compromise the server.</p><p>The other thing to remember is that 3rd-party services are also untrusted. Sanitize information from them, as you would user input. You wouldn&#8217;t rely on client-side validation for a form &#8211; same goes when validating external sources.</p> ]]></content:encoded> </item> <item><title>By: ddoctor</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173390</link> <dc:creator>ddoctor</dc:creator> <pubDate>Tue, 30 Sep 2008 21:59:59 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173390</guid> <description>With option 1, the client is making the request to the external service.
With option 2, the server is making a request to the external service.
Client-side is an untrusted world, and should be contained. A web page should only be trusted to make AJAX requests against the web server it came from, otherwise if it is compromised (e.g. via a XSS javascript injection attack) it can send sensitive information to another site (e.g. a login cookie, or more sensitive information it could get via a XMLHttpRequest). Cross-domain scripting controls are a simple measure to prevent this.
Security aside, architecturally, system integration should generally not be done in a GUI tier. Aggregate your data sources and functionality at the server and present that as a unified interface to the user. From the user&#039;s perspective, they are interfacing with a single service - the client tier should share this perspective.</description> <content:encoded><![CDATA[<p>With option 1, the client is making the request to the external service.<br
/> With option 2, the server is making a request to the external service.</p><p>Client-side is an untrusted world, and should be contained. A web page should only be trusted to make AJAX requests against the web server it came from, otherwise if it is compromised (e.g. via a XSS javascript injection attack) it can send sensitive information to another site (e.g. a login cookie, or more sensitive information it could get via a XMLHttpRequest). Cross-domain scripting controls are a simple measure to prevent this.</p><p>Security aside, architecturally, system integration should generally not be done in a GUI tier. Aggregate your data sources and functionality at the server and present that as a unified interface to the user. From the user&#8217;s perspective, they are interfacing with a single service &#8211; the client tier should share this perspective.</p> ]]></content:encoded> </item> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173389</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Tue, 30 Sep 2008 17:55:27 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173389</guid> <description>ah now we&#039;re really getting to the meat of things. Combine that with the fact that it would include the login cookie it could reset the entire config or open ports etc.</description> <content:encoded><![CDATA[<p>ah now we&#8217;re really getting to the meat of things. Combine that with the fact that it would include the login cookie it could reset the entire config or open ports etc.</p> ]]></content:encoded> </item> <item><title>By: Philip Taylor</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173388</link> <dc:creator>Philip Taylor</dc:creator> <pubDate>Tue, 30 Sep 2008 17:41:59 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173388</guid> <description>There&#039;s also the problem that option 1 lets site A access resources on site B even if site B is behind a firewall (or NAT or VPN or whatever), by getting a client behind the firewall to perform the request. E.g. I could use XMLHttpRequest to make a POST to your home router at http://192.168.0.1/, and it would be tricked into thinking the request was coming from a trusted source in its own LAN.</description> <content:encoded><![CDATA[<p>There&#8217;s also the problem that option 1 lets site A access resources on site B even if site B is behind a firewall (or NAT or VPN or whatever), by getting a client behind the firewall to perform the request. E.g. I could use XMLHttpRequest to make a POST to your home router at <a
href="http://192.168.0.1/" rel="nofollow">http://192.168.0.1/</a>, and it would be tricked into thinking the request was coming from a trusted source in its own LAN.</p> ]]></content:encoded> </item> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173387</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Tue, 30 Sep 2008 17:35:28 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173387</guid> <description>Thanks that does reveal some potential issues. I&#039;ll have to think it through a little more from that angle and see where it leads.</description> <content:encoded><![CDATA[<p>Thanks that does reveal some potential issues. I&#8217;ll have to think it through a little more from that angle and see where it leads.</p> ]]></content:encoded> </item> <item><title>By: Henri Sivonen</title><link>http://www.symphonious.net/2008/10/01/why-do-we-have-same-host-restrictions/comment-page-1/#comment-173386</link> <dc:creator>Henri Sivonen</dc:creator> <pubDate>Tue, 30 Sep 2008 16:39:45 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=974#comment-173386</guid> <description>In option 1, the browser sends the cookies for site B if the request is authorized via &lt;a href=&quot;http://dev.w3.org/2006/waf/access-control/&quot; rel=&quot;nofollow&quot;&gt;AC&lt;/a&gt;. In option, the browser sends the cookies for site A, so if it tunnels to site B, site B won&#039;t get a cookie meant for site B.
Option 1 without AC would allow evil site A read private content from site B using the login credentials of the user for site B.</description> <content:encoded><![CDATA[<p>In option 1, the browser sends the cookies for site B if the request is authorized via <a
href="http://dev.w3.org/2006/waf/access-control/" rel="nofollow">AC</a>. In option, the browser sends the cookies for site A, so if it tunnels to site B, site B won&#8217;t get a cookie meant for site B.</p><p>Option 1 without AC would allow evil site A read private content from site B using the login credentials of the user for site B.</p> ]]></content:encoded> </item> </channel> </rss>
