T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- research.py:54
- Finding
- Overly Broad DOM Extraction May Capture Unrelated Authenticated Browser Content<![CDATA[ ## Vulnerability Details **File Location**: `research.py:54-62`, `research.py:104-112`, `research.py:142-151` **Vulnerability Type**: Excessive access to authenticated browser-page content **Risk Level**: High ### Vulnerable Code ```python # research.py:54-62 const bodyText = document.body.innerText; // Check if still loading if (bodyText.includes('思考中') || bodyText.includes('搜尋中') || bodyText.includes('Searching')) return ''; // Strategy 1: find .prose or markdown containers const prose = document.querySelectorAll('.prose, [class*="prose"], [class*="markdown"]'); if (prose.length > 0) { const last = prose[prose.length-1].innerText; if (last.length > 100) return last; } // Strategy 2: find answer text from body content const lines = bodyText.split('\n').filter(l => l.trim().length > 40); if (lines.length > 3) return lines.join('\n'); ``` ```python # research.py:104-112 const scroll = document.querySelector('[class*="overflow-y-auto"][class*="scrollbar-gutter"]'); if (scroll && scroll.innerText.length > 50) { // Strip the user query (first line) to get just the response const lines = scroll.innerText.split('\n').filter(l => l.trim()); const responseStart = lines.findIndex((l, i) => i > 0 && l.length > 20); if (responseStart > 0) return lines.slice(responseStart).join('\n'); } return ''; ``` ```python # research.py:142-151 const allDivs = document.querySelectorAll('div'); let best = null, bestLen = 0; for (const d of allDivs) { const t = d.innerText; if (t.length > 200 && t.length < 15000 && !d.querySelector('nav, header, aside')) { if (t.length > bestLen) { bestLen = t.length; best = d; } } } if (best) return best.innerText; return ''; ``` ### Technical Analysis The Skill runs JavaScript inside pages opened under the user's authenticated Perplexity, Grok, and Gemini browser sessions. Its fallback extractors are not reliably limited to the response generated for the current query. The Perplexity fallback ...[truncated 1767 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all whole-document, generic scroll-container, and largest-element fallbacks. 2. Restrict extraction to a response element associated with the current request. 3. Record page state before submission and extract only response nodes created afterward. 4. Validate the active origin before evaluating extraction JavaScript. 5. Prefer stable service-specific identifiers, accessibility roles, and message ownership attributes. 6. Fail closed with an extraction error when the current response cannot be identified precisely. 7. Strip navigation, historical messages, user messages, hidden elements, and account-interface content. 8. Add automated tests proving that previous chats and sidebar content cannot enter extracted results. 9. Require explicit user confirmation before sending browser-derived content to any synthesis service. ]]>
