Exploiting an Order of Operations Bug to Achieve RCE in Oracle Opera
If you work in the hospitality industry, it’s quite likely that you have seen or worked with Oracle Opera. This software is used by almost all of the largest hotels/resort chains around the world. This critical piece of software holds all of the PII for every guest, including but not limited to credit card details.
Through our source code analysis of this software, we were able to achieve pre-authentication remote command execution by exploiting an order of operations bug within a file upload servlet. Oracle has released a critical patch update and has assigned this issue CVE-2023-21932.
Unfortunately, we disagree with Oracle’s classification of this vulnerability “difficult to exploit vulnerability allows high privileged attacker…” and this blog post will demonstrate why this CVE should have been assigned a rating of 10.0 instead of 7.2. This vulnerability does not require any authentication to exploit, despite what Oracle claims.
We first came across this target when participating in a live hacking event in 2022 for one of the largest resorts in the US being the target. The landing page for Oracle Opera alone caught our attention, as it looked like some 90’s legacy software:
Our gut instinct was that this software, given the specialised nature of it, probably did not have much attention from the security researcher community. The last major critical vulnerabilities discovered in Oracle Opera were in 2016, by Jackson T [1]. This was later expanded on/covered by the Chinese security research community: [2].
Obtaining this software was not difficult. Latest versions of this software are readily available in Oracle’s download center which can be accessed after authenticated as a regular user. No licenses or sales calls were required in order to obtain the installation files.
Inside <span class="code_single-line">operainternalservlets.war</span>, we found a servlet mapping for the FileReceiver endpoint:
This mapping correlates back to <span class="code_single-line">com.micros.opera.servlet.FileReceiver</span> which is responsible for taking in a file and uploading it to the system.
The file receiver endpoint takes in the following parameters as input:
Can you spot the vulnerability? This is a classic order of operations bug. The code above sanitizes an encrypted payload for the <span class="code_single-line">jndiname</span> and <span class="code_single-line">username</span> parameters, and then decrypts it. This should be in reverse order in order for it to be effective. With the above code, these two variables can contain any payload we would like without any sanitization occurring.
These parameters are then passed to the following function:
Looking into the <span class="code_single-line">Utility.isFileInWhiteList</span> function, we can see that the following logic is applied:
The user controllable values in the above function are <span class="code_single-line">jndiName</span> and <span class="code_single-line">schemaName</span> (username). As mentioned earlier, we are able to control schemaName (username) and no sanitisation is applied to this variable.
The logic for where the paths are built and checked can be found inside the <span class="code_single-line">isAllowedPath</span> function:
Again, in this function, we control the <span class="code_single-line">schemaName</span> and <span class="code_single-line">fileName</span>. Since we control <span class="code_single-line">schemaName</span>, and have performed path traversal within it, we are able to set the value of adjustedSourcePath to <span class="code_single-line">D:\</span>
Where <span class="code_single-line">schemaName = "foo/../../../../../"</span>
So <span class="code_single-line">adjustedSourcePath = "D:\"</span>. At this point, our <span class="code_single-line">fileName</span> can be any file in the <span class="code_single-line">D:\</span> directory, permitting us to write arbitrary files to the <span class="code_single-line">D:\</span> directory.
While the above describes the arbitrary file upload vulnerability into any drive/location, it does not explain how to achieve pre-auth command execution. There are two major blockers that would prevent you from being able to exploit the vulnerability above. The first is being able to encrypt valid strings, and the second is the knowledge of the JNDI connection name.
Fortunately, both of these blockers can easily be resolved. The JNDI connection name can be obtained by visiting the following URLs:
The JNDI names will be displayed by those servlets, which is accessible without any authentication. Now that the JNDI name has been obtained, we can move onto the encryption element, as we need to provide encrypted strings to the <span class="code_single-line">FileReceiver</span> servlet in order to achieve pre-authentication RCE.
We determined that Oracle Opera uses static keys to encrypt strings. We were able to recreate their encryption routine and repurposed this to be able to encrypt arbitrary strings. This is necessary to exploit this vulnerability. The code for this can be found below:
Show Encryption Code
Running this Java file above will output the following:
We can then use these two values for the rest of the exploitation.
The final payload used to upload arbitrary files to the <span class="code_single-line">D:\</span> directory can be found below. This HTTP request uploads a CGI web shell to the local file system:
The web shell will be accessible at the following location:
<span class="code_single-line">https://example.com/operabin/80088941a432b4458e492b7686a88da6.cgi?type%20C:\Windows\win.ini</span>
As seen above, RCE is possible without any special access or knowledge. All steps performed in the exploitation of this vulnerability were without any authentication. This vulnerability should have a CVSS score of 10.0.
There are a tonne of other vulnerabilities in Oracle Opera, some which are still not resolved. Please do not expose this to the internet, ever.
More Like This
Ready to get started?
Get on a call with our team and learn how Assetnote can change the way you secure your attack surface. We'll set you up with a trial instance so you can see the impact for yourself.