Skip to content
Leaked secrets Write-up Intermediate

Python Penetration Testing Teams Work Makes The Dreams Work

A developer stored an Azure AD client secret in plaintext on a system, allowing an attacker who gained initial access to the network to find it and use it to authenticate to Microsoft Graph API. The attacker could then read, search, send, and delete messages in a Microsoft Teams channel.

R. Eric Kiser Follow

Published on infosecwriteups.com

The Azure AD Client secret value created when generating an application secret, can only be seen during its creation. As a result, developers often make a copy of this secret for their own use or to share with their team.

R. Eric Kiser, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the client secret was stored in plaintext in a script or configuration file on a system that the attacker could access.

Impact

An attacker with the secret could read, search, send, and delete messages in the Teams channel, enabling data theft and phishing.

What the attacker needed

Initial network access; access to system with stored secret

The fix

Secrets should not be stored in plaintext; they should be kept in a secure vault and rotated regularly.

How it was found

  1. Gain initial foothold on the network (via a team member).
  2. Search the system for files containing Azure AD credentials.
  3. Extract tenant ID, client ID, client secret, team ID, and channel ID.
  4. Use the client credentials flow to obtain an access token from Microsoft Graph API.
  5. Use the token to list, search, send, or delete messages in the Teams channel.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A secret is like a password that lets a program talk to a service. Here, a developer left that password in a file on a computer. An attacker who already broke into the network found the password and used it to read and post messages in a company chat channel.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by R. Eric Kiser

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.