Your business’ toughest competition might be criminal. See why.
Utility navigation bar redirect icon
Portal LoginSupportContact
Search
Close search
Huntress Logo in Teal
  • Platform Overview
    Managed EDR

    Get full endpoint visibility, detection, and response

    Managed EDR

    Get full endpoint visibility, detection, and response

    Managed ITDR

    Protect your Microsoft 365 identities and email environments.

    Managed ITDR

    Protect your Microsoft 365 identities and email environments.

    Managed SIEM

    Managed threat response and robust compliance support at a predictable price.

    Managed SIEM

    Managed threat response and robust compliance support at a predictable price.

    Managed Security Awareness Training

    Empower your teams with science-backed security awareness training.

    Managed Security Awareness Training

    Empower your teams with science-backed security awareness training.

    Integrations
    Integrations
    Support Documentation
    Support Documentation
    See Huntress in Action

    Quickly deploy and manage real-time protection for endpoints, email, and employees - all from a single dashboard.

    Huntress Cybersecurity
    See Huntress in Action

    Quickly deploy and manage real-time protection for endpoints, email, and employees - all from a single dashboard.

    Huntress Cybersecurity
  • Threats We Stop
    Phishing
    Phishing
    Business Email Compromise
    Business Email Compromise
    Ransomware
    Ransomware
    View Allright arrowView Allright arrow
    Industries We Serve
    Education
    Education
    Financial Services
    Financial Services
    State and Local Government
    State and Local Government
    Healthcare
    Healthcare
    Law Firms
    Law Firms
    Manufacturing
    Manufacturing
    Utilities
    Utilities
    View Allright arrowView Allright arrow
    Tailored Solutions
    MSPs
    MSPs
    Resellers
    Resellers
    SMBs
    SMBs
    Compliance
    Compliance
    Cybercriminals Have Evolved

    Get the intel on today’s cybercriminal groups and learn how to protect yourself.

    Huntress Cybersecurity
    Cybercriminals Have Evolved

    Get the intel on today’s cybercriminal groups and learn how to protect yourself.

    Huntress Cybersecurity
  • Pricing
  • Community Series
    The Product Lab

    Shape the next big thing in cybersecurity together.

    The Product Lab

    Shape the next big thing in cybersecurity together.

    Fireside Chat

    Real people. Real perspectives. Better conversations.

    Fireside Chat

    Real people. Real perspectives. Better conversations.

    Tradecraft Tuesday

    No products, no pitches – just tradecraft.

    Tradecraft Tuesday

    No products, no pitches – just tradecraft.

    _declassified

    Exposing hidden truths in the world of cybersecurity.

    _declassified

    Exposing hidden truths in the world of cybersecurity.

    Resources
    Upcoming Events
    Upcoming Events
    ebooks
    ebooks
    On-Demand Webinars
    On-Demand Webinars
    Videos
    Videos
    Whitepapers
    Whitepapers
    Datasheets
    Datasheets
    Cybersecurity Education
    Cybersecurity 101
    Cybersecurity 101
    Cybersecurity Guides
    Cybersecurity Guides
    Threat Library
    Threat Library
    Real Tradecraft, Real Results
    Real Tradecraft, Real Results
    2026 Cyber Threat Report
    2026 Cyber Threat Report
    The Huntress Blog
    Huntress Lands on the Microsoft Marketplace
    Huntress Cybersecurity
    Huntress Lands on the Microsoft Marketplace
    Huntress Cybersecurity
    How Huntress & DEFCERT Are Streamlining CMMC Assessment Prep
    Huntress Cybersecurity
    How Huntress & DEFCERT Are Streamlining CMMC Assessment Prep
    Huntress Cybersecurity
    Live Hacking Into Microsoft 365 with Kyle Hanslovan
    Huntress Cybersecurity
    Live Hacking Into Microsoft 365 with Kyle Hanslovan
    Huntress Cybersecurity
  • Why Huntress

    Go beyond AI in the fight against today’s hackers with Huntress Managed EDR purpose-built for your needs

    Huntress Cybersecurity
    Why Huntress

    Go beyond AI in the fight against today’s hackers with Huntress Managed EDR purpose-built for your needs

    Huntress Cybersecurity
    The Huntress SOC

    24/7 Security Operations Center

    The Huntress SOC

    24/7 Security Operations Center

    Reviews

    Why businesses of all sizes trust Huntress to defend their assets

    Reviews

    Why businesses of all sizes trust Huntress to defend their assets

    Case Studies

    Learn directly from our partners how Huntress has helped them

    Case Studies

    Learn directly from our partners how Huntress has helped them

    Community

    Get in touch with the Huntress Community team

    Community

    Get in touch with the Huntress Community team

    Compare Huntress
    Bitdefender
    Bitdefender
    Blackpoint
    Blackpoint
    Breach Secure Now!
    Breach Secure Now!
    Crowdstrike
    Crowdstrike
    Datto
    Datto
    SentinelOne
    SentinelOne
    Sophos
    Sophos
    Compare Allright arrowCompare Allright arrow
  • HUNTRESS HUB

    Login to access top-notch marketing resources, tools, and training.

    Huntress Cybersecurity
    HUNTRESS HUB

    Login to access top-notch marketing resources, tools, and training.

    Huntress Cybersecurity
    Partners
    MSPs

    Join our partner community to deliver expert-led managed security.

    MSPs

    Join our partner community to deliver expert-led managed security.

    Resellers

    Partner program designed to grow your cybersecurity business.

    Resellers

    Partner program designed to grow your cybersecurity business.

    Tech Alliances

    Driving innovation through global technology Partnerships

    Tech Alliances

    Driving innovation through global technology Partnerships

    Microsoft Partnership

    A Level-Up for Your Business Security

    Microsoft Partnership

    A Level-Up for Your Business Security

  • Press Release
    Huntress Announces Collaboration with Microsoft to Strengthen Cybersecurity for Businesses of All Sizes
    Huntress Cybersecurity
    Press Release
    Huntress Announces Collaboration with Microsoft to Strengthen Cybersecurity for Businesses of All Sizes
    Huntress Cybersecurity
    Our Story

    We're on a mission to shatter the barriers to enterprise-level security.

    Our Story

    We're on a mission to shatter the barriers to enterprise-level security.

    Newsroom

    Explore press releases, news articles, media interviews and more.

    Newsroom

    Explore press releases, news articles, media interviews and more.

    Meet the Team

    Founded by former NSA Cyber Operators. Backed by security researchers.

    Meet the Team

    Founded by former NSA Cyber Operators. Backed by security researchers.

    Careers

    Ready to shake up the cybersecurity world? Join the hunt.

    Careers

    Ready to shake up the cybersecurity world? Join the hunt.

    Awards
    Awards
    Contact Us
    Contact Us
  • Portal Login
  • Support
  • Contact
  • Search
  • Get a Demo
  • Start for Free
