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

Merged
merged 6 commits into from
Jul 17, 2025

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
@YanaXu
Copy link
Contributor

YanaXu commented Jul 15, 2025

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@@ -19,6 +19,8 @@
-->
## Upcoming Release

* Fixes security bug in token acquisition for MI server registration
Copy link
Member

Choose a reason for hiding this comment

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

It is advisable to re-record atleast one test which is exercising this new code path.

@ankushbindlish2
Copy link
Member

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

I presume that re-recording a test which is exercising this code path or creating a new test covering this path should be sufficient. There is no need of "before" test result.

Copy link

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

@YanaXu
Copy link
Contributor

YanaXu commented Jul 17, 2025

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@YanaXu YanaXu merged commit 163d623 into Azure:main Jul 17, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants