Back to skill

Security audit

OpenAI Auth Switcher Public

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate account-switching purpose, but it gives a persistent local web service high-impact OAuth/account authority with insecure credential handling and an unreviewed external OAuth helper.

Review carefully before installing. Use only on a trusted, single-user admin machine, keep the service bound to 127.0.0.1 behind an SSH tunnel, do not reuse the generated password, and treat all OAuth/profile files as secrets. Production use should wait for fixes to credential storage, password rendering, path validation, HTML escaping, minimal environment passing, and packaging of the OAuth helper inside the reviewed skill.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
service/config.py:22
Finding

Plaintext administrative and OAuth credentials are stored and exposed without restrictive file permissions

Content
View full analysis
None: ensure_skill_dirs() INSTALL_INFO_PATH.write_text( json.dumps(data, ensure_ascii=False, indent=2) + '\n', encoding='utf-8', ) ``` ```python def save_json_atomic(path: Path, data: JsonDict) -> None: tmp_path = path.with_suffix(path.suffix + '.tmp') tmp_path.write_text( json.dumps(data, ensure_ascii=False, indent=2) + '\n', encoding='utf-8', ) tmp_path.replace(path) ``` The installation result contains and prints the plaintext password: ```python install_info = { 'ok': True, 'host': args.host, 'port': port, 'username': creds['username'], 'password': creds['password'], # ... } save_install_info(install_info) # ... print(f"Username: {creds['username']}") print(f"Password: {creds['password']}") ``` The resulting permissions depend entirely on the caller's umask. Under a common `0022` umask, newly created files can be readable by other local users. The same issue affects temporary OAuth profile files and other JSON state files created elsewhere through unrestricted `write_text()` calls. Printing the password is useful for first-run access, but it also places the secret in terminal capture, installation logs, automation output, and agent tool output. Persistent plaintext storage is needed only if Basic Authentication remains the design; broad file readability is not necessary for the declared functionality. ### Attack Path 1. ...[truncated 1305 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
service/channel_store.py:116
Finding

Unvalidated slot and OAuth session identifiers permit filesystem path traversal

Content
View full analysis
JsonDict: ensure_channel_state() slot_dir = get_profiles_dir() / slot auth_path = slot_dir / 'auth-profile.json' meta_path = slot_dir / 'meta.json' if not slot_dir.exists(): raise RuntimeError(f'channel not found: {slot}') src = Path(source).expanduser().resolve() if not src.exists(): raise RuntimeError(f'授权文件不存在: {src}') data = load_json_file(src) profile = ((data.get('profiles') or {}).get(OPENAI_PROFILE_KEY)) if 'profiles' in data else data if not isinstance(profile, dict): raise RuntimeError('授权文件格式不正确,缺少 openai-codex:default 或 profile 对象') save_json_atomic(auth_path, profile) meta = _load_json(meta_path, {}) if meta_path.exists() else {} meta['account_id'] = profile.get('accountId') meta['provider'] = profile.get('provider') or 'openai-codex' meta['status'] = 'ready' _save_json(meta_path, meta) ``` A value such as `../../some-existing-directory` causes `slot_dir` to resolve outside the intended profile area. The target only has to be an existing directory. OAuth session identifiers have the same weakness: ```python def oauth_session_dir(session_id: str) -> Path: return STATE_DIR / 'oauth-sessions' / session_id ``` ```python def submit_oauth_callback(session_id: str, callback_url: str) -> JsonDict: session_dir = oauth_session_dir(session_id) if not session_dir.exists(): return {'ok': False, 'error': f'session not found: {session_id}'} (session_dir / 'callback.txt').write_text( callback_u ...[truncated 2222 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
service/app.py:40
Finding

Stored HTML and JavaScript injection through unescaped channel and runtime data

Content
View full analysis
{item.get('displayName') or item.get('slot')}
状态:{oauth_status_label(item.get('status'))} · 通道:{item.get('slot')}
任务ID:{item.get('sessionId')}
" for item in reversed(oauth_sessions[-5:]) ) or "
暂无授权任务
" # ... channel_items = ''.join( f"
{row.get('display_name') or row.get('slot')}
通道标识:{row.get('slot')} · 状态:{'已授权' if row.get('has_auth_file') else '待授权'} · {'当前通道' if row.get('is_current') else '未选中'}
账号ID:{row.get('account_id') or '未配置'}
设为当前开始授权完成授权
" for row in channels ) or "
暂无通道
" ``` Values are inserted into both element content and single-quoted HTML attributes without contextual encoding. A display name such as: ```html '> ``` can terminate an attribute or create a new executable element. The affected values can originate from channel creation, profile metadata, imported state, or OAuth session files. Because this is persisted data, the payload executes whenever an administrator loads t ...[truncated 1743 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
service/app.py:283
Finding

Administrative password is embedded in client-side JavaScript and reused over plaintext HTTP Basic Authentication

Content
View full analysis
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Warning
Location
service/oauth_flow.py:89
Finding

OAuth workflow executes an external, unreviewed helper through a spoofable hardcoded tool path

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (95)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Uninstallation logic that stops services, deletes unit files, and removes runtime artifacts is sensitive and can affect availability or destroy forensic/state data. In this context, the danger comes from insufficient disclosure and the possibility of broad cleanup behavior in a skill centered on authentication workflows.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 55)May include surrounding context.

md
- `scripts/token_ledger.py` — local token attribution ledger rebuild

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · install.sh (reported line 48)May include surrounding context.

sh
if [[ -f "$STOPPER" ]]; then
  python3 "$STOPPER" >/dev/null 2>&1 || true
fi
rm -f "$RUNTIME_DIR/web-preview.pid" "$RUNTIME_DIR/web-preview.log" || true
if [[ -f "$UNIT_PATH" ]]; then
  rm -f "$UNIT_PATH"
  systemctl --user daemon-reload >/dev/null 2>&1 || true

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/install_web_app.py (reported line 23)May include surrounding context.

python
paths import ensure_skill_dirs, get_runtime_dir  # noqa: E402
from pick_port import pick_port  # noqa: E402
from web_process_lib import detect_systemd_user, read_unit_env, systemd_unit_exists, systemd_unit_status, systemd_user_available, wait_for_port, write_unit_file  # noqa: E402


DEFAULT_SYSTEMD_TEMPLATE = """[Unit]\nDescription=OpenAI Auth Switcher Public Web Preview\nAfter=default.target\n\n[Service]\nType=simple\nWorkingDirectory=__WORKSPACE__\nEnvironment=PYTHONUNBUFFERED=1\nEnvironment=OPENAI_AUTH_SWITCHER_HOST=127.0.0.1\nEnvironment=OPENAI_AUTH_SWITCHER_PORT=8765\nExecStart=/usr/bin/env python3 __WORKSPACE__/skills/openai-auth-switcher-public/service/app.py\nRestart=on-failure\nRestartSec=2\n\n[Install]\nWantedBy=default.target\n"""


SYSTEMD_PREVIEW_UNIT = 'openai-auth-switcher-web-preview.service'


def wait_for_systemd_ready(unit_name: str, host: str, port: int, timeout_seconds: float = 20.0, interval_seconds: float = 0.5) -> tuple[bool, dict]:
    deadline = __import__('t

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
84% confidence
Finding

Copying the full parent environment into the child web process can propagate unrelated secrets such as API tokens, cloud credentials, proxy auth, or session data into a long-lived service. If the child process, logs, debugging endpoints, crashes, or runtime inspection features expose environment variables, this becomes a credential leakage pathway.

Content

Scanner excerpt · scripts/install_web_app.py (reported line 46)May include surrounding context.

python
log_path = runtime_dir / 'web-preview.log'
    pid_path = runtime_dir / 'web-preview.pid'
    app_path = CURRENT_DIR.parent / 'service' / 'app.py'
    env = os.environ.copy()
    env['OPENAI_AUTH_SWITCHER_HOST'] = host
    env['OPENAI_AUTH_SWITCHER_PORT'] = str(port)
    with log_path.open('a', encoding='utf-8') as log:

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill description claims the package is release-safe and avoids bundling live auth snapshots, logs, callbacks, or machine-specific runtime data, but this service intentionally surfaces OAuth session data, callback workflow state, and runtime/log locations through the UI and APIs. This mismatch is dangerous because users may trust the skill as low-risk while it actually handles and reveals sensitive operational data.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The generated page embeds the Basic Auth username and password into client-side JavaScript via const BASIC_AUTH = 'Basic ' + btoa('{username}:{password}'), making the credential recoverable by any authenticated viewer, browser extension, page capture, or injected script. This defeats the purpose of using Basic Auth as a server-side secret and enables credential reuse for API access and potentially other systems if reused.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · service/oauth_flow.py (reported line 89)May include surrounding context.

python
'displayName': display_name or slot,
        'status': 'starting',
    })
    env = os.environ.copy()
    env['PATH'] = '/root/.local/share/pnpm:/root/.nvm/versions/node/v22.22.0/bin:/usr/local/bin:/usr/bin:/bin:' + env.get('PATH', '')
    subprocess.Popen(
        ['node', str((Path('/root/.openclaw/workspace/skills/openai-auth-switcher/scripts/oauth_web_login.mjs'))), str(STATE_DIR), session_id, slot, display_name or slot],

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill advertises and coordinates operations that imply shell, file, environment, and possibly network access, but it does not declare any tool scope or permission boundaries in the skill manifest. In an agent setting, missing explicit permissions increases the chance of overbroad execution, unsafe tool invocation, and user confusion about what the skill is allowed to do.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document sets lang="zh-CN" and all visible UI copy is presented in Chinese, indicating a fixed language/locale experience. Under the stated policy, forcing a specific language without user opt-in or a clearly documented region-specific justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.