T07 · Tool Hijacking and Spoofing
- Location
extension/index.ts:295- Finding
Unauthenticated legacy Unity bridge permits session hijacking and forged tool results
- Content
View full analysis
{ const url = new URL(req.url ?? "/", "http://localhost"); const path = url.pathname; // Only handle /unity/* paths if (!path.startsWith("/unity/")) { return false; } // Handle CORS preflight if (req.method === "OPTIONS") { res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS"); res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization"); res.statusCode = 204; res.end(); return true; } ``` The session registration endpoint accepts arbitrary clients without validating credentials: ```ts case "register": { if (req.method !== "POST") { sendJson(res, 405, { error: "Method not allowed" }); return true; } const body = await readJsonBody(req); const { project, version, platform, tools } = body; const sessionId = generateId(); const session: UnitySession = { sessionId, registeredAt: Date.now(), lastHeartbeat: Date.now(), projectName: project || "Unknown", unityVersion: version || "Unknown", platform: platform || "Unity ...[truncated 5522 chars]- Remediation
View remediation
