T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/dev_executor.py:190- Finding
Declared Telegram sender and group authorization is not enforced
- Content
View full analysis
tuple[bool, str]: line = line.strip() if not line.startswith("DEV "): return False, "SKIP" parts = shlex.split(line) # parts[0] = DEV if len(parts) < 2: return False, "ERR: missing command" cmd = parts[1] rest = parts[2:] if cmd == "skill": return handle_skill(rest) if cmd == "cron": return handle_cron(rest) return False, f"ERR: unknown command: {cmd}" def main(): ap = argparse.ArgumentParser() ap.add_argument("--group", required=True, help="Allowed Telegram group chat id") ap.add_argument("--pm-from", required=True, help="Allowed PM bot numeric from.id") ap.add_argument("--stdin", action="store_true", help="Read commands from stdin (for testing)") args = ap.parse_args() if args.stdin: for line in sys.stdin: ok, msg = handle_line(line) if msg != "SKIP": print(msg) return ``` ### Technical Analysis The executor accepts trusted Telegram group and sender identifiers through `--group` and `--pm-from`, but these values are never used to authorize commands. The command handler receives only an unstructured text line, so it has no access to the originating `chat.id` or `from.id`. Consequently, every input source that can write to the process's standard input is treated as authorized as long as the line begins with `DEV ` and contains an allowlisted command type. This contradicts the security contract in `SKILL.md`, which requires commands to be accepted only when both the Telegram group and sender match configured identifiers. Although the script is described as a scaffold, any wrapper that forwards Telegram text without independently and correctly enforcing identity checks would expose ...[truncated 1394 chars]- Remediation
View remediation
