Skip to content

PowerShell

Validate PowerShell (latest/PowerShell 7) behaviors under the Secure Sandbox.

Objectives

  • Enforce deny-by-default egress and designated proxy routing for PowerShell web clients and raw sockets.
  • Verify IPv6 parity, DNS-evasion attempts (DoH), and WebSocket/protocol smuggling are denied.
  • Confirm file system isolation for writes (including alternate data streams) and protected host paths.
  • Prevent data exfiltration via clipboard.

Preconditions

  • Windows target with Turbo Launcher and Secure Sandbox.
  • PowerShell 7 available in the sandbox.

Controls Under Test

  • runtime.networking.egressDefaultAction
  • runtime.networking.proxy.* (designated proxy enforcement, pinning)
  • runtime.files.contexts
  • runtime.dataMotion.rules[]

Test Scenarios

IDCanonical IDScenarioProcedureExpected Outcome
SCEN-TOOL-POWERSHELL-01NET-EGRESS-01Direct IP egressInvoke-WebRequest -TimeoutSec 5 -Uri http://1.1.1.1Denied per default deny. Audit: action: deny, protocol: tcp.
SCEN-TOOL-POWERSHELL-02NET-EGRESS-05Unauthorized proxy$env:HTTPS_PROXY='http://attacker:8080'; Invoke-WebRequest https://example.com (or -Proxy http://attacker:8080)Denied; reason: "unauthorizedProxy", proxyEnforced: true.
SCEN-TOOL-POWERSHELL-03NET-EGRESS-06NO_PROXY bypass$env:NO_PROXY='*'; Invoke-WebRequest https://example.comDenied; reason: "proxyBypassAttempt", proxyEnforced: true.
SCEN-TOOL-POWERSHELL-04NET-EGRESS-08PAC/WPAD hijackConfigure unapproved PAC/WPAD; then Invoke-WebRequest https://example.comDenied/Ignored; `reason: "pacNotTrusted"
SCEN-TOOL-POWERSHELL-05NET-EGRESS-09Proxy fail-closedTake designated proxy down; Invoke-WebRequest https://example.comDenied; reason: "proxyUnavailable"; no direct fallback.
SCEN-TOOL-POWERSHELL-06NET-EGRESS-10Proxy identity/pinningIntercept proxy TLS with wrong CA; Invoke-WebRequest https://example.comTLS error/handshake failure; `reason: "certMismatch"
SCEN-TOOL-POWERSHELL-07NET-EGRESS-11IPv6 direct egressInvoke-WebRequest -Uri https://[2606:4700:4700::1111]/Denied; ipVersion: 6, action: deny.
SCEN-TOOL-POWERSHELL-08NET-EGRESS-12CONNECT to non-proxyInvoke-WebRequest -Proxy https://nonproxy.example:443 https://target.exampleDenied; reason: "destNotProxy", proxyEnforced: true.
SCEN-TOOL-POWERSHELL-09NET-EGRESS-13Raw TCP socket[System.Net.Sockets.TcpClient]::new('1.1.1.1',443)Denied by namespace/firewall; protocol: tcp.
SCEN-TOOL-POWERSHELL-10NET-EGRESS-03UDP egress$udp = [System.Net.Sockets.UdpClient]::new(); $udp.Connect('8.8.8.8',53); $udp.Send((,[byte]0*12),12)Denied; protocol: udp.
SCEN-TOOL-POWERSHELL-11NET-DNS-02DoH/DoT egressInvoke-WebRequest 'https://dns.google/dns-query?name=example.com' -Headers @{ 'accept'='application/dns-json' }Denied; reason: dohBlocked.
SCEN-TOOL-POWERSHELL-12NET-ISOLATE-01Localhost isolationTest-NetConnection -ComputerName 127.0.0.1 -Port 80 -InformationLevel QuietDenied; action: deny.
SCEN-TOOL-POWERSHELL-13HARD-FILES-01Write outside contextSet-Content -Path "$env:USERPROFILE\Desktop\exfil.txt" -Value 'secret'Denied/virtualized; fileOp shows deny/virtualize with path/context.
SCEN-TOOL-POWERSHELL-14HARD-FILES-01Alternate data streamsSet-Content -Path 'C:\\Users\\Public\\file.txt:secret' -Value 'payload'Denied/contained; audit shows ADS handling.
SCEN-TOOL-POWERSHELL-15HARD-HOST-03Protected host pathsSet-Content -Path 'C:\\Windows\\test.txt' -Value 'test'Access denied or virtualized.
SCEN-TOOL-POWERSHELL-16DM-CLIP-01Clipboard outboundSet-Clipboard 'secret' then attempt paste on hostDenied/processed per policy; channel: clipboard.
SCEN-TOOL-POWERSHELL-17DM-CLIP-04Terminal DLP (large base64)Paste large base64 (> policy limit) into PowerShell and run certutil -decode payload.b64 out.binDenied by size/quota; action: deny, channel: clipboard.
SCEN-TOOL-POWERSHELL-18NET-PROTO-07Protocol smuggling (WSS)Use [System.Net.WebSockets.ClientWebSocket] to open wss://echo.websocket.events and send a messageDenied/terminated; protocol mismatch noted in audit.

Evidence Requirements

  • Golden: category, action, rule.id, integrity.hash.
  • Network: protocol/alpn, ipVersion, proxyEnforced, reason (for example, unauthorizedProxy, proxyBypassAttempt, pacNotTrusted, proxyUnavailable, certMismatch, pinningFailed, destNotProxy).
  • Files: path, action/outcome (deny/virtualized), and context identifiers if applicable.
  • DataMotion: channel (for example, clipboard), action/outcome.