Back to skill

Security audit

maven-central-publish

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Maven Central publishing guide, but it directs users to persist publishing tokens and a GPG passphrase in plaintext without adequate safety guidance.

Review before installing. The publishing workflow itself is normal, but do not store real Central Portal tokens or GPG passphrases in plaintext templates or commit them. Use Maven credential encryption, CI secret injection, restrictive file permissions, and a protected signing setup before following the release steps.

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

Error
Location
templates/settings.xml:15
Finding
Plaintext Storage of Maven Central Credentials and GPG Passphrase<![CDATA[ ## Vulnerability Details **File Location**: `templates/settings.xml:15-22, 27-34`; also documented in `SKILL.md:55-74` **Vulnerability Type**: Plaintext sensitive credential storage **Risk Level**: High ### Vulnerable Code `templates/settings.xml:15-22`: ```xml <servers> <!-- Central Portal Credentials --> <!-- Get these from https://central.sonatype.com/account --> <server> <id>central</id> <username>REPLACE_WITH_USER_TOKEN_NAME</username> <password>REPLACE_WITH_USER_TOKEN_PASS</password> </server> </servers> ``` `templates/settings.xml:27-34`: ```xml <profile> <id>release</id> <activation> <activeByDefault>false</activeByDefault> </activation> <properties> <gpg.executable>gpg</gpg.executable> <gpg.passphrase>REPLACE_WITH_PASSPHRASE</gpg.passphrase> </properties> ``` The same workflow is presented in `SKILL.md:55-74`: ```xml <settings> <servers> <server> <id>central</id> <username>USER_TOKEN_USERNAME</username> <password>USER_TOKEN_PASSWORD</password> </server> </servers> <profiles> <profile> <id>release</id> <activation> <activeByDefault>false</activeByDefault> </activation> <properties> <gpg.executable>gpg</gpg.executable> <gpg.passphrase>YOUR_GPG_PASSPHRASE</gpg.passphrase> </properties> </profile> </profiles> </settings> ``` ### Technical Analysis The supplied template and documentation instruct users to replace placeholders with a real Maven Central Portal token username, token password, and GPG private-key passphrase in Maven's `settings.xml`. Maven settings files are ordinary XML files, so these values remain readable plaintext unless Maven credential encryption or another secret-management mechanism is used. The project does not instruct users to encrypt the server password, inject secrets temporarily from a secure CI secret provider, restrict ...[truncated 2051 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Encrypt Maven server credentials** - Use Maven's supported password-encryption mechanism and store the master password in `~/.m2/settings-security.xml`. - Replace the plaintext server password in `settings.xml` with the encrypted value. - Protect both files with owner-only permissions. 2. **Use secure CI secret injection** - Store publication tokens and signing passphrases in the CI platform's encrypted secret store. - Generate a temporary Maven settings file only for the release job. - Delete the temporary file in an unconditional cleanup step after publication. - Disable command tracing and ensure secrets are masked in build logs. 3. **Avoid persistent GPG passphrases** - Supply the passphrase only at release time through a protected secret mechanism. - Prefer a hardware-backed signing key, isolated signing service, or dedicated ephemeral release environment where practical. - Do not place the signing passphrase in project-level Maven configuration. 4. **Apply restrictive permissions** - Require `chmod 600 ~/.m2/settings.xml ~/.m2/settings-security.xml`. - Ensure the GPG home directory and private-key material are accessible only to the release account. 5. **Prevent accidental disclosure** - Add explicit warnings that real settings files must never be committed, uploaded as build artifacts, or included in unencrypted backups. - Add relevant settings and generated secret files to `.gitignore`. - Use secret scanning in source control and CI. 6. **Limit credential privileges and lifetime** - Use a dedicated publication token with the minimum available scope. - Rotate tokens and signing credentials periodically and immediately after suspected exposure. - Keep `autoPublish` disabled unless automated publication is strictly required and protected by release approvals. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Hidden Instructions

High
Category
Prompt Injection
Content
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
  <mirrors>
    <!-- Optional: Aliyun Mirror for faster downloads in China -->
    <mirror>
      <id>aliyunmaven</id>
      <mirrorOf>central</mirrorOf>
Confidence
70% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Session Persistence

Medium
Category
Rogue Agent
Content
gpg --gen-key

# 2. Configure Loopback (Prevent UI prompts)
mkdir -p ~/.gnupg
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
gpg-connect-agent reloadagent /bye
Confidence
60% confidence
Finding
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.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs users to place the Central Portal token username/password and the GPG passphrase directly into ~/.m2/settings.xml in plaintext, without warning about secret exposure or safer alternatives. This increases the risk of credential theft from disk, backups, shared home directories, CI logs, or accidental check-in, and the GPG passphrase can enable unauthorized artifact signing if the key is also accessible.

Static analysis

No suspicious patterns detected.