T09 · Insecure Skill Coding Practices
- Location
__init__.py:31- Finding
Undocumented Hardcoded Exchange Server and Account Defaults May Expose Authentication Material
- Content
View full analysis
Vulnerability Details
File Location:
__init__.py, lines 31-45 and 166-178
Vulnerability Type: Unsafe credential configuration and hardcoded external destination
Risk Level: HighVulnerable 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) )The shared-calendar connection repeats the unsafe defaults:
python domain = os.getenv('EXCHANGE_DOMAIN', 'friendly-it') username = os.getenv('PICARD_USERNAME', 'picard') password = os.getenv('PICARD_PASSWORD') server = os.getenv('EXCHANGE_SERVER', 'oberau.friendly-it.at') creds = Credentials(username=f"{domain}\\{username}", password=password) config = Configuration( server=server, credentials=creds, auth_type=NTLM, version=Version(EXCHANGE_2010_SP2) )Technical Analysis
The documented setup instructs users to define
EXCHANGE_PASSWORD, but the implementation readsPICARD_PASSWORD. The exception message also incorrectly claims thatEXCHANGE_PASSWORDis missing. In addition, the implementation silently supplies organization-specific defaults for the Exchange domain, username, email address, and server.Because
autodiscoveris disabled, the configured or default server is used directly. If aPICARD_PASSWORDvalue is present while the documented Exchange variables are missing, the application can attempt NTLM authentication against the hardcoded serveroberau.friendly-it.at...[truncated 1525 chars]- Remediation
View remediation
Remediation Suggestions
- Remove all organization-specific defaults for the server, domain, username, and email address.
- Require explicit values for
EXCHANGE_SERVER,EXCHANGE_DOMAIN,EXCHANGE_USERNAME,EXCHANGE_EMAIL, andEXCHANGE_PASSWORD. - Use the same variable names in the implementation, documentation, and error messages.
- Fail closed if any mandatory setting is absent.
- Validate the Exchange server against an administrator-controlled allowlist.
- Require certificate validation and prohibit plaintext or downgraded transport.
- Avoid NTLM where modern authentication is available.
- Add tests confirming that missing configuration never initiates a connection to a fallback destination.
