Integrity Levels
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Integrity Levels
In Windows Vista and later versions, all protected items come with an integrity level tag. This setup mostly assigns a "medium" integrity level to files and registry keys, except for certain folders and files that Internet Explorer 7 can write to at a low integrity level. The default behavior is for processes initiated by standard users to have a medium integrity level, whereas services typically operate at a system integrity level. A high-integrity label safeguards the root directory.
A key rule is that objects can't be modified by processes with a lower integrity level than the object's level. The integrity levels are:
Untrusted: This level is for processes with anonymous logins. %%%Example: Chrome%%%
Low: Mainly for internet interactions, especially in Internet Explorer's Protected Mode, affecting associated files and processes, and certain folders like the Temporary Internet Folder. Low integrity processes face significant restrictions, including no registry write access and limited user profile write access.
Medium: The default level for most activities, assigned to standard users and objects without specific integrity levels. Even members of the Administrators group operate at this level by default.
High: Reserved for administrators, allowing them to modify objects at lower integrity levels, including those at the high level itself.
System: The highest operational level for the Windows kernel and core services, out of reach even for administrators, ensuring protection of vital system functions.
Installer: A unique level that stands above all others, enabling objects at this level to uninstall any other object.
You can get the integrity level of a process using Process Explorer from Sysinternals, accessing the properties of the process and viewing the "Security" tab:
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F129538173-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-L_2uGJGU7AVNRcqRvEi%252F-MFp9akXYQlg6aPryYjH%252F-MFpDiTLP6jm_X8PJz7g%252Fimage.png%3Falt%3Dmedia%26token%3De7dfd635-4f69-4699-8923-151cc235d018&width=768&dpr=4&quality=100&sign=eb8a35cb&sv=1)
You can also get your current integrity level using whoami /groups
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F129538173-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-L_2uGJGU7AVNRcqRvEi%252F-MFp9akXYQlg6aPryYjH%252F-MFpE4o33K41JeCFR3nh%252Fimage.png%3Falt%3Dmedia%26token%3D11a64f50-b87b-43a2-b2b2-a5da9a2e87f0&width=768&dpr=4&quality=100&sign=b0dfd81c&sv=1)
Integrity Levels in File-system
A object inside the file-system may need an minimum integrity level requirement and if a process doesn't have this integrity process it won't be able to interact with it. For example, lets create a regular from a regular user console file and check the permissions:
Now, lets assign a minimum integrity level of High to the file. This must be done from a console running as administrator as a regular console will be running in Medium Integrity level and won't be allowed to assign High Integrity level to an object:
This is where things get interesting. You can see that the user DESKTOP-IDJHTKP\user
has FULL privileges over the file (indeed this was the user that created the file), however, due to the minimum integrity level implemented he won't be able to modify the file anymore unless he is running inside a High Integrity Level (note that he will be able to read it):
Therefore, when a file has a minimum integrity level, in order to modify it you need to be running at least in that integrity level.
Integrity Levels in Binaries
I made a copy of cmd.exe
in C:\Windows\System32\cmd-low.exe
and set it an integrity level of low from an administrator console:
Now, when I run cmd-low.exe
it will run under a low-integrity level instead of a medium one:
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F129538173-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-L_2uGJGU7AVNRcqRvEi%252F-MFpMGGb8-fEPENLYJsB%252F-MFpNWdEZ0YvXf0xIEPt%252Fimage.png%3Falt%3Dmedia%26token%3D4e3d20bb-4dea-4831-8660-9f5f35ba88b8&width=768&dpr=4&quality=100&sign=1dc07044&sv=1)
For curious people, if you assign high integrity level to a binary (icacls C:\Windows\System32\cmd-high.exe /setintegritylevel high
) it won't run with high integrity level automatically (if you invoke it from a medium integrity level --by default-- it will run under a medium integrity level).
Integrity Levels in Processes
Not all files and folders have a minimum integrity level, but all processes are running under an integrity level. And similar to what happened with the file-system, if a process wants to write inside another process it must have at least the same integrity level. This means that a process with low integrity level can’t open a handle with full access to a process with medium integrity level.
Due to the restrictions commented in this and the previous section, from a security point of view, it's always recommended to run a process in the lower level of integrity possible.
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated