Cloud Security

The Test Tenant Was Production All Along

Jonas LindqvistJonas LindqvistCloud Security Architect30 Jan 20245 min read1484 views
Editorial cover for “The Test Tenant Was Production All Along”

On January 19 Microsoft disclosed that the Russian state actor it tracks as Midnight Blizzard had used a foothold gained in late November to read a very small percentage of its corporate email, including mailboxes belonging to senior leadership, security and legal staff. Six days later it published how. There was no zero-day in the story. There was a test account without multi-factor, and an old test application that had been given far more reach than its name suggested.

That combination exists in almost every Microsoft 365 estate we have looked at. Not because anyone was careless on a particular day, but because test environments are created quickly, forgotten slowly, and never re-reviewed when the permissions around them change.

What happened, in plain terms

Microsoft's own account, summarized:

  • A quiet password spray. A small number of accounts, a small number of attempts, kept under lockout thresholds. Traffic came through residential proxy networks, so the source addresses kept changing and IP blocklists were close to useless.
  • A legacy, non-production test tenant account with no MFA. That was the foothold.
  • A legacy test OAuth application with elevated access to the corporate environment. The actor created further OAuth applications, created a new user account to consent to them, and used the old test app to grant them the Exchange Online full_access_as_app role: application-level access to mailboxes, with no user sign-in involved.
  • Mailbox access through that role, which Microsoft traced by reviewing Exchange Web Services activity, with some emails and attached documents taken.

Microsoft detected the activity on January 12, says it was not the result of a vulnerability in its products, and says it has found no evidence of access to customer environments, production systems or source code. Days later Hewlett Packard Enterprise disclosed in an SEC filing that it had been notified in December of suspected activity by the same actor in its own cloud email.

Why a 300-person company has the same shape

"Legacy test tenant" sounds like a problem only a company with thousands of tenants could have. In our client base the equivalents are mundane:

  • The pilot tenant. Spun up for a collaboration trial in 2020, never deleted, still holding a global admin whose password dates from that year.
  • The migration app. Registered by a consultant with tenant-wide mail permissions for a project that finished two years ago. The client secret never expired.
  • The integration exclusion. A scanner or backup service account left out of conditional access because multi-factor broke the integration.
  • The dev subscription. An engineer granted themselves Owner, and a service principal to match, for a proof of concept.

None of these surface in a user-access review, because access reviews look at people. The pivot in January was non-human: an application, holding an application permission, granted on someone's authority long ago.

The distinction that matters is between delegated and application permissions. A delegated permission lets an app act as the signed-in user, limited to what that user can do and subject to whatever conditional access applies at sign-in. An application permission lets the app act as itself, tenant-wide by default, with no user and no MFA prompt. An app holding application-level mail access can read every mailbox in the tenant, the CEO's included, and the sign-in logs will show a service principal rather than a person.

The boundary that was not one

"Test" is a label. What matters is what an identity can reach.

If anything in a test environment holds a credential, a consent grant or a trust relationship into production, it is production with weaker controls. How a test application came to hold that access at Microsoft is Microsoft's story to tell. The general mechanism, an application registered in one tenant and granted permissions in another, is ordinary and used every day by legitimate software. That is exactly why it is easy to lose track of.

What to do this quarter

Find every tenant. Ask finance for anything billed under a second tenant. Search admin mailboxes for sign-up confirmations. Ask each person who has ever held global admin. For each tenant found, decide: retire it, or bring it under the same policies as production.

Inventory application permissions. List every enterprise application and service principal holding application (not delegated) permissions to mail, files or the directory, plus anything assigned full_access_as_app or ApplicationImpersonation in Exchange. For each one record an owner, a purpose and a last-used date. No owner and no purpose means removal.

Scope what has to stay. Exchange Online supports role-based access control for applications, so an app can be limited to the mailboxes it needs. A backup tool needs every mailbox. A ticketing integration needs one.

Turn off user consent to applications. Route requests through the admin consent workflow so that a new user account cannot grant anything meaningful on its own.

Put MFA on every human account in every tenant, test tenants included, and enable banned-password protection. Password spray works because common passwords still work.

Expire secrets. Prefer certificates or managed identities over client secrets, set a maximum lifetime, and treat a secret with no expiry as a finding.

The alerts we would build first

  • A new credential added to an existing application or service principal. Rare in normal operations and a standard persistence move.
  • A new high-privilege app role assignment or admin consent, especially for mail, files or directory write.
  • A newly created user granting consent within hours of creation.
  • Password spray detected by pattern, not by address. Many accounts, a few failures each, from many sources. Against residential proxies, IP indicators expire faster than you can load them.
  • App-only mailbox access at unusual volume. A service principal touching hundreds of mailboxes it has never touched before.

Microsoft's guidance includes hunting queries for several of these. If you are not on its tooling, the underlying events are in the audit and sign-in logs either way; the work is deciding someone will look at them.

The honest part

This happened to the company that builds the identity platform, and I would rather not pretend our clients are better at this than Microsoft is. They are not, and neither are we by default. In its disclosure Microsoft said it would bring its legacy systems up to current security standards even where that disrupts existing business processes. That is the right commitment, and it is the one to take to your own leadership, because locking down the forgotten tenant will break something somebody relies on. That breakage is the cost of closing the door, and it is far cheaper than the alternative.

If it can reach production, it is production.

Sources

#identity#OAuth#MFA#password spray#app permissions
Jonas Lindqvist

About the author

Jonas LindqvistCloud Security Architect

Jonas spent six years as a platform engineer before crossing over to security, which is why his hardening guidance actually survives contact with a real DevOps team. He is a CISSP with the AWS and Azure security specialty certs, and he wrote the landing-zone baseline we now deploy for every cloud-native client. His rule of thumb: if a control is not in code, it does not exist.

Cloud architecture reviewIAM & identity securityInfrastructure as codeKubernetes security

Discussion(0)

No comments yet — the floor is yours.

Join the discussion

Your email stays private; we only use it to distinguish real readers from bots.

open a channel

The best time to harden your defenses was yesterday.

The second-best time is right now. Tell us what keeps you up at night — we answer within one business day.