Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space in directory path breaks ColorLine/FORFILES logic within winPEAS.bat #301

Open
naterobbified opened this issue Jul 19, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@naterobbified
Copy link

Issue description

If the batch script is run from a directory path with a space, it breaks the ColorLine logic specifically within the FORFILES.exe loop. I attempted to debug the issue by adding quotes to the FORFILES.exe command but I couldn't figure out a working solution.

Steps to reproduce the issue

  1. Place the winPEAS.bat file in a path with a space, in my example I used C:\test folder. (I originally ran into this issue as I had a space in my Windows username so my path looked something like C:\Users\Bob Jones\Desktop)
  2. Run the script and you should see FORFILES.exe errors as shown below:
C:\test folder>winPEAS.bat

ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
...

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

none

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

Just used the vanilla batch file from the repo.

Is there any AV / Threat protection in the system?

Yes, but its all disabled.

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

Windows 10 Build 19043.1826

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

As described above, the ColorLine logic breaks when the batch script is run from a directory path with a space, resulting in FORFILES errors:
Capture2

How did you expect it to work?

I expected the script to run without errors.

Additional details / screenshot

@carlospolop
Copy link
Collaborator

Hey @naterobbified,
Sorry for the waiting.
Could you send a PR that if the current path contains spaces Winpeas notifies it and ends the execution?

@carlospolop carlospolop added the help wanted Extra attention is needed label Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants