Back to skill

Security audit

Infrastructure

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent infrastructure guidance skill, but users should harden the example backup scripts before using them in production.

Install only if you are comfortable reviewing infrastructure commands before running them. Treat the examples as templates: use your own cloud accounts and buckets, do not paste credentials into chat, pin Docker images, and harden the backup script with mktemp, strict permissions, quoted variables, safe cleanup traps, and cautious S3 retention logic.

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
backups.md:18
Finding

Predictable Temporary Backup File Enables Symlink Attacks and Data Exposure

Content
View full analysis
/tmp/backup_$TIMESTAMP.dump # Upload aws s3 cp /tmp/backup_$TIMESTAMP.dump $BUCKET/ # Cleanup local rm /tmp/backup_$TIMESTAMP.dump ``` ### Technical Analysis The documented backup script creates a database dump directly in the shared `/tmp` directory using a filename derived from the current timestamp. This name is predictable, and the script does not create the file atomically, verify that it is a regular file, restrict its permissions explicitly, or use a private temporary directory. Because shell redirection follows symbolic links, a local attacker who can write to `/tmp` may predict the filename and create a symbolic link at that location before the backup begins. When the shell processes the redirection, it may truncate and overwrite the symlink target with the privileges of the account running the backup job. The dump's permissions also depend on the process umask. With an overly permissive umask, other local users may be able to read the temporary database dump before it is uploaded and removed. The file can remain exposed indefinitely if `pg_dump`, the upload operation, or the script terminates unexpectedly, because no exit trap guarantees cleanup. ### Attack Path 1. The backup is configured to run at a known time, such as the documented daily 03:00 cron schedule. 2. A local low-privileged attacker predicts a filename such as `/tmp/backup_20260916_030000.dump`. 3. Before the backup starts, the attacker creates that path as a symbolic link to a file writable by the backup account. 4. The privileged shell opens the predictable path for output and follows the symbolic link. 5. The target file is truncated and receives PostgreSQL dump data, p ...[truncated 1074 chars]
Remediation
View remediation
"$BACKUP_FILE" aws s3 cp "$BACKUP_FILE" "$BUCKET/backup_$TIMESTAMP.dump" ``` The deployment should also verify that the dedicated account has only the database read privileges, bucket write permissions, and local filesystem access required for backups. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (8)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · backups.md (reported line 30)May include surrounding context.

md
aws s3 cp /tmp/backup_$TIMESTAMP.dump $BUCKET/

# Cleanup local
rm /tmp/backup_$TIMESTAMP.dump

# Cleanup old backups (keep 30 days)
aws s3 ls $BUCKET/ | while read -r line; do

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
88% confidence
Finding

The retention logic parses aws s3 ls output with awk and then deletes objects using a derived filename. This is brittle and can mis-handle unexpected object names, formatting changes, or parsing edge cases, potentially deleting the wrong backups and causing data loss or retention-policy bypass.

Content

Scanner excerpt · backups.md (reported line 39)May include surrounding context.

olderThan=$(date -d "30 days ago" +%s) if [[ $createDate -lt $olderThan ]]; then fileName=$(echo $line | awk '{print $4}') aws s3 rm $BUCKET/$fileName fi done

text

Cloud Storage Exfiltration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is uploaded to cloud storage (S3 / GCS / Azure Blob). This may be a legitimate backup or exfiltration to an external bucket. Manual review is recommended.

Content

Scanner excerpt · backups.md (reported line 27)May include surrounding context.

md
pg_dump -Fc $DATABASE_URL > /tmp/backup_$TIMESTAMP.dump

# Upload
aws s3 cp /tmp/backup_$TIMESTAMP.dump $BUCKET/

# Cleanup local
rm /tmp/backup_$TIMESTAMP.dump

Cloud Storage Exfiltration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is uploaded to cloud storage (S3 / GCS / Azure Blob). This may be a legitimate backup or exfiltration to an external bucket. Manual review is recommended.

Content

Scanner excerpt · backups.md (reported line 53)May include surrounding context.

md
pg_dump -Fc $DATABASE_URL > /tmp/backup_$TIMESTAMP.dump

# Upload
aws s3 cp /tmp/backup_$TIMESTAMP.dump $BUCKET/

# Cleanup local
rm /tmp/backup_$TIMESTAMP.dump

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.

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.

Tool Parameter Abuse

Low
Category
Tool Misuse
Confidence
15% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · backups.md (reported line 94)May include surrounding context.

Docker Volumes

bash
# Backup volume to tarball
docker run --rm -v myapp_data:/data -v $(pwd):/backup \
  alpine tar czf /backup/data_backup.tar.gz /data

# Restore

Tool Parameter Abuse

Low
Category
Tool Misuse
Confidence
15% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · backups.md (reported line 98)May include surrounding context.

Docker Volumes

bash
# Backup volume to tarball
docker run --rm -v myapp_data:/data -v $(pwd):/backup \
  alpine tar czf /backup/data_backup.tar.gz /data

# Restore

Static analysis

No suspicious patterns detected.