T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- server.go:67
- Finding
- Unauthenticated Task Management API Exposed on All Network Interfaces<![CDATA[ ## Vulnerability Details **File Location**: `server.go:67-86` **Vulnerability Type**: Missing authentication and network access restrictions **Risk Level**: High ### Vulnerable Code ```go // Routes e.GET("/", indexHandler) e.GET("/tasks", tasksHandler) e.GET("/tasks/:uuid", taskDetailHandler) e.POST("/api/tasks", createTaskAPI) e.GET("/api/tasks", queryTasksAPI) e.PUT("/api/tasks/:uuid", updateTaskAPI) e.PUT("/api/tasks/:uuid/status", updateTaskStatusAPI) e.GET("/api/stats", getStatsAPI) // Start server addr := fmt.Sprintf(":%d", port) fmt.Printf("Server started at http://localhost:%d\n", port) fmt.Println("The port can be configured through TASK_SKILL_PORT") e.Logger.Fatal(e.Start(addr)) ``` The status endpoint also accepts any caller-supplied status without authorization or transition validation: ```go var err error if input.ReviewComment != "" { err = database.UpdateTaskStatusWithComment( uuid, input.NewStatus, input.ReviewComment, ) } else { err = database.UpdateTaskStatus(uuid, input.NewStatus) } ``` ### Technical Analysis The address `:<port>` listens on all available network interfaces, not only the loopback interface. The displayed `localhost` URL therefore gives a misleading impression that the service is locally restricted. None of the task-management routes require authentication, authorization, an API token, or user-role checks. Any client that can reach the port can: - Enumerate tasks and their contents. - Create new tasks. - Modify task titles, priorities, and projects. - Change task status. - Mark a task as completed without human approval. The implementation also fails to enforce the documented workflow transitions. In particular, the status endpoint passes arbitrary `new_status` values directly to the database. This contradicts the documented requirement that an AI agent must not approve a task without explicit human authorization. ### Attack Path 1. An attacker discovers port 8080 on a w ...[truncated 1007 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bind to loopback by default: ```go addr := fmt.Sprintf("127.0.0.1:%d", port) ``` 2. Require explicit configuration before listening on non-loopback interfaces. 3. Add authentication to every API and page that exposes task data. 4. Enforce authorization separately for read, edit, approval, and administrative operations. 5. Implement a server-side transition matrix, for example: - `pending` → `agent_working` - `agent_working` → `agent_review` - `agent_review` → `human_review` - `human_review` → `done` only for an authenticated human reviewer 6. Reject unknown status strings and invalid transitions with HTTP 400 or 403. 7. Add CSRF protection when browser cookies or sessions are introduced. 8. Place the service behind a firewall or authenticated reverse proxy when remote access is required. ]]>
