Back to skill

Security audit

Log Analyzer

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward local log-analysis helper with disclosed file reading and optional user-directed JSON output, though users should treat logs and regex patterns carefully.

Install only if you are comfortable letting the agent analyze log files you choose. Avoid pointing it at sensitive logs unless you intend their contents to be summarized or printed, choose output paths deliberately, and use trusted/simple regex patterns because complex patterns could make analysis hang on large or crafted logs.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/analyze.py:85
Finding

Regular Expression Denial of Service Through an Unrestricted User-Supplied Pattern

Content
View full analysis

Vulnerability Details

File Location: scripts/analyze.py, lines 85–87 and line 120
Vulnerability Type: Regular Expression Denial of Service (ReDoS)
Risk Level: Medium

Vulnerable Code

python
# Pattern matching
if options.pattern:
    if re.search(options.pattern, line):
        stats['patterns'][options.pattern] += 1

The pattern originates from an unrestricted command-line argument:

python
parser.add_argument('--pattern', help='Search for regex pattern')

Technical Analysis

The analyzer accepts an arbitrary Python regular expression through --pattern and passes it directly to re.search(). It evaluates that expression against every complete line in the selected log file.

Python's standard re engine uses a backtracking implementation and does not provide an execution timeout for this call. Patterns containing nested or ambiguous quantifiers can therefore exhibit catastrophic backtracking on specially structured input. The implementation does not restrict pattern complexity, limit input-line length, precompile and validate the expression, or isolate matching with an enforceable resource limit.

For example, an expression structurally similar to ^(a+)+$ can require excessive CPU time when evaluated against a long sequence of a characters followed by a nonmatching character.

Attack Path

  1. An attacker supplies or influences the value passed to --pattern, or persuades an operator or automated process to use a pathological expression.
  2. The selected log file contains a sufficiently long matching or near-matching line. The attacker may be able to inject such content into application or access logs.
  3. analyze_file() reads the crafted line and invokes re.search(options.pattern, line).
  4. The regex engine enters excessive backtracking.
  5. The analyzer consumes substantial CPU or becomes unresponsive. Because matching occurs inside the per-line loop, multiple crafted lines can amplify the resource consumpti ...[truncated 464 chars]
Remediation
View remediation

Remediation Suggestions

  1. Prefer literal substring matching by default and require an explicit option to enable regular expressions.
  2. If regex support is necessary, use an engine or execution mechanism that supports enforceable matching timeouts.
  3. Reject oversized patterns and impose a maximum length on each input line before regex evaluation.
  4. Validate or disallow constructs associated with catastrophic backtracking, while recognizing that validation alone is not a complete defense.
  5. Compile the pattern once before processing the file, catch re.error separately, and fail with a clear validation message:
python
try:
    compiled_pattern = re.compile(options.pattern) if options.pattern else None
except re.error as exc:
    print(f"Invalid regular expression: {exc}", file=sys.stderr)
    return None
  1. Execute untrusted analysis jobs with CPU and wall-clock limits and under a low-privilege account.
  2. Document that regex patterns must be trusted unless robust timeout and resource controls are implemented.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (3)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises commands that read log files and write JSON output, but the manifest does not declare any explicit tool scope or permissions boundaries. That creates ambiguity about what files may be accessed or written, increasing the risk of overbroad file access or unsafe use by an agent in environments where logs may contain sensitive data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest describes a log-analysis skill for extracting insights, errors, and patterns from log files. While reading logs and printing summaries fits that purpose, accepting an --output path and writing JSON results to disk adds a file-modification capability not implied by a purely analytical description.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest description says to use the skill whenever a user needs to debug application errors, find patterns in server logs, analyze access logs, extract metrics, or create log summaries. This is fairly broad and does not define clear activation boundaries or exclusions, which could cause the skill to be selected for loosely related troubleshooting requests.

Content

No source excerpt is available for this finding.