Back to skill

Security audit

Med Reminder

Security checks for vulnerabilities and agentic risk

Overview

This medication reminder skill needs review because setup can disable other reminders and ordinary replies can wrongly record doses as taken.

Use a corrected release before relying on this for medication reminders. Scheduler cleanup must preserve other configurations, and recording all doses should require an explicit statement that they were taken. History recovery and timing defects also need correction. Avoid running the bundled full test suite unchanged on POSIX. Reminders disclose medication details to your configured messaging service and recipients. Review used source inspection and memory-only reproductions; live schedulers and the user-created sender were not tested.

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
setup-tasks.py
Finding

Windows migration deletes other state files' active reminder tasks

Content
View full analysis

Impact

Other configurations lose their scheduled reminders until their tasks are restored. Registering those configurations again can in turn delete the first configuration's task.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (92)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% 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 · README.md (reported line 216)May include surrounding context.

md
Legacy state fields (`status`, `confirmed_dose`, `last_taken`, `next_due`) keep being written for one release, so rolling back the code doesn't lose anything.

To roll the scheduler back manually: `python3 setup-tasks.py --clear` removes the tick (and legacy jobs), or per OS — `schtasks /delete /tn "\MedReminder\tick-<hash>"` on Windows, `launchctl unload ~/Library/LaunchAgents/<label>.plist` on macOS, edit the marked block out of `crontab -e` (or `systemctl --user disable <unit>.timer`) on Linux.

---

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% 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 · dispatch.py (reported line 164)May include surrounding context.

python
(ok, stderr). A hung sender is
    killed — tree, not just the shell — at `timeout` seconds and counts
    as a failure.
    """
    if dry_run:
        print(f"\n{'-' * 56}\n[DRY RUN] Message:\n{text}\n{'-' * 56}\n")
        return True, ""
    cmd = _resolve_send_cmd()
    if not cmd:
        log.error("No message sender configured")
        return False, "no sender configured"
    kwargs = {}
    if os.name != "nt":
        kwargs["start_new_session"] = True   # own process group → killable tree
    p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                         text=True, encoding="utf-8", errors="replace",
                         **kwargs)
    try:
        _, stderr = p.communicate(input=text, timeout=timeout)
    except subprocess.TimeoutExpired:
        _kill_tree(p)
        try:
            p.communicate(timeout=5)
        except Exception:
            pass
        log.warning("Send timed out after %ss (%d

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · doctor.py (reported line 166)May include surrounding context.

python
(h, run=_run):
                ok(f"systemd tick timer enabled ({setup.systemd_unit(h)}.timer)")
            else:
                fail("systemd tick timer missing — "
                     "run: python setup-tasks.py --scheduler systemd")
        else:
            if setup.verify_cron(h, run=_run):
                ok("crontab tick block present")
            else:
                fail("crontab tick block missing — run: python setup-tasks.py")

        # legacy jobs were crontab per-dose entries on every Unix flavor
        lines = setup.read_crontab(run=_run)
        if lines is None:
            warn("crontab unreadable — check legacy entries manually")
        else:
            legacy = setup.find_legacy_cron(lines, STATE_FILE, h)
            if legacy:
                fail(f"{len(legacy)} legacy crontab line(s) present — "
                     "re-run: python setup-tasks.py")
            else:
                ok("no legacy crontab lines")


def tick_m

Windows migration deletes other state files' tick tasks despite the documented state-file isolation.

High
Category
Excessive Agency
Confidence
100% confidence
Finding

Windows migration enumerates every task in the shared MedReminder folder but preserves only the current state's tick. Registering one state therefore deletes other states' valid reminder tasks, creating a medication-reminder availability risk without requiring malicious input.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
100% confidence
Finding

The destructive command is applied to every enumerated MedReminder task except the current state's tick, including valid ticks belonging to other states. This is the same ownership-scope defect as the Windows migration finding, not shell or command-line injection, and can silently stop other medication reminders.

Content

Scanner excerpt · setup-tasks.py (reported line 433)May include surrounding context.

python
if name in keep:
            continue
        if dry_run:
            print(f"  [DRY RUN] schtasks /delete /tn {name} /f")
            continue
        r = run(["schtasks", "/delete", "/tn", name, "/f"])
        if r.returncode == 0:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

Windows clear protects other states' tasks only when their registry files are discoverable in the current script directory. A missing or unreadable registry, or another installation sharing the scheduler folder, causes unrelated reminder tasks to be deleted, potentially suppressing medication reminders.

Content

Scanner excerpt · setup-tasks.py (reported line 659)May include surrounding context.

python
if name in protected:
                    continue
                if dry_run:
                    print(f"  [DRY RUN] schtasks /delete /tn {name} /f")
                    continue
                if run(["schtasks", "/delete", "/tn", name, "/f"]).returncode == 0:
                    print(f"  Removed: {name}")

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_date_range.py (reported line 108)May include surrounding context.

python
meds=[make_med(med_id="med-001", frequency="once_daily", times=["08:00"])])),
        encoding="utf-8")

    env = dict(os.environ)
    env.update({
        "MEDS_TEST": "1",
        "MEDS_LOG_FILE": str(tmp_path / "reply.log"),

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_pr4_final.py (reported line 36)May include surrounding context.

python
meds=[make_med(med_id="med-001", frequency="once_daily", times=["08:00"])])),
        encoding="utf-8")

    env = dict(os.environ)
    env.update({
        "MEDS_TEST": "1",
        "MEDS_LOG_FILE": str(tmp_path / "reply.log"),

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_send_leases.py (reported line 115)May include surrounding context.

python
out = tmp_path / "sent.txt"
    trip_flag = tmp_path / "trip-on"

    env_vars = dict(os.environ)
    env_vars.update({
        "MEDS_TEST": "1",
        "MEDS_SEND_CMD": f'"{sys.executable}" "{REPO / "tests" / "fake_sender.py"}"',

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_passport.py (reported line 190)May include surrounding context.

python
out_file     = tmp_path / "passport.html"
    state_file.write_text(json.dumps(state))

    env = os.environ.copy()
    env["MEDS_STATE_FILE"] = str(state_file)

    script = Path(__file__).parent.parent / "generate-passport.py"

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_reply_init.py (reported line 82)May include surrounding context.

python
def test_init_cli_then_add_med(tmp_path):
    sf = tmp_path / "meds-state.json"
    env = dict(os.environ, MEDS_TEST="1", MEDS_LOG_FILE=str(tmp_path / "r.log"),
               MEDS_HISTORY_FILE=str(tmp_path / "h.jsonl"),
               MEDS_FAKE_NOW="2026-04-21T09:00:00-07:00")

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · tests/test_scheduler_migration.py (reported line 33)May include surrounding context.

python
ion, pythonw registration
and the register-verify-remove flow (AC 34-35).
"""
import json
import subprocess
import sys
from pathlib import Path

import pytest

import doctor
from tests.conftest import load_setup_tasks

setup_tasks = load_setup_tasks()

FOREIGN = [
    "# backup job — not ours",
    "0 2 * * * /usr/local/bin/backup",
]


class FakeOs:
    """
    In-memory crontab + Task Scheduler + launchctl + systemctl for one test.
    `crontab=None` means "no crontab for user" (rc 1 + the classic stderr).
    """

    def __init__(self, crontab=None, tasks=None):
        self.crontab = list(crontab) if crontab is not None else None
        self.tasks = dict(tasks or {})      # windows: full task name -> True
        self.xml_by_task = {}               # windows: name -> XML passed to /create
        self.loaded_agents = set()          # launchd labels currently loaded
        self.enabled_timers = set()         # systemd units currently enabled

The crash test claims to kill only the spawned process tree, but its POSIX implementation kills the inherited process group.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

On POSIX, the subprocess inherits the parent's process group because Popen does not request a new session or group. Calling os.killpg(os.getpgid(p.pid), SIGKILL) can therefore kill the test runner, an invoking agent, and other signalable processes sharing that group, causing denial of service during an otherwise routine test run.

Content

No source excerpt is available for this finding.

Messaging setup lacks a warning about disclosing sensitive medication information to messaging providers.

Medium
Category
Output Handling
Confidence
93% confidence
Finding

The setup examples transmit medication names, doses, and potentially adherence information without explaining the resulting disclosure to messaging providers and chat participants. Local file permissions and log redaction do not protect message contents once delivered through these services.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · README.md (reported line 71)May include surrounding context.

md
MESSAGE=$(cat)   # full message text arrives on stdin

# Example: WhatsApp via OpenClaw gateway
# curl -s -X POST "$OPENCLAW_WEBHOOK" \
#   -H "Content-Type: application/json" \
#   -d "{\"text\": $(echo "$MESSAGE" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')}"

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 · README.md (reported line 78)May include surrounding context.

md
# Example: Telegram — the text goes to curl on STDIN ("text@-"), never as an
# argument: on Windows, Git Bash re-encodes arguments to the ANSI code page,
# so non-ASCII text (the digest's "Mon–Fri") arrives as invalid UTF-8 (#20)
# RESP=$(printf '%s' "$MESSAGE" | curl -s "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage" \
#   --data-urlencode chat_id="$TELEGRAM_CHAT_ID" \
#   --data-urlencode "text@-")
# echo "$RESP" | grep -q '"ok":true' || { echo "telegram: $RESP" >&2; exit 1; }

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% 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 216)May include surrounding context.

