Why you should stop using third-party apps with poor authentication

I have always preached that organisations stop using insecure authentication methods with their App registrations in Microsoft Entra. Authentication Methods such as Client Secrets offer no additional protection other than a simple password that potentially enables the use of highly-privileged actions within your environment.

If your environment is like most and has grown naturally over time, you should have a think about which third-party vendors you have interacted with in the past and what consent you have provided them through their multi-tenant Enterprise applications. In this article, I will show you how to identify third-party applications you have consented to and how to identify which authentication method they are using to authenticate to your environment.

Why does this matter?

Well, it matters because of three simple words “Supply, Chain, Attack”. If the software vendors who have access to your environment use Client secrets to authenticate to your environment, they likely do have that secrets saved in plaintext somewhere and that dramatically increases the likely hood if you bring compromised, if they are compromised.

If a vendor does choose convenience over security by using a Client Secret, they are essentially creating a master key to every customer tenant they serve. This can simply translates into a supply chain disaster:

  • Unlike a user’s password, which might be protected by MFA or conditional access policies, a Client Secret is a “non-interactive” credential. If an attacker steals it from a vendor’s internal documentation, a configuration file, or a developer’s local environment, they can use it to authenticate as that application from anywhere in the world. Yes, that vendor may have some internal Conditional Access policies that include Workload ID protection, but that costs money that would impact their bottom line, so they probably dont.
  • Because you have already provided admin consent to this multi-tenant application, Microsoft Entra views the attacker’s activity as legitimate. The attacker doesn’t need to phish your employees as they simply “log in” as the trusted service provider.
  • Once authenticated, the attacker inherits every permission you’ve granted that app. If the app was consented to for “Mail.Read” or “Directory.ReadWrite.All,” the attacker now has programmatic access directly into your data. They can exfiltrate sensitive files or even create new global administrators to ensure they maintain access even if the vendor eventually rotates their secret.

To be extra clear, as soon as you provide consent to a vendors application, you are extending your security perimeter to include that vendors internal security practices, if their security sucks, so does yours. And don’t just take the sales persons word on it!

Finding third-party applications you have consented to

To find all third-party applications in Microsoft Entra that you have provided consent to, you must use Microsoft Graph PowerShell as unfortunately, you cannot filter by applications now homed in your own tenant using the Entra UI.

Thankfully, no so long ago I created an Enterprise App Permissions report which provided a list of all Enterprise applications which you have provided consent to but are not homed in your own tenant. You can read about this report and use the script by reading my article “Create a free Enterprise App Permissions report in Microsoft Entra“

Types of Service Principal authentication

When an application authenticates to your environment an Entra sign-in log is produced in your Entra tenant. Within that log is the clientCredentialType property, this property explains how that application authenticated to your tenant.

The clientCredentialType property can have multiple values:

  • clientSecret (not recommended) – This is the most common but least secure “active” credential. Secrets are often accidentally committed to code or shared in plain text. Microsoft recommends moving away from these toward more secure options like certificates.
  • certificate – Much more secure than a secret. Even if an attacker sees the authentication traffic, they cannot spoof the identity without the private key, which is usually stored in a secure hardware module or Key Vault.
  • clientAssertion – This is a more generic category often used when a client is using a custom assertion or a specific OAuth2 flow where it “asserts” its identity via a signed token rather than a simple string secret.
  • managedIdentity (recommended) – Used by Azure resources (like a VM, Function App, or Logic App). The developer never sees a password or certificate; Azure handles the “under-the-hood” authentication between the service and Entra ID automatically.
  • federatedIdentityCredential -This is used for Workload Identity Federation. For example, a GitHub Action can get a token for Azure without needing a secret, because Entra ID trusts the token issued by GitHub.

Finding insecure multi-tenant sign-ins

To find multi-tenant applications which are authenticating to your tenant using insecure methods, I have created this small function which searches the Service Principal sign-in logs for sign-ins where the clientCredentialType is equal to ClientSecret and the appOwnerTenantId is not equal to your tenant Id.

Connect-MgGraph -Scopes AuditLog.Read.All

Function Get-MgSpSignIns {
    param(
        $filter
    )

    process {
        $response = Invoke-MgGraphRequest -uri "https://graph.microsoft.com/beta/auditLogs/signIns?&source=sp&`$filter=$filter" -OutputType PSObject | Select -Expand Value
        return $response
    }
}

$type = "ClientSecret"
$tid = "%your tenan id%"

Get-MgSpSignIns -filter "clientCredentialType eq '$type' and appOwnerTenantId ne '$tid'"

Once you run the command there may be lots or no authentication logs to work through. Here you can see an example from my tenant where I have highlighted a log from a well known vendor (redacted for fairness) which uses a insecure authentication method.

clientSecret sign-in log
clientSecret sign-in log

Wrapping up

Remember, no matter how much an organisation tells you that they practice good security management of client secrets, it is fundamentally an insecure authentication method which you should not accept being live in your production environment. Whenever you accept consent from a vendor, you are at the mercy of their people, processes and security. You’re security boundry has just double to include theirs, its a level of trust most people do not consider, but now you should. This also goes from the vibe-coded app your friend built!

Daniel Bradley

Daniel Bradley is a UK-based technical architect and Microsoft MVP in Security. He specialises in Microsoft Entra, Intune, and Microsoft Graph PowerShell and is the author of Microsoft Graph PowerShell for Administrators. He writes and edits Our Cloud Network using experience gained from working with Microsoft cloud environments.

This Post Has One Comment

  1. John

    Good one! But what about apps that register the “global reader” permissions. What do you think about that? Too much? Okay?

Leave a Reply