I. INTRODUCTION
Endpoint Detection & Response (EDR) systems often use the ProcessParameters field of the Process Environment Block (PEB) to retrieve information about the path and name of the executable image that initiated the process, along with any arguments passed to it.
By faking the "CommandLine" field of the process, we can somewhat confuse the log analysis system, making it easier to conceal activities on the target machine more discreetly.
Modern EDRs and antivirus solutions will show no mercy to your process if you attempt to overwrite the Process Environment Block (PEB) right after initialization. Therefore, you need to find a way to slip through this narrow gap.
In this article, I will experiment with faking the image file path in the "CommandLine" of the process by using a Symbolic Link. I will also conduct practical experiments with Process Explorer, Sysmon, and System Informer.
Feel free to ask me at: Two Seven One Three (@TwoSevenOneT) / X.
II. MAIN SECTION
1. Basic Information About Processparameters In PEB
The ProcessParameters field is a pointer to a RTL_USER_PROCESS_PARAMETERS structure.
This structure holds critical process startup information, including:
- CommandLine (UNICODE_STRING) - The full command line used to start the process.
- ImagePathName (UNICODE_STRING) - The full path to the executable.
- CurrentDirectory (UNICODE_STRING) - The working directory of the process.
- Environment (PVOID) - Pointer to environment variables.
- WindowTitle (UNICODE_STRING) - The title of the main window (if applicable).
- DesktopInfo (UNICODE_STRING) - Specifies the desktop for GUI processes.
- ShellInfo (UNICODE_STRING) - Shell-specific information.
- RuntimeData (UNICODE_STRING) - Used by the runtime loader.
In this article, we will focus on the CommandLine section.
2. Experimenting With Directory Symbolic Links Using Process Explorer
In Windows, a symbolic link (also known as a symlink or soft link) acts as a pointer to another file or directory, allowing the target to be accessed from multiple locations.
For example:
mklink /d "C:\MyFolder" "D:\TargetFolder"
This command creates a symbolic link named "C:\AliasFolder" that points to the folder "D:\TargetFolder". Now, when you navigate to "C:\ AliasFolder" in File Explorer or use it in a command, you'll be accessing the contents of "D:\TargetFolder".
So with the information above, let's assume I have the command to create a symlink as follows:
mklink /D "C:\FakePath\Modules" "C:\TMP\Target"
Comments
Post a Comment