LocalEndpoint / Endpoint Strategy

Plugin Permissions, Sandboxing, and Approval Policy

Report summary

The integration of untrusted C\ and Python plugins into a privileged desktop host necessitates a fundamental shift away from language-level sandboxing paradigms toward operating-system-enforced isolation. [Platform guarantee] : The .NET runtime explicitly states that Code Access Security (CAS), secu

Status
Research archive item
Category
LocalEndpoint / Endpoint Strategy
Length
5,457 words
Reading time
25 minutes
Report type
architecture

Key topics

  • LocalEndpoint / Endpoint Strategy
  • LocalEndpoint
  • Endpoint Strategy
  • AI
  • Agentic Web
  • .NET
  • Python
  • Runtime
  • NuGet

Research provenance

Archive status
Research archive item
Content identity
sha256:36d0d5eaf0907185c64d03378d8a2ad633741a6852b471a282153853cd4a6ecd

For citation, use the report title and canonical URL. Archival presence does not establish authorship or promote report statements into portfolio evidence.

This page renders the archived Markdown as safe, formatted HTML. It is background research and does not become a portfolio claim without evidence review.

Full report

On this page

1. Executive recommendation

The integration of untrusted C\# and Python plugins into a privileged desktop host necessitates a fundamental shift away from language-level sandboxing paradigms toward operating-system-enforced isolation. \[Platform guarantee\]: The .NET runtime explicitly states that Code Access Security (CAS), security transparency, and AppDomain boundaries are obsolete and no longer serve as security boundaries against malicious code1. Similarly, attempting to sandbox Python by hooking sys.path or wrapping os.system is a highly fragile approach that is easily bypassed by native extensions or CPython built-ins3. The architecture must recognize that any code executing within the plugin environment is fundamentally untrusted and potentially hostile. To achieve a defensible posture, the host must enforce a strict out-of-process isolation model. \[Security synthesis\]: The recommended architecture dictates that all untrusted plugins execute within a Windows AppContainer environment, structurally restricted from accessing the network and filesystem by withholding the internetClient and broad filesystem capabilities4. To govern resource consumption and ensure deterministic termination, these processes must be inextricably bound to Windows Job Objects utilizing the JOB\_OBJECT\_LIMIT\_KILL\_ON\_JOB\_CLOSE directive8. Access to privileged host capabilities—such as file manipulation, network egress, browser automation, and Large Language Model (LLM) prompt processing—must be mediated exclusively through a high-integrity Named Pipe broker utilizing gRPC for structured serialization11. This broker must implement a rigorous Policy Decision Point (PDP) that evaluates contextual human consent, durable rules, and cryptographic identities before enforcing actions via a Policy Enforcement Point (PEP). The system must operate under the assumption that the plugin is actively attempting to subvert the host, requiring execution-time revalidation and strict capability scoping to prevent confused deputy attacks and Time-of-Check to Time-of-Use (TOCTOU) file race conditions14.

2. Scope, assumptions, and zero-access declaration

This research delineates the architectural requirements for securing a C\# desktop host that extends its functionality via untrusted C\# and Python plugins. The analysis focuses specifically on the Windows operating system environment, emphasizing native access control mechanisms, Inter-Process Communication (IPC) brokering, and user consent frameworks. \[Assumption\]: The threat model operates under the premise that the plugin is either inherently malicious or entirely compromised by an external actor via indirect prompt injection or supply chain poisoning16. It is assumed that the plugin is capable of executing arbitrary native instructions, injecting shellcode into its own memory space, and attempting to spawn child processes to escape containment. Furthermore, it is assumed that full trust remains exclusively within the host broker process, which operates with the ambient authority of the logged-in user. A hard zero-access boundary has been maintained throughout this investigation. No active probing, scanning, or connection to localhost, private networks, or external endpoints was conducted. Furthermore, no attempts were made to bypass any existing LocalEndpoint software, nor were any proprietary source codes, binaries, manifests, policies, tokens, credentials, private data, or logs requested or inspected. All code examples, threat models, and architectural designs provided herein are strictly theoretical, abstract, and intended purely for defensive security engineering and policy formulation.

3. Source and threat-model method

The foundational principles of this analysis are derived from official Windows platform documentation, .NET and CPython runtime specifications, and peer-reviewed usable-security research. \[External guidance\]: The threat modeling aligns with Open Worldwide Application Security Project (OWASP) authorization guidelines and National Institute of Standards and Technology (NIST) Zero Trust Architecture principles, prioritizing secure-by-design methodologies18. The threat modeling method specifically interrogates the boundaries of Inter-Process Communication, evaluating the resilience of Named Pipes against token impersonation attacks (such as RoguePotato or PrintSpoofer) and examining the systemic risks of indirect prompt injection in autonomous agents20. A critical distinction is maintained throughout the analysis between operating-system guarantees and policy conventions. \[Security synthesis\]: Operating-system guarantees, such as Kernel-enforced Access Control Lists (ACLs) and AppContainer Security Identifiers (SIDs), represent immutable technical boundaries that arbitrary user-mode code cannot bypass without a kernel exploit. Conversely, policy conventions, such as manifest declarations or user consent dialogs, represent state logic evaluated by the host; they do not inherently restrict the execution capabilities of a compromised process unless strictly coupled with an OS-level enforcement mechanism7. This methodology ensures that the resulting architecture does not conflate declarative intent with cryptographic or kernel-level enforcement.

4. Capability taxonomy

To prevent ambiguous wildcard authority, capabilities must be explicitly declared, strictly typed, and independently grantable. A stable capability taxonomy provides the framework for translating user intent into deterministic enforcement rules.

Capability Schema and Composition

Capabilities must not compose into overly broad permissions. \[Policy proposal\]: If a plugin requests access to read a specific configuration file and separately requests access to the public internet, these capabilities must not intersect to allow the plugin to exfiltrate the configuration file. The capability schema must define the exact resource scope, operation, data class, remote eligibility, and maximum allowable grant duration. The taxonomy encompasses the following distinct domains:

Capability IdentifierResource ScopeAllowed ParametersMaximum Grant DurationRemote EligibilityAuto-Approval
plugin.fs.readExplicit paths only. Wildcards (\*) universally invalid.path, recursiveAlways Allow ExactLocal OnlyIsolated AppData only
plugin.fs.writeExplicit paths only.path, recursiveAlways Allow ExactLocal OnlyIsolated AppData only
plugin.network.publicPublic IP space and domains.destination, port, protocolSessionEligibleFirst-party only
plugin.network.locallocalhost, RFC 1918 private networks.destination, portAllow OnceIneligibleNever
plugin.browser.domActive browser tabs.action (read/inject)Allow OnceIneligibleNever
plugin.email.sendAuthenticated email accounts.target\_domainAllow OnceEligible (w/ Auth)Never
plugin.ui.automationDesktop shell, clipboard, UI automation.action (read/write)SessionEligibleNever
plugin.model.inferLocal or remote LLM execution.model\_id, max\_tokensAlways Allow AppEligibleSigned Partner
plugin.admin.configSystem settings, registry modifications.key, valueAllow OnceIneligibleNever

Granularity and Update Expansion

Resource scope must distinguish destination and origin. \[Security synthesis\]: Localhost and private network access represent a drastically higher risk profile than public internet access due to the prevalence of unauthenticated background services, internal enterprise APIs, and DNS rebinding vulnerabilities22. Consequently, plugin.network.local must be treated as a highly sensitive capability, ineligible for durable grants. Capabilities should be structured as install-time declarations that inform the user of maximum potential authority, followed by runtime requests that execute the just-in-time approval flow. \[Policy proposal\]: Any permission expansion introduced during a plugin update—such as a previously read-only plugin requesting plugin.fs.write, or a plugin requesting a new top-level domain—must automatically invalidate all existing durable grants. The host must detect this delta by hashing the manifest and comparing it against the previous installation, subsequently forcing a complete re-consent flow before the updated plugin is permitted to execute its first instruction. \[Sample\]:Generic Valid Manifest Example:

JSON { "plugin\_id": "com.partner.finance\_fetcher", "developer\_signature": "CN=Partner Inc, O=Partner Inc, C=US", "capabilities": \[ { "id": "plugin.network.public", "destination": "api.partner.com", "port": 443, "duration\_eligibility": "session", "remote\_eligible": true }, { "id": "plugin.model.infer", "model\_id": "local-llama-3", "duration\_eligibility": "always\_allow\_app", "remote\_eligible": true } \] }

Generic Invalid Manifest Example (Ambiguous Authority):

