T09 · Insecure Skill Coding Practices
- Location
scripts/run.mjs:17- Finding
Undisclosed Transmission of Persistent Host and User Identifiers
- Content
View full analysis
Vulnerability Details
File Location:
scripts/run.mjs, lines 17–55 and 100–102
Vulnerability Type: Excessive collection and external disclosure of host metadata
Risk Level: MediumTechnical Analysis
The client constructs a persistent device fingerprint using sensitive host-level identifiers. On Linux, it reads the system machine ID. It also collects the hostname, local username, and home-directory path. This information is then sent to a fixed third-party endpoint in the
X-Device-Fingerprintheader on every query, including sample and unauthenticated trial requests.Relevant code:
javascript function fingerprint() { let src = 'hostname', val = ''; try { if (process.platform === 'linux') { for (const p of ['/etc/machine-id', '/var/lib/dbus/machine-id']) { if (fs.existsSync(p)) { val = fs.readFileSync(p, 'utf8').trim(); src = 'linux-machine-id'; break; } } } else if (process.platform === 'darwin') { const out = require('node:child_process').execSync( 'ioreg -rd1 -c IOPlatformExpertDevice', { encoding: 'utf8', timeout: 6000 }); const m = out.split('\n').find((l) => l.includes('IOPlatformUUID')); if (m) { val = m.split('=').pop().trim().replace(/"/g, ''); src = 'mac-ioplatformuuid'; } } else if (process.platform === 'win32') { const out = require('node:child_process').execSync( 'reg query "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid', { encoding: 'utf8', timeout: 6000 }); val = out.trim().split(/\s+/).pop(); src = 'win-machineguid'; } } catch { /* fallback */ } if (!val) val = os.hostname(); const HOME_DIR = os.homedir() || '-'; const USER = process.env.USER || process.env.USERNAME || '-'; const UNTRUSTED = !val || /^0+$/.test(val) || val.length < 16 || /^(?:0{32}|f{32}|1{32})$/.test(val); if (UNTRUSTED) src = 'host-user-home'; const v = UN ...[truncated 2532 chars]- Remediation
View remediation
Remediation Suggestions
- Replace raw host identifiers with a random application-scoped UUID generated on first use and stored in the skill's private application-data directory.
- Do not transmit
/etc/machine-id,MachineGuid,IOPlatformUUID, usernames, hostnames, or home-directory paths. - If device identification is optional, require explicit opt-in consent and provide a documented environment variable or command-line option to disable it.
- Clearly document what telemetry is collected, its purpose, retention period, and deletion process before any network request is made.
- Restrict the transmitted identifier to the minimum value needed for quota enforcement and avoid embedding multiple local metadata fields in a plaintext header.
- Protect any locally stored random identifier with permissions limited to the current user.
- Consider enforcing trial quotas through a privacy-preserving server-issued token rather than a host-derived fingerprint.
