Commit Graph

54 Commits

Author SHA1 Message Date
Will 428d9061a4 Merge pull request #238 from hackjammer/dev
Improve output of Invoke-PrivescAudit
2017-09-17 14:27:25 -04:00
Dave Hull 0a894991dc Adds tolower() as it was dropping .DLL files in my local 2017-09-08 16:36:26 -05:00
Dave Hull 6eb3c6f281 Merge branch 'dev' of github.com:PowerShellMafia/PowerSploit into dev 2017-09-08 16:33:11 -05:00
Dave Hull bf652bcd26 Adds dlls from knowndll paths to knowndlls 2017-09-08 16:30:06 -05:00
b33f 3d0d32d9ee Path array fix for Get-ModifiablePath
This is a fix for:
https://github.com/PowerShellMafia/PowerSploit/issues/248
2017-08-10 22:05:41 +01:00
b33f fc43eb8cb7 Typo fix 2017-07-17 23:11:24 +01:00
HarmJ0y d12e1516f8 increased PowerUp error checking 2017-05-20 01:54:55 -04:00
HackJammer a78474aa5c Add Name alias to PowerUp object properties for easier parsing 2017-05-10 00:50:42 +01:00
HackJammer 52289768a9 Default Invoke-PrivEscAudit to return objects for parsing 2017-05-10 00:31:44 +01:00
HarmJ0y 94438eda67 Replaced Invoke-WScriptUACBypass with @enigma0x3's Invoke-EventVwrBypass function 2016-12-21 00:41:51 -05:00
HarmJ0y 1118f53dc2 Added "-InformationClass Type" to Get-TokenInformation to enumerate token type and impersonation level
Added Get-ProcessTokenType to enumerate type/impersonation level of a specified process
2016-12-21 00:35:38 -05:00
HarmJ0y 1916464092 bug fix in Get-TokenInformation 2016-12-20 23:13:16 -05:00
HarmJ0y 9ed26d65a8 removed whitespace 2016-12-14 18:25:15 -05:00
HarmJ0y 07ccc07fc6 mods to Get-System for it to pass PSScriptAnalyzer 2016-12-14 13:10:37 -05:00
HarmJ0y 7964823e3f Added documentation for PowerUp 2016-12-14 11:53:29 -05:00
HarmJ0y eae4695b13 PowerUp update:
-Standardized documentation, including adding output object types and required dependencies to all functions
-Added Get-ProcessTokenPrivilege to enumerate the current (or remote) process token privileges, replacing Get-CurrentUserTokenGroupSid
-Added Enable-Privilege to enable privileges using RtlAdjustPrivilege
-Added @enigma0x3's Invoke-WScriptUACBypass function
-Renamed Invoke-AllChecks to Invoke-PrivescAudit, added alias mapping
-Added tests for Get-ProcessTokenPrivilege, Enable-Privilege, and Invoke-WScriptUACBypass
-Renamed helper functions for consistency
-Passes PSScriptAnalyzer!
2016-12-12 14:25:20 -05:00
HarmJ0y 863699d97e typo fix for #179 2016-12-12 13:49:10 -05:00
Nick Landers 5ac6c919dd Service DACL false positive 2016-09-13 15:43:34 -06:00
HarmJ0y 8d46d02099 Merge pull request #161 from joncave/batnewlines
PowerUp: Remove badly encoded new lines from .bat output
2016-07-15 14:14:21 -07:00
Jon Cave 9596f68274 PowerUp: Remove badly encoded new lines from .bat output
The current implementation results in a .bat like:

  @echo off\n
  start /b net user john Password123! /add && timeout /t 5 && net localgroup Administrators john /add\n
  start /b "" cmd /c del "%~f0"&exit /b

With literal "\n" strings at the end of the first two lines.

A new line in a PowerShell string should be "`n". However, an extra new
line isn't actually necessary in this case.
2016-06-30 10:12:27 +02:00
Jon Cave 9d2b9d7631 PowerUp: Allocate enough space for TOKEN_GROUPS
Make an initial call to GetTokenInformation() with a NULL buffer to get
the actual buffer size required. Prevents "The data area passed to a system
call is too small" error being thrown.
2016-06-30 09:00:31 +02:00
Harmj0y 8dea905998 Fixed bug in Get-ModifiablePath that resulted in spaces being expanded to the current directory location
Fixed other logic bugs in Get-ModifiablePath
Fixed bug in Add-ServiceDacl when the [ServiceProcess.ServiceController] wasn't loaded yet by Get-Service
Error handling for Get-CachedGPPPassword
Changed some Write-Warnings to Write-Verbose
Updated Privesc Pester tests for PowerUp
2016-06-23 17:51:17 -04:00
Harmj0y 5d7fe6b100 Corrected -Path parameter in Write-ServiceBinary 2016-06-07 13:00:14 -04:00
Harmj0y da86d76adb updated Privesc.psd1 and README.md 2016-06-06 15:43:01 -04:00
Harmj0y 5f8d8b0a10 Addded Get-CachedGPPPassword to PowerUp, based almost entirely on Get-GPPPassword.
Added Pester tests for Get-CachedGPPPassword.
2016-06-06 15:37:52 -04:00
Harmj0y e83cfae798 Get-ModifiablePath now also checks parent folders of files for modification
Bug fixes
Corrected PowerUp Pester tests
Changed 'Path' field to 'ModifiablePath' in 'Get-ModifiablePath'
Get-ServiceUnquoted now filters paths through Get-ModifiablePath
2016-06-04 22:06:21 -04:00
Harmj0y 4915945292 Renamed Get-RegistryAutoRun to Get-ModifiableRegistryAutoRun
Renamed Find-PathHijack to Find-PathDLLHijack
Fixed exposed functions in PowerSploit.psd1
2016-06-04 19:07:28 -04:00
Harmj0y 83d1413acd -Enum specification bug fix
-Additional error checking and documentation
-OpenProcessToken() call now uses TOKEN_QUERY instead of TOKEN_READ
2016-06-04 17:46:43 -04:00
Harmj0y 1f926e7fd6 Added SidAttributes enum, Get-CurrentUserTokenGroupSid now returns an object with SID and attributes fields 2016-06-03 23:37:52 -04:00
Harmj0y 09d253f070 Added Get-CurrentUserTokenGroupSid to enumerate all group SIDs the current user is a part of, regardless of being disabled.
Replaced 'whoami /groups' local admin + medium integrity check with comparison against Get-CurrentUserTokenGroupSid
2016-06-03 22:43:12 -04:00
Harmj0y 9711069b7e -Added ValueFromPipelineByPropertyName to Get-ModifiablePath to parse passed file objects
-Service functions now accept just -Name (instead of -Service/-ServiceName) that accepts has ValueFromPipelineByPropertyName set in order to handle service objects on the pipeline
-Moved PSReflect signatures to the bottom of the script
-Function and help cleanup
2016-06-03 19:03:11 -04:00
Harmj0y 8083c1e1bb Updated Privesc README.md and .psd1 to reflect the new PowerUp function names. 2016-06-02 02:14:38 -04:00
Harmj0y 3c209ee6b3 -Get-ModifiableFile renamed to Get-ModifiablePath
-Get-VulnSchTask renamed to Get-ModifiableScheduledTaskFile
-Get-VulnAutoRun renamed Get-RegistryAutoRun
-Get-RegAutoLogon renamed Get-RegistryAutoLogon
-Find-DLLHijack renamed to Find-ProcessDLLHijack for clarification, code cleaned up, -Process parameter added, output object detail expanded, and help expanded
-Removed most of the code from Find-PathHijack, replacing it with Get-ModifiablePath
-Cleaned up logic for Write-HijackDll
-Expanded help for the registry enumeration cmdlets
-Added local user creation options to Write-HijackDll to match Write-ServiceBinary
-Increased pause between user creation commands
2016-06-02 02:01:16 -04:00
Harmj0y a1ba3876b1 -Help expanded for Invoke-ServiceAbuse
-Fixed parameter sets for Write-ServiceBinary and added -Credential and -Service params
-Simplified/corrected logic for Install-ServiceBinary
-Fixed parameter sets and simplified logic for Restore-ServiceBinary
-Added sanity check with Get-ModifiableFile for Install-ServiceBinary
-Cleaned up lingering spaces
2016-06-02 00:00:35 -04:00
Harmj0y ecc96be81a -Removed Invoke-ServiceStart, Invoke-ServiceStop, Invoke-ServiceEnable, Invoke-ServiceDisable
-Renamed Get-ServiceFilePermission to Get-ModifiableServiceFile
-Renamed Get-ServicePermission Get-ModifiableService
-Integrated PSReflect codebase from @mattifestation
-Modified Get-ModifiableFile to enumerate the ACLs for passed file paths, returning the path/permission set/identityreference for each modifable file (instead of opening file for modification)
-Added Add-ServiceDacl from @mattifestation to add service Dacls to Get-Service objects
-Added Set-ServiceBinPath replace "sc.exe config SERVICE binPath= X" - now modifies using the ChangeServiceConfig Win32 API call
-Revamped Test-ServiceDaclPermission to take advantage of Add-ServiceDacl. Service permissions are now matched up against the current user's group memberships and specified permission sets to check for.
-Functions that checked for service restarting now use Test-ServiceDaclPermission
-Get-ModifiableService now uses Test-ServiceDaclPermission
-Invoke-ServiceAbuse completely rebuilt to use native PowerShell functions and Set-ServiceBinPath to reconfiguring service binary paths for abuse
-Parameter sets rewritten for several functions to accept -Credential objects were applicable and -Service objects from Get-Service on the pipeline

