T09 · Insecure Skill Coding Practices
- Location
scripts/batch_processor.py:341- Finding
Unrestricted Command Execution Through Batch Task Manifests
- Content
View full analysis
List[Task]: """Parse task definition file (JSON or TOON format)""" content = file_path.read_text() # Try JSON first try: data = json.loads(content) if 'tasks' in data: return [Task(**task_def) for task_def in data['tasks']] return [Task(**data)] except json.JSONDecodeError: pass ``` String commands supplied by those task definitions are executed through the system shell: ```python def _execute_shell(self, task: Task) -> TaskResult: """Execute a shell command task""" result = TaskResult( task_id=task.id, task_type=task.type, status='failed', start_time=datetime.now() ) try: if self.dry_run: result.output = f"[DRY-RUN] Would execute: {task.command}" result.status = 'success' elif task.command: self.rate_limiter.acquire() use_shell = isinstance(task.command, str) proc = subprocess.run( task.command if use_shell else task.command.split(), capture_output=True, text=True, timeout=300, shell=use_shell ) ``` Manifest-controlled Python script paths and arguments are also executed without path restrictions: ```python def _execute_script(self, task: Task) -> TaskResult: """Execute a script task""" result = TaskResult( task_id=task.id, task_type=task.type, status='failed', start_time=datetime.now() ...[truncated 4394 chars]- Remediation
View remediation
