Back to skill

Security audit

安全事件日志调查助手

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says, but it sends potentially sensitive security logs to a configurable external LLM API without implemented redaction despite claiming automatic redaction.

Review before installing in sensitive environments. Use this only with logs you are allowed to send to the configured LLM provider, redact secrets manually first, verify the SILICONFLOW_BASE_URL destination, and do not rely on the documented automatic redaction claim unless the implementation is changed and tested.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
src/llm_client.py:84
Finding
Unredacted Security Logs Are Transmitted to a Configurable External API<![CDATA[ ## Vulnerability Details **File Location**: `src/analyzer.py:123-130`, `src/llm_client.py:19-30`, `src/llm_client.py:84-97`, `DESIGN.md:101-104` **Vulnerability Type**: Sensitive information disclosure through an external service **Risk Level**: High ### Vulnerable Code `src/analyzer.py:123-130`: ```python if not os.path.exists(log_file): print(f"❌ File does not exist: {log_file}") sys.exit(1) with open(log_file, "r", encoding="utf-8") as f: log_content = f.read() report = analyze_security_log(log_content, mode) print(report) ``` `src/llm_client.py:19-30`: ```python self.api_key = os.getenv("SILICONFLOW_API_KEY") self.base_url = os.getenv( "SILICONFLOW_BASE_URL", "https://api.siliconflow.cn/v1" ) self.model = os.getenv("SILICONFLOW_MODEL", "Qwen/Qwen3-8B") self.rate_limit = int(os.getenv("API_RATE_LIMIT", "2")) if not self.api_key: raise ValueError("SILICONFLOW_API_KEY is not configured") self.client = OpenAI( api_key=self.api_key, base_url=self.base_url ) ``` `src/llm_client.py:84-97`: ```python # Select the prompt if mode == "detailed": user_prompt = DETAILED_ANALYSIS_PROMPT.format(log_content=log_content) max_tokens = 3000 else: user_prompt = BRIEF_ANALYSIS_PROMPT.format(log_content=log_content) max_tokens = 1500 messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user_prompt} ] return self.chat(messages, max_tokens) ``` The design document states that sensitive information is automatically redacted, but no redaction implementation exists in the supplied source code. ### Technical Analysis The application reads the selected log file in full, performs only length-based truncation, embeds the retained content directly into an LLM prompt, and sends it to an OpenAI-compatible remote API. Security logs can contain credentials, authorization headers, session identifiers, access tokens, email addresses, usernames, internal IP addresses, private URLs ...[truncated 2445 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Implement local redaction before any prompt is constructed: - Detect and mask authorization headers, API keys, passwords, cookies, session IDs, private keys, and common token formats. - Support configurable rules for organization-specific identifiers. - Redact sensitive URL query parameters and request bodies. - Preserve only the minimum information needed for analysis. 2. Require explicit user consent before external transmission: - Display the selected provider and destination hostname. - Explain that retained log content will leave the local system. - Provide a preview of the redacted payload. 3. Validate the API destination: - Require HTTPS. - Reject URLs containing unexpected credentials, ports, or schemes. - Use an allowlist of approved provider hostnames where operationally possible. - Require a separate explicit unsafe-mode setting for custom endpoints. 4. Separate credentials by provider and avoid forwarding a production provider key to arbitrary custom endpoints. 5. Add automated tests containing representative secrets and verify that none appear in outbound prompts. 6. Update the documentation so its privacy claims accurately reflect implemented behavior. Do not claim automatic redaction until the feature is implemented and tested. 7. Consider an offline or locally hosted analysis option for highly sensitive incident data. ]]>

T01 · Skill Instruction Hijacking

Warning
Location
src/llm_client.py:84
Finding
Attacker-Controlled Log Entries Can Manipulate LLM Security Reports<![CDATA[ ## Vulnerability Details **File Location**: `src/prompts.py:6-14`, `src/prompts.py:37-49`, `src/prompts.py:104-114`, `src/llm_client.py:84-97` **Vulnerability Type**: Indirect prompt injection **Risk Level**: Medium ### Vulnerable Code `src/prompts.py:6-14`: ```python BRIEF_ANALYSIS_PROMPT = """You are a senior security incident response analyst. Analyze the following security log and provide a brief report. Requirements: 1. Identify the incident type 2. Assess the threat level 3. Extract key indicators of compromise 4. Provide no more than three action recommendations Log content: {log_content} ``` `src/prompts.py:37-49`: ```python DETAILED_ANALYSIS_PROMPT = """You are a senior security incident response analyst with more than ten years of security operations experience. Perform an in-depth analysis of the following security log. Requirements: 1. Reconstruct the complete event timeline 2. Analyze the attack chain and map it to MITRE ATT&CK 3. Extract all indicators of compromise 4. Analyze attacker tactics, techniques, and procedures 5. Assess the impact scope 6. Provide detailed mitigation and remediation recommendations 7. Provide follow-up monitoring recommendations Log content: {log_content} ``` `src/prompts.py:104-114`: ```python SYSTEM_PROMPT = """You are a professional security incident response analyst specializing in log analysis, threat hunting, and incident investigation. Your analysis should: - Accurately identify security threats - Provide actionable recommendations - Use a clear, structured format - Avoid excessive alerts and focus on genuine threats """ ``` `src/llm_client.py:84-97`: ```python # Select the prompt if mode == "detailed": user_prompt = DETAILED_ANALYSIS_PROMPT.format(log_content=log_content) max_tokens = 3000 else: user_prompt = BRIEF_ANALYSIS_PROMPT.format(log_content=log_content) max_tokens = 1500 messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": ...[truncated 3052 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Strengthen the system prompt with explicit trust-boundary instructions: - State that all log content is untrusted data. - Require the model to ignore commands, policies, role changes, or formatting directives found inside logs. - Prohibit following URLs or acting on instructions contained in evidence. - Require suspicious instruction-like log entries to be reported as possible prompt injection. 2. Isolate log evidence from instructions: - Serialize logs as structured JSON where practical. - Use explicit begin and end delimiters around evidence. - Escape or encode delimiter sequences occurring within the input. - Keep analysis policy exclusively in the system message. 3. Require structured output validated against a strict schema: - Restrict threat levels and incident types to expected values. - Validate indicator formats independently. - Reject responses that omit mandatory sections or contain unexpected instructions. 4. Add deterministic preprocessing: - Flag phrases such as “ignore previous instructions” when they occur in log data. - Preserve flagged content as evidence while clearly marking it as untrusted. - Do not rely on keyword filtering as the sole defense. 5. Treat model output as untrusted advisory content: - Require analyst confirmation before containment actions. - Avoid connecting recommendations directly to automated blocking, deletion, or account-disabling workflows. 6. Add adversarial tests using injected instructions in common log fields and verify that reports continue to follow the system policy. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (18)

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /root/.openclaw/skills/security-log-analyzer
pip install -r requirements.txt
cp .env.example .env
# 编辑.env 文件,填写 API Key
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

External Transmission

Medium
Category
Data Exfiltration
Content
## API 配置

**SiliconFlow 配置**:
- Base URL: https://api.siliconflow.cn/v1
- Model: Qwen/Qwen3-8B
- API Key: 从.env 文件读取
Confidence
80% confidence
Finding
Referencing a third-party API endpoint is not inherently malicious, but in this skill's context it confirms that security log data will leave the local environment and be sent to an external service. Because the skill is specifically for analyzing security incident logs, the transmitted data is likely to be sensitive, making external transmission materially risky without strong disclosure, minimization, and privacy controls.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The design states that user-provided security logs are sent to an external LLM for analysis, but it does not clearly disclose to users that potentially sensitive log contents will be transmitted to a third-party provider. Security logs often contain IPs, usernames, hostnames, internal paths, tokens, or incident details, so omission of an explicit third-party data transfer warning creates a real confidentiality and compliance risk.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The documentation describes analyzing security logs with an LLM and includes configuration for a third-party API endpoint, but it does not clearly warn users that uploaded log contents may be transmitted off-host to an external service. Security logs often contain sensitive data such as internal IPs, usernames, hostnames, tokens, and incident details, so undisclosed external transmission creates a real confidentiality and compliance risk.

External Transmission

Medium
Category
Data Exfiltration
Content
```bash
SILICONFLOW_API_KEY=sk-your-api-key-here
SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1
SILICONFLOW_MODEL=Qwen/Qwen3-8B
API_RATE_LIMIT=2
```
Confidence
90% confidence
Finding
The skill is configured to use an external API service, which means log data may leave the local environment for remote processing. In the context of security incident logs, this is more sensitive than generic text because the content may expose infrastructure details, credentials in logs, or active incident information to a third party.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The natural-language strings throughout the file, including the module description and all user-facing prompts, are exclusively in Chinese. This imposes a specific language on users without any opt-in, fallback, or explanation that the tool is intended only for a Chinese-language environment, which matches the language/locale policy violation criteria.

Context-Inappropriate Capability

Medium
Confidence
86% confidence
Finding
The file describes itself as a security event log analyzer and assistant, but the implementation requires a SILICONFLOW_API_KEY and sends log content to an LLM client for analysis. Without any manifest declaring networked third-party analysis, exfiltrating potentially sensitive logs to an external service is not obviously required by the stated purpose of log analysis.

External Transmission

Medium
Category
Data Exfiltration
Content
def __init__(self):
        self.api_key = os.getenv("SILICONFLOW_API_KEY")
        self.base_url = os.getenv("SILICONFLOW_BASE_URL", "https://api.siliconflow.cn/v1")
        self.model = os.getenv("SILICONFLOW_MODEL", "Qwen/Qwen3-8B")
        self.rate_limit = int(os.getenv("API_RATE_LIMIT", "2"))
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The code sends raw log content to an external LLM provider for analysis via `analyze_log()` without any built-in consent flow, warning, redaction, or data-classification check. Security logs often contain credentials, tokens, IPs, internal hostnames, or personal data, so transmitting them off-system can create confidentiality, compliance, and data-handling risks even if the API endpoint itself is legitimate.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The file’s natural-language instructions are entirely in Chinese and direct the model to respond using Chinese headings and field labels, which effectively imposes a specific language choice. Under the policy, a forced language without user opt-in is a natural-language locale violation unless the constraint is explicitly documented and justified.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
Natural-language policy violations apply to all file types. The file forces a specific language for all instructions and examples, and there is no indication that the skill is region-specific or that users can opt into another language/locale.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The manifest presents the skill name, display name, examples, and description entirely in Chinese, with no indication that users can choose another language or that the skill is intended only for a Chinese-speaking environment. This can violate language/locale policy when a skill implicitly forces a specific language without user opt-in or documented regional justification.

Unpinned Dependencies

Low
Category
Supply Chain
Content
openai>=1.0.0
python-dotenv>=1.0.0
tiktoken>=0.5.0
Confidence
96% confidence
Finding
The dependency is specified with a lower bound only, which allows future major or minor releases to be installed without review. This can introduce supply-chain risk, unexpected breaking changes, or newly introduced vulnerable versions into the skill environment.

Unpinned Dependencies

Low
Category
Supply Chain
Content
openai>=1.0.0
python-dotenv>=1.0.0
tiktoken>=0.5.0
Confidence
99% confidence
Finding
python-dotenv is unpinned, so the environment may resolve to different versions over time, including versions with known security issues or unsafe behavior changes. Because there is already advisory information associated with this package, leaving it unpinned increases the chance of pulling an affected release.

Unverifiable Dependency: python-dotenv has 2 known advisory(ies) (CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via ); CVE-2026-28684 (python-dotenv reads key-value pairs from a .env file and can set them as environ)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
90% confidence
Finding
The manifest includes python-dotenv without pinning a version, while known advisories exist for that package. Because the resolved installed version is unconstrained above 1.0.0, it is not possible to verify from this file alone that deployment will avoid affected releases, creating a plausible supply-chain and file-handling risk.

Unpinned Dependencies

Low
Category
Supply Chain
Content
openai>=1.0.0
python-dotenv>=1.0.0
tiktoken>=0.5.0
Confidence
95% confidence
Finding
The package is not pinned to an exact version, so builds are not reproducible and may silently consume newly published releases. This creates avoidable supply-chain exposure and can make security review and incident response harder.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The module docstring names the skill entirely in Chinese, which indicates a language-specific presentation without any visible option for user language choice. The file does not document that the skill is region-specific or otherwise justify the locale constraint.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
Docstrings, error messages, and console output are written in Chinese, including the test prompt and operational messages. This can violate language/locale policy when a specific language is imposed without user opt-in or documented justification.

Static analysis

No suspicious patterns detected.