[GH-ISSUE #2471] [Issue]: Professor Mari commits write actions with no approval (type:none), enabling prompt-injection code execution #1213

Closed
opened 2026-10-21 05:29:08 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Romuromylus on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2471

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Severity: Medium — security (indirect prompt injection → code execution). Professor Mari's write tools (edit_marinara_code_file, create_marinara_extension, create_marinara_custom_agent) execute autonomously inside the ReAct loop with no human-in-the-loop, and the response always returns action.type: "none" so no approval modal is ever shown. Combined with create_marinara_extension defaulting enabled: true (whose JS auto-runs), untrusted text fed to Mari can drive a silent arbitrary-JS-execution chain.

Expected behavior

Write actions should not commit without explicit user approval. Either the write tools should return a real create_record/edit_record action contract that the existing frontend approval path gates, or created extensions should be forced enabled: false until the user manually enables them. The wire contract should not be labeled read-only / type: "none" when a write actually occurred.

Actual behavior

// src-tauri/src/commands/storage/mari.rs
// agent (455-462) includes EditMarinaraCodeFileTool, CreateMarinaraExtensionTool, CreateMarinaraCustomAgentTool;
// AgentHooks is an empty derive (no gate); ToolRuntime::execute commits the write immediately in agent.run(task).
"action": read_only_mari_action_contract(),  // 527-540 — returned AFTER writes happened, type:"none"

// create_marinara_extension (1094-1121) persists attacker-supplied js with:
#[serde(default = "default_true")] enabled: bool,   // ~379 — auto-enabled

The frontend only surfaces an approval UI for create_record/edit_record actions; type: "none" shows nothing, so these writes are silent. CustomThemeInjector runs every enabled extension's js via import() of a Blob URL, handing it storageApi.create/update/delete — arbitrary JS in the desktop renderer. Untrusted text reaches the model on the same turn it can call write tools: attachment contents, the read_marinara_library snapshot of imported characters/personas/lorebooks (free-text fields), and the contents of any file read via read_marinara_code_file. A crafted persona/character/lorebook/attachment that instructs Mari to "create an enabled extension with this js" yields silent JS execution with zero confirmation.

Steps to reproduce

  1. Open Professor Mari with a tool-capable connection.
  2. Provide untrusted text that contains an injection — e.g. attach a file, or ask a "library" question so an imported character/persona/lorebook free-text field is injected — where that text instructs Mari to create_marinara_extension with a JS payload and enabled: true.
  3. Mari executes the write in-loop and returns type: "none"; no confirmation appears; the extension's JS auto-runs.

Impact area

  • Professor Mari or shell tools
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime

Environment

  • Branch or commit: refactor @ 1fae2c42
  • Run mode: Tauri desktop
  • OS + version: found via static source audit (not runtime-reproduced)
  • Node + pnpm versions: n/a (static audit)
  • Rust version, if relevant: n/a (static audit)
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: any tool-capable connection

Logs, screenshots, or video

Static trace: mari.rs:455-462 (tools), :527-540 (read_only_mari_action_contract / type:"none"), :379 (default_true), :1094-1121 (create_marinara_extension); execution sink CustomThemeInjector.tsx (import() of extension JS + storageApi exposure).

Regression notes

Not a regression — this autonomous-write Mari agent is a refactor-only surface with no main equivalent. Filing as a refactor bug. The chain is conditional (requires a tool-capable connection and the model obeying the injected text over its system prompt), which is why it is Medium rather than High; but indirect-prompt-injection → tool abuse is a recognized class and the RCE is one obeyed injection away.

Additional context

Note: edit_marinara_code_file is correctly path-guarded (resolve_repo_file + is_code_text_path), so out-of-repo writes are prevented; in-repo source mutation is still unconfirmed. Strongest fix: force create_marinara_extension to persist enabled: false regardless of the model-supplied flag, and route edit/create tools through a real create_record/edit_record action contract so the existing mari-entry.ts approval path gates the commit. At minimum, stop returning type:"none"/read_only_mari_action_contract when a write tool fired.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (Jun 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2471 Originally assigned to: @SpicyMarinara on GitHub. ## Summary **Severity: Medium — security (indirect prompt injection → code execution).** Professor Mari's write tools (`edit_marinara_code_file`, `create_marinara_extension`, `create_marinara_custom_agent`) execute autonomously inside the ReAct loop with no human-in-the-loop, and the response always returns `action.type: "none"` so no approval modal is ever shown. Combined with `create_marinara_extension` defaulting `enabled: true` (whose JS auto-runs), untrusted text fed to Mari can drive a silent arbitrary-JS-execution chain. ## Expected behavior Write actions should not commit without explicit user approval. Either the write tools should return a real `create_record`/`edit_record` action contract that the existing frontend approval path gates, or created extensions should be forced `enabled: false` until the user manually enables them. The wire contract should not be labeled read-only / `type: "none"` when a write actually occurred. ## Actual behavior ```rust // src-tauri/src/commands/storage/mari.rs // agent (455-462) includes EditMarinaraCodeFileTool, CreateMarinaraExtensionTool, CreateMarinaraCustomAgentTool; // AgentHooks is an empty derive (no gate); ToolRuntime::execute commits the write immediately in agent.run(task). "action": read_only_mari_action_contract(), // 527-540 — returned AFTER writes happened, type:"none" // create_marinara_extension (1094-1121) persists attacker-supplied js with: #[serde(default = "default_true")] enabled: bool, // ~379 — auto-enabled ``` The frontend only surfaces an approval UI for `create_record`/`edit_record` actions; `type: "none"` shows nothing, so these writes are silent. `CustomThemeInjector` runs every enabled extension's `js` via `import()` of a Blob URL, handing it `storageApi.create/update/delete` — arbitrary JS in the desktop renderer. Untrusted text reaches the model on the same turn it can call write tools: attachment contents, the `read_marinara_library` snapshot of imported characters/personas/lorebooks (free-text fields), and the contents of any file read via `read_marinara_code_file`. A crafted persona/character/lorebook/attachment that instructs Mari to "create an enabled extension with this js" yields silent JS execution with zero confirmation. ## Steps to reproduce 1. Open Professor Mari with a tool-capable connection. 2. Provide untrusted text that contains an injection — e.g. attach a file, or ask a "library" question so an imported character/persona/lorebook free-text field is injected — where that text instructs Mari to `create_marinara_extension` with a JS payload and `enabled: true`. 3. Mari executes the write in-loop and returns `type: "none"`; no confirmation appears; the extension's JS auto-runs. ## Impact area - [x] Professor Mari or shell tools - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime ## Environment - Branch or commit: refactor @ 1fae2c42 - Run mode: Tauri desktop - OS + version: found via static source audit (not runtime-reproduced) - Node + pnpm versions: n/a (static audit) - Rust version, if relevant: n/a (static audit) - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: any tool-capable connection ## Logs, screenshots, or video Static trace: `mari.rs:455-462` (tools), `:527-540` (`read_only_mari_action_contract` / `type:"none"`), `:379` (`default_true`), `:1094-1121` (`create_marinara_extension`); execution sink `CustomThemeInjector.tsx` (`import()` of extension JS + `storageApi` exposure). ## Regression notes Not a regression — this autonomous-write Mari agent is a refactor-only surface with no main equivalent. Filing as a refactor `bug`. The chain is conditional (requires a tool-capable connection and the model obeying the injected text over its system prompt), which is why it is Medium rather than High; but indirect-prompt-injection → tool abuse is a recognized class and the RCE is one obeyed injection away. ## Additional context Note: `edit_marinara_code_file` is correctly path-guarded (`resolve_repo_file` + `is_code_text_path`), so out-of-repo writes are prevented; in-repo source mutation is still unconfirmed. Strongest fix: force `create_marinara_extension` to persist `enabled: false` regardless of the model-supplied flag, and route edit/create tools through a real `create_record`/`edit_record` action contract so the existing `mari-entry.ts` approval path gates the commit. At minimum, stop returning `type:"none"`/`read_only_mari_action_contract` when a write tool fired. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:29:08 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jun 6, 2026):

Fixed on refactor in 038b7220.

Professor Mari write tools now require explicit approval and autonomous no-approval write execution is disabled; helper-created extensions and agents are forced disabled if that path is used.

Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.

<!-- gh-comment-id:4638720570 --> @SpicyMarinara commented on GitHub (Jun 6, 2026): Fixed on refactor in 038b7220. Professor Mari write tools now require explicit approval and autonomous no-approval write execution is disabled; helper-created extensions and agents are forced disabled if that path is used. Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1213
No description provided.