fluentcms / fluentcms/FluentCMS.Infrastructure
[Security] Arbitrary code execution through unrestricted DLL scanning in PluginDiscovery
- 主要言語
- C#
- スター
- 0
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
## Summary
`PluginDiscovery.Scan()` resolves the scan path from `Assembly.GetExecutingAssembly().Location` / `Environment.ProcessPath` and enumerates **all** `*.dll` files in the application's output directory that match `ScanAssemblyPatterns` (default: `FluentCMS.Plugins.*`). Any DLL placed in that directory will be loaded and executed with the application's full trust level on next startup.
## Location
`Plugins/FluentCMS.Infrastructure.Plugins/Discovery/PluginDiscovery.cs` — `Scan()` method (~line 42)
## Risk
A supply-chain or filesystem-level attacker can drop a malicious DLL matching the naming pattern and have arbitrary code execute at application startup. There is no:
- File signature / hash verification
- Allowlist of trusted publishers (Authenticode)
- Sandbox or isolated execution
## Reproduction
1. Build the host application.
2. Copy a malicious DLL named `FluentCMS.Plugins.Evil.dll` into the output directory.
3. Restart the application — the DLL is discovered, loaded, and any `IPluginStartup` implementation executes.
## Recommendation
1. Allow operators to configure an **explicit, out-of-tree plugin directory** instead of defaulting to the host binary directory:
```csharp
options.PluginDirectory = "/opt/myapp/plugins"; // separate from binaries
```
2. Optionally add **file hash verification** or **Authenticode certificate validation** before loading each assembly.
3. Consider a plugin allowlist (name + expected hash) stored in a protected configuration location.
## Severity
🔴 **Critical / Security**
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Plugins/FluentCMS.Infrastructure.Plugins/Discovery/PluginDiscovery.cs から始め、Scan() メソッドと、そこでの ScanAssemblyPatterns、Assembly.GetExecutingAssembly().Location、Environment.ProcessPath の使用に焦点を当てます。プラグインの読み込みと IPluginStartup の実行がどのように動作するかを確認し、その後、採用するディレクトリ構成およびアセンブリ検証のアプローチを定義します。選択した信頼性チェックなしに、一致する DLL がホストの出力ディレクトリから読み込まれなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- backend, security
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100