Skip to content

Security hardening: disallow ScriptBlock step handlers by default (RCE risk via StepRegistry) #23

@blindzero

Description

@blindzero

Finding

Step handlers can be ScriptBlocks that are executed by the engine. The step registry may be supplied via Providers.StepRegistry without explicit trust validation. If an untrusted source can influence the registry, this becomes an RCE vector.

Goal

Make the engine safe by default:

  • Step handlers MUST NOT be ScriptBlocks unless explicitly allowed (dev/test scenario).

Proposed approach

  • Update step handler resolution logic to accept only:
    • string (function name / command name)
    • optionally CommandInfo (if desired)
  • Reject ScriptBlock handlers unless an explicit trust policy/flag allows it, e.g.:
    • ExecutionContext.Policy.AllowScriptBlockHandlers = $true
    • or Invoke-IdlePlan -AllowScriptBlockHandlers (exact API tbd)

Acceptance criteria

  • Default behavior: ScriptBlock handlers are rejected with a clear error message.
  • Opt-in behavior: ScriptBlock handlers can be enabled explicitly for demo/test scenarios.
  • Pester tests cover:
    • default reject
    • opt-in accept
    • error message includes which step/handler was rejected

Documentation

  • Document the trust boundary: Providers.StepRegistry is host-provided and must be trusted.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions