* Invoke-Item (alias ii) opens a file with its default handler (ShellExecute * on Windows, open/xdg-open on Unix). On an .exe/.ps1/.bat/.cmd this is RCE. * Bug 008: ii is in no blocklist; passthrough prompt doesn't explain the * exec hazard. Always ask — there is no safe variant (even opening .tx
( parsed: ParsedPowerShellCommand, )
| 820 | * invoke a user-configured handler that accepts arguments). |
| 821 | */ |
| 822 | function checkInvokeItem( |
| 823 | parsed: ParsedPowerShellCommand, |
| 824 | ): PowerShellSecurityResult { |
| 825 | for (const cmd of getAllCommands(parsed)) { |
| 826 | const lower = cmd.name.toLowerCase() |
| 827 | if (lower === 'invoke-item' || lower === 'ii') { |
| 828 | return { |
| 829 | behavior: 'ask', |
| 830 | message: |
| 831 | 'Invoke-Item opens files with the default handler (ShellExecute). On executable files this runs arbitrary code.', |
| 832 | } |
| 833 | } |
| 834 | } |
| 835 | return { behavior: 'passthrough' } |
| 836 | } |
| 837 | |
| 838 | /** |
| 839 | * Scheduled-task persistence primitives. Register-ScheduledJob was blocked |
nothing calls this directly
no test coverage detected