T09 · Insecure Skill Coding Practices
- Location
gaimode-cli.py:20- Finding
Google session cookies are stored without enforced access controls
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a Google search automation helper, but it asks users to expose sensitive Google session access and leaves a powerful browser debugging interface running with weak controls.
Review this carefully before installing. Use only a dedicated low-privilege Google account, do not export primary-account cookies, lock down any cookie file permissions, and avoid keeping Chrome DevTools Protocol running continuously. Be aware that the launcher can kill existing Chrome sessions and that any local process reaching the debugging port may control or inspect the dedicated browser.
gaimode-cli.py:20Google session cookies are stored without enforced access controls
start-chrome-cdp.sh:7Chrome launcher forcibly terminates unrelated browser processes
start-chrome-cdp.sh:11Persistent unauthenticated CDP endpoint exposes broad control over the dedicated browser
The documentation instructs users to export Google cookies and save them locally, but does not clearly warn that these cookies are authentication secrets that may permit account access if stolen. In an agent-skill context, encouraging local storage of reusable session material increases the chance of credential leakage through weak file permissions, backups, logs, or other tools that can read the file.
The module docstring presents the tool as a 'Google AI Mode Search Tool', and the CLI help repeats that framing. However, both search implementations navigate to 'https://www.google.com/search?udm=50&q=...' rather than a distinct AI Mode interface, while also using Chrome CDP or imported cookies to fetch page text. This is an intent-level contradiction between the documented purpose and the implemented behavior.
The tool stores and reuses browser-exported cookies from a local JSON file to authenticate automated sessions, but it provides only minimal warning despite the high sensitivity of session cookies. If the file is stolen, mishandled, or users are encouraged to export full browser cookies without safeguards, an attacker could hijack authenticated sessions or expose private account data.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def is_cdp_running():
"""Check if Chrome CDP is running on port 9222"""
try:
result = subprocess.run(['curl', '-s', '--max-time', '3', 'http://localhost:9222/json/version'],
capture_output=True, text=True)
return 'Chrome' in result.stdout
except:
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def get_cdp_ws_url():
"""Get WebSocket URL from Chrome CDP"""
try:
result = subprocess.run(['curl', '-s', 'http://localhost:9222/json/version'],
capture_output=True, text=True)
data = json.loads(result.stdout)
return data.get('webSocketDebuggerUrl')
The 'search' subcommand is documented as 'Search Google AI Mode'. In execution, 'search_cdp' and 'search_cookies' open a regular Google search URL, wait, and then scrape the visible body text, which does not match the stated command intent. This is a direct mismatch between command documentation and actual code behavior.
The header comment says to 'Run ONCE, keep it open for 24/7 access', implying a benign persistent launcher, but the script's first operational step is to terminate all matching 'Google Chrome' processes with pkill -9. That is an active side effect contradicting the implied behavior of simply starting and keeping one browser instance open.
The script forcefully terminates all matching Google Chrome processes with SIGKILL and no confirmation, which can cause denial of service, loss of unsaved user data, and interruption of unrelated browsing sessions. In the context of a skill intended to expose Chrome DevTools remotely, this behavior is more dangerous because it disrupts an active browser environment in order to bring up a debug-enabled instance.
No suspicious patterns detected.