TODO: Tune up Write-ServiceBinary, Install-ServiceBinary, Restore-ServiceBinary, Find-DLLHijack, Find-PathHijack, Write-HijackDll, and all the registry checks
2016-06-01 19:03:18 -04:00
Harmj0y 5660218b38 Bug fix for Get-System for when a needed assembly isn't loaded. 2016-05-31 23:28:19 -04:00
Harmj0y 83305c5243 Combined Get-SiteListPassword.ps1 into PowerUp.ps1 2016-05-23 18:51:44 -04:00
Harmj0y c30c682797 Bug fix for issue #137 2016-05-23 18:36:46 -04:00
HarmJ0y 785f4757bd Merge pull request #122 from joncave/patch-1
Find-PathHijack: Expand environment variables in path
2016-04-08 12:59:01 -07:00
Jon Cave 84b8e1da9a Find-PathHijack: Expand environment variables in path
Paths containing environment variables can cause false-positives to occur, e.g. `%SystemRoot%\system32\WindowsPowerShell\v1.0\`. `Find-PathHijack` will believe this is a relative path and will report it as hijackable if the current directory is writeable.
2016-03-20 21:28:22 +00:00
Harmj0y 13adf516d5 Moved admin check for Get-System to allow for RevToSelf 2016-03-15 15:13:02 -04:00
Harmj0y 6a17f759ab Added Get-System to Privesc/
Added Pester tests for Get-System
2016-03-11 17:45:46 -05:00
Harmj0y 6de1d78af8 Added Pester tests for Get-SiteListPassword
Encrypted password check for Get-SiteListPassword fields
2016-02-12 17:25:13 -05:00
Harmj0y eae5eef91f Added additional search paths, code cleanup. 2016-02-12 16:26:35 -05:00
Harmj0y 2e6b301170 Added Get-SiteListPassword to decrypt McAfee SiteList.xml file passwords. 2016-02-11 21:42:20 -05:00
HarmJ0y 1832e324e9 Merge pull request #111 from sagishahar/dev
Fix 'Install-ServiceBinary' for non-'Modifiable' files
2016-01-25 15:19:58 -08:00
HarmJ0y 43c4c69b38 Merge pull request #108 from sagishahar/master
Add 'CanRestart' to output and Pester tests
2016-01-25 15:19:20 -08:00
sagishahar 3f1dd34500 Fix 'Install-ServiceBinary' for non-'Modifiable' files
The 'Install-ServiceBinary' function fails on an edge case where the
service's file permission does not include the 'Modify' permission but
does include the 'Write' permission
(https://technet.microsoft.com/en-au/library/dd349321(v=ws.10).aspx). In
this scenario, renaming the original service file for backup purposes
will result in 'Access Denied' message. Fixing this requires that the
file be copied to service.exe.bak instead of renamed to service.exe.bak.
2016-01-17 23:04:27 +08:00
sagishahar 5f13c7b4de Add 'CanRestart' to output and Pester tests
Pester tests to the function 'Test-ServiceDaclPermission' were added in
order to increase confidence in its reliability. In general, my
intention was to replace the current functionality of the service
management functions such as Invoke-ServiceStart, to not use blindly
'sc.exe start' but rather consult with the DACL permissions and base the
decision on that. Unforunately, further investigation lead me to the
conclusion that retrieval of the service's DACL permissions requires
that an additional DACL permission (RC) be set. This may lead to an edge
case that could miss a potential privilege escalation condition and
thereby the original idea was discarded. Nonetheless,
'Test-ServiceDaclPermission' can be used for less critical tasks.
Therefore, a 'CanRestart' property was added to the output of the
service enumeration functions such as 'Get-ServiceUnquoted' as I think
that it will add value to redteamers/pentesters by helping them
prioritise which service should be abused for escalation of privileges.
Services that can be restarted by a low privileged user will probably be
prioritised first. Additionally, manual checking whether the vulnerable
service can be restarted would not be required in most cases.
2016-01-13 01:36:23 +08:00
Stuart Morgan ed60b51f0a Sorted exports into alphabetical order 2015-12-29 14:06:06 +00:00