T09 · Insecure Skill Coding Practices
- 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
Security audit
Security checks for vulnerabilities and agentic risk
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.
scripts/outlook_auth.py:46OAuth Tokens and Client Secret Are Stored Without Restrictive File Permissions
references/setup.md:134Dependency Installation Uses an Unpinned Package Without Integrity Verification
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
}, 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:
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
}
try:
resp = requests.post(token_url, data=token_payload, timeout=30)
resp.raise_for_status()
token_resp = resp.json()
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
}
try:
resp = requests.post(token_url, data=token_payload, timeout=30)
resp.raise_for_status()
token_resp = resp.json()
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.
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.
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.
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.
- 配置文件:`~/.outlook-microsoft/`
- `config.json` - Client ID、Secret、Tenant ID
- `credentials.json` - OAuth Token(自动管理)
- 安装指南:[references/setup.md](references/setup.md)
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).
如果需要重新授权,删除 credentials 文件后重新授权:
rm ~/.outlook-microsoft/credentials.json
PYTHONIOENCODING=utf-8 python3 /path/to/outlook_auth.py authorize
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def load_env():
"""从 .env 文件加载环境变量"""
if not ENV_FILE.exists():
return
with open(ENV_FILE, "r") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def load_env():
"""从 .env 文件加载环境变量"""
if not ENV_FILE.exists():
return
with open(ENV_FILE, "r") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def load_env():
"""从 .env 文件加载环境变量"""
if not ENV_FILE.exists():
return
with open(ENV_FILE, "r") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def load_env():
"""从 .env 文件加载环境变量"""
if not ENV_FILE.exists():
return
with open(ENV_FILE, "r") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def load_env():
"""从 .env 文件加载环境变量"""
if not ENV_FILE.exists():
return
with open(ENV_FILE, "r") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def load_env():
"""从 .env 文件加载环境变量"""
if not ENV_FILE.exists():
return
with open(ENV_FILE, "r") as f:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def get_access_token():
"""获取有效的 Access Token"""
creds = load_credentials()
if not creds:
print(json.dumps({
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def get_access_token():
"""获取有效的 Access Token"""
creds = load_credentials()
if not creds:
print(json.dumps({
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def get_access_token():
"""获取有效的 Access Token"""
creds = load_credentials()
if not creds:
print(json.dumps({