Back to skill

Security audit

Java

Security checks for vulnerabilities and agentic risk

Overview

This Java help skill is a documentation-only package with scoped local preference memory; the main thing to understand is that it may read and update Java-related Clawic preference files.

Install this if you want Java-focused help that can remember stated preferences across sessions. Review or delete ~/Clawic/data/java/ if you do not want persistent Java preferences, and treat any heap dumps or JVM diagnostic artifacts it helps create as sensitive because they can contain secrets or personal data.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (10)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

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

md
| `list.remove(someInt)` on a `List<Integer>` | The `remove(int)` overload wins over `remove(Object)` — it removes by INDEX and can throw `IndexOutOfBoundsException` | `list.remove(Integer.valueOf(x))` |
| `SimpleDateFormat` in a static or shared field | Not thread-safe; under load it returns silently wrong dates rather than throwing | `DateTimeFormatter` — immutable and thread-safe (`datetime.md`) |
| `Collectors.toMap(k, v)` on data where a key can repeat | Throws `IllegalStateException` only for inputs that collide, so it passes tests and fails in production | Supply a merge function: `toMap(k, v, (a, b) -> b)` |
| `@Transactional` called from another method of the same class | Self-invocation bypasses the proxy: no transaction, no warning, no rollback | Move the annotated method into another bean (`spring.md`) |
| JUnit 4 annotations left in a JUnit 5 project | `org.junit.Test` classes are simply not executed by the Jupiter engine — a green build running zero tests | One engine, or add the vintage engine deliberately (`testing.md`) |
| `Files.lines()` / `Files.walk()` outside try-with-resources | Holds the file handle until GC; the failure shows up hours later as "Too many open files" | try-with-resources (Core Rule 4) |
| `printStackTrace()` in server code | Writes to stderr, detached from the request context and invisible to log aggregation | Logger with the throwable |

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · memory-template.md (reported line 13)May include surrounding context.

md
last: YYYY-MM-DD

## Context
<!-- Their stack: JDK, build tool, framework, persistence, deployment target -->
<!-- Where the code runs: container limits, CI, app server -->

## Pain Points

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · security.md (reported line 70)May include surrounding context.

md
- Scan dependencies in CI and rebuild periodically: a jar pinned for six months carries six months of published CVEs (`build.md`).
- Pin versions and prefer digests where the registry supports them; a mutable tag or a version range can be repointed after you vetted it.
- Verify the checksum or signature of anything downloaded during a build (`RUN curl | sh` in a Dockerfile has no place in a JVM build either).
- Generate an SBOM (CycloneDX plugins exist for both Maven and Gradle) so that "are we affected?" is a query, not an investigation.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guidance says to always run production with automatic heap dumps enabled, but heap dumps commonly contain highly sensitive application memory such as credentials, tokens, PII, session data, and proprietary business records. Recommending this without an explicit warning and handling requirements can lead operators to persist sensitive data to disk in production, increasing exposure through local access, backups, log shipping, or incident artifact sharing.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · security.md (reported line 33)May include surrounding context.

md
- Path traversal: `base.resolve(userInput)` returns an absolute path if the input is absolute, and `..` walks out. Validate as `Path p = base.resolve(input).normalize(); if (!p.startsWith(base)) reject;` — normalize BEFORE the check (`io.md`).
- Zip Slip: an archive entry named `../../etc/cron.d/x` writes outside the extraction directory. Apply the same containment check to every `ZipEntry.getName()`, and cap the entry count and decompressed size (a zip bomb is a denial of service).
- Temp files: `Files.createTempFile` creates with owner-only permissions atomically; `File.createTempFile` followed by a separate write in a world-writable `/tmp` is a symlink race.
- Never make an uploaded file executable, and never derive a filesystem path from a client-supplied filename — store under a generated id and keep the original name as metadata.

## Crypto Choices

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction 'Do not interview the user' combined with mandatory preference loading removes an opportunity for informed consent and forces data collection automatically. In this context, that makes the privacy issues more dangerous because the skill is designed to access and use personal local state without a user decision point.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill directs the agent to read local profile and preference files from the user's home directory without prior disclosure or consent. Accessing unrelated local files expands the skill's data reach beyond what is necessary for handling a Java question and may expose personal environment preferences or other sensitive context unexpectedly.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to persist user preferences, habits, and work patterns into files under the user's home directory even though the skill's stated purpose is Java debugging and advisory help. This creates unnecessary long-term data retention and can accumulate behavioral or environment metadata without explicit user consent, increasing privacy and misuse risk if those files are later accessed by other tools or users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The setup explicitly instructs the agent to write user preferences and behavioral history to local files without user-facing notice. Silent persistence of habits, policies, and prior corrections can create a durable profile of the user that exceeds the immediate support need and may be sensitive in shared or monitored environments.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.