r/PowerShell • • May 15 '26

Information Running native PowerShell 7.6.1 inside an Android APK with no Termux/chroot/proot

Over the last couple days I’ve been experimenting with hosting the raw Microsoft.PowerShell.SDK directly inside a .NET 11 Android APK.

This is not a remote session, SSH client, or Linux container. The PowerShell runspace is running in-process on the Android device itself inside the app process.

Current stack:

  • .NET 11 (net11.0-android)
  • PowerShell 7.6.1
  • React/Vite WebView frontend
  • Persistent background runspace
  • Single-file HTML applets loaded via iframe shell
  • Android ↔ PowerShell bridge over a Base64 JSON IPC layer

A few interesting problems had to be solved to get PowerShell booting cleanly on Android:

  • intercepting libpsl-native syslog calls that assume glibc semantics
  • bypassing IL trimming issues caused by PowerShell’s reflection-heavy cmdlet discovery
  • synchronizing React/WebView startup against the background runspace lifecycle

I documented the details in the repo, including the DllImportResolver interception layer and the Android-compatible stub library used to bypass the syslog crash path.

Repo:
Android-Terminal GitHub Repository

The current direction is less “terminal emulator” and more “PowerShell-native micro frontend environment”:

  • applets as standalone HTML tools
  • persistent runspace
  • Android SAF integration
  • PSRP experimentation
  • semantic object transport instead of plain terminal text

Still early, but the core runtime is working on physical ARM64 Android hardware today.

Would genuinely appreciate feedback from people familiar with PowerShell internals, hosting, PSRP, or Android runtime edge cases.

11 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/turbokid May 17 '26 edited May 17 '26

My point wasnt that attackers dont have other attack vectors, its more that its introducing a new execution surface (webview - IPC - Powershell) that doesnt currently exist. Powershell is also easier to write, so it lowers the barrier of entry, which allows people like script kiddies to use this. Any good public API has been hardened over time. What does this particular method bring that overrides the concern this will be used nefariously?