T09 · Insecure Skill Coding Practices
- Location
connector.cjs:40- Finding
Predictable temporary PID lock enables process termination and symlink-based file overwrite
- Content
View full analysis
0) { try { process.kill(oldPid, 0); // still alive? console.log('Stopping previous session (pid ' + oldPid + ')'); process.kill(oldPid, 'SIGTERM'); } catch (e) { console.log('Removing stale lock (pid ' + oldPid + ' not running)'); } } } fs.writeFileSync(lockfile, String(process.pid)); } function releaseDeviceLock() { if (!lockfile) return; try { if (fs.readFileSync(lockfile, 'utf8').trim() === String(process.pid)) { fs.unlinkSync(lockfile); } } catch (e) {} } ``` ### Technical Analysis The connector stores lock files in the predictable shared path `/tmp/intiface-locks` and does not enforce restrictive directory permissions, verify ownership, reject symbolic links, or create the lock atomically. The PID read from the lock file is trusted after only numeric parsing. If it identifies a live process that the connector's operating-system account is permitted to signal, the connector sends that process `SIGTERM`. No verification establishes that the PID belongs to an earlier instance of this connector. The subsequent `fs.writeFileSync()` follows existing symbolic links. An attacker who can prepare the lock directory or lock file can therefore redirect the PID write to another file writable by the victim account. The overwrite content is li ...[truncated 1627 chars]- Remediation
View remediation
