MultiPotato – Another Potato to get SYSTEM via SeImpersonate privileges

First of all – credit to @splinter_code & @decoder_it for RoguePotato as this code heavily bases on it.

This is just another Potato to get SYSTEM via SeImpersonate privileges. But this one is different in terms of

  • It doesn’t contain any SYSTEM auth trigger for weaponization. Instead the code can be used to integrate your favorite trigger by yourself.
  • It’s not only using CreateProcessWithTokenW to spawn a new process. Instead you can choose between CreateProcessWithTokenW, CreateProcessAsUserW, CreateUser and BindShell.

So this project is able to open up a NamedPipe Server, impersonates any user connecting to it and afterwards does one of the options mentioned above. If any new SYSTEM auth triggers are published in the future this tool can still be used to elevate privileges – you just need to use another Pipe-Name in this case.

Examples:

  1. CreateUser with modified PetitPotam trigger:
c:tempMultiPotato> MultiPotato.exe -t CreateUser

You have by default value 60 secconds (changable via THEAD_TIMEOUT) to let the SYSTEM account or any other account authenticate. This can be done for example via an unpatched MS-EFSRPC function. By default MultiPotato listens on the pipename \.pipepwned/pipe/srvsvc which is meant to be used in combination with MS-EFSRPC. For other SYSTEM auth triggers you can adjust this value via the -p parameter.

c:tempMultiPotato> PetitPotamModified.exe localhost/pipe/pwned localhost

Using PetitPotam.py as trigger from a remote system with a valid low privileged user is of course also possible.

AVvXsEjt3SCvsTADc8FV0c gjq4C7xRG5IUCChpPIyfR5ZS3qlwbe7UWR8NTL3IM K9dhzjZo4Z8aUxQ8P0b5D8wEEJMM6AN4GlbU6bRK3ZhSrQq3OIHS5WVGAeBKmKINvv E lLPqm9YdX8W8XzmI DE2Aia2tcRbufI42zz1J3T7C 0GssQ3ZlKFhfKZ8t4w=w640 h344

  1. CreateProcessAsUserW with SpoolSample trigger:
c:tempMultiPotato> MultiPotato.exe -t CreateProcessAsUserW -p "pwnedpipespoolss" -e "C:tempstage2.exe"

And trigger it via

c:tempMultiPotato>MS-RPRN.exe \192.168.100.150 \192.168.100.150/pipe/pwned

AVvXsEhxkOOB3lWVj6jhN7gf9jqrryt3busX apfDDLpnJkTAUe5x5auhKEUWPjfIbut kl95Vpd SpUsezIFyItvQHIzYg3ycbTQuLhGe25PdOXqmGQ 8uUPHaRkfY9RPyNZBSzhdeIh5PEG4oLhSQ2BsPPsJRHFsxumgzp9g104rI8HUIhShfdoAg9WezXQQ=w640 h172

Important: In my testings for MS-RPRN I could not use localhost or 127.0.0.1 as target, this has to be the network IP-Adress or FQDN. In addition the Printer Service needs to be enabled for this to work.

  1. BindShell with SpoolSample PipeName
c:tempMultiPotato> MultiPotato.exe -t BindShell -p "pwnedpipespoolss"

 

AVvXsEiCxxqoVpCiazuWIrKsoZk ihg8Gkf TnTrZ59TLal5DT Kw13au1rBLJcw2PNhYkf pl5rZm5X4nhYKQhyPZRz8J3f2LPapaKphGZUf 9JoTj1wuTGgiqtNBiBrhAWUNZon4wkEavhMAIIKBgFvoEZ5lMzs9BQgz 4WpsuTuvSqQHBrin Ey3AqBAHQ=w640 h146

AVvXsEi 9MKbc6IcC226BII5n sGSqNHSZZ5UxoRzNVI 0rjnD1OUmoeL3SfY22YqIXcOjjlNvyvwUjTPAyS U0KZ0UHCETvZYAEbj0OIGdqZzaWsL351kjXLp0b8Y6IXKLOTvKNPGm2J3M3amDYaRdQ4l0FMkkikjrCCAdWGOxLPARcv5k1LxRfP58BDyRaaw=w640 h164

Why??

I recently had a penetrationtest, where I was able to pwn a MSSQL Server via SQL-Injection and XP_CMDShell. But all public Potatoes failed on this target system to elevate privileges from service-account to SYSTEM. The System auth trigger was not the problem – instead CreateProcessWithTokenW failed all the time with NTSTATUS Code 5 – access forbidden. This didn’t really makes sense for me and may be an edge case. One reason for that could be the local endpoint protection which may have blocked the process creation after impersonating SYSTEM.

Therefore I searched for alternatives – and asked some people on Twitter about it. Again Credit to @splinter_code for explaining me how to do it via CreateProcessAsUserW which worked fine on the pwned MSSQL server to get a SYSTEM C2-Callback.

click here to read full Article

Read More on Pentesting Tools

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: