Skip to content

Add Fuzz Tests#26384

Merged
TravisEz13 merged 6 commits intoPowerShell:masterfrom
anamnavi:onefuzz-testing
Nov 6, 2025
Merged

Add Fuzz Tests#26384
TravisEz13 merged 6 commits intoPowerShell:masterfrom
anamnavi:onefuzz-testing

Conversation

@anamnavi
Copy link
Copy Markdown
Member

@anamnavi anamnavi commented Nov 5, 2025

PR Summary

PR Context

Add fuzz tests, to fuzz token received from HyperV-Socket response. This uses LibFuzzer and SharpFuzz, and the tests can be run via the included script, which builds the FuzzingApp project, instruments its .dll as well as the dependent SMA .dll. The corpus includes 2 files, maxinput and mininput as valid input examples.

PR Checklist

Copilot AI review requested due to automatic review settings November 5, 2025 17:40
@TravisEz13 TravisEz13 added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Nov 5, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds fuzzing infrastructure for PowerShell using SharpFuzz and libfuzzer-dotnet. The fuzzing targets the HyperV socket token extraction functionality in the remoting layer to discover potential parsing vulnerabilities.

Key changes:

  • Adds fuzzing test infrastructure with a dedicated FuzzingApp project
  • Refactors token extraction logic into a testable ExtractFuzzedToken method
  • Exposes internal methods for fuzzing via InternalsVisibleTo attribute

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/fuzzing/runFuzzer.ps1 New PowerShell script to orchestrate the fuzzing workflow (build, instrument, execute)
test/fuzzing/FuzzingApp/powershell-fuzz-tests.csproj Project file for fuzzing test harness targeting .NET 10.0
test/fuzzing/FuzzingApp/Program.cs Fuzzing harness entry point that invokes SharpFuzz on token extraction
test/fuzzing/inputs/mininput Minimal fuzzing corpus input
test/fuzzing/inputs/maxinput Maximum fuzzing corpus input with extended character set
src/System.Management.Automation/engine/remoting/common/RemoteSessionHyperVSocket.cs Refactors token parsing into ExtractFuzzedToken method and updates call sites
src/System.Management.Automation/AssemblyInfo.cs Adds InternalsVisibleTo for fuzzing test assembly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/fuzzing/runFuzzer.ps1
Comment thread test/fuzzing/runFuzzer.ps1
Comment thread test/fuzzing/runFuzzer.ps1
Comment thread test/fuzzing/runFuzzer.ps1
Comment thread test/fuzzing/runFuzzer.ps1
Comment thread test/fuzzing/runFuzzer.ps1 Outdated
Comment thread src/System.Management.Automation/AssemblyInfo.cs Outdated
Comment thread test/fuzzing/FuzzingApp/Program.cs Outdated
Comment thread test/fuzzing/runFuzzer.ps1
@anamnavi anamnavi requested a review from TravisEz13 November 5, 2025 20:34
@anamnavi
Copy link
Copy Markdown
Member Author

anamnavi commented Nov 5, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 26384 in repo PowerShell/PowerShell

@TravisEz13 TravisEz13 enabled auto-merge (squash) November 5, 2025 23:36
@TravisEz13 TravisEz13 merged commit 000c116 into PowerShell:master Nov 6, 2025
44 of 46 checks passed
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
Co-authored-by: anamnavi <annavied@microsoft.com>
kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request Jan 2, 2026
Co-authored-by: anamnavi <annavied@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants