Back to skill

Security audit

amphp

Security checks for vulnerabilities and agentic risk

Overview

This AMPHP coding skill is coherent and not malicious, but it includes copyable examples that can teach unsafe file upload and credential-handling patterns.

Review this skill before installing if you expect it to generate production PHP. The main risk is not hidden malware; it is that some examples may lead an agent to generate insecure code unless you explicitly require sanitized upload filenames, environment-based secrets, localhost-only development binds, safe logging, and confirmation before destructive filesystem or database examples are run.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
references/class-examples.md:691
Finding

Untrusted Upload Filenames Allow Path Traversal and Arbitrary File Writes

Content
View full analysis
getValue('username'); $file = $form->getFile('avatar'); if ($file !== null) { \Amp\File\write('/uploads/' . $file->getFilename(), $file->getContents()); } return new Response(HttpStatus::OK, [], "Hello, $username"); } } ``` ```php class StreamingUploadHandler implements RequestHandler { public function handleRequest(Request $request): Response { $parser = new StreamingFormParser(); $parser->parseForm($request, function (mixed $field) { if ($field instanceof FileField) { $dest = File\openFile('/uploads/' . $field->getFilename(), 'w'); ByteStream\pipe($field->getStream(), $dest); } }); return new Response(HttpStatus::OK, [], 'Uploaded'); } } ``` ### Technical Analysis Both examples use the client-supplied multipart filename directly when constructing a destination path. Multipart filenames are attacker-controlled and may contain traversal sequences such as `../`, platform-specific separators, absolute path components, or names of existing files. Concatenating such a filename with `/uploads/` does not guarantee that the resulting normalized path remains inside the intended upload directory. Opening the destination with write mode may also truncate an existing file. The examples do not: - Remove directory components from the supplied filename. - Generate a server-controlled filename. - Resolve and validate the canonical destination path. ...[truncated 1683 chars]
Remediation
View remediation
getStream(), $dest); ``` The implementation should additionally verify that `$uploadRoot` is the intended canonical directory and that `validatedExtension()` uses a strict application-specific allowlist. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
examples/database.md:13
Finding

Hardcoded Credential Patterns Encourage Secrets to Be Embedded in Generated Source Code

