Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Introduce environment variables#136

Open
forensicxlab wants to merge 6 commits intomemflow:mainfrom
forensicxlab:main
Open

Introduce environment variables#136
forensicxlab wants to merge 6 commits intomemflow:mainfrom
forensicxlab:main

Conversation

@forensicxlab
Copy link

@forensicxlab forensicxlab commented Nov 14, 2025

This PR introduce the environment variables trait and listing in memflow. Linked to this memfow-win32 PR implementing environment variables listing for Win32Kernel as well as a rawmem connector to be able to add the possibility to pass a raw memory dump.

Goal

The goal of this feature is to introduce the possibility for the user to inspect environement variables linked to a process. This can help to tie a process to a user/session, workstation role or container/pod, retreive API KEYS some credentials and more.

Example output

The following output is produced when running the envars_list example on a raw memory image using the memflow-rawmem connector.

cargo run --release --example envars_list -- -vvv -c memraw:/path/to/mem.raw --os win32 --process explorer.exe --envar USERDOMAIN
20:26:25 [INFO] arch=X86(64, false) kernel_hint=fffff8043cff1ca0 dtb=1aa000
20:26:26 [INFO] base=fffff8043cc00000 size=17063936
20:26:26 [INFO] kernel_guid=Some(Win32Guid { file_name: "ntkrnlmp.pdb", guid: "769C521E4833ECF72E21F02BF33691A51" })
20:26:26 [INFO] trying to find NtBuildNumber export
20:26:26 [INFO] NtBuildNumber found at 0xc11f48
20:26:26 [INFO] trying to find RtlGetVersion export
20:26:26 [INFO] RtlGetVersion found at 0x6d8200
20:26:26 [INFO] nt_build_number: 4026550882
20:26:26 [INFO] kernel version: 10.0.19042
20:26:26 [INFO] kernel_winver=Win32Version { nt_major_version: 10, nt_minor_version: 0, nt_build_number: 4026550882 }
20:26:26 [INFO] PsInitialSystemProcess found at 0xfffff8043d8fc420
20:26:26 [INFO] eprocess_base=ffffbf0f64a63080
20:26:26 [INFO] start_block.dtb=1aa000
20:26:26 [INFO] reading pdb from local cache: /Users/X/Library/Caches/memflow/ntkrnlmp.pdb/769C521E4833ECF72E21F02BF33691A51
20:26:26 [INFO] updating connector mem_map=MemoryMapping: base=1000 size=9e000 real_base=1000
MemoryMapping: base=100000 size=2000 real_base=100000
MemoryMapping: base=103000 size=dfeed000 real_base=103000
MemoryMapping: base=100000000 size=20000000 real_base=100000000
20:26:26 [INFO] updating sysproc_dtb=1aa000
found process: ReprCString { 0: "explorer.exe" }

PID  4352 | explorer.exe | sys=X86(64, false) proc=X86(64, false)
   VARIABLE | VALUE
    =::=::\
    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\John Doe\AppData\Roaming
    CommonProgramFiles=C:\Program Files\Common Files
    CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
    CommonProgramW6432=C:\Program Files\Common Files
    COMPUTERNAME=DESKTOP-0J3S8C2
    ComSpec=C:\Windows\system32\cmd.exe
    DriverData=C:\Windows\System32\Drivers\DriverData
    FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
    FPS_BROWSER_USER_PROFILE_STRING=Default
    HOMEDRIVE=C:
    HOMEPATH=\Users\John Doe
    LOCALAPPDATA=C:\Users\John Doe\AppData\Local
    LOGONSERVER=\\DESKTOP-0J3S8C2
    NUMBER_OF_PROCESSORS=4
    OneDrive=C:\Users\John Doe\OneDrive
    OS=Windows_NT
    Path=C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\John Doe\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Nmap
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=8e0c
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files
    PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
    PUBLIC=C:\Users\Public
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\JOHNDO~1\AppData\Local\Temp
    TMP=C:\Users\JOHNDO~1\AppData\Local\Temp
    USERDOMAIN=DESKTOP-0J3S8C2
    USERDOMAIN_ROAMINGPROFILE=DESKTOP-0J3S8C2
    USERNAME=John Doe
    USERPROFILE=C:\Users\John Doe
    windir=C:\Windows

Cheers.
k1nd0ne.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant