T09 · Insecure Skill Coding Practices
Error
- Location
- poc/d9_launch.py:20
- Finding
- Hardcoded Wallet Private Key and OpenRouter API Key## Vulnerability Details **File Location**: `poc/d9_launch.py:20-23` **Vulnerability Type**: Plaintext hardcoded credentials **Risk Level**: Critical ### Vulnerable Code ```python # ============ Configuration ============ PRIVATE_KEY = "0xa1007620c8d030e613759de8ac18865799ab798e2447dd28893cbdc015b79cd1" OPENROUTER_API_KEY = "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" ``` The credentials are subsequently used in security-sensitive operations: ```python headers = { "Authorization": f"Bearer {OPENROUTER_API_KEY}", "Content-Type": "application/json", } ``` ```python account = Account.from_key(PRIVATE_KEY) ``` ### Technical Analysis The source contains a complete Ethereum-compatible private key and a complete OpenRouter API key in plaintext. Repository access is therefore equivalent to access to both credentials. The private key is loaded into an account and used to sign BSC mainnet token-deployment and initial-purchase transactions. It is not directly transmitted by the code, but possession of the committed value is sufficient for any party to independently sign arbitrary transactions for the associated wallet. The OpenRouter key is placed in an HTTP `Authorization` header and sent to the configured OpenRouter endpoint. It can be reused outside this project to consume the account's API quota or incur charges. ### Attack Path 1. An attacker obtains the repository, a source archive, a package containing the PoC, or an older commit. 2. The attacker copies the private key and imports it into a Web3-compatible wallet. 3. The attacker derives the associated public address and checks its balances and token approvals. 4. The attacker signs arbitrary transfers or contract calls, potentially draining all assets controlled by the key. 5. Independently, the attacker copies the OpenRouter API key and submits API requests billed to the affected account. 6. Removing the ...[truncated 613 chars]
- Remediation
- ## Remediation Suggestions 1. Immediately revoke and rotate the OpenRouter API key. 2. Permanently abandon the exposed wallet key. Transfer remaining assets and permissions to a newly generated wallet using a key that has never appeared in source control. 3. Replace hardcoded values with environment-variable or secret-manager references: ```python private_key = os.environ["OPENCLAW_WALLET_KEY"] api_key = os.environ["OPENROUTER_API_KEY"] ``` 4. Purge the credentials from the complete Git history and any published packages, archives, logs, caches, forks, and CI artifacts. Rotation remains mandatory because history rewriting cannot invalidate copied credentials. 5. Add automated secret scanning to pre-commit hooks and CI. 6. Use a dedicated, minimally funded launch wallet rather than a wallet containing unrelated assets. 7. Scope API credentials to the minimum available permissions and configure provider-side spending limits and alerts.
