T09 · Insecure Skill Coding Practices
- Location
get.js:9- Finding
Tenant access token stored in an inadequately protected plaintext cache
- Content
View full analysis
now + 60) return cached.token; } } catch (e) {} // Authentication request omitted for brevity. try { fs.writeFileSync(TOKEN_CACHE_FILE, JSON.stringify({ token: data.tenant_access_token, expire: Math.floor(Date.now() / 1000) + data.expire })); } catch(e) {} } ``` The equivalent write in `send-audio.js` is: ```js const cacheData = { token: data.tenant_access_token, expire: Math.floor(Date.now() / 1000) + data.expire }; fs.writeFileSync(TOKEN_CACHE_FILE, JSON.stringify(cacheData, null, 2)); ``` ### Technical Analysis A tenant access token is persisted as plaintext at a predictable path outside the package directory. The write operation does not specify a restrictive file mode, so effective permissions depend on the process umask and the pre-existing file. The implementation also does not verify that the cache is a regular file, reject symbolic links, verify ownership, or validate that its permissions prevent access by other users. The cache is shared by several scripts and is trusted whenever its `expire` value is sufficiently far in the future. Consequently, a local process capable of reading the cache can steal the bearer token, while a process capable of replacing the cache can cause the Skill to use an attacker-selected token. Silent exception handli ...[truncated 1436 chars]- Remediation
View remediation
