MSDefenderForEndpoint responder - Rename, OAuth v2.0 migration, bug fixes & new action - #1479
Open
3lina wants to merge 1 commit into
Open
MSDefenderForEndpoint responder - Rename, OAuth v2.0 migration, bug fixes & new action#14793lina wants to merge 1 commit into
3lina wants to merge 1 commit into
Conversation
…fixes & new action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Review of the MSDefender responder against current Microsoft docs: renamed for
consistency with the sibling analyzer, migrated to OAuth v2.0, fixed several bugs
(three only caught by running real jobs against a live Cortex instance), converted to
snake_case, removed a deprecated action, added one new action.
baseConfigrenamed (MSDefenderforEndpoints→MSDefenderForEndpoint) — orgs needto re-enter credentials.
namerenamed on all 12 flavors — each needs re-enabling per org.pushIOCAlertremoved because deprecated since 2022 — usepushIOCAuditinstead (identical behavior).AddTagToArtifacttags renamed (MsDefender:xxx→MSDefenderForEndpoint:xxx).Not breaking: OAuth migration, snake_case, folder/file rename (all internal), new
stopAndQuarantineFileaction (additive).Bug fixes
self.error()broke JSON serialization.b'...'into IOCs sent to Defender.get_machine_id()returned the wrong ID for hostname lookups — it preferredaadDeviceIdover the MDEid, but action endpoints requireid. Worked by luckfor IPs, broke for hostnames. Now always returns
id.self.error()call (~20 sites) passed a dict, making error messagesinvisible in the UI —
cortexutils.Worker.error()expects a plain string, not adict (unlike
report(), which does expect one). This was the real cause behind every"no error shown" case hit while testing this PR. Fixed everywhere.
FullVirusscan→FullVirusScan.OAuth v1.0 → v2.0
oauth2/token→oauth2/v2.0/token,resource→scope. Scope stays pinned tohttps://api.securitycenter.microsoft.com/.defaulteven though the API host is nowunified (
api.security.microsoft.com) — required by current MS docs, otherwise 403.Python elements renamed for consistency to follow PEP8 convention
Folder/file/class renamed, all 12 flavors renamed, full snake_case conversion (checked
for collisions with wire-protocol strings that must stay as-is — none touched).
Removed:
pushIOCAlertMicrosoft's
Alert/AlertAndBlockactions are legacy, unsupported since Jan 2022. Thisflavor was already an exact duplicate of
pushIOCAuditinternally.New action:
stopAndQuarantineFileSHA1-only. Resolves machines via
GET /files/{sha1}/machines, thenPOST /machines/{id}/StopAndQuarantineFileon each, aggregated report.Not added:
Offboard,CollectInvestigationPackage,LiveResponse,UpdateAlert(out of scope / not a good fit for a generic responder).
Testing
Tested against a real MDE tenant and TheHive/Cortex local instances.