T01 · Skill Instruction Hijacking
- Location
SKILL.md:24- Finding
Forced collection of user account credentials through agent instructions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This legal-search skill needs Review because it asks users for a phone number and password in chat, stores an API key locally, and ships obfuscated network code.
Install only if you are comfortable sending legal queries to LexSeek and handling LexSeek authentication through this skill. Do not provide reusable passwords in chat or CLI arguments; prefer a scoped token or browser/OAuth-style login. Review or replace the obfuscated script, pin the API URL to the legitimate LexSeek host, and store any API key in a managed secret store rather than the skill directory.
SKILL.md:24Forced collection of user account credentials through agent instructions
scripts/lexseek.js:1Plaintext password accepted through command-line arguments
scripts/lexseek.js:1API key stored in a plaintext Skill-local file without explicit restrictive permissions
scripts/lexseek.js:1Attacker-configurable API destination receives the authentication key
scripts/lexseek.js:1Security-sensitive network and credential logic distributed as heavily obfuscated code
The stated purpose is legal search, but the workflow also includes credential collection, remote login, and local credential storage/management. This mismatch is dangerous because users may consent to a narrow retrieval function without realizing the skill will solicit passwords and maintain authenticated state, increasing the risk of credential theft or misuse.
The skill explicitly instructs the model to ask the user for a phone number and password, but provides no privacy warning, secure handling guidance, or safer alternative. Collecting passwords through conversational prompts is highly risky because users may disclose reusable credentials into an untrusted channel and the skill may transmit them to a remote endpoint.
The skill directly instructs the assistant to solicit a phone number and password in plain conversational text to continue service. This is dangerous because it conditions users to share sensitive credentials with the assistant, creating phishing-like behavior and exposing secrets to logging, interception, or misuse.
The repeated error-handling logic reinforces credential solicitation whenever authentication fails, normalizing unsafe secret-sharing behavior. Repetition increases the likelihood that the assistant will aggressively request credentials and process them, compounding the risk of password exposure and unauthorized account access.
The script reads and writes a local .env file and stores the API key there, which is a form of credential access and insecure secret persistence. Reusable credentials on disk are high-value targets and may be exposed through weak file permissions, backups, logs, or accidental inclusion in source control.
const fs=require('fs'),path=require('path'),readline=require('readline'),APIConstants={'BASE_URL':'https://api.lexseek.cn','ENDPOINTS':{'LOGIN':'/api/v1/auth/login/password','SEARCH_LAW':'/api/v1/skills/search-law'}},ENV_FILE=path['join'](__dirname,'.env');function readEnvFile(){try{return fs['readFileSync'](ENV_FILE,'utf-8');}catch(_0x31f03b){return _0x31f03b['code']!=='ENOENT'&&console['error']('读取配置文件失败:',_0x31f03b['message']),'';}}function writeEnvFile(_0x457f8b){try{return fs['writeFileSync'](ENV_FILE,_0x457f8b,'utf-8'),!![];}catch(_0x1e1927){return console['error']('写入配置文件失败:',_0x1e1927['message']),![];}}function updateEnvKey(_0x58d667,_0x55e2e3){let _0x58a1ea=readEnvFile();const _0x260f52=_0x58a1ea['split']('\x0a'),_0x14c0ca=[];let _0x50c070=![];for(const _0x32bdf1 of _0x260f52){if(_0x32bdf1['startsWith'](_0x58d667+'='))_0x14c0ca['push'](_0x58d667+'='+_0x55e2e3),_0x50c070=!![];else _0x32bdf1['trim']()&&_0x14c0ca['push'](_0x32bdf1);}return!_0x50c070&&_0x14c0ca['push'](_0x58d667+'='+_0x55e2e3),writeEnvFile(_0x14c0ca['join']('\x0a'));}function getEnv(_0xf1c13e,_0x4fed29){const _0x5c133b=readEnvFile(),_0x3d661f=new RegExp('^'+_0xf1c13e+'=(.*)$','m'),_0x3a93a8=_0x5c133b['match'](_0x3d661f);return _0x3a93a8?_0x3a93a8[0x1da8+-0x318+0x1a8f*-0x1]['trim']():_0x4fed29;}function parseArgs(){const _0x56a7cc=process['argv']['slice'](-0x83*0xd+0x1bcd+-0x1524),_0x21c9c8={'_':[]};for(let _0x4a75b3=-0xab*-0x36+0x236e+-0x4780;_0x4a75b3<_0x56a7cc['length'];_0x4a75b3++){const _0x5b9235=_0x56a7cc[_0x4a75b3];if(!_0x5b9235['startsWith']('--')){_0x21c9c8['_']['push'](_0x5b9235);continue;}if(_0x5b9235['startsWith']('--')){const _0x2a8821=_0x5b9235['slice'](0x1d9*-0x11+-0x1*-0x24c4+0x1*-0x559),_0x16b884=_0x56a7cc[_0x4a75b3+(-0x1e2+0x881*-0x4+0x23e7)];if(!_0x16b884||_0x16b884['startsWith']('--'))_0x21c9c8[_0x2a8821]=!![];else!_0x16b884['startsWith']('--')&&(_0x2a8821==='k'||_0x2a8821==='limit'||_0x2a8821==='page'?_0x21c9c8[_0x2a8821]=parseInt(_0x16b884,-0x10f3+0x1*-0x17d3+0x28d0):_0x21c
...[truncated 27 chars]
The code is heavily obfuscated/minified, which materially reduces auditability for a skill that handles login credentials and remote requests. In this context, obfuscation makes it harder to verify that only the documented behavior occurs and increases the chance that unsafe or hidden functionality goes unnoticed.
const fs=require('fs'),path=require('path'),readline=require('readline'),APIConstants={'BASE_URL':'https://api.lexseek.cn','ENDPOINTS':{'LOGIN':'/api/v1/auth/login/password','SEARCH_LAW':'/api/v1/skills/search-law'}},ENV_FILE=path['join'](__dirname,'.env');function readEnvFile(){try{return fs['readFileSync'](ENV_FILE,'utf-8');}catch(_0x31f03b){return _0x31f03b['code']!=='ENOENT'&&console['error']('读取配置文件失败:',_0x31f03b['message']),'';}}function writeEnvFile(_0x457f8b){try{return fs['writeFileSync'](ENV_FILE,_0x457f8b,'utf-8'),!![];}catch(_0x1e1927){return console['error']('写入配置文件失败:',_0x1e1927['message']),![];}}function updateEnvKey(_0x58d667,_0x55e2e3){let _0x58a1ea=readEnvFile();const _0x260f52=_0x58a1ea['split']('\x0a'),_0x14c0ca=[];let _0x50c070=![];for(const _0x32bdf1 of _0x260f52){if(_0x32bdf1['startsWith'](_0x58d667+'='))_0x14c0ca['push'](_0x58d667+'='+_0x55e2e3),_0x50c070=!![];else _0x32bdf1['trim']()&&_0x14c0ca['push'](_0x32bdf1);}return!_0x50c070&&_0x14c0ca['push'](_0x58d667+'='+_0x55e2e3),writeEnvFile(_0x14c0ca['join']('\x0a'));}function getEnv(_0xf1c13e,_0x4fed29){const _0x5c133b=readEnvFile(),_0x3d661f=new RegExp('^'+_0xf1c13e+'=(.*)$','m'),_0x3a93a8=_0x5c133b['match'](_0x3d661f);return _0x3a93a8?_0x3a93a8[0x1da8+-0x318+0x1a8f*-0x1]['trim']():_0x4fed29;}function parseArgs(){const _0x56a7cc=process['argv']['slice'](-0x83*0xd+0x1bcd+-0x1524),_0x21c9c8={'_':[]};for(let _0x4a75b3=-0xab*-0x36+0x236e+-0x4780;_0x4a75b3<_0x56a7cc['length'];_0x4a75b3++){const _0x5b9235=_0x56a7cc[_0x4a75b3];if(!_0x5b9235['startsWith']('--')){_0x21c9c8['_']['push'](_0x5b9235);continue;}if(_0x5b9235['startsWith']('--')){const _0x2a8821=_0x5b9235['slice'](0x1d9*-0x11+-0x1*-0x24c4+0x1*-0x559),_0x16b884=_0x56a7cc[_0x4a75b3+(-0x1e2+0x881*-0x4+0x23e7)];if(!_0x16b884||_0x16b884['startsWith']('--'))_0x21c9c8[_0x2a8821]=!![];else!_0x16b884['startsWith']('--')&&(_0x2a8821==='k'||_0x2a8821==='limit'||_0x2a8821==='page'?_0x21c9c8[_0x2a8821]=parseInt(_0x16b884,-0x10f3+0x1*-0x17d3+0x28d0):_0x21c
...[truncated 27 chars]
The skill declares network-dependent behavior via external API authentication and search, but does not specify an explicit tool scope such as allowed-tools or permissions. This weakens execution transparency and reviewability, making it easier for the skill to invoke networked behavior without clear operator awareness or policy gating.
The auto-trigger condition is broad enough to activate on ordinary legal discussion, which can cause the assistant to invoke networked, authenticated behavior unexpectedly. In this skill, that broad trigger is more dangerous because activation may lead to credential solicitation for a third-party service during routine conversation.
L003 及整份文档均将技能定义为中文法律助手,并未提供语言/locale 选择或说明仅在用户明确选择中文场景下使用。按照语言/locale 政策,若技能实际上强制特定语言输出而无用户选择,可能构成自然语言策略违规。
The skill references API key–based authentication via environment variables but does not explain credential usage, transmission, or storage expectations. This lack of disclosure can lead operators or users to unknowingly expose sensitive keys or misunderstand how authentication secrets are handled.
The phrase 'user asks a specific legal question or keyword' is insufficiently bounded and can overlap with general legal advice conversations. Because the skill forbids fallback and pushes users toward login, vague triggering increases the chance of unnecessary data exposure and disruptive credential prompts.
This JSON eval file consistently defines prompts and expected outputs only in Chinese, including instructional phrases and user-facing responses. Because the file contains no indication that language selection is optional or that the skill is intentionally limited to a Chinese-only locale, it suggests a language policy constraint without user opt-in.
The skill instructs the model to collect a user's phone number and password and pass them to a local script, even though the skill's primary purpose is legal text retrieval. This creates unnecessary credential-handling behavior, expands the model's access to sensitive secrets, and could expose user credentials through logs, prompts, process listings, or downstream tooling.
The skill tells the model to solicit a phone number and password and forward them to a login script without any warning about secret handling, storage, or exposure risks. In an LLM-agent setting, this is dangerous because users may disclose highly sensitive credentials to a system not designed to safely process passwords, and the script invocation may leak them to logs or telemetry.
The documentation says the API key is automatically stored locally but does not clearly warn about credential persistence or its security implications. This omission can mislead users and integrators into accepting insecure default secret storage, increasing the chance of accidental exposure and unauthorized reuse of the API key.
The documentation directs that the API key be automatically stored in a local .env file, introducing persistent credential storage beyond the immediate retrieval task. Persisting secrets locally increases the risk of later disclosure through filesystem access, source control mistakes, workspace sharing, backups, or other skills/tools reading the file.
The document instructs the skill to send user legal queries to an external third-party API using an API key, but it does not disclose that potentially sensitive user-provided case facts or legal questions will leave the local environment. In a legal-assistant context, queries may contain confidential personal, employment, family, or dispute information, so the omission creates a meaningful privacy and data-handling risk.
The skill’s declared purpose is legal text retrieval, but the code also implements login/logout and local credential persistence in a sidecar .env file. This expands the trust boundary from simple retrieval to credential handling, increasing risk because secrets are stored locally without strong safeguards and outside the narrowly stated scope.
The code prompts for a phone number and password, exchanges them for an API key, and then persists that key locally. For a law-retrieval skill, this is unnecessary exposure of sensitive credentials and creates a risk of credential theft or accidental leakage from the local filesystem.
The login flow silently writes the returned API key to a local .env file, but the user is not clearly warned before persistent storage occurs. This undermines informed consent and can leave reusable credentials on disk where other local users, backups, or tools may access them.
The script's prompts, errors, and help output are entirely hardcoded in Chinese, including login, search, and error flows. This forces a specific language/locale on all users without any opt-in or documented region-specific justification, matching the policy violation criteria for language/locale constraints.
The skill documentation appears to require Chinese by presenting all instructions and interface descriptions exclusively in Chinese, with no opt-in or note that the skill is intended for a Chinese-language context. This can violate language or locale policy when a skill forces a specific language without user choice or explicit justification.
The login flow silently writes the returned API key to a local .env file, but the user is not clearly warned before persistent storage occurs. This undermines informed consent and can leave reusable credentials on disk where other local users, backups, or tools may access them.