Back to skill

Security audit

Google Drive to Nextcloud Migration (experimental)

Security checks for vulnerabilities and agentic risk

Overview

The scanners rate this Google Drive to Nextcloud migration skill suspicious because its instructions run a script from a predictable shared /tmp path with Nextcloud account privileges, creating a risk that the script could be substituted.

The verdict is suspicious (the Review bucket), not a claim of malicious intent. Before installing, consider whether you can verify that any script run with the Nextcloud account is staged in a protected location and cannot be replaced by another local user. Skillspector scanned all three listed components, but marked its analysis partial because some referenced paths were missing; the evidence does not establish that the skill is safe.

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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (13)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
Phase 2 — server-side fixes, INSIDE `data/USER/files`, as the Nextcloud system user (YunoHost: `nextcloud`, bare Debian: `www-data`; `yunohost app shell nextcloud` gives that shell):

    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh'")            # dry-run
    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --apply'")
    terminal(command="ssh -t user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --interactive'")

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
Phase 2 — server-side fixes, INSIDE `data/USER/files`, as the Nextcloud system user (YunoHost: `nextcloud`, bare Debian: `www-data`; `yunohost app shell nextcloud` gives that shell):

    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh'")            # dry-run
    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --apply'")
    terminal(command="ssh -t user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --interactive'")

Phase 3 — rescan as the Nextcloud user:

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh'")            # dry-run
    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --apply'")
    terminal(command="ssh -t user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --interactive'")

Phase 3 — rescan as the Nextcloud user:

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% 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 · SKILL.md (reported line 43)May include surrounding context.

md
- Full-auto: `migrate_gdrive.sh SRC DST LOG_DIR`, then `fix_nextcloud_files.sh --apply [--auto-office]`, then occ scan. Review the error report afterwards.
- Granular: run phases separately; copy folder-by-folder via SRC/DST subpaths; preview with `--dry-run` (nothing transferred); cap bandwidth with `--bwlimit 5M` (or timetable `"08:00,512k 23:00,off"`) and volume with `--max-transfer 10G`; re-triage an existing log with `--report-only LOG_DIR`; fix script dry-run → review plan → `--apply`.
- Didactic / interactive: `fix_nextcloud_files.sh --interactive` (needs a terminal; over SSH use `ssh -t`). Per file: `y` do it, `n` skip, `a` all remaining suggestions, `q` quit. Unknown MIME types: the `file` description is shown and the user types an extension by hand (empty = skip). As the agent in this mode: explain each command before running it, show the dry-run plan, and wait for the user's explicit go before each destructive phase — never chain phases without confirmation.

## How to Run

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

Running as the Nextcloud service account is appropriate, but executing a script from the predictable shared path /tmp/fix_nextcloud_files.sh creates a script-substitution risk. A local attacker who pre-creates a writable file there, or otherwise retains control over it, could modify the uploaded script and gain execution as the Nextcloud account; dry-run mode does not protect against substituted code.

Content

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

md
Phase 2 — server-side fixes, INSIDE `data/USER/files`, as the Nextcloud system user (YunoHost: `nextcloud`, bare Debian: `www-data`; `yunohost app shell nextcloud` gives that shell):

    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh'")            # dry-run
    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --apply'")
    terminal(command="ssh -t user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --interactive'")

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

This command executes the migration script as the Nextcloud account from a predictable shared /tmp pathname without establishing trusted ownership or integrity. If a local attacker controls that file, substitution can expose or destroy data accessible to the service account, independently of the legitimate --apply behavior.

Content

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

md
Phase 2 — server-side fixes, INSIDE `data/USER/files`, as the Nextcloud system user (YunoHost: `nextcloud`, bare Debian: `www-data`; `yunohost app shell nextcloud` gives that shell):

    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh'")            # dry-run
    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --apply'")
    terminal(command="ssh -t user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --interactive'")

Phase 3 — rescan as the Nextcloud user:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

The interactive command still executes a script from the predictable shared /tmp location as the Nextcloud service account. A substituted script can run attacker-controlled commands before presenting any confirmation, so the interactive safeguards do not address this execution-path risk.

Content

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

md
terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh'")            # dry-run
    terminal(command="ssh user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --apply'")
    terminal(command="ssh -t user@host 'cd /home/yunohost.app/nextcloud/data/USER/files && sudo -u nextcloud bash /tmp/fix_nextcloud_files.sh --interactive'")

Phase 3 — rescan as the Nextcloud user:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
Phase 3 — rescan as the Nextcloud user:

    YunoHost: yunohost app shell nextcloud  →  php occ files:scan --all
    Bare:     sudo -u www-data php /var/www/nextcloud/occ files:scan --all

## Procedure

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
eport (`--report-only LOG_DIR` re-parses without copying).
- On metered links (tethering/4G), always `--bwlimit` and/or `--max-transfer` — a full Drive copy can be hundreds of GB. `--dry-run` first.
- Never run the fix script on the whole datadirectory (appdata, versions, uploads) — only `USER/files`. It refuses `/` and `$HOME` and warns outside a `*/files` path.
- Run as the Nextcloud user, not root: new files must be owned by it. As root the script chowns new files to the data-dir owner, but `sudo -u nextcloud` / `sudo -u www-data` is the correct path.
- `--interactive` refuses to run without a terminal (use `ssh -t`). In interactive mode, `a` applies all remaining suggestions INCLUDING office types; unknown types with no typed extension still land in the manual list.
- Multi-image HEIC (bursts, Live Photos): `heif-convert` can emit extra `NAME-1.jpg`, `NAME-2.jpg`… siblings — keep them.
- Disk-level renames are invisible to Nextcloud until `occ files:scan`; skipping phase 3 looks li

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
LOG_DIR` re-parses without copying).
- On metered links (tethering/4G), always `--bwlimit` and/or `--max-transfer` — a full Drive copy can be hundreds of GB. `--dry-run` first.
- Never run the fix script on the whole datadirectory (appdata, versions, uploads) — only `USER/files`. It refuses `/` and `$HOME` and warns outside a `*/files` path.
- Run as the Nextcloud user, not root: new files must be owned by it. As root the script chowns new files to the data-dir owner, but `sudo -u nextcloud` / `sudo -u www-data` is the correct path.
- `--interactive` refuses to run without a terminal (use `ssh -t`). In interactive mode, `a` applies all remaining suggestions INCLUDING office types; unknown types with no typed extension still land in the manual list.
- Multi-image HEIC (bursts, Live Photos): `heif-convert` can emit extra `NAME-1.jpg`, `NAME-2.jpg`… siblings — keep them.
- Disk-level renames are invisible to Nextcloud until `occ files:scan`; skipping phase 3 looks like "files disappeared"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/fix_nextcloud_files.sh (reported line 41)May include surrounding context.

sh
DIR_OWNER=""
if [ "$(id -u)" -eq 0 ]; then
  DIR_OWNER=$(stat -c '%u:%g' .)
  echo "WARNING: running as root; new files chowned to $DIR_OWNER (dir owner). Prefer sudo -u <nextcloud-user>." >&2
fi
own() { if [ -n "$DIR_OWNER" ]; then chown "$DIR_OWNER" "$1"; fi; }

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/fix_nextcloud_files.sh (reported line 193)May include surrounding context.

sh
echo
  echo "NEXT: rescan as the Nextcloud user:"
  echo "  YunoHost: yunohost app shell nextcloud  ->  php occ files:scan --all"
  echo "  bare:     sudo -u www-data php /path/to/nextcloud/occ files:scan --all"
fi
[ "${#failures[@]}" -eq 0 ]

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
- GitHub: push the folder to a repo, then `hermes skills install <owner>/<repo>/<path-to>/gdrive-nextcloud-migration`.
- Direct URL: host `SKILL.md` with its `scripts/` subtree on any web server, then `hermes skills install https://host/path/SKILL.md` — referenced `scripts/` files are fetched and security-scanned automatically.
- Without Hermes: run the two bash scripts directly as documented in How to Run.
- Scan note: Skills Guard rates this skill CAUTION — `privilege_escalation` findings on the `sudo -u` / chown / occ guidance, which are standard Nextcloud administration requirements (files must belong to the Nextcloud user; the skill explicitly discourages running as root). Community installs are blocked by default: review the findings, then install with `hermes skills install <identifier> --force`.