T09 · Insecure Skill Coding Practices
- Location
references/setup.md:21- Finding
Gateway Credentials Exposed in Plaintext During Authentication Setup
- Content
View full analysis
Vulnerability Details
File Location:
references/setup.md, lines 21-27
Vulnerability Type: Plaintext disclosure of reusable gateway credentials
Risk Level: MediumComplete Code Snippet:
js const { TradfriClient } = require('node-tradfri-client'); const tradfri = new TradfriClient('YOUR_GATEWAY_HOST'); const result = await tradfri.authenticate(SECURITY_CODE); console.log(result);The instructions then direct the user to store the returned values in
config.json.Technical Analysis
TradfriClient.authenticate()returns authentication material that includes the gateway identity and pre-shared key. The documented example prints the entire returned object withconsole.log(result). Consequently, reusable credentials may be exposed in terminal output, command transcripts, CI or automation logs, session recordings, or Agent-visible tool output.The documentation also instructs users to place the returned credentials in
config.json, but it does not prescribe restrictive file permissions or a secret-management mechanism. Although the distributedconfig.jsoncontains placeholders rather than real credentials, users following the setup procedure may create a plaintext credential file readable beyond the intended account.Attack Path
- A user or automation agent follows the authentication procedure in
references/setup.md. - The gateway returns an identity and PSK through
tradfri.authenticate(SECURITY_CODE). console.log(result)writes the complete authentication result to standard output.- Terminal logging, session capture, automation infrastructure, an Agent transcript, or another party with access to the output obtains the identity and PSK.
- Alternatively, an unauthorized local user reads the populated
config.jsonif its permissions are insufficiently restrictive. - The attacker reuses the credentials from a host that can reach the local TRÅDFRI gateway.
- The a ...[truncated 852 chars]
- A user or automation agent follows the authentication procedure in
- Remediation
View remediation
Remediation Suggestions
- Remove
console.log(result)from the authentication example so the complete authentication object is never emitted to standard output. - Persist the returned identity and PSK directly to a protected secret store or configuration file rather than passing them through logs or chat output.
- When creating a local credential file, use owner-only permissions such as mode
0600, and verify that parent directories are not accessible to unauthorized users. - Prefer an operating-system secret manager or securely injected environment variables where available.
- If any confirmation output is necessary, display only a success message or heavily redacted values; never print the PSK.
- Add
config.jsonto.gitignorewhen it may contain real credentials, and provide a separate placeholder file such asconfig.example.json. - Update the setup documentation to warn users not to paste authentication results into chat, issue trackers, CI logs, or other retained transcripts.
- Rotate the gateway credentials if the authentication result has already been logged or otherwise disclosed.
- Remove
