T01 · Skill Instruction Hijacking
- Location
src/knowledge.js:57- Finding
Untrusted Knowledge Sources Can Hijack Verification and Automatic Correction
- Content
View full analysis
maxFileSize) continue; // skip large files const content = fs.readFileSync(fullPath, 'utf8'); results.push({ path: path.relative(HOME, fullPath), content, }); } catch { /* skip unreadable */ } } ``` `src/knowledge.js:175-222` collects content from memory, workspace files, custom paths, and OpenClaw root documents: ```javascript function loadKnowledge(config) { const sources = config.knowledge_sources || {}; const allFiles = []; // 1. System memory (always on by default) if (sources.use_system_memory !== false) { // 1a. Memory flush files (markdown) allFiles.push(...readDir(MEMORY_DIR, 2)); // 1b. Memory database (SQLite — extract text chunks) const dbChunks = readMemoryDb(); if (dbChunks.length > 0) { allFiles.push({ path: '.openclaw/memory/main.sqlite (chunks)', content: dbChunks.join('\n\n') }); } } // 2. Workspace root files (non-recursive, just top-level docs) const workspaceFiles = readDir(WORKSPACE, 1); allFiles.push(...workspaceFiles); // 3. Custom document paths if (Array.isArray(sources.document_paths)) { for (const docPath of sources.document_paths) { const resolved = docPath.startsWith('~/') ? path.join(HOME, docPath.slice(2)) : path.resolve(docPath); try { const stat = fs.statSync(resolved); if (stat.isDirectory()) { allFiles.push(...readDir(resolv ...[truncated 4317 chars]- Remediation
View remediation