Portal LoginSupportContact
Search
Close search
Get a Demo
Start for Free
HomeBlog
Threat Hunting for Business Email Compromise Through User Agents
Published:
July 6, 2023

Threat Hunting for Business Email Compromise Through User Agents

By:
Dray Agha
Share icon
Glitch effectGlitch effectGlitch effect

We all have thoughts that keep us up at night.

Will the ticking noise the car made end up being an expensive repair? When will YouTube superstar John Hammond respond to my posted fanfiction? And are there user agents in Microsoft 365’s security telemetry that we can use to detect potential business email compromise (BEC)?

It’s the latter one that kept me up at 3am, recently.

If the curl command leaves a unique and obvious user agent behind, are there other (malicious) tools that leave a unique user agent, in a Microsoft 365 context, that are indicative of malevolence? 

We’ve shared some Microsoft 365 investigations before, and in this blog, we’ll explore how we took a business email compromise (BEC) threat hunting hypothesis through the empirical endeavor and produced not just detections but also identified and reported malicious behavior to our community members.

User Agents

In the Microsoft 365 world, user agents in and of themselves aren’t malicious. A user agent is a string your device gives to a website when you traverse the internet and is designed to share some information about you and your device, which allows the website to tailor the format of the content to best serve you. 

There are command-line tools—like Python and Curl—that will leverage a user agent that states it is a command-line tool and its version number (for example, curl/7.54.1). Now, it’s trivial to change the default user agent in both of these tools to masquerade as a different user agent, but as someone who observes adversaries deploy tools like Impacket without changing the default coded-in directories, I can attest to the fact that adversaries often do not deviate from the default of their offensive tools. 

Thus, our hypothesis was conjured: could we identify business email compromise by honing in on anomalous user agents?

On the Hunt

Installed across more than 2 million endpoints, and monitoring 50,000+ email accounts across 1,500 small businesses, the Huntress SOC squad is spoiled for choice when it comes to telemetry. Quite literally, think of what you want to find and diving into our data lake you will find it. And similar to the archer, to ultimately propel our weapons forward to engage our adversarial target, we must first draw backward and prepare ourselves; what are we trying to accomplish here?

We’ve already established that user agents are easy to change. Furthermore, detecting on user agents alone is a fool's errand due to false positives or true negatives. Even the most prized Microsoft 365/Azure Offensive Security suite of tools, AADInternals, does not leave behind unique user agents and facilitates the minor effort to change the user agent. 

What we’re looking for across Huntress’ Microsoft 365 telemetry are successful logins from less common user agents, as a contextual indicator that something malevolent is afoot. Through anomaly analysis, we filter out the common user agents, and analyze the rarer user agents until we’re left with a rather interesting user agent: 

AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.10 (Linux-5.4.0-137-generic-x86_64-with-glibc2.31)

In our Huntress telemetry, we filter for this with the following search: user_agent.original.text: "Azsdk", and we identify some rather interesting territories associated with this user agent.

I, too, legitimately authenticate into my email account via the command line when I am vacationing in Russia or China…

Screenshot 2023-07-05 at 1.55.29 PM

Digging Deeper

From there, we dug deeper into what tool this user agent came from (no points for guessing a Python package). The user agent comes from the Microsoft-blessed Python library here and has been associated with malicious activity reported by Alice Klimovitsky in May 2023. 

The user-agent/Python library is not malicious itself. Rather, the presence of this specific user agent in Microsoft 365 telemetry warrants further investigation. You won’t be surprised, then, that the rest of the investigation was focused on determining exactly how anomalous and malicious was a successful authentication with the user-agent: AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-resource (spoilers: quite anomalous, quite malicious).

Reviewing our telemetry, we had 85 hits for this overall user agent, with the majority being login fails and only four successful logins with the suspicious user agent. 

Filtering out the login fails, we’re left with four successful authentications for four user accounts, in all of June 2023. Sounds pretty sus to me tbh…

User Baselining

To investigate this behavior, we can correlate the user’s authentication pattern: how often have they signed in from this territory in the world, how common is it they authenticate with rare user agents, maybe they’re a developer testing some stuff? Saving both you and me the time, evidence attested all four were malicious authentications and all four warranted critical reports to our Huntress community members. 

For example, take our "Sales" friend, who consistently authenticated from Belgium only to then anomalously authenticate with the Azsdk-python user agent from Korea. 

Or our dear friend "Po" whose Azsdk-python authentication was associated with an Indonesian public IPv4 with a penchant for attempting to sign in as a myriad of accounts. 

This also demonstrates the benefit of collecting and storing raw traversable telemetry. Once we identified that these particular IPv4 are malicious, we can then pivot and start to look at what else they have been up to, and if they have had successful authentications elsewhere, and all because we have held onto the telemetry. 

Reporting Business Email Compromise in Microsoft 365

From this one hypothesis-driven threat hunt, we issued a number of true positive reports advising our community members of business email compromise, and a suite of remediation strategies to evict the adversary, restore trust to the account, and prevent future compromise. 

And the community rewards our investigation with engagement. Below, we have included a testimonial from the recipient of one of the above reports, which demonstrates that Huntress MDR for Microsoft 365 pays security dividends when driven and contextualized by the handsome experts of the Huntress SOC. 

Detection Technology Augmented by Humans

The threat hunting cycle, as my colleague Anthony Smith has advised in the past, should close the loop between that which we manually found that was yet to be detected, and how to go on to automate detecting those findings in the future.

Below is what we have so far put forward internally as a detection, but this will go on to be curated and shaped by the experts in Huntress’ dedicated detection engineering team—such as Matt Anderson, Matthew Brennan, Kris Luzadre, and Greg Ake.

event.action: UserLoggedIn AND user_agent.original.text:"azsdk-python"
# Filter for successful authentications only
# And essentially wildcard for any user agent containing the above string

With the detection conjured, Huntress’ resident ninja Sharon Martin pushed it to production and it immediately fired on the activity we manually identified—that right there is what we call a success. 🙂

I leave it to the reader to decide the priority for this detection. Environments vary in what their baseline is for normal, and far be it for me to tell you whether this should be a high- or low-priority detection.

Remember, this activity alone is not the signal to throw a code red. Rather, as we said, this is a detector that instigates further investigation; it is not the sign of something overtly malicious, but it is the sign of something amiss and anomalous, where we would advise filtering down into the user’s historical baselines and seeing if this fits in with their wider authentication pattern. And, to reiterate, user agents are trivial to change—but when it comes to changing a tool’s defaults, Huntress analysts have observed adversaries to just… not do that. 

Prevention

