|
34 | 34 | # Authors:
|
35 | 35 | # Alberto Solino (@agsolino)
|
36 | 36 | # Dirk-jan Mollema / Fox-IT (https://www.fox-it.com)
|
| 37 | +# Sylvain Heiniger / Compass Security (https://www.compass-security.com) |
37 | 38 | #
|
38 | 39 |
|
39 | 40 | import argparse
|
|
52 | 53 |
|
53 | 54 | from impacket import version
|
54 | 55 | from impacket.examples import logger
|
55 |
| -from impacket.examples.ntlmrelayx.servers import SMBRelayServer, HTTPRelayServer, WCFRelayServer, RAWRelayServer |
| 56 | +from impacket.examples.ntlmrelayx.servers import SMBRelayServer, HTTPRelayServer, WCFRelayServer, RAWRelayServer, RPCRelayServer |
56 | 57 | from impacket.examples.ntlmrelayx.utils.config import NTLMRelayxConfig, parse_listening_ports
|
57 | 58 | from impacket.examples.ntlmrelayx.utils.targetsutils import TargetsProcessor, TargetsFileWatcher
|
58 | 59 | from impacket.examples.ntlmrelayx.servers.socksserver import SOCKS
|
@@ -194,14 +195,15 @@ def start_servers(options, threads):
|
194 | 195 | c.setOutputFile(options.output_file)
|
195 | 196 | c.setdumpHashes(options.dump_hashes)
|
196 | 197 | c.setLDAPOptions(options.no_dump, options.no_da, options.no_acl, options.no_validate_privs, options.escalate_user, options.add_computer, options.delegate_access, options.dump_laps, options.dump_gmsa, options.dump_adcs, options.sid, options.add_dns_record)
|
197 |
| - c.setRPCOptions(options.rpc_mode, options.rpc_use_smb, options.auth_smb, options.hashes_smb, options.rpc_smb_port) |
| 198 | + c.setRPCOptions(options.rpc_mode, options.rpc_use_smb, options.auth_smb, options.hashes_smb, options.rpc_smb_port, options.icpr_ca_name) |
198 | 199 | c.setMSSQLOptions(options.query)
|
199 | 200 | c.setInteractive(options.interactive)
|
200 | 201 | c.setIMAPOptions(options.keyword, options.mailbox, options.all, options.imap_max)
|
201 | 202 | c.setIPv6(options.ipv6)
|
202 | 203 | c.setWpadOptions(options.wpad_host, options.wpad_auth_num)
|
203 | 204 | c.setSMB2Support(options.smb2support)
|
204 | 205 | c.setSMBChallenge(options.ntlmchallenge)
|
| 206 | + c.setSMBRPCAttack(options.rpc_attack) |
205 | 207 | c.setInterfaceIp(options.interface_ip)
|
206 | 208 | c.setExploitOptions(options.remove_mic, options.remove_target)
|
207 | 209 | c.setWebDAVOptions(options.serve_image)
|
@@ -242,6 +244,8 @@ def start_servers(options, threads):
|
242 | 244 | c.setListeningPort(options.wcf_port)
|
243 | 245 | elif server is RAWRelayServer:
|
244 | 246 | c.setListeningPort(options.raw_port)
|
| 247 | + elif server is RPCRelayServer: |
| 248 | + c.setListeningPort(options.rpc_port) |
245 | 249 |
|
246 | 250 | s = server(c)
|
247 | 251 | s.start()
|
@@ -293,11 +297,13 @@ def stop_servers(threads):
|
293 | 297 | serversoptions.add_argument('--no-http-server', action='store_true', help='Disables the HTTP server')
|
294 | 298 | serversoptions.add_argument('--no-wcf-server', action='store_true', help='Disables the WCF server')
|
295 | 299 | serversoptions.add_argument('--no-raw-server', action='store_true', help='Disables the RAW server')
|
| 300 | + serversoptions.add_argument('--no-rpc-server', action='store_true', help='Disables the RPC server') |
296 | 301 |
|
297 | 302 | parser.add_argument('--smb-port', type=int, help='Port to listen on smb server', default=445)
|
298 | 303 | parser.add_argument('--http-port', help='Port(s) to listen on HTTP server. Can specify multiple ports by separating them with `,`, and ranges with `-`. Ex: `80,8000-8010`', default="80")
|
299 | 304 | parser.add_argument('--wcf-port', type=int, help='Port to listen on wcf server', default=9389) # ADWS
|
300 | 305 | parser.add_argument('--raw-port', type=int, help='Port to listen on raw server', default=6666)
|
| 306 | + parser.add_argument('--rpc-port', type=int, help='Port to listen on rpc server', default=135) |
301 | 307 |
|
302 | 308 | parser.add_argument('--no-multirelay', action="store_true", required=False, help='If set, disable multi-host relay (SMB and HTTP servers)')
|
303 | 309 | parser.add_argument('--keep-relaying', action="store_true", required=False, help='If set, keeps relaying to a target even after a successful connection on it')
|
@@ -338,15 +344,17 @@ def stop_servers(threads):
|
338 | 344 | smboptions.add_argument('-e', action='store', required=False, metavar = 'FILE', help='File to execute on the target system. '
|
339 | 345 | 'If not specified, hashes will be dumped (secretsdump.py must be in the same directory)')
|
340 | 346 | smboptions.add_argument('--enum-local-admins', action='store_true', required=False, help='If relayed user is not admin, attempt SAMR lookup to see who is (only works pre Win 10 Anniversary)')
|
| 347 | + smboptions.add_argument('--rpc-attack', action='store', choices=[None, "TSCH", "ICPR"], required=False, default=None, help='Select the attack to perform over RPC over named pipes.') |
341 | 348 |
|
342 | 349 | #RPC arguments
|
343 | 350 | rpcoptions = parser.add_argument_group("RPC client options")
|
344 |
| - rpcoptions.add_argument('-rpc-mode', choices=["TSCH"], default="TSCH", help='Protocol to attack, only TSCH supported') |
| 351 | + rpcoptions.add_argument('-rpc-mode', choices=["TSCH", "ICPR"], default="TSCH", help='Protocol to attack') |
345 | 352 | rpcoptions.add_argument('-rpc-use-smb', action='store_true', required=False, help='Relay DCE/RPC to SMB pipes')
|
346 | 353 | rpcoptions.add_argument('-auth-smb', action='store', required=False, default='', metavar='[domain/]username[:password]',
|
347 | 354 | help='Use this credential to authenticate to SMB (low-privilege account)')
|
348 | 355 | rpcoptions.add_argument('-hashes-smb', action='store', required=False, metavar="LMHASH:NTHASH")
|
349 | 356 | rpcoptions.add_argument('-rpc-smb-port', type=int, choices=[139, 445], default=445, help='Destination port to connect to SMB')
|
| 357 | + rpcoptions.add_argument('-icpr-ca-name', action='store', default="", help='Name of the CA for ICPR attack') |
350 | 358 |
|
351 | 359 | #MSSQL arguments
|
352 | 360 | mssqloptions = parser.add_argument_group("MSSQL client options")
|
@@ -502,6 +510,9 @@ def stop_servers(threads):
|
502 | 510 | if not options.no_raw_server:
|
503 | 511 | RELAY_SERVERS.append(RAWRelayServer)
|
504 | 512 |
|
| 513 | + if not options.no_rpc_server: |
| 514 | + RELAY_SERVERS.append(RPCRelayServer) |
| 515 | + |
505 | 516 | if targetSystem is not None and options.w:
|
506 | 517 | watchthread = TargetsFileWatcher(targetSystem)
|
507 | 518 | watchthread.start()
|
|
0 commit comments