Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[release/9.0-staging] Prevent format injection in hosting Windows PAL printf functions when redirected to file - #119786

#119786
Merged
jkoritzinsky merged 1 commit into
dotnet:release/9.0-stagingdotnet/runtime:release/9.0-stagingfrom
jkoritzinsky:9.0-host-printfjkoritzinsky/runtime:9.0-host-printfCopy head branch name to clipboard
Oct 7, 2025
Merged

[release/9.0-staging] Prevent format injection in hosting Windows PAL printf functions when redirected to file#119786
jkoritzinsky merged 1 commit into
dotnet:release/9.0-stagingdotnet/runtime:release/9.0-stagingfrom
jkoritzinsky:9.0-host-printfjkoritzinsky/runtime:9.0-host-printfCopy head branch name to clipboard

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

Fixes Issue #119566

main PR #119568

Description

Customer Impact

Prevents crashes when a path in deps.json or a framework name in runtimeconfig.json contains a '%' character.

Regression

Yes, introduced by #102295

Testing

Manual validation with testing

Risk

Low risk. This is a standard fix for this scenario, and it's only reachable on .NET 9 with an opt-in COREHOST_TRACE=1 environment variable.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

Copilot AI review requested due to automatic review settings September 16, 2025 22:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a format injection vulnerability in the hosting Windows PAL printf functions when output is redirected to a file. The issue occurs when paths in deps.json or framework names in runtimeconfig.json contain '%' characters, which are interpreted as format specifiers and can cause crashes.

  • Replaces direct pal::file_vprintf call with a safer file_printf wrapper that uses %s format specifier
  • Adds a new file_printf helper function to properly handle string formatting
  • Prevents format injection attacks when trace output is redirected to files

@JulieLeeMSFT

Copy link
Copy Markdown
Member

Approved. Please get code review and check test results.

@JulieLeeMSFT JulieLeeMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@JulieLeeMSFT JulieLeeMSFT added the Servicing-consider Issue for next servicing release review label Sep 16, 2025
@JulieLeeMSFT

Copy link
Copy Markdown
Member

CC @jeffschwMSFT.

@rbhanda rbhanda modified the milestones: 9.0.x, 9.0.11 Oct 2, 2025
@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 2, 2025
@jkoritzinsky

Copy link
Copy Markdown
Member Author

/azp run runtime

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky

Copy link
Copy Markdown
Member Author

/ba-g failures matched to existing issue, but BA is not green because this is a servicing branch

@jkoritzinsky
jkoritzinsky merged commit 836cc98 into dotnet:release/9.0-staging Oct 7, 2025
150 of 154 checks passed
@jkoritzinsky
jkoritzinsky deleted the 9.0-host-printf branch October 7, 2025 15:16
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.