Multi-factor authentication (MFA) and complex conditional access policies are your friends. I know they receive user pushback, I know they are a pain to administer but, between you and I, business email compromise isn’t going anywhere; the threat looms large and grows every day. Moreover, another secret between the two of us: if you neutralize a threat at your email perimeter, you’ll likely deny the adversary at the earliest stages of their campaign to infiltrate your network; this saves you money, time, and pain in the long run.

Through the cloud, it has never been easy to self-serve your own security alerting, detection, and response. The cloud can facilitate incredible security visibility into the finer details of your users’ activities (maybe too much visibility, too much noise). 

You don’t HAVE to have Huntress’ ThreatOps team in your corner—you can just keep an eye out for blogs like this and STEAL borrow the best bits. But if this blog has emphasized anything, it’s that we have a team of people who love doing this, who do it well, we do it quick, and we make life easier for you and harder for cybercriminals. We’re constantly innovating and ambushing adversaries’ where they try to hide, and worryingly, we all find this incredibly fun.

So, spin up a trial if you want to see us in action, learn more about Huntress MDR for Microsoft 365, or feel free to DM me to chat more.

Continue to part three: Thwarting Financial Fraud: Shutting Down Hackers in Microsoft 365

• • •

IoCs:

  • 213.154.80[.]21
  • 203.251.62[.]51 
  • 91.158.221[.]9 
  • 118.98.90[.]2

ATT&CK TTPs:

  • Initial Access, T1078.004, valid cloud accounts

Detection:

  • event.action: UserLoggedIn AND user_agent.original.text:"azsdk-python"
Categories
Threat Analysis
Summarize this postClose Speech Bubble
ChatGPTClaudePerplexityGoogle AI

See Huntress in action

Our platform combines a suite of powerful managed detection and response tools for endpoints and Microsoft 365 identities, science-backed security awareness training, and the expertise of our 24/7 Security Operations Center (SOC).

Book a Demo
Share
Facebook iconTwitter X iconLinkedin iconDownload icon
Glitch effect

You Might Also Like

  • Business Email Compromise via Azure Administrative Privileges

    Explore how Huntress stopped a massive business email compromise (BEC) attack targeting multiple user accounts within a single organization.
  • Thwarting Financial Fraud: Shutting Down Hackers in Microsoft 365

    In this blog, explore how Huntress caught an attempt at financial fraud through business email compromise (BEC) in Microsoft 365.
  • One MSP, Three Microsoft 365 Compromises, 72 Hours

    Discover how Huntress Managed Identity Threat Detection and Response identified three business email compromise (BEC) attacks within 72 hours of each other.
  • What Is Business Email Compromise? BEC Defined

    A business email compromise (BEC) attack is a type of scam where bad actors impersonate a trusted source to obtain information from their targeted individual.
  • Huntress MDR for Microsoft 365: The Full Story

    Read up on how and why Huntress built its Managed ITDR (formerly MDR for Microsoft 365) solution to help combat the growing threat of business email compromise (BEC).
  • Prevent Business Email Compromise Attacks

    Learn how to prevent business email compromise attacks and learn how to communicate this emerging cyber threat to your employees.
  • Hunting for M365 Password Spraying

    Join Huntress Threat Hunters as they unpack the password-spraying techniques of threat actors, exposing how they target everything from small businesses to giants like Microsoft.
  • Breaking Down the Threat Hunting Process

    Discover the key phases of the threat hunting process and how threat hunters structure their hunts to proactively seek out threats.

Sign Up for Huntress Updates

Get insider access to Huntress tradecraft, killer events, and the freshest blog updates.
Privacy • Terms
By submitting this form, you accept our Terms of Service & Privacy Policy
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Huntress Managed Security PlatformManaged EDRManaged EDR for macOSManaged EDR for LinuxManaged ITDRManaged SIEMManaged Security Awareness TrainingBook a Demo
PhishingComplianceBusiness Email CompromiseEducationFinanceHealthcareManufacturingState & Local Government
Managed Service ProvidersResellersIT & Security Teams24/7 SOCCase Studies
BlogResource CenterCybersecurity 101Upcoming EventsSupport Documentation
Our CompanyLeadershipNews & PressCareersContact Us
Huntress white logo

Protecting 215k+ customers like you with enterprise-grade protection.

Privacy PolicyCookie PolicyTerms of UseCookie Consent
Linkedin iconTwitter X iconYouTube iconInstagram icon
© 2025 Huntress All Rights Reserved.

Join the Hunt

Get insider access to Huntress tradecraft, killer events, and the freshest blog updates.

By submitting this form, you accept our Terms of Service & Privacy Policy