T05 · Unauthorized Access and Privilege Escalation
- Location
commands/configshare.js:44- Finding
Missing Authorization for Agent Configuration Mutations
- Content
View full analysis
Vulnerability Details
File Location:
commands/configshare.js:44-108; exposed throughindex.js:284-341
Vulnerability Type: Missing authentication and object-level authorization
Risk Level: HighVulnerable Code
javascript function createOrUpdateConfig(input) { const { agent_id, agent_name, agent_handle, agent_avatar, owner_id, config, current_loyalty, current_argue, argue_label, events_participated, total_replies, total_argues } = input; // Determine visibility based on loyalty const visibility = current_loyalty >= LOYALTY_THRESHOLD ? VISIBILITY.PUBLIC : VISIBILITY.PRIVATE; // Check if agent already exists const existing = configStore.agents.get(agent_id); let loyaltyTrend = [current_loyalty]; if (existing && existing.stats && existing.stats.loyalty_trend) { loyaltyTrend = [...existing.stats.loyalty_trend, current_loyalty].slice(-10); } // Calculate rank (simplified) const rank = calculateRank(agent_id, current_loyalty); const agentConfig = { agent_id, agent_name: agent_name || agent_id, agent_handle: agent_handle || `@${agent_id}`, agent_avatar: agent_avatar || '🤖', owner_id: owner_id || 'system', config: { base_model: config?.base_model || 'Unknown', model_provider: config?.model_provider || 'Unknown', tools: config?.tools || [], system_prompt_style: config?.system_prompt_style || PROMPT_STYLES[0], system_prompt_hash: config?.system_prompt_hash || generateHash(agent_id), knowledge_bases: config?.knowledge_bases || [], temperature: config?.temperature || 0.7, max_tokens: config?.max_tokens || 1024 }, ...[truncated 3714 chars]- Remediation
View remediation
Remediation Suggestions
- Require an authenticated principal for every configuration mutation.
- Derive
owner_idfrom the authenticated session or execution context rather than request parameters. - When an agent already exists, compare its stored owner with the authenticated principal and reject mismatches.
- Restrict visibility revocation and administrative overrides to the owner or an explicitly authorized administrator.
- Do not accept
current_loyalty,current_argue, ranks, or other authoritative statistics from clients. Retrieve them from trusted scoring records maintained by the service. - Introduce explicit create and update operations so duplicate identifiers cannot silently overwrite existing objects.
- Validate all configuration fields against a strict schema, including bounds for
temperature,max_tokens, array lengths, and string sizes. - Record immutable audit events for configuration creation, modification, ownership changes, publication, and revocation.
- Add tests proving that one authenticated owner cannot modify, publish, or revoke another owner's agent configuration.
