Back to skill

Security audit

outlook-microsoft

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to perform the advertised Outlook mail and calendar tasks, but it keeps powerful Microsoft access credentials in local plaintext files without enforcing private permissions.

Install only if you trust this skill with your mailbox and calendar, including the ability to read, send, modify, and delete content. Use a dedicated least-privilege app registration where possible, avoid providing a client secret for the device-code flow unless truly required, protect or replace ~/.outlook-microsoft with a secure credential store, and revoke the Microsoft app consent if you stop using it.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/outlook_auth.py:46
Finding

OAuth Tokens and Client Secret Are Stored Without Restrictive File Permissions

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
references/setup.md:134
Finding

Dependency Installation Uses an Unpinned Package Without Integrity Verification

Content
View full analysis
Remediation
View remediation
\ --hash=sha256: ``` 4. Regenerate and review the lock file through a controlled dependency-update process. Do not silently track the latest package release. 5. Document the expected trusted package index and discourage installation through unknown mirrors. 6. Install dependencies in a dedicated virtual environment rather than the global interpreter or a shared user package directory. 7. Add automated dependency vulnerability and provenance scanning to the release process. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (48)

Tainted flow: 'device_code_url' from os.getenv (line 99, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 113)May include surrounding context.

python
}, ensure_ascii=False))

    try:
        resp = requests.post(device_code_url, data=device_payload, timeout=30)
        resp.raise_for_status()
        device_data = resp.json()
    except requests.exceptions.HTTPError as e:

Tainted flow: 'token_url' from os.getenv (line 268, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 172)May include surrounding context.

python
}

        try:
            resp = requests.post(token_url, data=token_payload, timeout=30)
            resp.raise_for_status()
            token_resp = resp.json()

Tainted flow: 'token_url' from os.getenv (line 268, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 278)May include surrounding context.

python
}

        try:
            resp = requests.post(token_url, data=token_payload, timeout=30)
            resp.raise_for_status()
            token_resp = resp.json()

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The documented behavior claims broad Outlook mail and calendar management, but the analyzed skill description primarily evidences OAuth authorization, token refresh, local credential storage, and a connection test. This mismatch is security-relevant because users and orchestrators may grant trust or permissions based on an inaccurate description, enabling credential handling or persistence that was not clearly scoped.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The documented behavior claims broad Outlook mail and calendar management, but the analyzed skill description primarily evidences OAuth authorization, token refresh, local credential storage, and a connection test. This mismatch is security-relevant because users and orchestrators may grant trust or permissions based on an inaccurate description, enabling credential handling or persistence that was not clearly scoped.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The documented behavior claims broad Outlook mail and calendar management, but the analyzed skill description primarily evidences OAuth authorization, token refresh, local credential storage, and a connection test. This mismatch is security-relevant because users and orchestrators may grant trust or permissions based on an inaccurate description, enabling credential handling or persistence that was not clearly scoped.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

Documenting persistent storage of OAuth tokens in credentials.json indicates credential material is retained locally, creating a direct credential-access target. In the context of an Outlook/Graph skill with Mail.ReadWrite, Mail.Send, and Calendars.ReadWrite, token theft could allow mailbox access, message sending, and calendar manipulation.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

md
- 配置文件:`~/.outlook-microsoft/`
  - `config.json` - Client ID、Secret、Tenant ID
  - `credentials.json` - OAuth Token(自动管理)
- 安装指南:[references/setup.md](references/setup.md)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/setup.md (reported line 238)May include surrounding context.

如果需要重新授权,删除 credentials 文件后重新授权:

bash
rm ~/.outlook-microsoft/credentials.json
PYTHONIOENCODING=utf-8 python3 /path/to/outlook_auth.py authorize

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup.md (reported line 189)May include surrounding context.

md
SCRIPT_DIR = Path(__file__).parent
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup.md (reported line 238)May include surrounding context.

md
SCRIPT_DIR = Path(__file__).parent
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 21)May include surrounding context.

python
SCRIPT_DIR = Path(__file__).parent
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_calendar.py (reported line 23)May include surrounding context.

python
SCRIPT_DIR = Path(__file__).parent
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_mail.py (reported line 23)May include surrounding context.

python
SCRIPT_DIR = Path(__file__).parent
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 22)May include surrounding context.

python
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"


def load_env():

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_calendar.py (reported line 24)May include surrounding context.

python
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"


def load_env():

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_mail.py (reported line 24)May include surrounding context.

python
CONFIG_DIR = Path.home() / ".outlook-microsoft"
CONFIG_FILE = CONFIG_DIR / "config.json"
CREDS_FILE = CONFIG_DIR / "credentials.json"
ENV_FILE = SCRIPT_DIR / ".env"


def load_env():

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 26)May include surrounding context.

python
def load_env():
    """从 .env 文件加载环境变量"""
    if not ENV_FILE.exists():
        return
    with open(ENV_FILE, "r") as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 87)May include surrounding context.

python
def load_env():
    """从 .env 文件加载环境变量"""
    if not ENV_FILE.exists():
        return
    with open(ENV_FILE, "r") as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_calendar.py (reported line 28)May include surrounding context.

python
def load_env():
    """从 .env 文件加载环境变量"""
    if not ENV_FILE.exists():
        return
    with open(ENV_FILE, "r") as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_calendar.py (reported line 44)May include surrounding context.

python
def load_env():
    """从 .env 文件加载环境变量"""
    if not ENV_FILE.exists():
        return
    with open(ENV_FILE, "r") as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_mail.py (reported line 28)May include surrounding context.

python
def load_env():
    """从 .env 文件加载环境变量"""
    if not ENV_FILE.exists():
        return
    with open(ENV_FILE, "r") as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_mail.py (reported line 44)May include surrounding context.

python
def load_env():
    """从 .env 文件加载环境变量"""
    if not ENV_FILE.exists():
        return
    with open(ENV_FILE, "r") as f:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 257)May include surrounding context.

python
def get_access_token():
    """获取有效的 Access Token"""
    creds = load_credentials()
    if not creds:
        print(json.dumps({

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_auth.py (reported line 316)May include surrounding context.

python
def get_access_token():
    """获取有效的 Access Token"""
    creds = load_credentials()
    if not creds:
        print(json.dumps({

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/outlook_calendar.py (reported line 55)May include surrounding context.

python
def get_access_token():
    """获取有效的 Access Token"""
    creds = load_credentials()
    if not creds:
        print(json.dumps({