Skip to content

Commit c492490

Browse files
committed
2 parents cdc8edc + e0bb367 commit c492490

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

README.md

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# UAC bypass - DLL hijacking
22

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.
46

57
## Summary
68

79
- [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)
912
- [DLLHijacking.exe](#dllhijackingexe)
1013
- [Log file](#log-file)
11-
- [Command](#command)
14+
- [Execution](#execution)
1215
- [Result](#result)
1316
- [test.dll](#testdll)
17+
- [Sources](#sources)
1418

1519
## Generate Header from CSV
1620

1721
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).
1822

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:
2226
- `asInvoker`
2327
- `highestAvailable`
2428
- `requireAdministrator`
25-
- In the manifest if the autoElevate is set to "true":
29+
- In the manifest if the autoElevate is set to true:
2630
```xml
2731
<autoElevate>true</autoElevate>
2832
```
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.
3034

31-
The help message of the script can be seen by running **CsvToHeader.py -h**:
35+
### Arguments
3236

3337
```
3438
> python .\CsvToHeader.py -h
@@ -58,26 +62,26 @@ DLLHijacking.exe is the file that will be used to generate the list of vulnerabl
5862
It will perform the following steps:
5963
1. CreateFakeDirectory
6064
61-
The `CreateFakeDirectory` function will create a directory in `C:\windows \system32`.
65+
Function that create a directory in `C:\windows \system32`.
6266
6367
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]`
6670
3. Trigger
6771
68-
Run the executable from `C:\windows \system32\[TARGET].exe`
72+
Run the executable from `C:\windows \system32\[TARGET.EXE]`
6973
7074
4. CleanUpFakeDirectory
7175
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.
7377
5. CheckExploit
7478
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.
7680
7781
### Log file
7882
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.
8185
- The executable name
8286
- The dll name
8387
@@ -87,32 +91,31 @@ E.g.
8791
0,computerdefaults.exe,Secur32.dll
8892
```
8993
90-
### Command
94+
### Execution
9195
9296
Command to run:
9397
9498
DLLHijacking.exe [DLL_PATH]
9599
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`.
97101
98102
### Result
99103
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).
101105
102106
![ExploitResult](ExploitResult.png)
103107
104108
## test.dll
105109
106110
`test.dll` is a simple dynamic library that will be use to see if the exploit is successfully.
107111
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.
109113
- The executable name
110114
- The DLL name
111115
112-
This file will be removed after the exploit is completed.
113-
116+
This file will be deleted once the exploit is complete.
114117
115-
## Source:
118+
## Sources:
116119
117120
- https://www.wietzebeukema.nl/blog/hijacking-dlls-in-windows
118121
- https://github.com/wietze/windows-dll-hijacking/
@@ -122,4 +125,6 @@ This file will be removed after the exploit is completed.
122125
123126
## Legal Disclaimer:
124127
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

Comments
 (0)