Skip to content

Fix for Server Challenge Token Security Incident #28177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

stefong99
Copy link
Contributor

@stefong99 stefong99 commented Jul 11, 2025

Description

This change makes a fix for CVE-2025-47158

Incident 31000000381506 : [MSRC] [98867] - ElevationOfPrivilege - Local Privilege Escalation that results in Arbitrary File Read in Azure File Sync Agent on Arc enabled Windows server

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@Copilot Copilot AI review requested due to automatic review settings July 11, 2025 18:18
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

@Copilot 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 addresses CVE-2025-47158 by strengthening how the server challenge token’s secret file path is parsed and validated.

  • Renamed and clarified the header variable and improved its parsing
  • Centralized path normalization and validation in a new IsSecretFilePathValid helper
  • Updated error handling to use a consistent error resource
Comments suppressed due to low confidence (3)

src/StorageSync/StorageSync/Interop/ManagedIdentity/ServerManagedIdentityUtils.cs:275

  • [nitpick] The variable name wwwHeader is ambiguous. Consider renaming it to something more descriptive like authenticateHeaderValue or challengeHeaderValue to improve readability.
                    var wwwHeader = authenticateHeaderValues.FirstOrDefault();

src/StorageSync/StorageSync/Interop/ManagedIdentity/ServerManagedIdentityUtils.cs:344

  • The new IsSecretFilePathValid method contains critical security logic but lacks dedicated unit tests. Please add tests covering valid paths, invalid paths, edge cases, and path traversal attempts.
        private static bool IsSecretFilePathValid(string secretFilePath)

src/StorageSync/StorageSync/Interop/ManagedIdentity/ServerManagedIdentityUtils.cs:296

  • [nitpick] Reusing the same error message for both a missing secret file and an invalid path may be confusing. Consider using distinct error codes or messages to differentiate missing file vs invalid path scenarios.
                            StorageSyncResources.AgentMI_InvalidSecretFileError,

@stefong99 stefong99 added this to the Az 14.3.0 (08/05/2025) milestone Jul 11, 2025
@YanaXu
Copy link
Contributor

YanaXu commented Jul 14, 2025

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@YanaXu
Copy link
Contributor

YanaXu commented Jul 14, 2025

Please provide the test result before and after this change. Thanks!

@YanaXu YanaXu self-assigned this Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants