You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-25Lines changed: 30 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,38 @@
1
1
# UAC bypass - DLL hijacking
2
2
3
-
This is a PoC for bypassing UAC using DLL hijacking and abusing the "Trusted Directories" verification.
3
+
## Description
4
+
5
+
This is a PoC for bypassing [UAC](https://docs.microsoft.com/en-us/windows/security/identity-protection/user-account-control/how-user-account-control-works) using [DLL hijacking](https://attack.mitre.org/techniques/T1574/001/) and abusing the "Trusted Directories" verification.
4
6
5
7
## Summary
6
8
7
9
-[Generate Header from CSV](#generate-header-from-csv)
8
-
-[Generate the list of vulnerable PE](#generate-the-list-of-vulnerable-pe)
10
+
-[Arguments](#arguments)
11
+
-[Generate the list of vulnerable PE and DLL](#generate-the-list-of-vulnerable-pe-and-dll)
9
12
-[DLLHijacking.exe](#dllhijackingexe)
10
13
-[Log file](#log-file)
11
-
-[Command](#command)
14
+
-[Execution](#execution)
12
15
-[Result](#result)
13
16
-[test.dll](#testdll)
17
+
-[Sources](#sources)
14
18
15
19
## Generate Header from CSV
16
20
17
21
The python script `CsvToHeader.py` can be used to generate a header file. By default it will use the CSV file `dll_hijacking_candidates.csv` that can be found here: [dll_hijacking_candidates.csv](https://raw.githubusercontent.com/wietze/windows-dll-hijacking/master/dll_hijacking_candidates.csv).
18
22
19
-
The script will check for each portable executable(PE) the following:
20
-
- If the the PE exist under the file system
21
-
- In the manifest if the requestedExecutionLevel is set to one of the following values:
23
+
The script will check for each portable executable(PE) the following condition:
24
+
- If the PE exists in the file system.
25
+
- In the manifest of the PE, if the _requestedExecutionLevel_ is set to one of the following values:
22
26
-`asInvoker`
23
27
-`highestAvailable`
24
28
-`requireAdministrator`
25
-
- In the manifest if the autoElevate is set to "true":
29
+
- In the manifest if the autoElevate is set to true:
26
30
```xml
27
31
<autoElevate>true</autoElevate>
28
32
```
29
-
- If the user specified the `-c` argument, the script will check if the DLL to hijack is in the list of DLLs imported by the PE table.
33
+
- If the user specified the `-c` argument, the script will check if the DLL to hijack is in the list of DLLs imported form PE table.
30
34
31
-
The help message of the script can be seen by running **CsvToHeader.py -h**:
35
+
### Arguments
32
36
33
37
```
34
38
> python .\CsvToHeader.py -h
@@ -58,26 +62,26 @@ DLLHijacking.exe is the file that will be used to generate the list of vulnerabl
58
62
It will perform the following steps:
59
63
1. CreateFakeDirectory
60
64
61
-
The `CreateFakeDirectory` function will create a directory in `C:\windows \system32`.
65
+
Function that create a directory in `C:\windows \system32`.
62
66
63
67
2. Copy Files in the new directory
64
-
- form `C:\windows\system32\[TARGET.EXE]` to `C:\windows \system32\[TARGET.EXE]`
65
-
- form `[CUSTOM_DLL_PATH]` to `C:\windows \system32\[TARGET.DLL]`
68
+
- from `C:\windows\system32\[TARGET.EXE]` to `C:\windows \system32\[TARGET.EXE]`
69
+
- from `[CUSTOM_DLL_PATH]` to `C:\windows \system32\[TARGET.DLL]`
66
70
3. Trigger
67
71
68
-
Run the executable from `C:\windows \system32\[TARGET].exe`
72
+
Run the executable from `C:\windows \system32\[TARGET.EXE]`
69
73
70
74
4. CleanUpFakeDirectory
71
75
72
-
The `CleanUpFakeDirectory` function will delete the directory created in step 1 and files form step 2.
76
+
Function that delete the directory created in step 1 and files from step 2.
73
77
5. CheckExploit
74
78
75
-
Check the contain of the file `C:\ProgramData\exploit.txt` to see if the exploit was successful.
79
+
Check the content of the file `C:\ProgramData\exploit.txt` to see if the exploit was successful.
76
80
77
81
### Log file
78
82
79
-
DLLHijacking.exe will always generate a file log file `exploitable.log` with the following content:
80
-
- 0 or 1 to indicate if the exploit was successful.
83
+
DLLHijacking.exe will always generate a log file `exploitable.log` with the following content:
84
+
- 0 or 1 to indicates whether the exploit was able to bypass the UAC.
81
85
- The executable name
82
86
- The dll name
83
87
@@ -87,32 +91,31 @@ E.g.
87
91
0,computerdefaults.exe,Secur32.dll
88
92
```
89
93
90
-
### Command
94
+
### Execution
91
95
92
96
Command to run:
93
97
94
98
DLLHijacking.exe [DLL_PATH]
95
99
96
-
if no argument is passed, the script will use the current path and the file `test.dll`.
100
+
if no argument is passed, the script will use the DLL `test.dll` which is stored in the resouce of `DLLHijacking.exe`.
97
101
98
102
### Result
99
103
100
-
Tested on Windows 10 Pro version (10.0.19043 N/A Build 19043).
104
+
Tested on Windows 10 Pro (10.0.19043 N/A Build 19043).
101
105
102
106

103
107
104
108
## test.dll
105
109
106
110
`test.dll` is a simple dynamic library that will be use to see if the exploit is successfully.
107
111
The DLL will create a file `C:\ProgramData\exploit.txt` with the following content:
108
-
- 0 or 1 to indicate if the exploit was successful.
112
+
- 0 or 1 to indicates whether the exploit was able to bypass the UAC.
109
113
- The executable name
110
114
- The DLL name
111
115
112
-
This file will be removed after the exploit is completed.
113
-
116
+
This file will be deleted once the exploit is complete.
@@ -122,4 +125,6 @@ This file will be removed after the exploit is completed.
122
125
123
126
## Legal Disclaimer:
124
127
125
-
This project is made for educational and ethical testing purposes only. Usage of this software for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.
128
+
This project is made for educational and ethical testing purposes only. Usage of this software for attacking targets without prior mutual consent is illegal.
129
+
It is the end user's responsibility to obey all applicable local, state and federal laws.
130
+
Developers assume no liability and are not responsible for any misuse or damage caused by this program.
0 commit comments