T09 · Insecure Skill Coding Practices
Error
- Location
- __init__.py:31
- Finding
- Undocumented Hardcoded Exchange Endpoint May Receive Credentials## Vulnerability Details **File Location**: `__init__.py`, lines 31–55; duplicated configuration logic at lines 166–181 **Vulnerability Type**: Insecure credential and endpoint configuration **Risk Level**: High ### Vulnerable Code ```python domain = os.getenv('EXCHANGE_DOMAIN', 'friendly-it') username = os.getenv('PICARD_USERNAME', 'picard') email = os.getenv('EXCHANGE_EMAIL', 'picard@friendly-it.com') password = os.getenv('PICARD_PASSWORD') server = os.getenv('EXCHANGE_SERVER', 'oberau.friendly-it.at') if not password: raise ValueError("EXCHANGE_PASSWORD not found in .env.credentials") creds = Credentials(username=f"{domain}\\{username}", password=password) config = Configuration( server=server, credentials=creds, auth_type=NTLM, version=Version(EXCHANGE_2010_SP2) ) return Account( primary_smtp_address=email, config=config, autodiscover=False, access_type=DELEGATE ) ``` ### Technical Analysis The implementation silently defaults to the organization-specific Exchange endpoint `oberau.friendly-it.at` and identity values such as `friendly-it`, `picard`, and `picard@friendly-it.com`. These defaults are not disclosed in `SKILL.md`. The documented credential variable is `EXCHANGE_PASSWORD`, but the implementation reads `PICARD_PASSWORD`. This inconsistency can cause credentials inherited from the environment or supplied under the implementation-specific variable to be used with the hardcoded endpoint when `EXCHANGE_SERVER` is absent. Because NTLM authentication is configured with the resulting credentials, invoking any public operation that calls `get_account()` can initiate authentication against that endpoint. The same unsafe configuration pattern is repeated in `get_shared_calendar()`. ### Attack Path 1. A user or execution environment supplies `PICARD_PASSWORD`, intentionally or through an inherited environment variable. 2. `EXCHANGE_SERVER` is absent because the user follows incomplete configuration, re ...[truncated 1035 chars]
- Remediation
- ## Remediation Suggestions - Remove all organization-specific default values for the server, domain, username, and email address. - Require explicit `EXCHANGE_SERVER`, `EXCHANGE_DOMAIN`, `EXCHANGE_USERNAME`, `EXCHANGE_EMAIL`, and `EXCHANGE_PASSWORD` settings. - Align implementation variable names with those documented in `SKILL.md`. - Fail closed with a clear configuration error if any mandatory setting is absent. - Validate the configured Exchange server against an administrator-controlled allowlist where feasible. - Consolidate Exchange configuration in one function so `get_account()` and `get_shared_calendar()` cannot diverge. - Avoid placing credentials into global process environment state when a scoped configuration object can be used. - Add tests confirming that missing endpoint configuration never triggers a network connection.