Content
View full analysis
getHeader('Authorization') === 'Bearer secret'; } ``` ```php $tunnelConnector = new Http1TunnelConnector( proxyAddress: '127.0.0.1:3128', proxyHeaders: [ 'Proxy-Authorization' => 'Basic ' . base64_encode('user:secret'), ], ); ``` ### Technical Analysis The identified values appear to be illustrative placeholders, not verified live credentials. However, the Skill presents these patterns as copyable implementation examples. This can cause generated applications to embed real database passwords, Redis passwords, proxy credentials, or bearer tokens directly in source files. Base64 encoding a Basic authentication value does not protect it; it is a reversible transport encoding. A hardcoded bearer token also creates a shared static credential and may encourage deployment with a predictable example value. Source-embedded credentials can be exposed through: - Version-control history. - Source archives and backups. - Generated responses or debugging output. - Error reports and stack traces. - Code review systems and CI arti ...[truncated 1719 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (26)

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · README.md (reported line 3)May include surrounding context.

md
# 🔥 AMPHP v3 Skill for AI Coding Assistants

> Teach AI agents to write **correct non-blocking async PHP using AMPHP v3**

[![Claude Code](https://img.shields.io/badge/Claude-Code-blue)]()
[![Cursor](https://img.shields.io/badge/Cursor-Compatible-purple)]()

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
85% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · README.md (reported line 102)May include surrounding context.

2️⃣ Claude Code (per project)

bash
mkdir -p .claude/skills
git clone https://github.com/opencck/skill-amphp .claude/skills/amphp

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · README.md (reported line 126)May include surrounding context.

Place the skill file manually:

text
skills/amphp/SKILL.md

Example:

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README states the skill activates automatically when broad tokens such as 'Amp\Future', 'Amp\async', 'Amp\delay', 'Revolt\EventLoop', or 'amphp/*' are detected, plus vague 'async server patterns'. Overbroad trigger conditions can cause the skill to load in unintended contexts, influencing agent behavior when merely discussing, auditing, or comparing these technologies rather than requesting the skill's guidance.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · README.md (reported line 232)May include surrounding context.

Good prompt:

text
Write async AMPHP v3 code for this API client

Bad prompt:

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The Russian section says the skill 'activates automatically' without restating any trigger constraints, which reinforces an unconditional or overly broad activation model. In multilingual documentation, inconsistent trigger descriptions can cause implementers or agents to apply the skill more broadly than intended, increasing prompt-routing and instruction-contamination risk.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
80% 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 · docs/namespaces.md (reported line 107)May include surrounding context.

// File\getSize(string $path): int // File\deleteFile(string $path): void // File\deleteDirectory(string $path): void // File\createDirectoryRecursively(string $path, int $mode = 0777): void // File\listFiles(string $path): string[] — FILENAMES ONLY, not full paths! // File\openFile(string $path, string $mode): File\File — streaming I/O

text

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The natural-language prompts are written as direct instructions in Russian, e.g. "Напиши...", which imposes a specific language/locale on the generated output. The file does not offer any user opt-in or language choice, and there is no documented region-specific reason for this constraint.

Content

No source excerpt is available for this finding.

Unbounded Output

Medium
Category
Output Handling
Confidence
75% confidence
Finding

Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Content

Scanner excerpt · examples/cache.md (reported line 12)May include surrounding context.

md
use Amp\Cache\LocalCache;

// Default constructor: no size limit, no TTL
$cache = new LocalCache();

// Optional: $sizeLimit caps the number of entries (LRU eviction)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation embeds plaintext credentials directly in MySQL connection strings, including realistic hostnames and passwords, without warning against hardcoding secrets. This can normalize insecure secret handling, lead users to copy the pattern into production code, and increase the risk of credential leakage through source control, logs, or screenshots.

Content

No source excerpt is available for this finding.

Behavior Manipulation

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Subtle instructions detected that may alter agent decision-making or introduce hidden biases.

Content

Scanner excerpt · examples/database.md (reported line 102)May include surrounding context.

md
use function Amp\Redis\createRedisClient;

// createRedisClient() is a FACTORY FUNCTION — not a constructor!
// Always use it instead of new RedisClient(...)
$redis = createRedisClient(RedisConfig::fromUri('redis://127.0.0.1:6379'));

// With password:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The Redis example includes a password-bearing URI inline, which exposes the secret in code and encourages insecure credential handling patterns. If copied into real applications, the password may be committed to repositories, leaked in logs, or exposed through process inspection and debugging output.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · examples/http-client.md (reported line 18)May include surrounding context.

md
$client = HttpClientBuilder::buildDefault();

// GET
$response = $client->request(new HttpRequest('https://api.example.com/data'));
$body     = $response->getBody()->buffer(); // MUST buffer or fully iterate!
echo $response->getStatus(); // 200

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · examples/http-client.md (reported line 23)May include surrounding context.

md
$client = HttpClientBuilder::buildDefault();

// GET
$response = $client->request(new HttpRequest('https://api.example.com/data'));
$body     = $response->getBody()->buffer(); // MUST buffer or fully iterate!
echo $response->getStatus(); // 200

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/class-examples.md (reported line 570)May include surrounding context.

md
$client = HttpClientBuilder::buildDefault();

// GET
$response = $client->request(new HttpRequest('https://api.example.com/data'));
$body     = $response->getBody()->buffer(); // MUST buffer or fully iterate!
echo $response->getStatus(); // 200

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The proxy example includes an explicit Proxy-Authorization header built from a username and secret and demonstrates transmitting credentials to a proxy without any warning about secret handling, logging exposure, or safe credential sourcing. In documentation, hardcoded credential patterns are risky because readers may copy them into production code, leak them to source control, or normalize unsafe handling of sensitive values.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The example binds the HTTP server to 0.0.0.0:8080, which exposes it on all network interfaces. In documentation, this is risky because users often copy-paste examples into development or even production-like environments without realizing the service will be reachable from other hosts, increasing the chance of unintended exposure of test endpoints or incomplete auth controls.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · examples/websocket.md (reported line 184)May include surrounding context.

md
- `WebsocketClientHandler`, `Websocket`, `AllowOriginAcceptor` → `Amp\Websocket\Server\*`
- Push-only handlers **must** drain incoming messages to prevent deadlock
- After the receive loop exits, call `$sender->ignore()` to suppress abandoned-fiber errors
- `addClient()` in `WebsocketClientGateway` automatically removes clients on disconnect

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/class-examples.md (reported line 1588)May include surrounding context.

md
- `WebsocketClientHandler`, `Websocket`, `AllowOriginAcceptor` → `Amp\Websocket\Server\*`
- Push-only handlers **must** drain incoming messages to prevent deadlock
- After the receive loop exits, call `$sender->ignore()` to suppress abandoned-fiber errors
- `addClient()` in `WebsocketClientGateway` automatically removes clients on disconnect

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

This markdown file documents transactional INSERT operations and later shows Redis delete operations, but it does not include any warning that running these examples will create, modify, or remove live data. For markdown files, the rule asks for warnings when described behavior can affect user data or system integrity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This markdown file demonstrates multiple filesystem-modifying operations such as writing files, truncating files, and deleting files/directories, but it does not include any warning that the examples change local filesystem state. Under the markdown-file criteria, descriptions that affect user data or system integrity should disclose that behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The deleteDirectory section demonstrates removal of files and directories, including deleting contents before deleting the directory, but the surrounding prose does not warn users that these operations are destructive. For markdown documentation, destructive behaviors should be clearly disclosed so users do not run examples against important paths unintentionally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The example logs the full request URI, which may include sensitive query parameters or identifiers depending on deployment. The markdown does not mention this privacy consideration or advise sanitizing logged request data.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.