Back to skill

Security audit

linux-forensics-automation

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate forensic purpose, but it encourages collecting very sensitive system data and sending it to Google Drive or email with limited safeguards.

Use this only for authorized incident response or audit work. Before installing or using it, require local review of the referenced scripts, restrict OAuth scopes and token storage, confirm Drive folder permissions, avoid public or broadly shared links, and redact or encrypt reports before uploading or emailing them.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:54
Finding

Overbroad Collection and External Upload of Sensitive Host Forensic Data

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:54-62, 85-101
Vulnerability Type: Excessive collection of privileged system information followed by external archival
Risk Level: Medium

Vulnerable Documentation Snippet

markdown
Each forensic report includes:

- **System Info**: Kernel version, hostname, OS details
- **Users & Groups**: All user accounts, sudoers configuration
- **Network**: IP addresses, routes, listening ports, connections
- **Packages**: Installed software (apt/rpm)
- **Processes**: Full process listing with arguments
- **System Logs**: dmesg, auth logs, system events
- **Cron Jobs**: Scheduled tasks across all users
- **File Integrity**: Recently modified files (last 7 days)
- **Disk Usage**: Storage breakdown
markdown
### `forensics_and_upload.sh`

Orchestration script: Generate report + Upload to Drive in one command.

```bash
bash forensics_and_upload.sh

# One-step forensic collection and archival
# Includes 2-second rate limit delay to avoid Google API throttling

What it does:

  • Runs linux_forensics.sh automatically
  • Gets most recent report
  • Waits 2 seconds (rate limiting)
  • Uploads to Google Drive
  • Returns Drive link
text

### Technical Analysis

The documented workflow aggregates a broad set of security-sensitive host information into a single report and then uploads it to an external Google Drive account. Particularly sensitive categories include:

- Sudoers configuration and account details.
- Full process arguments, which can contain command-line passwords, API tokens, access keys, or internal service addresses.
- Authentication and system logs.
- Cron jobs belonging to all users.
- Network connections, listening services, and routing information.
- Recently modified file paths.

This crosses the local system trust boundary and creates a concentrated repository of information useful for host reconnaissance 
...[truncated 1970 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit confirmation that the operator is authorized to collect data from the target host.
  2. Make each data category opt-in rather than collecting all categories by default.
  3. Redact credentials, tokens, authorization headers, private keys, and known secret patterns from process arguments and logs.
  4. Avoid collecting complete command lines when executable names and process identifiers are sufficient.
  5. Default to local, encrypted output and require a separate confirmation before any external upload.
  6. Encrypt reports before uploading and manage encryption keys separately from the Google account.
  7. Use narrowly scoped OAuth permissions and a dedicated destination account or folder.
  8. Validate destination ownership and access controls before transmission.
  9. Record an audit event containing the operator, host, selected data categories, destination, and upload result.
  10. Add retention and secure-deletion policies for both local and remotely stored reports.
  11. Include the referenced scripts in the reviewable package so their privilege handling, redaction, file permissions, and upload behavior can be audited.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:103
Finding

Potential Exposure of Forensic Reports Through Shareable Drive Links

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:103-117, 260-265
Vulnerability Type: Insecure external sharing of plaintext forensic reports
Risk Level: Medium

Vulnerable Documentation Snippet

markdown
### `upload_to_drive.py`

Upload any file to Google Drive using authenticated session.

```bash
python3 upload_to_drive.py <file_path> [folder_id]

# Examples
python3 upload_to_drive.py /tmp/report.txt
python3 upload_to_drive.py /tmp/report.txt "1a2b3c4d5e6f7890"  # Optional: upload to specific folder

Returns:

  • File name on Drive
  • File ID (for API access)
  • Shareable link
text

```markdown
## Security Considerations

1. **OAuth tokens** stored in `~/.gmail_tokens.json` — keep secure (600 permissions)
2. **Refresh tokens** enable long-term automation without re-auth
3. **Scripts run read-only** — no system modification
4. **Drive links** are shareable — consider folder permissions

Technical Analysis

The skill explicitly advertises returning a shareable link for an uploaded forensic report, while access control is addressed only through the advisory phrase “consider folder permissions.” It does not require private-by-default permissions, validate inherited folder access, constrain recipients, set link expiration, or verify that anonymous or domain-wide access is disabled.

Forensic reports contain system configuration, accounts, process arguments, logs, network information, and filesystem metadata. A broadly accessible link therefore has materially greater consequences than sharing an ordinary document.

A “shareable link” is not necessarily public by itself, and the implementation of upload_to_drive.py is absent. It is therefore not possible to verify whether the script creates public permissions. The confirmed weakness is that the documented workflow relies on unspecified Drive permissions and lacks mandatory access-control safeguards for highly sensitive ...[truncated 1253 chars]

Remediation
View remediation

Remediation Suggestions

  1. Keep every uploaded report private by default.
  2. Do not create “anyone with the link” permissions.
  3. Require an explicit allowlist of user or group identities before sharing.
  4. Validate both direct file permissions and inherited destination-folder permissions.
  5. Reject uploads to folders with public, domain-wide, or otherwise excessive access.
  6. Return a restricted authenticated URL rather than creating broader sharing permissions.
  7. Add optional link expiration and automatic permission revocation after incident closure.
  8. Encrypt reports before upload so Drive permissions are not the sole confidentiality control.
  9. Avoid placing report links or file identifiers in publicly accessible logs and tickets.
  10. Periodically audit report permissions and automatically delete reports after the approved retention period.
  11. Document the precise OAuth scopes and use the narrowest scope compatible with uploading to the designated folder.
  12. Include upload_to_drive.py in the package so permission creation, MIME handling, and error behavior can be independently reviewed.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill prominently advertises automated collection and external sharing of forensic data to Google Drive or via email, but it does not clearly warn that the generated reports can contain highly sensitive host, user, process, network, and log data. This creates a real risk of unintentional data exfiltration because users may invoke the automation without understanding that sensitive evidence is being transmitted off-host.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

The documented OAuth setup saves tokens to ~/.gmail_tokens.json for later reuse, which establishes persistent authenticated access to Google Drive/Gmail from the host. While common for automation, persistent tokens create a real security concern: if the host or home directory is compromised, an attacker may reuse the tokens to access or exfiltrate data through the linked cloud account.

Content

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

Google Drive API setup required once:

bash
# 1. Create GCP project and enable Google Drive API
# 2. Create OAuth 2.0 Desktop App credentials (JSON)
# 3. Run one-time setup
python3 setup_gmail.py

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The one-command workflow combines evidence collection and Google Drive upload in a single step without an explicit warning that the resulting forensic report leaves the host. In a forensic context, this is particularly dangerous because it encourages rapid exfiltration of potentially privileged logs, user data, process arguments, and network state to an external cloud service with minimal operator awareness.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The email workflow instructs users to send forensic report material via email without a warning about the sensitivity of forensic contents or the risks of transmitting them through email systems. Email increases exposure through mailbox retention, forwarding, misaddressing, and weaker handling controls, making accidental disclosure of incident data more likely.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

The one-time API setup and downloaded OAuth desktop credentials imply long-lived authenticated capability for Drive/Gmail operations, enabling durable access beyond a single session. In combination with automated forensic upload, this persistence increases the blast radius if credentials or tokens are mishandled or stolen.

Content

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

1. Google Drive API Setup (One-time)

bash
# Create GCP project and enable APIs:
# - Google Drive API
# - Gmail API (for email integration)

Static analysis

No suspicious patterns detected.