<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Barklund.org &#187; Security</title>
	<atom:link href="http://www.barklund.org/blog/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.barklund.org/blog</link>
	<description>work smarter when building current web trends</description>
	<lastBuildDate>Wed, 26 May 2010 09:49:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Vimeo highly vulnerable to CSRF attacks &#8211; now fixed</title>
		<link>http://www.barklund.org/blog/2010/02/12/vimeo-vulnerable-csrf/</link>
		<comments>http://www.barklund.org/blog/2010/02/12/vimeo-vulnerable-csrf/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 00:33:36 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=683</guid>
		<description><![CDATA[I recently found, that vimeo.com had a cross-domain policy, that allowed anyone to connect, which was an open invitation for CSRF attacks. I alerted them to the issue, and it has now been fixed. As has been said over and over, allow-all cross-domain policy files should never be used on domains, where users log on. [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/07/15/sys-con-aral-balkan-stupidity-ignorance/' rel='bookmark' title='Permanent Link: Sys-Con once again attacks Aral Balkan with stupidity and ignorance'>Sys-Con once again attacks Aral Balkan with stupidity and ignorance</a></li>
<li><a href='http://www.barklund.org/blog/2009/11/23/link-sharing-spam-facebook/' rel='bookmark' title='Permanent Link: Link sharing spam on Facebook'>Link sharing spam on Facebook</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/10/re-youtube-january-2010-idea/' rel='bookmark' title='Permanent Link: Re-Youtube &#8211; January 2010 Ideas'>Re-Youtube &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p> I recently found, that <a href="http://vimeo.com/">vimeo.com</a> had a cross-domain policy, that allowed anyone to connect, which was an open invitation for CSRF attacks. I alerted them to the issue, and it has now been fixed.</p>
<p><span id="more-683"></span></p>
<p>As has been said <a href="http://shiflett.org/blog/2006/sep/the-dangers-of-cross-domain-ajax-with-flash">over</a> and <a href="http://shiflett.org/blog/2009/nov/facebook-myspace-and-crossdomain.xml">over</a>, allow-all cross-domain policy files should never be used on domains, where users log on. This leaves the site open for <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF attacks</a> from flash clients on different domains, that can load pages from the target domain utilizing the user&#8217;s automated log-in and thus the flash load&#8217;s the pages, like the user himself would. This not only allows the flash file to (without the user knowing it) load all his private information from the target site, but potentially also post data to the site, which could include updating the user&#8217;s password, email, profile or in worse circumstances add/remove content or even make purchases, if the target site has any feature like that.
<p>This has been done against large sites like Facebook, MySpace, Adobe and Youtube &#8211; the latter was ironically <a href="http://www.vimeo.com/1762861">documented via a video on Vimeo</a> by Jeremiah Grossman.</p>
<p>In Vimeo&#8217;s case, you can &#8220;only&#8221; upload videos, but an attacker could actually perform any action on the user&#8217;s behalf, that the user himself could &#8211; including changing the user&#8217;s bio, add/remove videos, comment on/like other videos etc. I made a <a href="http://barklund.org/examples/fun_with_vimeo/fun_with_vimeo.html">small, seemingly innocent page</a>, that included a hidden flash element, which first loaded the user&#8217;s info from <a href="http://vimeo.com/settings/personal">vimeo.com/settings/personal</a> and then re-posted this info back to the same page adding an extra line to the bio &#8211; namely &#8220;You have been bwned&#8221;, as it can seen on <a href="http://vimeo.com/barklund">my vimeo profil</a>e.</p>
<p>Someone at vimeo has clearly seen this demo, (<a href="http://vimeo.com/julia">Julia Quinn has indeed</a>) and now <a href="http://vimeo.com/crossdomain.xml">the cross-domain policy only allows *.vimeo.com</a> (the new file is served with a Last-Modified timestamp of <code>Thu, 11 Feb 2010 23:32:05 GMT</code>, so the change is only an hour old). The strange thing is, that if you go back via <a href="http://web.archive.org/">the Wayback Machine from archive.org</a>, you can see, that they had much better security back <a href="http://web.archive.org/web/20070224144110/http://www.vimeo.com/crossdomain.xml">in 2007</a> and <a href="http://web.archive.org/web/20080610033603/http://www.vimeo.com/crossdomain.xml">2008</a> (html render fails, but view source), so I have no idea how such a relaxed policy suddenly appeared on their site. <a href="http://74.125.77.132/search?q=cache:Kssyyl60UAUJ:www.vimeo.com/crossdomain.xml">Google&#8217;s cache still show the allow-all policy</a> as it dates back to January 20th (again, view source to see contents).</p>
<p>I found this while playing around attempting to load videos from Vimeo directly in a custom FLV-player on a different host than vimeo.com and found that this was actually possible, as all videos from their site are hosted from av.vimeo.com and this has an allow-all cross-domain policy. And this makes sense, as this domain is only used for serving videos and nothing else &#8211; no cookies or authentication info shared to this domain.</p>
<p>I haven&#8217;t heard from Vimeo yet &#8211; neither stating that they are looking at the issue nor that it has been fixed. I only post this after now seeing, that it has been fixed.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/07/15/sys-con-aral-balkan-stupidity-ignorance/' rel='bookmark' title='Permanent Link: Sys-Con once again attacks Aral Balkan with stupidity and ignorance'>Sys-Con once again attacks Aral Balkan with stupidity and ignorance</a></li>
<li><a href='http://www.barklund.org/blog/2009/11/23/link-sharing-spam-facebook/' rel='bookmark' title='Permanent Link: Link sharing spam on Facebook'>Link sharing spam on Facebook</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/10/re-youtube-january-2010-idea/' rel='bookmark' title='Permanent Link: Re-Youtube &#8211; January 2010 Ideas'>Re-Youtube &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2010/02/12/vimeo-vulnerable-csrf/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Turn (Closed) Content Into an API &#8211; January 2010 Ideas</title>
		<link>http://www.barklund.org/blog/2010/01/28/turn-content-into-api-january-2010-idea/</link>
		<comments>http://www.barklund.org/blog/2010/01/28/turn-content-into-api-january-2010-idea/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 08:00:56 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[January 2010 Ideas]]></category>
		<category><![CDATA[Online Rights]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=675</guid>
		<description><![CDATA[The twenty-eighth idea for my 365 social ideas is about the open web and about &#8220;forcing&#8221; classic websites to export their data. Imagine sites with lots of useful information, that is frequently updated, but is hidden away behind forms, in PDF&#8217;s or in hard-to-scrape tables. Then imagine a website, where you could provide this address, [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/01/11/coordinate-proxy-january-2010-idea/' rel='bookmark' title='Permanent Link: Coordinate-Proxy &#8211; January 2010 Ideas'>Coordinate-Proxy &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/18/open-data-january-2010-idea/' rel='bookmark' title='Permanent Link: Open Data &#8211; January 2010 Ideas'>Open Data &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/04/social-subway-january-2010-idea/' rel='bookmark' title='Permanent Link: Social Subway &#8211; January 2010 Ideas'>Social Subway &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The twenty-eighth idea for my <a href="/blog/365ideas/" title="365 Social Ideas from Barklund.org">365 social ideas</a> is about the <a href="/blog/2010/01/18/open-data-january-2010-idea/">open web</a> and about &#8220;forcing&#8221; classic websites to export their data. Imagine sites with lots of useful information, that is frequently updated, but is hidden away behind forms, in PDF&#8217;s or in hard-to-scrape tables. Then imagine a website, where you could provide this address, and give it some guidance as to how to input data in forms and how to interpret the results. And then imagine, that this website would act as a proxy with this interaction described as a simple, queryable API and then behind the scenes would fetch data from the original website.</p>
<p><span id="more-675"></span></p>
<p>There are of course a lot of legal issues, and such a service should probably obey robots.txt. And there should be a very clear opt-out possibility for websites that have been targeted in user-contributed additions &#8211; maybe even moderation before the services are publicly available. It should not be seen as an attack vector, as a proxy method for illegal purposes or anything like that, but simply as a way of &#8220;helping&#8221; free information to be used freely.</p>
<h4 id="toc-why">Why?</h4>
<p>A lot of data on the web is hidden in the so-called <a href="http://en.wikipedia.org/wiki/Deep_web">&#8220;deep web&#8221;</a> behind forms or in inaccessible parts of websites. With a service like the above-mentioned, this would suddenly not only become visible and indexable, but even queryable.</p>
<h4 id="toc-whats-next">What&#8217;s next?</h4>
<p>Do with this idea whatever you like &#8211; expand, implement, trash or forget. Just remember, that if you use it in anyway make sure to attribute me according to the Creative Commons Attribution 3.0 License, that all these <a href="/blog/365ideas" title="365 Social Ideas from Barklund.org">365 Social Ideas</a> are published under.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/01/11/coordinate-proxy-january-2010-idea/' rel='bookmark' title='Permanent Link: Coordinate-Proxy &#8211; January 2010 Ideas'>Coordinate-Proxy &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/18/open-data-january-2010-idea/' rel='bookmark' title='Permanent Link: Open Data &#8211; January 2010 Ideas'>Open Data &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/04/social-subway-january-2010-idea/' rel='bookmark' title='Permanent Link: Social Subway &#8211; January 2010 Ideas'>Social Subway &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2010/01/28/turn-content-into-api-january-2010-idea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password-friendly Website Certificate &#8211; January 2010 Ideas</title>
		<link>http://www.barklund.org/blog/2010/01/06/password-friendly-website-certificate-january-2010-idea/</link>
		<comments>http://www.barklund.org/blog/2010/01/06/password-friendly-website-certificate-january-2010-idea/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 08:00:43 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[January 2010 Ideas]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=566</guid>
		<description><![CDATA[The sixth idea for my 365 social ideas is more about social web principles than an actual idea. And then again, it is an idea to establish a new code of conduct and standards for a Password-friendly Website Certificate. &#8220;Certificate&#8221; should be taken lightly, as it is merely two very simple question for website owners [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/01/11/coordinate-proxy-january-2010-idea/' rel='bookmark' title='Permanent Link: Coordinate-Proxy &#8211; January 2010 Ideas'>Coordinate-Proxy &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/28/turn-content-into-api-january-2010-idea/' rel='bookmark' title='Permanent Link: Turn (Closed) Content Into an API &#8211; January 2010 Ideas'>Turn (Closed) Content Into an API &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/04/social-subway-january-2010-idea/' rel='bookmark' title='Permanent Link: Social Subway &#8211; January 2010 Ideas'>Social Subway &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The sixth idea for my <a href="/blog/365ideas/" title="365 Social Ideas from Barklund.org">365 social ideas</a> is more about social web principles than an actual idea. And then again, it is an idea to establish a new code of conduct and standards for a Password-friendly Website Certificate. &#8220;Certificate&#8221; should be taken lightly,  as it is merely two very simple question for website owners to answer: Do you really need to ask users for a password? And if you do, do you then salt my password and then one-way encrypt it before storing it anywhere? The first is of course the better, but the latter is necessary if you do actually ask me for a password.</p>
<p><span id="more-566"></span></p>
<p>Okay, things are a bit technical, but there are 5 ways to store passwords. Let&#8217;s start with the least secure and move up from there (explanations given below for the curious):</p>
<ol>
<li>Store a password in plain-text.</li>
<li>Store a password via regular (decryptable) encryption.</li>
<li>Store a password via one-way (non-decryptable) encryption with none or the same salt for all passwords.</li>
<li>Store a password via one-way encryption uniquely salted.</li>
<li>Don&#8217;t store passwords.</li>
</ol>
<h4 id="toc-salt">Salt?</h4>
<p><strong>Note: </strong>If you already know what encryption and salt is about, feel free to skip this section. Furthermore, if you don&#8217;t really care but just take my word for it, that the above 5 levels exist, feel free to skip further down as well.</p>
<p>How the password is stored in the database matters for two reasons. First of all, if you don&#8217;t trust the site owner completely, they should not have your password in a way, where they themselves can read it. Secondly, if their database is compromised and someone gets a hold of all the passwords (in whatever form they are stored) as well as corresponding usernames/emails, they could use this information to access a lot of other accounts in a lot of other websites used by the same users &#8211; because must users use the same passwords or the same few passwords for most services.</p>
<p>Whether the password is stored in <a href="http://en.wikipedia.org/wiki/Plaintext" title="Plaintext on Wikipedia">plaintext</a> or in <a href="http://en.wikipedia.org/wiki/Symmetric-key_algorithm" title="Symmetric-key algorithm on Wikipedia">a decryptable form</a> (with the decryption keys most likely compromised along with the database) is actually the same, as the decryption (with keys available) is very straight-forward to do. The result is, that the attacker will easily obtain the plain-text passwords alongside the matching usernames/emails.</p>
<p><a href="http://en.wikipedia.org/wiki/Cryptographic_hash_functions" title="Cryptographic hash functions on Wikipedia">One-way encryption</a> (commonly known as &#8220;hashing&#8221;) is a way to generate a value based on the original password, that does not directly reveal the original password. Imagine the original password as a set of numbers. If we add the numbers, we get the sum, and if we store this sum, then we could match against any password entered, and if the original password is entered, it would give the correct sum and thus allow access. But only knowing the sum does not reveal the actual password. Of course, simply adding the numbers is not good enough, as many easily testable sequences of numbers will give this sum but the idea is the same, just a lot more fine-grained and to date impossible to reverse for the best known such hashing-algorithms.</p>
<p>The only way to &#8220;reverse&#8221; a good hashing-algorithm is to <a href="http://en.wikipedia.org/wiki/Brute_force_attack" title="Brute force attack on Wikipedia">brute-force</a> it. E.g. if you know the sum of a set of numbers is supposed to be X, then try any combination of number to see if they give this sum. For hashing-algorithms it&#8217;s a bit more tricyk, but basically try all known words and see if the result of applying the hashing-algorithm is the expected sum. This does seem quite infeasible, but if you have maybe 200.000 users all with their passwords stored via the same direct hashing, you could start by trying the password &#8220;secret&#8221; and see how many of the 200.000 stored hashed values matches. I would guess at least 500 of them. And so on, you could try any dictionary word and each time learn more and more of the passwords.</p>
<p>But then we add <a href="http://en.wikipedia.org/wiki/Salt_%28cryptography%29" title="Salt (cryptography) on Wikipedia">salt</a>. A salt is an extra known but unique string added to the password before hashing it. Imagine that we say, that for user U1, we add the salt S1 (a series of random letters) to the password and get the hash value X1, that we store along with the salt in the database. For user U2 we add the salt S2 (another series of random letters) to get X2 and store S2 and X2. Now, S1 and S2 are different, so even though user U1 and U2 might have the same password, X1 and X2 are different. Thus even though 500 users might use the password &#8220;secret&#8221;, we won&#8217;t know until we try each one with the unique salt. This makes brute-force attacks much less efficient, as we have to try every dictionary word once for every unique salt to know anything interesting &#8211; which would then take 200.000 times longer that if they all used no salt or the same salt.</p>
<h4 id="toc-do-you-really-need-my-password">Do you really need my password?</h4>
<p>If I want to use some new service, that I don&#8217;t really know if I can trust, I know I shouldn&#8217;t trust them with a password, that I also use elsewhere in more important applications. But I can only remember so many passwords, so I will mostlike reuse some of my less secure passwords or built passwords according to some rule (like adding the website name to the password or something like that).</p>
<p>But this creates a new vulnerability for me, a new potential violation of my privacy. So I should really only give you my password or a slot in my limited password-memory, if you really, really need it. And today, any small online service could easily do without. Because any user who would user your service would most likely already have either a <a href="http://apiwiki.twitter.com/OAuth-FAQ" title="Twitter OAuth FAQ">Twitter</a>, <a href="http://developers.facebook.com/connect.php" title="Facebook Connect Developer Information">Facebook</a> or <a href="http://openid.net/" title="The openID website">openID</a> account. And it is technically quite easy to use any of these services to have you user securely log on to your service via any of these networks (without the user giving out his password to strangers) and this should provide any small service with more than enough user information. How to do this is quite simple and any worthwhile web developer can tell and show you in no time. Why to do this should be provided above &#8211; and summarized below.</p>
<h4 id="toc-why">Why?</h4>
<p>Only give to people you trust completely your most private and most secure passwords. And for the lesser trusted people, give less secure passwords. And don&#8217;t ask for passwords, you don&#8217;t really need. Just because it seems like the user is more &#8220;your own&#8221; when he has his own password for your service, it is actually a bad thing. And if you really, really need my password, please promise me that you treat it with the utmost respect.</p>
<p>Oh, want some examples? Okay, here&#8217;s an easy one: <a href="http://support.tweetdeck.com/forums/63876/entries/57538" title="TweetDeck requiring me to create a new user with a password just for them - with the only purpose to synchronize installations?">TweetDeck</a>. I have granted your application the privilege to post updates to both my Facebook and Twitter account, and yet that is not enough for you &#8211; you actually want me to invent a new password just for you to be able to synchronize my TweetDeck installations? How stupid are you? And that&#8217;s just to name the most obvious one, that I&#8217;ve come across&#8230;</p>
<h4 id="toc-whats-next">What&#8217;s next?</h4>
<p>Do with this idea whatever you like &#8211; expand, implement, trash or forget. Just remember, that if you use it in anyway make sure to attribute me according to the Creative Commons Attribution 3.0 License, that all these <a href="/blog/365ideas" title="365 Social Ideas from Barklund.org">365 Social Ideas</a> are published under.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/01/11/coordinate-proxy-january-2010-idea/' rel='bookmark' title='Permanent Link: Coordinate-Proxy &#8211; January 2010 Ideas'>Coordinate-Proxy &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/28/turn-content-into-api-january-2010-idea/' rel='bookmark' title='Permanent Link: Turn (Closed) Content Into an API &#8211; January 2010 Ideas'>Turn (Closed) Content Into an API &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/04/social-subway-january-2010-idea/' rel='bookmark' title='Permanent Link: Social Subway &#8211; January 2010 Ideas'>Social Subway &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2010/01/06/password-friendly-website-certificate-january-2010-idea/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Link sharing spam on Facebook</title>
		<link>http://www.barklund.org/blog/2009/11/23/link-sharing-spam-facebook/</link>
		<comments>http://www.barklund.org/blog/2009/11/23/link-sharing-spam-facebook/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 13:25:59 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Trends]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=455</guid>
		<description><![CDATA[I just saw a link on Facebook, that I somehow had to interact with &#8211; it featured a not-that-dressed girl and said &#8220;Wanna C Something Hot?&#8221;/&#8221;Want 2 C Something Hot?&#8221; or variations of this. Well, clicking the link sent to me to an external site featuring a single button and the same image urging me [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/05/03/i-like-facebook/' rel='bookmark' title='Permanent Link: I like Facebook'>I like Facebook</a></li>
<li><a href='http://www.barklund.org/blog/2009/11/06/100-000-spam-comments/' rel='bookmark' title='Permanent Link: 100,000 spam comments fought off'>100,000 spam comments fought off</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/24/private-comment-sharing-january-2010-idea/' rel='bookmark' title='Permanent Link: Private Comment Sharing &#8211; January 2010 Ideas'>Private Comment Sharing &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I just saw a link on Facebook, that I somehow had to interact with &#8211; it featured a not-that-dressed girl and said &#8220;Wanna C Something Hot?&#8221;/&#8221;Want 2 C Something Hot?&#8221; or variations of this. Well, clicking the link sent to me to an external site featuring a single button and the same image urging me to click it. When clicked, I came to some porn site. But why would several of my friends post links to this site, which incidentally sent me to a porn site? Well, as I soon after saw on Facebook, I had just posted the same link on my wall for all my friends to see. How?
<p>It is a &#8220;simple&#8221; case of &#8220;click-jacking&#8221; and the site tricks you to click a Facebook share button, but disguises this as some other button. Please read on for full description.</p>
<p><strong>UPDATE 2009-12-2:</strong> &#8220;Press the button or dog dies&#8221;/&#8221;Push the button or this dog dies&#8221; (located at pressthebuttonordogdies.com, but don&#8217;t go there) is a new such site. The target website is &#8220;thisblogrules.com&#8221; and the measures used are a little different but all in all the same anyway.</p>
<p>Furthermore, I have used bit.ly for tracking how much these links have been used so far on Facebook &#8211; it is pretty inflicting: The &#8220;hot&#8221; girl has <a href="http://bit.ly/info/shesnotthathot">been shared almost 59,000 times</a> and the poor dog has <a href="http://bit.ly/info/stilldontpressthebutton">been shared 5,309 times</a> as of this writing. You can see the direct stats from the <a href="http://wiki.developers.facebook.com/index.php/Links.getStats">Facebook link.getStats API</a> here: <a href="http://api.facebook.com/restserver.php?method=links.getStats&#038;urls=http://3dvv.com/somethinghot/">Somthing Hot</a> and <a href="http://api.facebook.com/restserver.php?method=links.getStats&#038;urls=http://www.pressthebuttonordogdies.com/">Or Dog Dies</a></p>
<p><span id="more-455"></span></p>
<p>The original post looked like this (taken from my own feed):</p>
<div id="attachment_456" class="wp-caption aligncenter" style="width: 339px"><img src="http://www.barklund.org/blog/wp-content/uploads/2009/11/facebook_post.png" alt="Don&#039;t go to this page if you see this post" title="Facebook Link Post" width="329" height="185" class="size-full wp-image-456" /><p class="wp-caption-text">Don't go to this page if you see this post</p></div>
<p>The page it linked to was <code>http://3dvv.com/somethinghot/</code> (don&#8217;t go there, nothing to see) and looks like:</p>
<div id="attachment_457" class="wp-caption aligncenter" style="width: 310px"><img src="http://www.barklund.org/blog/wp-content/uploads/2009/11/wanna_c_page-300x195.png" alt="The page tricking you to share the link" title="Want 2 C Something Hot?" width="300" height="195" class="size-medium wp-image-457" /><p class="wp-caption-text">The page tricking you to share the link</p></div>
<p>When you press the &#8220;button&#8221; you actually press this (opacity on iframe set to 1 instead of 0):</p>
<div class="wp-caption aligncenter" style="width: 481px"><img src="http://www.barklund.org/blog/wp-content/uploads/2009/11/the_real_button.png" alt="The real button that you actually press kind of looks like a Facebook button, right?" title="The real button that you actually press kind of looks like a Facebook button, right?" width="471" height="181" class="aligncenter size-full wp-image-458" /><p class="wp-caption-text">The real button that you actually press kind of looks like a Facebook button, right?</p></div>
<p>The trick here is, that they have used the layout of this page about sharing the link (safe to go to, just don&#8217;t actually press the share button): <a href="http://www.facebook.com/share.php?u=http://3dvv.com/somethinghot/">http://www.facebook.com/share.php?u=http://3dvv.com/somethinghot/</a>. Then, they included this page inside an iframe that was offset the right amount negatively to the left and to the top, to leave just the share button visible in the corner here (no need to visit): <code>http://3dvv.com/somethinghot/ngr.php</code>, which looks simply like:</p>
<div class="wp-caption aligncenter" style="width: 210px"><img src="http://www.barklund.org/blog/wp-content/uploads/2009/11/only_share.png" alt="How to only show the share button by iframing the share.php page" title="How to only show the share button by iframing the share.php page" width="67" height="35" class="aligncenter size-full wp-image-460" /><p class="wp-caption-text">How to only show the share button by iframing the share.php page</p></div>
<p>If we on this page remove the constraints, we can see the whole bottom corner of the page like this:</p>
<div class="wp-caption aligncenter" style="width: 318px"><img src="http://www.barklund.org/blog/wp-content/uploads/2009/11/rest_of_share.png" alt="The rest of the share cutout with the button in the corner" title="The rest of the share cutout with the button in the corner" width="308" height="127" class="aligncenter size-full wp-image-461" /><p class="wp-caption-text">The rest of the share cutout with the button in the corner</p></div>
<p>Well, this is not all. In order not to have the page simply redirect to what facebook normally would after having shared a link, this page with only the share button visible is wrapped in another iframe, that steals the redirect Facebook creates and make their own redirect to the actual target (porn) site.</p>
<p>All in all, it is a very clever albeit strictly illegal way of using the Facebook sharing functionality for viral spamming purposes.</p>
<p>What can Facebook do about it? One thing would be to not allow share.php to be embedded in iframes via a simple javascript, but that might break desired functionality in other places. Otherwise, they could shift the placement of the sharebutton slightly of different page loads, but that could probably be circumvented by detecting the position of the button via script and isn&#8217;t a viable solution. Or they could require that the user had to type some captcha before being able to post links to new sites not posted before, but that creates a lot of other problems (and a good scammer could simply require the user to answer the captcha as well as click the button &#8211; users would do that). I&#8217;m sure Facebook can think of something, though.</p>
<p>What can you as a user do about it? Nothing really. Only click on &#8220;links&#8221; on foreign pages that you know for sure are legitimate and that you trust that your friends really did post on their own. But it is pretty hard to protect against. It really is Facebook&#8217;s job to make sure this doesn&#8217;t happen.</p>
<p>Please share this with everyone!</p>
<p><strong>Update 2009-11-24:</strong> <a href="http://www.geek.com/articles/news/facebook-worm-wants-you-to-click-da-button-baby-20091124/" title="Report on geek.com">Several</a> <a href="http://itknowledgeexchange.techtarget.com/security-bytes/new-facebook-worm-uses-sexy-model-to-get-guys-to-click-da%E2%80%99-button/" title="TechTarget.com">sites</a> <a href="http://www.itwire.com/content/view/29561/53/" title="ITWire.com">report</a> this as an example of CSRF/XSRF (Cross-Site Request Forgery) and most use <a href="http://fitzgerald.blog.avg.com/2009/11/new-facebook-worm-dont-click-da-button-baby.html" title="New Facebook worm - don't click da' button baby!">this AVG blog post</a> as source. Not that it really matters, but it is not <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" title="XSRF on Wikipedia">XSRF</a> &#8211; it is <a href="http://en.wikipedia.org/wiki/Clickjacking" title="Clickjacking on Facebook">clickjacking</a>. There is a slight difference, the main difference being, that the countermeasures are very different.</a></p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/05/03/i-like-facebook/' rel='bookmark' title='Permanent Link: I like Facebook'>I like Facebook</a></li>
<li><a href='http://www.barklund.org/blog/2009/11/06/100-000-spam-comments/' rel='bookmark' title='Permanent Link: 100,000 spam comments fought off'>100,000 spam comments fought off</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/24/private-comment-sharing-january-2010-idea/' rel='bookmark' title='Permanent Link: Private Comment Sharing &#8211; January 2010 Ideas'>Private Comment Sharing &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2009/11/23/link-sharing-spam-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why signed applet trust is a stupid question (and why SnapABug is not to blame)</title>
		<link>http://www.barklund.org/blog/2009/10/19/signed-applet-trust-stupid/</link>
		<comments>http://www.barklund.org/blog/2009/10/19/signed-applet-trust-stupid/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 11:45:25 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Trends]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=406</guid>
		<description><![CDATA[After having written about the inner workings of SnapABug, I have now looked a bit further into signed applets and their permission levels. And the conclusion is, that the trust question is stupid. SnapABug did the right thing, the only thing they could do. Untrusted (unsigned) code lives in a special sandbox and cannot use [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/10/14/how-snapabug-works/' rel='bookmark' title='Permanent Link: How SnapABug works &#8211; and what they should do'>How SnapABug works &#8211; and what they should do</a></li>
<li><a href='http://www.barklund.org/blog/2009/06/06/wordpress-automatic-update-fails/' rel='bookmark' title='Permanent Link: If WordPress automatic update fails &#8220;silently&#8221;&#8230;'>If WordPress automatic update fails &#8220;silently&#8221;&#8230;</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/06/password-friendly-website-certificate-january-2010-idea/' rel='bookmark' title='Permanent Link: Password-friendly Website Certificate &#8211; January 2010 Ideas'>Password-friendly Website Certificate &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>After having written about the <a href="http://www.barklund.org/blog/2009/10/14/how-snapabug-works/">inner workings of SnapABug</a>, I have now looked a bit further into signed applets and their permission levels. And the conclusion is, that the trust question is stupid.</p>
<p>SnapABug did the right thing, the only thing they could do. Untrusted (unsigned) code <a href="http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/security.html#policy" title="Security in JavaSE 6 from sun.com">lives in a special sandbox</a> and cannot use functions outside of this sandbox. The end user can change how much this sandbox has access to, but it is not trivial and the normal user would never touch that with a pitch fork. <a href="http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/rsa_deploying.html" title="Deploying RSA-Signed Applets in Java Plug-in from sun.com">Trusted code lives in another sandbox</a> with almost infinite possibilities. The end user can limit this sandbox too, but again almost no end user does that.</p>
<p><span id="more-406"></span></p>
<p>The problem? How is code deemed to be trusted code? Code is trusted, if the publisher is trusted, and the validity of the publisher is guaranteed through the digital signature. The signature is automatically verified by the Java client, and the end user is then asked to do the final step &#8211; the Java client asks the end user to trust the code:</p>
<blockquote><p>We know this code has been written by this person (even though we don&#8217;t know what the code does). We know this person/company is, who (s)he says (s)he is. You can therefore safely trust the authenticity of this person. Do you trust that this person has written safe code?</p></blockquote>
<p>First of all, this is a strange question to ask any end user. Secondly, that if the actual question was written as above, it would have been much better as it would assume that the person has written safe code, but would let the end user decide &#8211; instead the question is written in a form that almost suggests, that the end user tries to illegally gain access to your computer by asking:</p>
<blockquote><p>An applet from &#8220;domain&#8221; is requesting unrestricted access to your computer</p></blockquote>
<div id="attachment_407" class="wp-caption aligncenter" style="width: 494px"><img src="http://www.barklund.org/blog/wp-content/uploads/2009/10/Screen-shot-2009-10-15-at-12.29.52.png" alt="The SnapABug applet trust question" title="The SnapABug applet trust question" width="484" height="199" class="size-full wp-image-407" /><p class="wp-caption-text">The SnapABug applet trust question</p></div>
<p>And below that in smaller letters is says that the digital signature has been verified (whatever that means to Average Joe). I am aware, that this might be the more specific question asked by my Java client/browser combination, as Sun <a href="http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/security.html#dialogs">seems to indicate</a>, that the dialog looks different on other systems.</p>
<p>In any case: that question is stupid. Would the normal end user install programs, if the standard windows installation flow included the question:</p>
<blockquote><p>When installing this application, the application could potentially install spamware, adware, take over your computer or copy your banking information. Do you wish to proceed?</p></blockquote>
<p>Let&#8217;s just say that adoptions of small programs from small developers would be a lot lower (which might be a good thing to prevent all those installing spamware because they think they have a virus or silly things like that, but in the long run it would probably be a bad thing). Asking such a question is stupid. This question really should be re-phrased in a way to clearly indicate, that the user should assume that this is a safe, trusted application, but the user has the opportunity to deny access anyway.</p>
<p>Secondly, (trusted) applications should have a way of asking for access to only what they need. The digital signature is simply for verification of origin, but the actual access level needed should be separate from that. As I asked in my previous post: why should the SnapABug applet have access to files on my computer? And they don&#8217;t need it, in fact I&#8217;m pretty sure, that if they could avoid having that access, they would rather do that. But they can&#8217;t.</p>
<p>Thus SnapABug is not to blame &#8211; if anyone, Sun is.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/10/14/how-snapabug-works/' rel='bookmark' title='Permanent Link: How SnapABug works &#8211; and what they should do'>How SnapABug works &#8211; and what they should do</a></li>
<li><a href='http://www.barklund.org/blog/2009/06/06/wordpress-automatic-update-fails/' rel='bookmark' title='Permanent Link: If WordPress automatic update fails &#8220;silently&#8221;&#8230;'>If WordPress automatic update fails &#8220;silently&#8221;&#8230;</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/06/password-friendly-website-certificate-january-2010-idea/' rel='bookmark' title='Permanent Link: Password-friendly Website Certificate &#8211; January 2010 Ideas'>Password-friendly Website Certificate &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2009/10/19/signed-applet-trust-stupid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How SnapABug works &#8211; and what they should do</title>
		<link>http://www.barklund.org/blog/2009/10/14/how-snapabug-works/</link>
		<comments>http://www.barklund.org/blog/2009/10/14/how-snapabug-works/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 11:07:05 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=390</guid>
		<description><![CDATA[I just saw the SnapABug website, and was quite impressed, until I actually tried to submit a bug. Unrestricted access to my computer, why would I grant that to an unknown applet? And why do you even require unrestricted access to all files etc. on my computer to create a screenshot? Well, I delved into [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/10/19/signed-applet-trust-stupid/' rel='bookmark' title='Permanent Link: Why signed applet trust is a stupid question (and why SnapABug is not to blame)'>Why signed applet trust is a stupid question (and why SnapABug is not to blame)</a></li>
<li><a href='http://www.barklund.org/blog/2009/11/23/iphone-developer-boycott-in-the-works/' rel='bookmark' title='Permanent Link: The iPhone developer boycott in the works'>The iPhone developer boycott in the works</a></li>
<li><a href='http://www.barklund.org/blog/2009/07/17/uk-copyright-does-extend-to-digitization/' rel='bookmark' title='Permanent Link: Why UK copyright law does extend copyright to the digitization of public domain works'>Why UK copyright law does extend copyright to the digitization of public domain works</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I just saw the <a href="http://www.snapabug.com/" title="Official page">SnapABug website</a>, and was quite impressed, until I actually tried to submit a bug. Unrestricted access to my computer, why would I grant that to an unknown applet? And why do you even require unrestricted access to all files etc. on my computer to create a screenshot?</p>
<p>Well, I delved into the application and found the answers &#8211; they could of course have done with a more restrictive permission.</p>
<p><span id="more-390"></span></p>
<p>First I found <a href="http://www.snapabug.com/snapabug.js">the JavaScript file</a>. The interesting part here was to find, that they actually inserted a java-applet in the corner of the application (in the <code>startWebCapture</code>-function):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">startWebCapture<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'SnapABug_Applet'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
    	document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'SnapABug_Applet'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> 
	    <span style="color: #3366CC;">'&lt;applet style=&quot;position:absolute;background-position-x:0px;background-position-y:0px;display:inline;font-size:2px;width:300px;height:2px;&quot; name=&quot;SnapABug_Applet&quot; code=&quot;webCaptureApplet.WebCaptureApplet.class&quot; codebase=&quot;'</span> <span style="color: #339933;">+</span> baseURL <span style="color: #339933;">+</span> <span style="color: #3366CC;">'/&quot; archive=&quot;sWebCaptureApplet.jar&quot; width=&quot;200&quot; height=&quot;2&quot; mayscript&gt;'</span>
        <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;param name=&quot;h&quot; value=&quot;'</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getWindowHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;'</span>
        <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;param name=&quot;w&quot; value=&quot;'</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getWindowWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;'</span>
        <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;param name=&quot;c&quot; value=&quot;'</span> <span style="color: #339933;">+</span> caseId <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;'</span>
        <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;param name=&quot;d&quot; value=&quot;300&quot;&gt;'</span>
        <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/applet&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This applet (<a href="http://www.snapabug.com/sWebCaptureApplet.jar">JAR file</a>) is passed the viewport size and a case ID (used for sending the screenshot directly to the server). The source for this applet is easily accessible using e.g. <a href="http://java.decompiler.free.fr/?q=jdgui#downloads" title="The JD Java Decompiler download page">JD</a>.</p>
<p>The interesting part here is how they actually find the offset of the viewport. Getting a screenshot of all the available screen devices is quite easily managed through the <code>GraphicsEnvironment</code> class iterating through all screen <code>GraphicsDevice</code>&#8216;s to make it work on multi-screen setups. But finding the browser-window on the screenshot bitmap is a bit tricky &#8211; the browser chrome can look in all different sorts of ways, the only thing that we can be sure of is, that the viewport is rectangular and has the size given to the applet by JavaScript. If we could find just one of the corners of the viewport&#8230; Well, they solve this in a very low-tech way by via the above JavaScript embedding the Java Applet in the top-left corner at 2*200px and then in the <code>paint(Graphics g)</code>-function of the applet draw a certain pattern in that area:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  ...
  <span style="color: #003399;">BigInteger</span> bi <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BigInteger</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;11010100110010110011&quot;</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ...
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> paint<span style="color: #009900;">&#40;</span><span style="color: #003399;">Graphics</span> g<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;paint: drawing corner&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    drawCornerCode<span style="color: #009900;">&#40;</span>g<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ...
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> drawCornerCode<span style="color: #009900;">&#40;</span><span style="color: #003399;">Graphics</span> g<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    g.<span style="color: #006633;">clearRect</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">bi</span>.<span style="color: #006633;">testBit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">19</span> <span style="color: #339933;">-</span> i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        g.<span style="color: #006633;">setColor</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        g.<span style="color: #006633;">setColor</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">white</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      g.<span style="color: #006633;">drawLine</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">0</span>, i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      g.<span style="color: #006633;">drawLine</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span>, i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      g.<span style="color: #006633;">drawLine</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This draws a black and white striped pattern in the top left corner of the browser which functions somewhat like a bar code. Then, when JavaScript asks the applet to create a screenshot, the applet runs through every pixel of every screen and sees, if from that pixel the bar code follows:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">      <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> j <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>j <span style="color: #339933;">&lt;</span> devices.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>detected<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>j<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">GraphicsDevice</span> device <span style="color: #339933;">=</span> devices<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">GraphicsConfiguration</span> config <span style="color: #339933;">=</span> device.<span style="color: #006633;">getDefaultConfiguration</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">Rectangle</span> bounds <span style="color: #339933;">=</span> config.<span style="color: #006633;">getBounds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ...
          <span style="color: #006633;">screenshot</span> <span style="color: #339933;">=</span> rbt.<span style="color: #006633;">createScreenCapture</span><span style="color: #009900;">&#40;</span>bounds<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ...
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>y <span style="color: #339933;">&lt;</span> screenshot.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>detected<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>y<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&lt;</span> screenshot.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">21</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>detected<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> x <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span>
          <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>screenshot.<span style="color: #006633;">getRGB</span><span style="color: #009900;">&#40;</span>x, y<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span>.<span style="color: #006633;">getRGB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">bi</span>.<span style="color: #006633;">testBit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">19</span> <span style="color: #339933;">-</span> i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>screenshot.<span style="color: #006633;">getRGB</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span>, y<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span>.<span style="color: #006633;">getRGB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>
                <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">bi</span>.<span style="color: #006633;">testBit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">19</span> <span style="color: #339933;">-</span> i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>screenshot.<span style="color: #006633;">getRGB</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">3</span>, y<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">white</span>.<span style="color: #006633;">getRGB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
              <span style="color: #009900;">&#123;</span>
                detected <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
              <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                detected <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
              <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>detected<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;detected x: &quot;</span> <span style="color: #339933;">+</span> x <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; y: &quot;</span> <span style="color: #339933;">+</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
              detectedX <span style="color: #339933;">=</span> x<span style="color: #339933;">;</span>
              detectedY <span style="color: #339933;">=</span> y<span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This <strong>is</strong> actually quite brilliant, but of course not a revolution &#8211; just a smart simple way of using what&#8217;s available.</p>
<p>What is the problem then? Unrestricted access is the problem! I never allow unrestricted access to any applet unless I can&#8217;t do without it and trust the publisher. For this tool, neither criteria is fulfilled. After having checked the source code, I have allowed the applet, but not before &#8211; unrestricted access is simply way more than they should ever have. They need access for two things:</p>
<ol>
<li><code>AWTPermission</code> &#8211; access to the screens (which also gives access to create frameless windows and access to the visible state of all other programs running).</li>
<li><code>SocketPermission</code> &#8211; access to cross-domain posting of the final image.</li>
</ol>
<p>Of these permissions, only the first one is really necessary. The latter could be solved by requiring implementers to have a script locally on their own domain, that could process submitted images or simply forward them.</p>
<p>If the applet only asked permission to these two &#8211; or even better only <code>AWTPermission</code> &#8211; it would be way more trustworthy. As <a href="http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html" title="Appendix A: Security and Permissions">Sun says</a> about the <code>AllPermission</code>:</p>
<blockquote><p>
<code>java.security.AllPermission</code> specifies all permissions in the system for all possible targets and actions. This permission should be used only during testing because it grants permission to run with all security restrictions disabled as if there were no security manager.
</p></blockquote>
<p>Only during testing! Never in deployed applets from an unknown company expecting major adoption across third-party websites. The permission, that I particularly don&#8217;t like any applet not needing it to have is <code>FilePermission</code>. They should not be able to read any files on my computer or write any &#8211; they don&#8217;t need it!</p>
<p><s>If it does get implemented on many sites, this jar file will then be very very interesting to phishers and scammers, as they could use this (if they replaced the file with their own) to infiltrate many computers with key-loggers, malware and anything else.</s> This is not the case, as the applet is digitally signed, so modifying would require re-signing it, which would require re-authorizing it by end users.</p>
<p>But nevertheless &#8211; a very interesting feedback mechanism, that definitely has potential.</p>
</p>
<p>Source-code published under fair use. All rights belong to <a href="http://www.timzon.com/">Timzon</a> and only published here as-is without any warranty, obligations or any claims of copyright on my behalf.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/10/19/signed-applet-trust-stupid/' rel='bookmark' title='Permanent Link: Why signed applet trust is a stupid question (and why SnapABug is not to blame)'>Why signed applet trust is a stupid question (and why SnapABug is not to blame)</a></li>
<li><a href='http://www.barklund.org/blog/2009/11/23/iphone-developer-boycott-in-the-works/' rel='bookmark' title='Permanent Link: The iPhone developer boycott in the works'>The iPhone developer boycott in the works</a></li>
<li><a href='http://www.barklund.org/blog/2009/07/17/uk-copyright-does-extend-to-digitization/' rel='bookmark' title='Permanent Link: Why UK copyright law does extend copyright to the digitization of public domain works'>Why UK copyright law does extend copyright to the digitization of public domain works</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2009/10/14/how-snapabug-works/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Clients can never be trusted</title>
		<link>http://www.barklund.org/blog/2007/06/03/clients-can-never-be-trusted/</link>
		<comments>http://www.barklund.org/blog/2007/06/03/clients-can-never-be-trusted/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 13:05:34 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/2007/06/03/clients-can-never-be-trusted/</guid>
		<description><![CDATA[And for once, I am not talking bad about our company clients, but the clients in a client-server architecture. Flash memory cheats have always been known to any good flash game hackers and ditto developer, but some still don&#8217;t know about them. Thus, as shoemoney recently posted a competition to get the best score in [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/09/04/mxhr4as3-multipart-mixed-file-download-flash/' rel='bookmark' title='Permanent Link: Announcing MXHR4AS3: Multipart/mixed-file download by Flash clients'>Announcing MXHR4AS3: Multipart/mixed-file download by Flash clients</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/21/game-of-life-january-2010-idea/' rel='bookmark' title='Permanent Link: Game of Life &#8211; January 2010 Ideas'>Game of Life &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/25/facebook-notes-images-competition-january-2010-idea/' rel='bookmark' title='Permanent Link: Facebook Notes and Images for Competition Results &#8211; January 2010 Ideas'>Facebook Notes and Images for Competition Results &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>And for once, I am not talking bad about our company clients, but the clients in a client-server architecture.</p>
<p>Flash memory cheats have always been known to any good flash game hackers and ditto developer, but some still don&#8217;t know about them. Thus, as <a href="http://www.shoemoney.com" title="Guess he just likes the game">shoemoney</a> recently <a href="http://www.shoemoney.com/2007/05/25/can-you-beat-me-at-desktop-tower-defense/" title="A bit naive of him">posted a competition to get the best score</a> in <a href="http://www.handdrawngames.com/DesktopTD/" title="It IS a cool game">Desktop Tower Defence</a>, &#8220;some guy&#8221; of course fired up <a href="http://www.timsvault.com/cheattools/tsearch.htm" title="Simple and rude, but very efficient">Tsearch</a> and throw a lot of points his way. <a href="http://www.shoemoney.com/2007/05/31/congrats-tylerc-on-the-dtd-challenge/" title="At least shoemoney was true to his word">The result was of course, that he won</a> (even though he cheated), and afterwards <a href="http://www.rotinpieces.com/2007/06/02/how-to-hack-desktop-tower-defence" title="Tsearch this and that">he posted a simple guide to do it</a>.</p>
<p>That is why should should always have a server telling you what to do when. More on this topic in the months to come &#8211; as I and a friend is developing a brand new game site including high-level security.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/09/04/mxhr4as3-multipart-mixed-file-download-flash/' rel='bookmark' title='Permanent Link: Announcing MXHR4AS3: Multipart/mixed-file download by Flash clients'>Announcing MXHR4AS3: Multipart/mixed-file download by Flash clients</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/21/game-of-life-january-2010-idea/' rel='bookmark' title='Permanent Link: Game of Life &#8211; January 2010 Ideas'>Game of Life &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/25/facebook-notes-images-competition-january-2010-idea/' rel='bookmark' title='Permanent Link: Facebook Notes and Images for Competition Results &#8211; January 2010 Ideas'>Facebook Notes and Images for Competition Results &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2007/06/03/clients-can-never-be-trusted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
