> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flintai.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Hardcoded credentials

> Credentials embedded directly in tool code or configuration files that can be read by attackers.

Credentials embedded directly in tool code or configuration files that can be read by attackers.

## How to resolve

* **Use specific tooling for secure credential management:** Remove all hardcoded credentials from source code, configuration files, and metadata immediately. Store credentials securely using environment variables, configuration management systems, or dedicated secrets management solutions like HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, or Google Cloud Secret Manager.
* **Update credentials regularly:** Implement credential rotation procedures to regularly update secrets and ensure rotated credentials are automatically distributed to applications. Make sure leaked credentials are rotated immediately. This helps mitigating the scope of a leaked credential to a given timeframe.
* **Proactively detect leaked credentials:** Implement secret scanning in CI/CD pipelines using tools like GitGuardian, TruffleHog, or git-secrets to prevent future commits of hardcoded credentials. Audit version control history to identify and remediate historical credential exposures, and rotate any exposed credentials. For credentials already committed to repositories, treat them as compromised and rotate immediately.
* **Corporate training:** Establish policies and developer training to prevent hardcoded credentials in future development.

## Risk

**Governance/Compliance**

Hardcoded credential vulnerabilities violate multiple security standards:

* **NIST SP 800-53 Rev. 5 (IA-5):** Fails to implement authenticator management controls that require secure storage and regular rotation of credentials.
* **OWASP MCP Top 10 (MCP01:2025 - Token Mismanagement & Secret Exposure):** Enables token mismanagement and secret exposure through credentials embedded in MCP server code or configuration.
* **NIST Cybersecurity Framework (CSF) 2.0 (PR.PS-01, PR.DS-01)**: Requires a configuration that protects the integrity of the assets, and that data is protected at rest.
* **OWASP Top 10 2025 (A07:2025 Authentication Failures)**: Violates the requirement of not storing the password in plaintext.

**Security**

Hardcoded credentials represent one of the most severe security vulnerabilities because they provide direct, often privileged access to systems and data. Attackers who obtain hardcoded credentials through code repository access, configuration file leaks, decompilation, or memory inspection can authenticate as the application and access all protected resources.

These credentials are difficult to rotate because they are embedded in code or configuration, meaning compromised credentials may remain valid for extended periods. Hardcoded secrets are frequently committed to version control systems, making them permanently accessible in repository history even after removal from current code.

For MCP servers, compromised credentials can expose external APIs, databases, cloud services, and other critical infrastructure the server accesses.

## Explanation

This rule is triggered when credentials such as API keys, passwords, tokens, or other authentication secrets are embedded directly in MCP server tool code, configuration files, or metadata. Hardcoded credentials can be discovered by attackers through source code inspection, configuration file access, memory dumps, or reverse engineering. The scanner detects common secret patterns, known API key prefixes, and plaintext credentials in code, configuration files, and server metadata.

## Specifications

**Trigger**

* MCP server scan detects hardcoded secret patterns, API key prefixes (e.g., sk\_, api\_key=), passwords, tokens, or other credentials embedded in source code, configuration files, or metadata.

**Severity**

* CRITICAL

**Applies to**: MCP Server