md
Legacy state fields (`status`, `confirmed_dose`, `last_taken`, `next_due`) keep being written for one release, so rolling back the code doesn't lose anything.

To roll the scheduler back manually: `python3 setup-tasks.py --clear` removes the tick (and legacy jobs), or per OS — `schtasks /delete /tn "\MedReminder\tick-<hash>"` on Windows, `launchctl unload ~/Library/LaunchAgents/<label>.plist` on macOS, edit the marked block out of `crontab -e` (or `systemctl --user disable <unit>.timer`) on Linux.

---

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 · README.md (reported line 216)May include surrounding context.

md
Legacy state fields (`status`, `confirmed_dose`, `last_taken`, `next_due`) keep being written for one release, so rolling back the code doesn't lose anything.

To roll the scheduler back manually: `python3 setup-tasks.py --clear` removes the tick (and legacy jobs), or per OS — `schtasks /delete /tn "\MedReminder\tick-<hash>"` on Windows, `launchctl unload ~/Library/LaunchAgents/<label>.plist` on macOS, edit the marked block out of `crontab -e` (or `systemctl --user disable <unit>.timer`) on Linux.

---

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 · setup-tasks.py (reported line 448)May include surrounding context.

python
# ── macOS launchd user agent ──────────────────────────────────────────────────

def launchd_plist_path(label: str) -> Path:
    return Path.home() / "Library" / "LaunchAgents" / f"{label}.plist"

def build_plist(label: str, python: str, dispatch: str, state_path,

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 · setup-tasks.py (reported line 449)May include surrounding context.

python
# ── macOS launchd user agent ──────────────────────────────────────────────────

def launchd_plist_path(label: str) -> Path:
    return Path.home() / "Library" / "LaunchAgents" / f"{label}.plist"

def build_plist(label: str, python: str, dispatch: str, state_path,
                tick_minutes: int) -> str:

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 · setup-tasks.py (reported line 451)May include surrounding context.

python
def launchd_plist_path(label: str) -> Path:
    return Path.home() / "Library" / "LaunchAgents" / f"{label}.plist"

def build_plist(label: str, python: str, dispatch: str, state_path,
                tick_minutes: int) -> str:
    args = "".join(f"    <string>{xml_escape(a)}</string>\n" for a in (
        python, dispatch, "--state", str(Path(state_path).resolve()),

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 · setup-tasks.py (reported line 477)May include surrounding context.

python
if dry_run:
        print(f"  [DRY RUN] launchd agent {label} (StartInterval {tick_minutes * 60}s)")
        return True
    plist = launchd_plist_path(label)
    plist.parent.mkdir(parents=True, exist_ok=True)
    plist.write_text(build_plist(label, sys.executable, str(DISPATCH_FILE),
                                 state_path, tick_minutes), encoding="utf-8")

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 · setup-tasks.py (reported line 477)May include surrounding context.

python
if dry_run:
        print(f"  [DRY RUN] launchd agent {label} (StartInterval {tick_minutes * 60}s)")
        return True
    plist = launchd_plist_path(label)
    plist.parent.mkdir(parents=True, exist_ok=True)
    plist.write_text(build_plist(label, sys.executable, str(DISPATCH_FILE),
                                 state_path, tick_minutes), encoding="utf-8")

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 · setup-tasks.py (reported line 478)May include surrounding context.

python
print(f"  [DRY RUN] launchd agent {label} (StartInterval {tick_minutes * 60}s)")
        return True
    plist = launchd_plist_path(label)
    plist.parent.mkdir(parents=True, exist_ok=True)
    plist.write_text(build_plist(label, sys.executable, str(DISPATCH_FILE),
                                 state_path, tick_minutes), encoding="utf-8")
    run(["launchctl", "unload", str(plist)])           # reload if it was already loaded

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 · setup-tasks.py (reported line 481)May include surrounding context.

python
plist.parent.mkdir(parents=True, exist_ok=True)
    plist.write_text(build_plist(label, sys.executable, str(DISPATCH_FILE),
                                 state_path, tick_minutes), encoding="utf-8")
    run(["launchctl", "unload", str(plist)])           # reload if it was already loaded
    r = run(["launchctl", "load", str(plist)])
    if r.returncode != 0:
        print(f"  launchctl load failed: {(r.stderr or '').strip()}")