Skip to content

Microsoft Defender XDR: fix ARM-TTK hardcoded URI false positives in …#14472

Open
juanjosalco wants to merge 3 commits into
Azure:masterfrom
juanjosalco:juansala/fix-mdxdr-hardcoded-uri
Open

Microsoft Defender XDR: fix ARM-TTK hardcoded URI false positives in …#14472
juanjosalco wants to merge 3 commits into
Azure:masterfrom
juanjosalco:juansala/fix-mdxdr-hardcoded-uri

Conversation

@juanjosalco

Copy link
Copy Markdown

Refactor Potential OAuth phishing email delivered into Inbox and Possible device code phishing attempts hunting queries in the Microsoft Defender XDR solution to construct login.microsoftonline.com and login.microsoftonline.us URLs using KQL strcat() instead of inline string literals.

The queries legitimately need to match these URLs at runtime (OAuth consent and device-code phishing patterns), but the literal strings tripped the ARM-TTK DeploymentTemplate Must Not Contain Hardcoded Uri rule on the generated mainTemplate.json. Splitting the host string via strcat() preserves query semantics and clears the linter.

Version bumped to 3.0.15; mainTemplate.json and 3.0.15.zip regenerated via createSolutionV3.

Change(s):

  • Updated KQL in Solutions/Microsoft Defender XDR/Hunting Queries/Email and Collaboration Queries/Custom Detections/Potential OAuth phishing email delivered into Inbox.yaml to build OAuth consent URLs via strcat() and bumped its version to 1.0.1.
  • Updated KQL in Solutions/Microsoft Defender XDR/Hunting Queries/Email and Collaboration Queries/Phish/Possible device code phishing attempts.yaml to build the device-code URLs via strcat() inside a pack_array let-binding used by has_any, and bumped its version to 1.0.1.
  • Bumped solution version 3.0.14 → 3.0.15 in Solution_Microsoft Defender XDR.json.
  • Regenerated Package/mainTemplate.json and Package/3.0.15.zip via createSolutionV3.ps1.
  • Added a 3.0.15 row to ReleaseNotes.md.

Reason for Change(s):

  • ARM-TTK DeploymentTemplate Must Not Contain Hardcoded Uri was failing on mainTemplate.json with 4 hits at lines 11153 and 22284, all originating from these two hunting queries. This blocked the Sentinel solution validation pipeline on any PR touching the Defender XDR package.
  • The flagged strings are not deployment URIs — they are detection patterns the queries must match. Reconstructing them at query time via strcat() keeps runtime behavior identical while removing the literal hostnames from the serialized ARM template.

Version updated:

  • Yes — solution 3.0.14 → 3.0.15; both hunting query YAMLs bumped to 1.0.1.

Testing Completed:

  • Yes. Repackaged via ./.script/local-validation/build-and-validate.ps1 -SolutionName "Microsoft Defender XDR" -VersionBump patch -SkipValidation -ReleaseNotes "..." to regenerate mainTemplate.json and the zip from the updated YAML sources.
  • Ran ./.script/local-validation/run-arm-ttk.ps1 -SolutionPath "Solutions/Microsoft Defender XDR": - Before: Pass=29 Fail=1 Total=30 (DeploymentTemplate Must Not Contain Hardcoded Uri failed with 4 hits).
  • After: Pass=30 Fail=0 Total=30 on mainTemplate.json and Pass=18 Fail=0 Total=18 on createUiDefinition.json — ARM-TTK-SUMMARY: Pass=48 Fail=0 Total=48.
  • Verified the regenerated mainTemplate.json contains zero login.microsoftonline.com literal matches.
  • Ran the .NET KQL validation suite on the modified hunting queries; both pass after switching has_any(strcat(...)) to has_any(<pack_array let>) in the device-code query.

Checked that the validations are passing and have addressed any issues that are present:

  • Yes. ARM-TTK and KQL validation pass locally for the files this PR touches. Any other failures observed in the full local validation run (e.g., SolarWinds_SUNBURST_Process-IOCs.yaml schema check, ASim parser KQL failures) are pre-existing on master and unrelated to this change.

…phishing hunting queries

Refactor 'Potential OAuth phishing email delivered into Inbox' and 'Possible device code phishing attempts' hunting queries to construct login.microsoftonline.com and login.microsoftonline.us URLs using KQL strcat() instead of string literals.

The queries legitimately need to match these URLs at runtime (OAuth consent and device-code phishing patterns), but the literal strings tripped the ARM-TTK 'DeploymentTemplate Must Not Contain Hardcoded Uri' rule on the generated mainTemplate.json. Splitting the host string via strcat() preserves query semantics and clears the linter.

Version bumped to 3.0.15; mainTemplate.json and 3.0.15.zip regenerated via createSolutionV3.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@juanjosalco juanjosalco requested review from a team as code owners June 12, 2026 17:57
@v-maheshbh v-maheshbh added the Solution Solution specialty review needed label Jun 15, 2026
@v-maheshbh v-maheshbh requested a review from Copilot June 15, 2026 04:53

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates two Microsoft Defender XDR hunting queries to reconstruct specific Microsoft login-related URL patterns at runtime (via strcat()), avoiding ARM-TTK “hardcoded URI” false positives in the packaged ARM template, and bumps the solution/package version accordingly.

Changes:

  • Refactored two hunting queries to build login.microsoftonline.* URL patterns using strcat()/pack_array() instead of inline literals.
  • Bumped query versions to 1.0.1 and solution version to 3.0.15.
  • Updated release notes for the new solution version.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

File Description
Solutions/Microsoft Defender XDR/ReleaseNotes.md Adds a 3.0.15 release note entry describing the query refactor and ARM-TTK impact.
Solutions/Microsoft Defender XDR/Hunting Queries/Email and Collaboration Queries/Phish/Possible device code phishing attempts.yaml Refactors URL matching list into a pack_array binding and bumps query version.
Solutions/Microsoft Defender XDR/Hunting Queries/Email and Collaboration Queries/Custom Detections/Potential OAuth phishing email delivered into Inbox.yaml Refactors OAuth consent URL list construction via strcat() and bumps query version.
Solutions/Microsoft Defender XDR/Data/Solution_Microsoft Defender XDR.json Bumps solution version to 3.0.15.

Comment thread Solutions/Microsoft Defender XDR/ReleaseNotes.md Outdated
…gnInEventsBeta beta table); reword 3.0.15 release notes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@juanjosalco juanjosalco requested a review from a team as a code owner June 15, 2026 05:25
…BufferOverflow rule

Remove the empty 'groupByAlertDetails: []' and 'groupByCustomDetails: []' arrays from PossibleWebpBufferOverflow.yaml. With groupingConfiguration.enabled set to false these fields are unused, and the empty arrays caused ARM-TTK 'Template Should Not Contain Blanks' failures on the regenerated mainTemplate.json. Regenerate mainTemplate.json and 3.0.15.zip; consolidate the 3.0.15 release notes entry to cover both this fix and the existing hardcoded-URI strcat refactor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@v-atulyadav

Copy link
Copy Markdown
Collaborator

Hi @juanjosalco,
lease review the validation failure below and take the necessary action to resolve it. Thanks
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Solution Solution specialty review needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants