fluentcms / fluentcms/FluentCMS.Infrastructure

[Security] Arbitrary code execution through unrestricted DLL scanning in PluginDiscovery

Abierto
#4 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug security
Lenguaje dominante
C#
Estrellas
0
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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**

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza en Plugins/FluentCMS.Infrastructure.Plugins/Discovery/PluginDiscovery.cs, centrándote en el método Scan() y en el uso que hace de ScanAssemblyPatterns, Assembly.GetExecutingAssembly().Location y Environment.ProcessPath. Revisa cómo funcionan la carga de plugins y la ejecución de IPluginStartup y, después, define qué enfoque de configuración de directorios y verificación de assemblies se adoptará; se considerará terminado cuando las DLL coincidentes no se carguen desde el directorio de salida del host sin las comprobaciones de confianza seleccionadas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
backend, security
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.