Back to skill

Security audit

Git Sync Daemon

Security checks for vulnerabilities and agentic risk

Overview

This skill is an auto-sync daemon, but its Linux service installer can create a persistent root-running service from a user-writable script path.

Review carefully before installing on Linux. Avoid the sudo systemd installer unless it is changed to run under a dedicated unprivileged user, validate the unit name, and copy scripts to a protected root-owned location. The macOS launchd path and manual run-once mode are more consistent with the stated purpose, but any auto-commit/push daemon should only be used on repositories you intentionally trust for unattended synchronization.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/git_sync_ctl.sh:249
Finding

Persistent systemd service runs a user-modifiable script as root

Content
View full analysis
&2 exit 1 fi local unit_path unit_path="/etc/systemd/system/${SYSTEMD_UNIT}" cat > "$unit_path" <
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (23)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The unit filename comes from the environment variable GIT_SYNC_SYSTEMD_UNIT and is interpolated directly into an absolute path for rm -f. Because the script runs as root for systemd uninstall, an attacker or mistaken caller can supply path traversal such as '../../../etc/shadow' and cause deletion of arbitrary root-owned files outside /etc/systemd/system.

Content

Scanner excerpt · scripts/git_sync_ctl.sh (reported line 300)May include surrounding context.

sh
fi

  systemctl disable --now "$SYSTEMD_UNIT" >/dev/null 2>&1 || true
  rm -f "/etc/systemd/system/${SYSTEMD_UNIT}"
  systemctl daemon-reload
  echo "systemd removed: $SYSTEMD_UNIT"
}

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 59)May include surrounding context.

bash scripts/git_sync_ctl.sh init bash scripts/git_sync_ctl.sh add-repo /path/to/repo bash scripts/git_sync_ctl.sh run-once sudo bash scripts/git_sync_ctl.sh install-systemd bash scripts/git_sync_ctl.sh status

text

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 74)May include surrounding context.

md
Service lifecycle:
- macOS install: `bash scripts/git_sync_ctl.sh install-launchd`
- macOS uninstall: `bash scripts/git_sync_ctl.sh uninstall-launchd`
- Linux install: `sudo bash scripts/git_sync_ctl.sh install-systemd`
- Linux uninstall: `sudo bash scripts/git_sync_ctl.sh uninstall-systemd`

## Production hardening checklist

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 75)May include surrounding context.

md
Service lifecycle:
- macOS install: `bash scripts/git_sync_ctl.sh install-launchd`
- macOS uninstall: `bash scripts/git_sync_ctl.sh uninstall-launchd`
- Linux install: `sudo bash scripts/git_sync_ctl.sh install-systemd`
- Linux uninstall: `sudo bash scripts/git_sync_ctl.sh uninstall-systemd`

## Production hardening checklist

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 13)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 190)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 192)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 227)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 230)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 231)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 245)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 246)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 13)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 192)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 193)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/git_sync_ctl.sh (reported line 224)May include surrounding context.

sh
INTERVAL="${GIT_SYNC_INTERVAL:-60}"
TIMEOUT_SECS="${GIT_SYNC_GIT_TIMEOUT:-45}"
LABEL="${GIT_SYNC_LAUNCHD_LABEL:-com.samwei12.git-sync-daemon}"
PLIST_PATH="${GIT_SYNC_LAUNCHD_PLIST:-$HOME/Library/LaunchAgents/${LABEL}.plist}"
SYSTEMD_UNIT="${GIT_SYNC_SYSTEMD_UNIT:-git-sync-daemon.service}"

trim() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 47)May include surrounding context.

sh
list-repos
  run-once
  status
  install-launchd
  uninstall-launchd
  install-systemd
  uninstall-systemd

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 48)May include surrounding context.

sh
run-once
  status
  install-launchd
  uninstall-launchd
  install-systemd
  uninstall-systemd
EOF

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 234)May include surrounding context.

sh
run-once
  status
  install-launchd
  uninstall-launchd
  install-systemd
  uninstall-systemd
EOF

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 49)May include surrounding context.

sh
status
  install-launchd
  uninstall-launchd
  install-systemd
  uninstall-systemd
EOF
}

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 232)May include surrounding context.

sh
uid="$(id -u)"
  launchctl bootout "gui/${uid}" "$PLIST_PATH" >/dev/null 2>&1 || true
  launchctl bootstrap "gui/${uid}" "$PLIST_PATH"
  launchctl enable "gui/${uid}/${LABEL}" >/dev/null 2>&1 || true
  launchctl kickstart -k "gui/${uid}/${LABEL}"
  echo "launchd installed: $LABEL"
}

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 285)May include surrounding context.

sh
EOF

  systemctl daemon-reload
  systemctl enable --now "$SYSTEMD_UNIT"
  echo "systemd installed: $SYSTEMD_UNIT"
}

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% 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 · scripts/git_sync_ctl.sh (reported line 286)May include surrounding context.

sh
systemctl daemon-reload
  systemctl enable --now "$SYSTEMD_UNIT"
  echo "systemd installed: $SYSTEMD_UNIT"
}

cmd_uninstall_systemd() {