The vulnerability lies in an unauthenticated HTTP server in OpenCode that exposes dangerous endpoints. The provided description clearly identifies the vulnerable endpoints (/session/:id/shell, /pty, /file/content) and the file where the server is defined (server.ts). The patch, located in packages/opencode/src/server/server.ts, modifies the Cross-Origin Resource Sharing (CORS) policy from a permissive .use(cors()) to a more restrictive one. This change occurs within the server's initialization logic, which is encapsulated within the Server.listen function as indicated by the call Server.listen() in cli/cmd/tui/worker.ts. Although the patch doesn't show the route handlers themselves, the Server.listen function is the entry point that configures and starts the server, making it the primary function responsible for exposing the vulnerable endpoints. The vulnerability is a combination of the lack of authentication and the permissive CORS policy, both of which are configured within the scope of the server's startup process.