T09 · Insecure Skill Coding Practices
- Location
CAPABILITY.md:215- Finding
Unnecessary Collection and Plaintext Storage of Full X Account Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill mostly matches its X/Twitter scraping purpose, but it asks for and automatically uses sensitive account credentials in ways that are broader than needed and not clearly controlled.
Review this skill carefully before installing. Use a limited X API bearer token rather than an account password, avoid placing credentials or cookies under /root, do not provide a full browser cookie jar unless you intentionally want authenticated scraping, and isolate any browser scraping from your normal logged-in sessions.
CAPABILITY.md:215Unnecessary Collection and Plaintext Storage of Full X Account Credentials
scripts/fetch_x_playwright.py:12Browser Scraper Automatically Imports a Privileged Full-Session Cookie Jar
The documentation explicitly identifies a credential file path for X login secrets, indicating the skill depends on direct access to stored authentication material. In an agent environment, exposing or normalizing access to credential files materially raises the risk of credential theft, unauthorized account use, and lateral misuse of authenticated sessions, especially combined with scraping workflows.
Credentials file: /root/.openclaw/credentials/x_login_credentials.env
Required environment variables:
The declared behavior says the skill performs X/Twitter scraping and analysis, but the finding indicates the underlying implementation does not actually do those tasks and instead serves some unrelated testing/parsing purpose. This kind of description-behavior mismatch is dangerous because users and orchestrators may grant trust, secrets, or execution rights under false assumptions, enabling deceptive or unintended operations.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Default locations
possible_paths = [
Path.home() / '.openclaw' / 'credentials' / 'x_api_tokens.env',
Path.home() / '.openclaw' / 'credentials' / 'x_credentials.env',
]
for path in possible_paths:
if path.exists():
The manifest describes this skill as specifically for X (Twitter) data extraction and analysis, with examples centered on tweets, user timelines, and X search. The capability doc states it searches and scrapes 'social media content (X/Twitter, Reddit, etc.)', which broadens the advertised behavior to other platforms not covered by the skill manifest.
The skill documents authenticated scraping using stored account credentials and cookies, but provides no user-facing warning or constraints around privacy, account ownership, terms-of-service, or data-access implications. In an agent context, this increases the chance of silent collection of non-public or account-scoped data and unsafe automated use of privileged credentials.
The README instructs users to persist a live API bearer token in a plaintext file under ~/.openclaw/credentials without mentioning permission hardening or safer storage options. If that file is readable by other local users, included in backups, or unintentionally exposed by tooling, the token could be stolen and used to access the user's X API quota or data access privileges.
export X_BEARER_TOKEN="Bearer YOUR_TOKEN"
Or create ~/.openclaw/credentials/x_api_tokens.env:
X_BEARER_TOKEN=Bearer YOUR_TOKEN_HERE
The skill advertises scripts that use environment secrets, local credential files, and network access, but it does not declare any explicit tool scope or permissions. In an agent setting, this weakens least-privilege boundaries and can allow broader-than-expected access to secrets, files, or outbound requests if the skill is invoked.
The description says to use the skill when the user asks to "search X for" or "analyze Twitter data," which are broad natural-language triggers without clear boundaries or exclusion conditions. These phrases could overlap with ordinary requests and may cause unintended invocation because the file does not define tighter scope or negative examples.
The skill instructs users to store a bearer token in a persistent file under the home directory, which creates ongoing secret exposure risk if local files are accessible to other skills, processes, or logs. Persisting API credentials outside a dedicated secret manager increases the chance of token leakage and unauthorized reuse.
Credentials: Create ~/.openclaw/credentials/x_api_tokens.env:
X_BEARER_TOKEN=Bearer YOUR_TOKEN_HERE
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
Credentials: Create ~/.openclaw/credentials/x_api_tokens.env:
X_BEARER_TOKEN=Bearer YOUR_TOKEN_HERE
The docstring claims an API-related purpose and specifically says it "Bypasses API rate limits," which implies constrained API use. In reality, the code never calls the X/Twitter API; it opens twitter.com pages in Playwright and extracts DOM content, which is a different mechanism and intent than documented.
The script silently loads authentication cookies from a fixed path and injects them into a browser context, enabling requests to run under an existing logged-in session without explicit user awareness or consent at runtime. In a skill context, this can expose private account data, perform authenticated scraping, and misuse sensitive credentials if the cookie file belongs to a real user or shared service account.
User-supplied search terms are sent directly to X/Twitter via automated requests with no clear warning that input will be transmitted to an external third party. In an agent skill, users may provide sensitive names, topics, or investigative queries they do not expect to leave the local environment, creating privacy and data-handling risk.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
class XAPIClient:
"""X API v2 Client"""
BASE_URL = "https://api.twitter.com/2"
def __init__(self, bearer_token=None, credentials_path=None):
"""
The file presents the core capability description and method descriptions in Chinese, but does not indicate that the skill is Chinese-specific or give users an option to choose language. The policy for natural-language content requires avoiding forced language/locale constraints without opt-in or justification.
This markdown file instructs users to obtain and store an API bearer token in an environment variable or local credentials file. While it explains how to set the token, it does not include any user warning about the sensitivity of the credential, avoiding committing it to source control, or protecting the local file.
This code performs remote API calls to look up a username and fetch tweet/account metadata, but the function and CLI provide no explicit warning or user-facing notice that network requests will be made and that returned profile data will be emitted to stdout. For a code file, SQP-2 applies when network calls transmitting or retrieving user/system data lack confirmation, logging, or clear explanatory disclosure.
No suspicious patterns detected.