Skip to content

Commit 9a7b1e6

Browse files
authored
Create setx.yml
1 parent 9d531af commit 9a7b1e6

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

yml/OSBinaries/setx.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
Name: SetX.exe
3+
Description: Microsoft-signed utility used to create or modify user and system environment variables. Supports registry extraction, remote execution context, and coordinate-based file parsing. Useful for persistence, execution flow hijacking, discovery, and lateral movement.
4+
Aliases:
5+
- Alias: setx64.exe
6+
Author: Raja Singh
7+
Created: 2025-12-10
8+
9+
Commands:
10+
- Command: setx MACHINE COMPAQ
11+
Description: Creates or updates a user environment variable.
12+
Usecase: Persistent environment modification.
13+
Category: Hijack Execution Flow
14+
Privileges: User
15+
MitreID: T1547
16+
OperatingSystem: Windows
17+
18+
- Command: setx MACHINE "COMPAQ COMPUTER" /M
19+
Description: Creates or updates a system-wide environment variable.
20+
Usecase: System-level persistence.
21+
Category: Hijack Execution Flow
22+
Privileges: Administrator
23+
MitreID: T1547
24+
OperatingSystem: Windows
25+
26+
- Command: setx MYPATH %PATH%
27+
Description: Copies current PATH into a new variable.
28+
Usecase: Allows PATH manipulation before hijack.
29+
Category: Hijack Execution Flow
30+
Privileges: User
31+
MitreID: T1574.009
32+
OperatingSystem: Windows
33+
34+
- Command: setx MYPATH ~PATH~
35+
Description: Uses tilde syntax to copy PATH.
36+
Usecase: Introduce malicious directories for execution hijacking.
37+
Category: Hijack Execution Flow
38+
Privileges: User
39+
MitreID: T1574.009
40+
OperatingSystem: Windows
41+
42+
- Command: setx /S system /U user /P password MACHINE COMPAQ
43+
Description: Creates a variable on a remote host.
44+
Usecase: Remote persistence without shell access.
45+
Category: Lateral Movement
46+
Privileges: DomainUser
47+
MitreID: T1021
48+
OperatingSystem: Windows
49+
50+
- Command: setx /S system /U user /P password MYPATH ^%PATH^%
51+
Description: Writes variables to remote host using escaped syntax.
52+
Usecase: Environment poisoning on remote machines.
53+
Category: Lateral Movement
54+
Privileges: DomainUser
55+
MitreID: T1021
56+
OperatingSystem: Windows
57+
58+
- Command: setx TZONE /K HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName
59+
Description: Extracts registry value into an environment variable.
60+
Usecase: Harvest registry data without reg.exe or PowerShell.
61+
Category: Collection
62+
Privileges: User
63+
MitreID: T1005
64+
OperatingSystem: Windows
65+
66+
- Command: setx BUILD /K "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber" /M
67+
Description: Extracts build number and writes it as system variable.
68+
Usecase: Persistence with registry-derived data.
69+
Category: Persistence
70+
Privileges: Administrator
71+
MitreID: T1547
72+
OperatingSystem: Windows
73+
74+
- Command: setx /S system /U user /P password TZONE /K HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName
75+
Description: Extracts registry data remotely into variables.
76+
Usecase: Remote discovery and persistence.
77+
Category: Lateral Movement
78+
Privileges: DomainUser
79+
MitreID: T1021
80+
OperatingSystem: Windows
81+
82+
- Command: setx /S system /U user /P password BUILD /K "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber" /M
83+
Description: Writes system variables on remote host using registry data.
84+
Usecase: Cross-host persistent config poisoning.
85+
Category: Lateral Movement
86+
Privileges: DomainAdmin
87+
MitreID: T1021
88+
OperatingSystem: Windows
89+
90+
- Command: setx /F ipconfig.out /X
91+
Description: Displays a file with coordinate references.
92+
Usecase: Covert file reading without type/more.
93+
Category: Discovery
94+
Privileges: User
95+
MitreID: T1083
96+
OperatingSystem: Windows
97+
98+
- Command: setx IPADDR /F ipconfig.out /A 5,11
99+
Description: Extracts text at absolute coordinates.
100+
Usecase: Extract sensitive info from dumped output.
101+
Category: Discovery
102+
Privileges: User
103+
MitreID: T1083
104+
OperatingSystem: Windows
105+
106+
- Command: setx OCTET1 /F ipconfig.out /A 5,3 /D "#$*."
107+
Description: Parses file content using delimiter tokens.
108+
Usecase: Structured data extraction.
109+
Category: Discovery
110+
Privileges: User
111+
MitreID: T1083
112+
OperatingSystem: Windows
113+
114+
- Command: setx IPGATEWAY /F ipconfig.out /R 0,7 Gateway
115+
Description: Extracts text relative to a matched pattern.
116+
Usecase: Pattern-based file parsing like grep/awk.
117+
Category: Discovery
118+
Privileges: User
119+
MitreID: T1083
120+
OperatingSystem: Windows
121+
122+
- Command: setx /S system /U user /P password /F c:\ipconfig.out /X
123+
Description: Remote file read using SetX.
124+
Usecase: File discovery without remote shell.
125+
Category: Lateral Movement
126+
Privileges: DomainUser
127+
MitreID: T1021
128+
OperatingSystem: Windows
129+
130+
Full_Path:
131+
- Path: C:\Windows\System32\setx.exe
132+
- Path: C:\Windows\SysWOW64\setx.exe
133+
134+
Code_Sample:
135+
- Code: setx payload C:\Users\Public\evil.exe
136+
- Code: setx /M COMSPEC C:\Users\Public\cmd.exe
137+
- Code: setx PATH "%PATH%;C:\Temp\bin"
138+
- Code: setx SECRET /K HKCU\Software\MyApp\Config\Password
139+
- Code: setx KEYVAL /F output.txt /A 2,5
140+
- Code: setx /S 10.0.0.8 /U corp\admin /P Pass123 backdoor C:\backdoor.exe
141+
142+
Detection:
143+
- IOC: Modification of PATH, COMSPEC, WINDIR, PATHEXT, TEMP, TMP
144+
- IOC: SetX usage with /M from untrusted process
145+
- IOC: Remote variable creation via /S /U /P
146+
- IOC: Registry extraction via /K from sensitive paths
147+
- IOC: Coordinate-based parsing (/A, /R, /X)
148+
- Analysis: Environment manipulation followed by suspicious execution
149+
150+
Resources:
151+
- Link: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/setx
152+
153+
Acknowledgement:
154+
- Person: Raja Singh
155+
Handle: '@fluxwarden'

0 commit comments

Comments
 (0)