repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
telephony-tapsrv-arbitrary-dword-write-to-rce.mdMarkdown58 lines5.5 KiBsource raw download

title: "Telephony tapsrv Arbitrary DWORD Write to RCE (TAPI Server Mode)" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/windows-local-privilege-escalation/telephony-tapsrv-arbitrary-dword-write-to-rce.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/telephony-tapsrv-arbitrary-dword-write-to-rce.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Telephony tapsrv Arbitrary DWORD Write to RCE (TAPI Server Mode)#

When the Windows Telephony service (TapiSrv, tapisrv.dll) is configured as a TAPI server, it exposes the tapsrv MSRPC interface over the \pipe\tapsrv named pipe to authenticated SMB clients. CVE-2026-20931 in asynchronous event delivery lets an attacker turn a purported mailslot handle into a controlled 4-byte write to a pre-existing file writable by NETWORK SERVICE. The published chain overwrites the Telephony administrator list, then reaches an administrator-only DLL load and executes as NETWORK SERVICE.[1][2]

Attack Surface#

Primitive: Mailslot Path Confusion → Arbitrary DWORD Write#

Forcing Deterministic Writes#

  1. Open target file: ClientAttach with pszDomainUser = <existing writable path> (e.g., C:\Windows\TAPI\tsec.ini).
  2. For each DWORD to write, execute this RPC sequence against ClientRequest:
    • Initialize (Req_Func 47): set InitContext = <4-byte value> and pszModuleName = DIALER.EXE (or another top entry in the per-user priority list).
    • LRegisterRequestRecipient (Req_Func 61): dwRequestMode = LINEREQUESTMODE_MAKECALL, bEnable = 1 (registers the line app, recalculates highest priority recipient).
    • TRequestMakeCall (Req_Func 121): forces NotifyHighestPriorityRequestRecipient, generating the async event.
    • GetAsyncEvents (Req_Func 0): dequeue/completes the write.
    • LRegisterRequestRecipient again with bEnable = 0 (unregister).
    • Shutdown (Req_Func 86) to tear down the line app.

From DWORD Write to RCE inside TapiSrv#

  1. Grant yourself Telephony “admin”: target C:\Windows\TAPI\tsec.ini and append [TapiAdministrators]\r\n<DOMAIN\\user>=1 using the 4-byte writes above. Start a new session (ClientAttach) so the service re-reads the INI and sets ptClient->dwFlags |= 9 for your account.
  2. Admin-only DLL load: send GetUIDllName with dwObjectType = TUISPIDLL_OBJECT_PROVIDERID and supply a path via dwProviderFilenameOffset. For admins, the service does LoadLibrary(path) then calls the export TSPI_providerUIIdentify:
    • Works with UNC paths to a real Windows SMB share; some attacker SMB servers fail with ERROR_SMB_GUEST_LOGON_BLOCKED.
    • Alternative: slowly drop a local DLL using the same 4-byte write primitive, then load it.
  3. Payload: the export executes under NETWORK SERVICE. A minimal DLL can run cmd.exe /c whoami /all > C:\Windows\Temp\poc.txt and return a non-zero value (e.g., 0x1337) so the service unloads the DLL, confirming execution.[1]

Hardening / Detection Notes#

References#