JSON { "plugin\_id": "com.untrusted.scraper", "capabilities": \[ { "id": "plugin.network.\", "destination": "\", "duration\_eligibility": "always" }, { "id": "plugin.fs.write", "path": "C:\\\\", "duration\_eligibility": "always" } \] }

5. Windows enforcement option matrix

To enforce the capability schema, the host application must isolate the plugin. \[Platform guarantee\]: Manifest declarations and user consent dialogs are not enforcement boundaries; they are merely state logic. Without an OS-level isolation boundary, a malicious plugin can simply ignore the broker, bypass the manifest, and utilize ambient user authority to directly invoke Win32 APIs to access the filesystem or exfiltrate data7. The following matrix compares the viability of various Windows containment mechanisms for hosting C\# and CPython plugins.

Containment MechanismSecurity StrengthNetwork ControlFilesystem ControlChild-Process ControlBroker SupportOperational Burden
In-Process (AssemblyLoadContext)None. Deprecated as a security boundary1.None. Shares host memory space and threads.None. Ambient authority applies.None.High. Direct memory access.Low. Minimal deployment complexity.
Out-of-Process (Full Trust)Low. Relies solely on user's ambient authority.None (unless third-party WFP firewalls are manually injected).Limited to standard user ACLs.None.High. Standard IPC applies.Low.
Restricted Tokens (Low IL)Medium. Uses CreateRestrictedToken and Low Integrity Level (S-1-16-4096)7.Weak. Low IL processes can still easily open outbound network sockets7.Medium. Stops writes to Medium/High IL, but readable by "Everyone" ACLs.High (via Job Objects).High.Medium. Complex token manipulation required5.
AppContainer (Zero Capabilities)High. Native OS sandbox using LowBox tokens4.Strong. Blocked by default unless specific capabilities like internetClient are granted6.Strong. Isolated to virtualized AppData; explicit broker needed for external files29.High (via Job Objects).High.High. Requires AppContainer profile management and SID derivation7.
Windows Sandbox (Disposable VM)Maximum. Hardware virtualization boundary utilizing Hyper-V5.Maximum. Virtual Switch isolation.Maximum. Requires explicit host folder mapping34.Maximum.Low. Complex host-to-guest bridging required.Very High. Unavailable on Windows Home SKUs; high latency startup5.

\[Security synthesis\]: AppContainer, combined with Job Objects, represents the optimal balance for executing C\# and CPython plugins4. By initializing the AppContainer with an empty SECURITY\_CAPABILITIES array, the OS inherently blocks the plugin from interacting with the network, the registry, or the broader filesystem7. All required interactions must therefore be explicitly brokered through the host. In this paradigm, fundamentally trusted code (e.g., first-party core libraries) executes within the High-Integrity broker, while all plugin logic executes within the AppContainer. The broker relies on Kernel-enforced Access Control Lists (ACLs) and the Windows Filtering Platform (WFP) to constrain handles, ensuring UI automation, clipboard access, and desktop interactions are systematically denied to the plugin process unless explicitly marshaled through the IPC channel.

The architecture relies on a strict separation of privileges between the High-Integrity Host (the Broker) and the Low-Integrity Plugin (the Sandbox).

Trust Boundaries and Responsibilities

The Host runs with the ambient authority of the user and acts as the singular gateway to system resources. It is responsible for launching the sandbox, establishing the Named Pipe server, rendering UI consent prompts, managing the SQLite policy database, and executing high-privilege actions on behalf of the plugin. Conversely, the Plugin runs inside an AppContainer and is responsible solely for executing domain logic, processing data provided by the broker, and formulating requests for external actions. \[Platform limitation\]: Exposing raw OS handles (such as a raw file handle with write permissions) to the sandbox risks Handle Duplication and TOCTOU attacks if the sandbox attempts to elevate the handle's access mask (SECTION\_ALL\_ACCESS) or manipulate the underlying file pointer concurrently7. Therefore, a least-authority broker must expose narrow operations—such as yielding a structured byte stream or a specific data structure—rather than raw OS handles or unrestricted COM/service objects, ensuring the plugin cannot bypass the broker through ambient user authority.

Process and Request Flow

The broker exposes operations via a gRPC interface over Named Pipes, establishing a robust and serialized communication channel11.

  1. Initialization: The Host creates an AppContainer profile via CreateAppContainerProfile and an associated Job Object via CreateJobObject, applying the JOB\_OBJECT\_LIMIT\_KILL\_ON\_JOB\_CLOSE limit flag9.
  2. IPC Setup: The Host opens a Named Pipe server (NamedPipeServerStream). \[Security synthesis\]: To prevent unauthorized local processes from hijacking the communication, the Host must assert FILE\_FLAG\_FIRST\_PIPE\_INSTANCE20. The Host applies a strict PipeSecurity DACL that permits only the specific AppContainer SID (derived via DeriveAppContainerSidFromAppContainerName) to connect32.
  3. Process Launch: The Host launches the plugin executable utilizing CreateProcess and passing a STARTUPINFOEX structure. This structure contains the PROC\_THREAD\_ATTRIBUTE\_SECURITY\_CAPABILITIES initialized for the AppContainer SID30. The process is immediately assigned to the Job Object.
  4. Request Initiation: The Plugin formulates a request (e.g., ReadEmail) and transmits it via the gRPC client11.
  5. Authentication and Revalidation: The Host receives the connection. \[Platform limitation\]: The Host must never utilize ImpersonateNamedPipeClient to execute code as the plugin, as this is a known vector for token theft and Local Privilege Escalation (LPE) vulnerabilities20. Instead, the Host explicitly verifies the client's PID using GetNamedPipeClientProcessId and maps it to the tracked Job Object to ensure the request genuinely originated from the isolated plugin42.
  6. Policy Decision Point (PDP): The Host routes the authenticated request to the internal PDP.
  7. Policy Enforcement Point (PEP): Upon approval, the Host performs the action and streams the resulting data back through the gRPC channel.

7. Policy evaluation model

The Policy Decision Point (PDP) evaluates incoming requests against contextual facts. \[Policy proposal\]: The evaluation model must be deterministic, fail-closed, and strictly ordered to prevent logical bypasses.

Input Facts and Conflict Resolution

A comprehensive policy decision requires multiple input facts: the cryptographically verified Plugin Identity, Publisher Signature, exact Capability requested, strict Resource path/URI, Originating User, Local or Remote Origin, Session ID, App Target, assigned Risk Level, Prior Grants (and their expiry), and the Current Safety State of the host. Conflict resolution operates on strict deny precedence. If an exact match for a deny rule exists, it overrides any wildcard or categorical allow rules. Clock skew must be accounted for by utilizing monotonic clocks for session expiry rather than absolute system time, which can be manipulated.

Execution-Time Revalidation

To prevent Time-of-Check/Time-of-Use (TOCTOU) errors, idempotency and request identity must be rigorously maintained. Approval bindings must be cryptographically tied to the execution request, ensuring that a delayed execution cannot leverage an approval that was subsequently revoked. Execution-time revalidation requires the PEP to re-verify the active status of the grant microseconds before invoking the OS system call, failing closed if the state has mutated.

Pseudocode Evaluation Algorithm

\[Sample\]:

Python def evaluate\_request(request\_context): \# 1\. Global Emergency Gate if system.is\_emergency\_stop\_active(): return DENY("Emergency stop in effect.")

\# 2\. Plugin Cryptographic Identity Verification if not verify\_signature(request\_context.plugin\_binary): if request\_context.publisher\_tier \!= "UNTRUSTED\_THIRD\_PARTY": return DENY("Plugin signature invalid or modified.")

\# 3\. Execution-Time Revalidation (Prevent TOCTOU) if not is\_process\_in\_tracked\_job\_object(request\_context.client\_pid): return DENY("Unrecognized client process.")

\# 4\. Manifest Validation if request\_context.capability not in get\_manifest\_capabilities(request\_context.plugin\_id): return DENY("Capability not declared in manifest.")

\# 5\. Remote Session Binding Check if request\_context.is\_remote\_origin: if not is\_capability\_remote\_eligible(request\_context.capability): return DENY("Capability ineligible for remote execution.") if not verify\_remote\_session\_token(request\_context.remote\_token): return DENY("Invalid or expired remote session.")

\# 6\. Check Explicit Deny Rules (Deny Precedence) if check\_deny\_rules(request\_context) \== MATCH: return DENY("Explicitly denied by user policy.")

\# 7\. Check Durable Allow Rules allow\_rule \= check\_allow\_rules(request\_context) if allow\_rule \== MATCH: if allow\_rule.is\_expired(): purge\_rule(allow\_rule) elif allow\_rule.matches\_exact\_resource(request\_context.resource): return ALLOW("Matched durable allow rule.")

\# 8\. High-Risk Capability Gate (Requires real-time human presence) if is\_high\_risk(request\_context.capability): if request\_context.is\_remote\_origin and not request\_context.local\_desktop\_opt\_in: return DENY("Remote high-risk action requires local user presence opt-in.")

\# 9\. Prompt User for Consent (If no rules match) user\_decision \= trigger\_human\_approval\_ui(request\_context)

if user\_decision.action \== "ALLOW": if user\_decision.duration \== "ALWAYS": save\_durable\_rule(request\_context) elif user\_decision.duration \== "SESSION": save\_session\_rule(request\_context) return ALLOW("User granted access.")

return DENY("User denied access.")

Rules must be instantly invalidated upon sign-out, plugin binary update, publisher certificate change, manifest permission alterations, endpoint IP shifts, or the initiation of an emergency stop.

8. Human approval and durable-rule policy

Meaningful consent represents the most fragile link in the authorization chain. \[External guidance\]: Peer-reviewed usable-security research and OWASP design principles emphasize that excessive prompting leads to "warning fatigue," habituation, and automatic approvals by the user18. An approval is only specific and informed when the user comprehends the exact capability, the precise resource targeted, and the irreversible consequences of the action.

Approval-Risk Matrix

To combat habituation and deceptive content, the system must categorically withhold "Always Allow" options for highly sensitive actions, forcing session-based or one-shot approvals.

Target Application / DomainRead OperationsWrite / Destructive OperationsCredential / PurchaseSend / Publish / External
Browser ContextsAllow for SessionAllow OnceWithheld (Requires Auth)Allow Once
Email ClientsAllow for SessionAllow OnceWithheldAllow Once
File Manager (User Docs)Always Allow AppAlways Allow AppN/AN/A
Password ManagersWithheldWithheldWithheldWithheld
System SettingsAlways Allow AppAllow OnceN/AN/A
Camera / MicrophoneAllow for SessionN/AN/AN/A
Unknown TargetsAllow OnceAllow OnceWithheldAllow Once

\[Policy proposal\]: Dynamic security facts must never be hidden behind generic reassurance. The UI must expose the authority boundary clearly, utilizing Simple and Advanced experiences to cater to different user technical proficiencies while maintaining the same underlying authority boundary.

  • Install Permission Summary: "This plugin will operate in an isolated sandbox. It may request to read specific files, but it cannot access the internet without your permission."
  • Simple Experience (Runtime Approval): "The plugin 'FinanceScraper' wants to read your emails from 'banking@example.com'. \[Allow Once\] \[Deny\]"
  • Advanced Experience (Runtime Approval): Exposes the exact capability string (plugin.email.read), the specific URIs requested, the cryptographic hash of the plugin binary, and the duration of the proposed grant.
  • Browser & Email Warning: Browsers and emails are high-consequence because a single trusted process manages multiple identities, financial sessions, and raw external communications. The prompt must explicitly state: "Warning: Granting access to the browser allows this plugin to view your active login sessions, bypass two-factor authentication for active tabs, and read personal messages." Treating the entire browser process as uniformly safe is a critical anti-pattern.
  • Credential/Purchase Warning: "This action requires direct financial authorization. The plugin will be paused while you authenticate."
  • Remote-Origin Warning: "A remote user (Device: Owner\_Phone) is attempting to execute this action on your local desktop. \[Allow for this session\] \[Deny\]."

9. Remote authority and emergency control

Protected remote operations introduce a paradigm where the local user may not be the direct initiator of an action. Consequently, locally initiated and remotely initiated requests must differ significantly in policy and evidence.

Remote Session Binding

Locally initiated requests rely on the logged-in user's active desktop session token. Remotely initiated requests must cryptographically bind a remote session ID, a timestamp, and a geographic/network origin fact to the request payload. \[Security synthesis\]: The PDP must prioritize Local User Overrides; a local "Deny" rule or active desktop presence restriction always supersedes a remote "Allow" command18.

Emergency Stop Mechanics

The local user must retain an unconditional, un-interceptable hardware or keyboard macro (e.g., Ctrl+Alt+Shift+Pause) to trigger an emergency stop. \[Platform guarantee\]: Because the plugins are strictly contained within Windows Job Objects, the Host can execute PInvoke.SetInformationJobObject to manipulate the limits, or simply terminate the root handle. When the Host closes the Job Object handle, the JOB\_OBJECT\_LIMIT\_KILL\_ON\_JOB\_CLOSE flag ensures that the OS immediately and ungracefully kills all processes and child processes inside the Job boundary8. This architectural feature terminates queued work, flushes active grants in memory, and halts execution instantly without relying on the plugin to gracefully exit or respond to cancellation tokens. Active durable rules must be temporarily suspended, and network sockets held by the Host on behalf of the plugin must be forcefully closed. Following a restart, network loss, or service outage, remote commands older than a defined clock-skew threshold (e.g., 60 seconds) must be discarded as stale to prevent replay attacks.

10. Secrets and privacy-safe audit

Brokered Secret Flow

Plugins must never receive raw credentials (e.g., OAuth tokens, database passwords) in plaintext, as memory scraping or arbitrary read exploits could easily exfiltrate them16. \[Policy proposal\]: The host broker acts as a secure, opaque proxy. If a plugin requires an API key to communicate with an external service, the Host retains the raw key within the encrypted Windows Credential Manager. The plugin requests an outbound HTTP call via the gRPC broker, passing an opaque reference ID. The Host evaluates the policy, and upon approval, injects the Authorization header into the request after it has left the sandbox boundary. The plugin only receives the sanitized HTTP response.

Privacy-Safe Audit Receipts

Audit logs are essential for non-repudiation and forensic analysis but must not become an inadvertent vector for data exfiltration or privacy violations52. \[Security synthesis\]: To prove identity, decision, scope, and execution without compromising privacy, audit receipts must include:

  • Timestamp, Decision (Allow/Deny), Plugin\_Identity\_Hash, Capability\_Requested, Target\_Resource\_URI\_Masked, Evaluation\_Policy\_Version, Initiation\_Origin (Local/Remote), and Revocation\_Event\_ID (if applicable).
  • Logs must strictly exclude: Raw email body content, screenshots, plaintext passwords, private file contents, and user prompt inputs. Log integrity should be protected via append-only files or Event Tracing for Windows (ETW) to prevent audit tampering by compromised components52.

11. Threat model

A comprehensive defense-in-depth model acknowledges that architectural boundaries will be vigorously tested by advanced adversaries. The following threat vectors must be systematically mitigated:

  1. Confused Deputy & Prompt Injection: As plugins increasingly integrate with LLMs, they become susceptible to indirect prompt injection. An attacker embeds malicious instructions within third-party content (e.g., an email or webpage) which the AI misinterprets as legitimate commands, directing the plugin to execute unauthorized actions (MCP-T2, MCP-T4)15. Mitigation: The Host's strict capability schema and UI consent dialogs break the confused deputy chain. The defense is credential isolation, not prompt hardening. Even if the LLM is hijacked, the requested destructive action hits the PEP, triggering a human approval dialog that the LLM cannot programmatically click50.
  2. Time-of-Check/Time-of-Use (TOCTOU) & Symlink Escapes: A malicious plugin might request to write to a permitted directory (C:\\Safe\\), wait for the broker to approve the path during the check phase, and instantly replace C:\\Safe\\ with a symbolic link pointing to a restricted directory (C:\\Windows\\System32\\) before the broker executes the write phase14. Mitigation: The broker must resolve all paths natively, disable following reparse points during the final handle creation utilizing O\_NOFOLLOW semantics or Windows equivalents, and perform operations using file descriptors opened exactly once during the check phase57.
  3. DNS Rebinding & Localhost Abuse: A plugin may attempt to bypass network restrictions by resolving an external domain to 127.0.0.1 after the initial security check, exploiting the Same-Origin Policy to attack local services22. Mitigation: The AppContainer lacks loopback capabilities by default6. If the broker processes outbound HTTP requests on behalf of the plugin, it must resolve the DNS internally, cache the IP, and strictly drop any connections pointing to 127.0.0.0/8, 10.0.0.0/8, or 192.168.0.0/164.
  4. Named Pipe Impersonation: A plugin may attempt to create a malicious Named Pipe and trick the privileged Host into connecting to it, subsequently stealing the Host's SYSTEM token20. Mitigation: The Host must never connect to pipes created by the plugin. The Host strictly acts as the Named Pipe server, establishing the pipe prior to launching the plugin, and utilizing FILE\_FLAG\_FIRST\_PIPE\_INSTANCE to prevent pipeline squatting20.
  5. Child-Process Escapes & Handle Inheritance: A plugin may attempt to spawn elevated child processes or abuse inherited handles. Mitigation: Job objects enforce absolute active process limits4. The STARTUPINFOEX structure must use a strictly controlled handle inheritance allowlist (PROC\_THREAD\_ATTRIBUTE\_HANDLE\_LIST) to ensure the plugin cannot inherit raw file handles that the Host left open7.

12. Automated and specialist verification

Verifying the integrity of the containment model requires a dual approach of continuous automated testing and adversarial red-teaming.

  • Automated Policy Tests: Deterministic unit tests must evaluate every branch of the PDP logic matrix. Schema tests must validate manifest parsing, while property-based matching tests assert that Deny rules always override Allow rules, that expired durable grants return default denials, and that remote requests lacking cryptographic binding fail instantly.
  • Fuzzing the Broker IPC: The Named Pipe gRPC interface must be subjected to continuous fuzzing to identify buffer overflows, malformed serialization attacks, and memory leaks that could crash the Host process.
  • Adversarial Fixture Plugins: Deploy purpose-built, malicious "fixture" plugins within the integration test suite that actively attempt to:
  • Call CreateProcess to spawn a shell (Expected: Blocked by Job Object / AppContainer).
  • Perform a rapid Symlink swap via concurrent threading to test TOCTOU resilience.
  • Bind a local socket on port 8080 (Expected: Blocked by AppContainer capabilities).
  • Specialist Assessment: \[External guidance\]: Claims regarding the impenetrability of the AppContainer LowBox tokens, the cryptographic derivation of the AppContainer SID, and the resilience against kernel-level Handle Duplication require a formal Windows security assessment by specialized, third-party red teams.

13. Open implementation and policy questions

Several edge cases remain undefined and require organization-specific risk tolerance assessments prior to implementation:

  1. Clipboard Monitoring: Does a productivity plugin require continuous read access to the clipboard to function as an assistant, and how can the UI indicate that the clipboard is being actively monitored without overwhelming the user with constant pop-ups?
  2. Legitimate Symlinks: How does the file-broker elegantly handle legitimate developer symlinks (e.g., Node.js node\_modules junctions) without triggering the strict TOCTOU anti-symlink defenses, which typically fail closed upon encountering any reparse point65?
  3. UI Spoofing: If the plugin commands the automation of the desktop, how does the OS prevent the plugin from drawing a fake "Consent" dialog over the actual Host's PEP dialog to trick the user into authorizing a destructive action17?

14. Limitations and residual risk

No sandbox is entirely impermeable. The proposed architecture fundamentally isolates the plugin from the Operating System, but it cannot secure external accounts if the user explicitly grants the plugin access to them. \[Platform limitation\]: If the user approves a prompt granting the plugin access to their live browser session, the plugin possesses the legitimate authority to manipulate the Document Object Model (DOM), read secure cookies, and act on behalf of the user's logged-in identity to exfiltrate data or initiate purchases16. The Operating System and the Host broker cannot distinguish between a "good" DOM manipulation and a "bad" DOM manipulation once the trust boundary is bridged. Furthermore, the Host remains susceptible to zero-day privilege escalation vulnerabilities within the Windows kernel itself (e.g., win32k.sys vulnerabilities) that could allow a heavily sandboxed process inside an AppContainer to escape66. Therefore, defense-in-depth, strict UI gating, user education, and minimizing the blast radius of compromised endpoints remain the ultimate mitigating factors against residual risk.

15. Sources

The findings and architectural recommendations in this report are synthesized from a rigorous examination of authoritative industry sources and platform-specific technical documentation. Foundational security principles and threat modeling frameworks were adapted from the Open Worldwide Application Security Project (OWASP) guidelines on authorization and prompt injection defenses, alongside the National Institute of Standards and Technology (NIST) directives on Zero Trust Architecture. Deep technical specifics regarding Windows kernel behavior, AppContainer lifecycle management, and Job Object constraints were sourced directly from Microsoft Learn platform documentation, supplemented by applied research from offensive security analysts detailing Named Pipe impersonation vulnerabilities (e.g., PrintSpoofer) and token manipulation techniques. Mitigations for Time-of-Check to Time-of-Use (TOCTOU) file race conditions were informed by recent vulnerability disclosures (such as CVE-2025-68146 in Python filelock libraries) and secure coding best practices. Furthermore, the handling of indirect prompt injection and confused deputy attacks within Multi-Agent Systems reflects the latest research from AI security consortiums and specialized threat intelligence reports, ensuring the proposed model addresses the unique vulnerabilities introduced by Large Language Model integrations. This is for informational purposes only. For medical advice or diagnosis, consult a professional.

Works cited

  1. Overview of upgrading Windows Forms apps \- Microsoft Learn, https://learn.microsoft.com/en-us/dotnet/desktop/winforms/migration/
  2. .NET Framework technologies unavailable on .NET 6+ | Microsoft Learn, https://learn.microsoft.com/en-us/dotnet/core/porting/net-framework-tech-unavailable
  3. Sandboxing Python with Win32 App Isolation \- Windows Developer Blog, https://blogs.windows.com/windowsdeveloper/2024/03/06/sandboxing-python-with-win32-app-isolation/
  4. Building Secure Sandboxes for Code Execution on Windows \- n1n.ai, https://explore.n1n.ai/blog/building-secure-sandboxes-code-execution-windows-2026-05-14
  5. Building a safe, effective sandbox to enable Codex on Windows \- OpenAI, https://openai.com/index/building-codex-windows-sandbox/
  6. Workpackage 2: Analysis of Windows 10 \- BSI, https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Cyber-Sicherheit/SiSyPHus/Workpackage2\_Analyse\_Gesamtsystem.pdf?\_\_blob=publicationFile\&v=1
  7. Windows renderer sandbox (Job objects \+ AppContainer \+ restricted token) \- GitHub, https://github.com/wilsonzlin/fastrender/blob/main/docs/windows\_sandbox.md
  8. Terminating a Process and any Child Processes with a Timeout \- Stack Overflow, https://stackoverflow.com/questions/35704615/terminating-a-process-and-any-child-processes-with-a-timeout
  9. Kill child process when parent process is killed \- Stack Overflow, https://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed
  10. Killing all child processes when the parent exits (Job Object) \- Meziantou's blog, https://www.meziantou.net/killing-all-child-processes-when-the-parent-exits-job-object.htm
  11. GrpcDotNetNamedPipes 3.1.0 \- NuGet, https://www.nuget.org/packages/GrpcDotNetNamedPipes/
  12. Inter-process communication with gRPC | Microsoft Learn, https://learn.microsoft.com/en-us/aspnet/core/grpc/interprocess?view=aspnetcore-10.0
  13. cyanfish/grpc-dotnet-namedpipes: Named pipe transport for gRPC in C\#/.NET \- GitHub, https://github.com/cyanfish/grpc-dotnet-namedpipes
  14. What Is Time of Check Time of Use (TOCTOU)? Explained \- DeepStrike, https://deepstrike.io/blog/what-is-time-of-check-time-of-use-toctou
  15. Taming Various Privilege Escalation in LLM-Based Agent Systems: A Mandatory Access Control Framework \- arXiv, https://arxiv.org/html/2601.11893v1
  16. What Is Prompt Injection? \- PurpleSec, https://purplesec.us/resources/ai-security-glossary/prompt-injection/
  17. Confused ChatGPT: Cross-App Context Poisoning via First-Party APIs \- arXiv, https://arxiv.org/html/2606.00485v1
  18. Principles of security \- OWASP Developer Guide, https://devguide.owasp.org/en/02-foundations/03-security-principles/
  19. Secure Product Design \- OWASP Cheat Sheet Series, https://cheatsheetseries.owasp.org/cheatsheets/Secure\_Product\_Design\_Cheat\_Sheet.html
  20. Named Pipe Client Impersonation \- HackTricks, https://hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/named-pipe-client-impersonation.html
  21. Prompt injection: types, real-world CVEs, and enterprise defenses \- Vectra AI, https://www.vectra.ai/topics/prompt-injection
  22. nccgroup/singularity: A DNS rebinding attack framework. \- GitHub, https://github.com/nccgroup/singularity
  23. DNS Rebinding Attack: How Malicious Websites Exploit Private Networks, https://unit42.paloaltonetworks.com/dns-rebinding/
  24. DNS Rebinding Attacks \- AppCheck Ltd, https://appcheck-ng.com/dns-rebinding-attacks-past-present-future/
  25. A plugin system with .NET Core \- CodeTherapist, https://codetherapist.com/blog/netcore3-plugin-system/
  26. Exploiting a “Simple” Vulnerability, Part 2 – What If We Made Exploitation Harder?, https://windows-internals.com/exploiting-a-simple-vulnerability-part-2-what-if-we-made-exploitation-harder/
  27. You Won't Believe what this One Line Change Did to the Chrome Sandbox \- Project Zero, https://projectzero.google/2020/04/you-wont-believe-what-this-one-line.html
  28. Is it possible to prevent a process from making any Windows API calls? \- Stack Overflow, https://stackoverflow.com/questions/70801911/is-it-possible-to-prevent-a-process-from-making-any-windows-api-calls
  29. AppContainer for legacy apps \- Win32 apps | Microsoft Learn, https://learn.microsoft.com/en-us/windows/win32/secauthz/appcontainer-for-legacy-applications-
  30. Windows Internals, Part 1: System architecture, processes, threads, memory management, and more, https://empyreal96.github.io/nt-info-depot/Windows-Internals-PDFs/Windows%20System%20Internals%207e%20Part%201.pdf
  31. Windows apps--packaging, deployment, and process \- Microsoft Learn, https://learn.microsoft.com/en-us/windows/apps/get-started/intro-pack-dep-proc
  32. Universal Windows Apps \- BSI, https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Cyber-Security/SiSyPHuS/AP9/Workpackage9\_Analysis\_Universal\_Windows\_Apps\_and\_Windows\_Information\_Protection\_Part1.pdf?\_\_blob=publicationFile\&v=3
  33. Application Isolation \- Windows 11 Security Book \- Microsoft Learn, https://learn.microsoft.com/en-us/windows/security/book/application-security-application-isolation
  34. Sandbox Maker · HotCakeX/Harden-Windows-Security Wiki \- GitHub, https://github.com/HotCakeX/Harden-Windows-Security/wiki/Sandbox-Maker
  35. 40078787 \- Chromium Issue, https://issues.chromium.org/40078787
  36. Local inter-process communication over named pipes with ASP.NET Core or StreamJsonRpc in .NET \- Anthony Simmon, https://anthonysimmon.com/local-ipc-over-named-pipes-aspnet-core-streamjsonrpc-dotnet/
  37. Inter-process communication with gRPC and Named pipes \- Microsoft Learn, https://learn.microsoft.com/en-us/aspnet/core/grpc/interprocess-namedpipes?view=aspnetcore-10.0
  38. How to configure NamedPipes permissions when using gRPC ASP.NET Core over ... \- Stack Overflow, https://stackoverflow.com/questions/78053229/how-to-configure-namedpipes-permissions-when-using-grpc-asp-net-core-over-namedp
  39. Securely extending and running low-code applications with C\# 28th February 2023 \- arXiv, https://arxiv.org/pdf/2307.06340
  40. Can't open thread token of NamedPipe client: "Cannot open an anonymous level security token" \- Stack Overflow, https://stackoverflow.com/questions/71145570/cant-open-thread-token-of-namedpipe-client-cannot-open-an-anonymous-level-sec
  41. 命名管道 \- Fay·D·Flourite, https://0xfay.github.io/posts/%E5%91%BD%E5%90%8D%E7%AE%A1%E9%81%93
  42. windows package \- golang.org/x/sys/windows \- Go Packages, https://pkg.go.dev/golang.org/x/sys/windows
  43. CODE WHITE | CVE-2019-19470: Rumble in the Pipe, https://code-white.com/blog/2020-01-cve-2019-19470-rumble-in-pipe/
  44. Raining SYSTEM Shells with Citrix Workspace app \- Pen Test Partners, https://www.pentestpartners.com/security-blog/raining-system-shells-with-citrix-workspace-app/
  45. Bridging the Privacy Gap: Enhanced User Consent Mechanisms on the Web, https://www.researchgate.net/publication/369179265\_Bridging\_the\_Privacy\_Gap\_Enhanced\_User\_Consent\_Mechanisms\_on\_the\_Web
  46. How to Mitigate and Reduce Alert Fatigue: A Guide for MSPs, https://saasalerts.com/how-msps-can-mitigate-and-reduce-alert-fatigue/
  47. How to Minimize Alert Fatigue in Cybersecurity \- Ridge Security, https://ridgesecurity.ai/blog/how-to-minimize-alert-fatigue-in-cybersecurity/
  48. Packaging a Win32 app isolation application with Visual Studio \- Microsoft Learn, https://learn.microsoft.com/en-us/windows/win32/secauthz/app-isolation-packaging-with-vs
  49. How terminate child processes when parent process terminated in C\# \- Stack Overflow, https://stackoverflow.com/questions/3235218/how-terminate-child-processes-when-parent-process-terminated-in-c-sharp
  50. Prompt Injection, Credential Theft, and AI Trust Boundaries: What Developers Building on LLMs Need to Understand \- Kiteworks, https://www.kiteworks.com/cybersecurity-risk-management/prompt-injection-credential-theft-ai-trust/
  51. Threat-Modeling the Model Context Protocol \- Abubakar Siddiq Ango, https://abuango.me/blog/threat-modeling-the-model-context-protocol/
  52. A09 Security Logging and Alerting Failures \- OWASP Top 10:2025, https://owasp.org/Top10/2025/A09\_2025-Security\_Logging\_and\_Alerting\_Failures/
  53. Bypassing Access Mask Auditing Strategies | by Jonathan Johnson \- Medium, https://jonny-johnson.medium.com/bypassing-access-mask-auditing-strategies-480fb641c158
  54. Defend against indirect prompt injection attacks | Microsoft Learn, https://learn.microsoft.com/en-us/security/zero-trust/sfi/defend-indirect-prompt-injection
  55. Terminal Sandbox: Infrastructure for the Agent Harness \- Qoder, https://qoder.com/blog/qoder-desktop-sandbox
  56. 12 Questions and Answers About toctou race condition \- Security Scientist, https://www.securityscientist.net/blog/12-questions-and-answers-about-toctou-race-condition/
  57. Exploiting TOCTOU vulnerability using OpLock and Junctions, https://lucabarile.github.io/Blog/toctou/index.html
  58. TOCTOU race condition allows symlink attacks during lock file creation \- GitHub, https://github.com/tox-dev/filelock/security/advisories/GHSA-w853-jp5j-5j7f
  59. Security: Symlink TOCTOU in filesystem tools — resolve-then-access window · Issue \#4790 · HKUDS/nanobot \- GitHub, https://github.com/HKUDS/nanobot/issues/4790
  60. How to handle TOCTOU problem between access() and unlink()? \- Stack Overflow, https://stackoverflow.com/questions/75587120/how-to-handle-toctou-problem-between-access-and-unlink
  61. Agentic Danger: DNS Rebinding Exposes Internal MCP Servers \- Straiker, https://www.straiker.ai/blog/agentic-danger-dns-rebinding-exposing-your-internal-mcp-servers
  62. Technical Advisory – Ollama DNS Rebinding Attack (CVE-2024-28224) \- NCC Group, https://www.nccgroup.com/research/technical-advisory-ollama-dns-rebinding-attack-cve-2024-28224/
  63. K7 Antivirus: Named pipe abuse, registry manipulation and privilege escalation (CVE-2025-67826) \- Quarkslab's blog, https://blog.quarkslab.com/k7-antivirus-named-pipe-abuse-registry-manipulation-and-privilege-escalation.html
  64. Process API Improvements in .NET 11 \- Microsoft Developer Blogs, https://devblogs.microsoft.com/dotnet/process-api-improvements-in-dotnet-11/
  65. Windows Local Privilege Escalation \- HackTricks, https://hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/index.html
  66. CVE-2026-2441: The Chrome CSS Zero-Day That Starts Inside the Sandbox and Rarely Ends There \- Penligent, https://www.penligent.ai/hackinglabs/cve-2026-2441-the-chrome-css-zero-day-that-starts-inside-the-sandbox-and-rarely-ends-there/