=============================================================================== BAE Systems Detica Security Advisory: DS-2013-005 =============================================================================== Title: Atlassian Confluence Multiple Issues Version: 4.3.5, and earlier Issue type: Persistent Cross-site Scripting, Persistent Cross-site Flashing, Click Jacking Affected vendor: Atlassian (www.atlassian.com) Release date: 10/07/2013 Discovered by: Andrew Horton, Sow Ching Shiong, Mahendra Issue status: Patch available (unconfirmed) =============================================================================== Summary ------- Security researchers Andrew Horton, Sow Ching Shiong and Mahendra discovered persistent cross-site scripting, persistent cross-site flashing, and insufficient framing protection, vulnerabilities in Confluence version 4.3.5. The latest fully patched version of the application was used at the time of discovery. The persistent cross-site scripting, and cross-site flashing vulnerabilities, enable an attacker with a user account on the Atlassian Confluence web application, to specially craft a Confluence webpage that will hijack the session of users who visit that page. This can be used by an attacker to elevate privileges from a basic user account, to an administrative account after any administrative user visits the webpage. The insufficient framing protection vulnerability enables an attacker without a user account, to lure an authenticated user into following an untrusted link, click on a webpage, and perform unwanted actions. A harmless example is to update a user’s profile with new information. * Persistent Cross-site Scripting The vulnerability is caused by insufficient controls in the application to prevent JavaScript content executing that is included in user uploaded files. When a user uploads a file as an attachment to a wiki page, the web application chooses whether to allow the file to be rendered in-line based on the filename extension and the provided content-type. It is possible to bypass these controls and upload a file containing JavaScript content that will execute JavaScript in a user’s web browser. * Persistent Cross-site Flashing The vulnerability exists because the application has a design flaw that allows Adobe Flash files to be uploaded, and Flash files can trigger JavaScript to be executed. Cross-site flashing vulnerabilities are similar in impact to cross-site scripting. * Insufficient Framing Protection Framing involves placing one webpage within another webpage by use of the iframe HTML element. One familiar use of iframes is to embed maps within web pages. When a website is framed within another untrusted webpage, various attacks are possible including click jacking and frame sniffing. Persistent Cross-site Scripting Description ============================================ Cross-site scripting vulnerabilities exist when an attacker can cause arbitrary JavaScript into be included within a response from a web application. Persistent cross-site scripting occurs when the JavaScript payload is stored in the web application and presented to another user of the web application at a later time. Throughout most of the Atlassian Confluence web application, there is adequate user input validation and output sanitization to protect against cross-site scripting however the attachment upload functionality can be abused to perform this attack. When a user uploads a file as an attachment to a wiki page, the web application chooses whether to render the content in-line or provide it as a downloadable file depending on the filename extension and the user provided content-type. HTML files are restricted from being rendered in-line. However, it is possible to bypass these controls and upload a file containing JavaScript content that will be rendered as HTML in the web browser. This can be achieved by uploading a filename that does not contain an “HTML” extension, and providing a user supplied content-type that is set to something other than “text/html”. Impact ------ This vulnerability can be used to perform unwanted actions on a user’s behalf, and to perform a session hijacking attack by injecting malicious JavaScript. Affected products ------------------ This vulnerability was discovered in default installations of Confluence 4.3.5. Other earlier versions may also be affected. Proof of concept ------------------ To demonstrate the persistent cross-site scripting, follow the steps below. 1. Create a file that contains a cross-site scripting payload such as the following example:
2. Add an attachment to a wiki page. 3. Use your proxy software to intercept the POST request that uploads the attachment file. Alter the user supplied content-type to a value other than “text/html” and ensure that the filename does not contain the suffix, “.html” as shown below. 4. Observe that the attached file has been uploaded. 5. Follow the attached file link and observe that cross-site scripting occurs. Solution --------- * Solution for Atlassian Use a whitelist of allowed content types that can be rendered in-line instead of a blacklist approach which restricts files based on filenames and user provided content-types. Ensure that none of the whitelisted content-types can be used to render HTML which may include scripting content. For unknown and non-whitelisted content types, force the browser to download the file by including the “Content-Disposition: attachment;” HTTP header. * Solution for Confluence users Upgrade to Atlassian Confluence version 4.3.7. Note that Detica has not verified this issue is resolved. Persistent Cross-site Flashing Description ========================================== Cross-site flashing vulnerabilities exist when an attacker can cause arbitrary JavaScript into be executed from within a Flash file in a web application. Persistent cross-site scripting occurs when the JavaScript payload is stored in the web application and presented to another user of the web application at a later time. The vulnerability is due to a design flaw in the application that allows Adobe Flash files to be uploaded, and Flash files can trigger JavaScript to be executed. Cross-site flashing vulnerabilities are similar in impact to cross-site scripting. This vulnerability is more easily exploited than the persistent cross-site scripting vulnerability as the JavaScript can be automatically executed upon viewing a webpage on the wiki. A variety of methods are available within the ActionScript language to execute JavaScript from within a Flash file. These methods include, but are not limited to the following examples: * ExternalInterface.call("document.write",""); * navigateToURL(new URLRequest("Javascript: document.write(\"hi