peass-ng / PEASS-ng

PEASS - Privilege Escalation Awesome Scripts SUITE (with colors)
https://book.hacktricks.xyz
Other
15.73k stars 3.05k forks source link

winPEASexe binary not self contained, DLL and regex files not included in the final build #359

Closed sro-nviso closed 1 year ago

sro-nviso commented 1 year ago

Issue description

Building winPEASexe with Visual Studio 2022 Community results in the winPEAS binary and DLLs as well as regex files being separate although I suspect them for running they should be in one merged executable.

Steps to reproduce the issue

  1. Git clone the repository
  2. Change the build config to x64, Release
  3. Build in Vistual Studio
  4. Execute from a powershell prompt

Which parameters did you use for executing the script and how did you execute it?

Executed without parameters, leads to the following errors:

Exception: An exception occured while parsing sensitive_files.yaml configuration file: String reference not set to an instance of a String.
Error while creating directory list: System.IO.FileNotFoundException: Could not load file or assembly 'AlphaFS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9' or one of its dependencies. The system cannot find the file specified.

If winpeas, did you use a clean or obfuscated winpeas, and for which architecture?

Clean build, Release x64 architecture and build config

Is there any AV / Threat protection in the system?

Yes, Defender, but exception for the build folder.

Please, indicate the OS, the OS version, and the kernel version (build number in case of Windows)

Windows 10 - 21H2 (OS build 19044.2965) (VM)

Please, indicate the check that is failing and add a screenshot showing the problem

image

How did you expect it to work?

I expected a single binary to be build that includes the regex search patterns as well as the AlphaFS library and all needed DLLs so I can run it contained.

Additional details / screenshot

Thank you for the great tool!

ManuelRickliOneconsult commented 1 year ago

I have the same behaviour with the AlphaFS library. Any updates on this?

Luke-lujunxian commented 1 year ago

For anyone who needs a quick fix:

  1. Download AlphaFS from https://www.nuget.org/packages/AlphaFS, and open it as a zip to extract the dll
  2. Use an assemblies merger (like https://github.com/gluck/il-repack) to produce a self-contained .exe
carlospolop commented 1 year ago

Hi guys, I'm pretty busy and I don't do much Windows stuff anymore. Could anyone send a PR fixing this?

ClaraLeigh commented 1 year ago

To those stumbling across this from a google, use an older version if you just want to download something rn. I believe the bug started in #350 so you could use this version or an older one to bypass the problem

carlospolop commented 1 year ago

fixed in https://github.com/carlospolop/PEASS-ng/pull/377 Check latest compiled version