<p>I want to allow my users to embed their own Flash animations in their posts.  Usually the actual file is hosted on some free image hosting site.  I wouldn't actually load the flash unless the user clicked a button to play (so that nothing auto-plays on page load).  I know people can make some really annoying crap in flash, but I can't find any information about potential <em>serious</em> damage a flash app could cause to the viewer.</p>

<p>Is it unsafe to embed just any flash file from the internets?  If so, how can I let users embed innocent animations but still keep out the harmful apps?</p>

<p>edit:</p>

<p>From what I can gather, the most obvious threat is for actionscript to redirect you to a malicious site.</p>

<p>Adobe <a href="http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_04.html" rel="nofollow noreferrer">says</a> you can set <strong>allowScriptAccess=never</strong> and <strong>allowNetworking=none</strong> and the swf should have no access to anything outside of itself.  <strong>Will this solve all my problems?</strong></p>

[{'answer_id': 43996, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 0, 'selected': False, 'text': "<p>Yes, it's unsafe.</p>\n\n<p>There's no easy way of allowing it. You could have a domain whitelist that allowed YouTube, Hulu, etc. through, but whitelisting is inherently painstaking - you'd be constantly updating.</p>\n"}, {'answer_id': 44021, 'author': 'RedWolves', 'author_id': 648, 'author_profile': 'https://Stackoverflow.com/users/648', 'pm_score': 1, 'selected': False, 'text': '<p>As an <a href="http://drupal.org/node/178192" rel="nofollow noreferrer">example Drupal has a scenario</a> of how allowing flash content from users could be a security concern.</p>\n'}, {'answer_id': 44650, 'author': 'grapefrukt', 'author_id': 914, 'author_profile': 'https://Stackoverflow.com/users/914', 'pm_score': 2, 'selected': False, 'text': '<p>Flash has some neat security measures in place. Allowing users to upload swf\'s to your site and embedding them is unsafe, you\'re basically setting yourself up for an XSS attack.</p>\n\n<p>However, allowing them to hotlink should not be a problem. The swf will be locked to the domain that is hosting it and is not allowed calling url\'s outside of that space. </p>\n\n<p>It will still be open to "evil links" (i\'m sure theres a proper word for them), and by that I mean having regular links to yoursite.com/admin/deleteallpages.php which it tries to load "as" you. It will not however be able to use this data in any way, it\'ll basically be the same as a normal link, and I\'d guess modern cms\' are protected from that type of attacks.</p>\n\n<p>You could get the same protection by hosting your flashes on a different subdomain, since flash considers this the same as a completely different domain.</p>\n'}, {'answer_id': 50977, 'author': 'dsims', 'author_id': 744, 'author_profile': 'https://Stackoverflow.com/users/744', 'pm_score': 2, 'selected': True, 'text': '<p>Adobe says you can set <strong>allowScriptAccess</strong>=never and <strong>allowNetworking</strong>=none and the swf should have no access to anything outside of itself.  Although allowNetworking is only in Flash Player 9, so users with earlier versions of Flash would still be susceptible to some exploits.</p>\n\n<p><a href="http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_04.html" rel="nofollow noreferrer">Creating more secure SWF web applications : Security Controls Within the HTML Code</a></p>\n\n<p><a href="http://blogs.adobe.com/stateofsecurity/2007/07/how_to_restrict_swf_content_fr_1.html" rel="nofollow noreferrer">How to restrict SWF content from HTML</a></p>\n'}, {'answer_id': 52037, 'author': 'RickDT', 'author_id': 5421, 'author_profile': 'https://Stackoverflow.com/users/5421', 'pm_score': 2, 'selected': False, 'text': "<p>When embedding SWFs from unknown sources, it is also best practice to throw a mask on the Loader so that the loaded SWF can't take over more screen real estate than expected.</p>\n\n<p>Pseudo-code to do so:</p>\n\n<pre><code>var maskSpr : Sprite = new Sprite();\nmaskSpr.graphics.beginFill();\nmaskSpr.graphics.drawRect(0,0,safeWidth,safeHeight);\nmaskSpr.graphics.endFill();\nmyLdr.mask = maskSpr;\n</code></pre>\n"}, {'answer_id': 851308, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>There is actually more than one option.</p>\n\n<p>To be totally safe, set allowScriptAccess=never and allowNetworking=none and the swf will have no access to anything outside of itself. </p>\n\n<p>NOTE: allowNetworking is only in Flash Player 9 (it was created in response to various myspace worms), so you\'ll need to use <a href="http://code.google.com/p/swfobject/" rel="nofollow noreferrer">SWF Object</a> to insure that only users with the right flash player version or better have the flash loaded.</p>\n\n<p>If you want to enable things like youtube videos, though, you can\'t set allowNetworking to "none".  Fortunately, there is an intermediate level of security for this field - "internal" which lets the SWF talk to its hosted domain.</p>\n\n<p>Also note that you better not have a crossdomain.xml file on your site - read more about those dangers <a href="http://blog.monstuff.com/archives/000302.html" rel="nofollow noreferrer">here</a> and other places.</p>\n\n<p>Here are some other sites that are mentioned by other answers that go into more detail:</p>\n\n<p><a href="http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_04.html" rel="nofollow noreferrer">http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_04.html</a></p>\n\n<p><a href="http://blogs.adobe.com/stateofsecurity/2007/07/how_to_restrict_swf_content_fr_1.html" rel="nofollow noreferrer">http://blogs.adobe.com/stateofsecurity/2007/07/how_to_restrict_swf_content_fr_1.html</a></p>\n'}]
['https://Stackoverflow.com/questions/43992', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/744/']