forked from r00t-3xp10it/venom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsherlock.ps1
2124 lines (1791 loc) · 82.8 KB
/
sherlock.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
.SYNOPSIS
Find missing software patchs for privilege escalation (windows).
Author: @_RastaMouse (Deprecated)
Update: @r00t-3xp10it (v1.3.4)
Tested Under: Windows 10 (18363) x64 bits
Required Dependencies: none
Optional Dependencies: none
PS cmdlet Dev version: v1.3.4
.DESCRIPTION
Cmdlet to find missing software patchs for privilege escalation (windows).
This CmdLet continues @_RastaMouse (Deprecated) Module with new 2020 CVE
entrys and a new function to find missing security KB patches by comparing
the list of installed patches againts Sherlock KB List entrys ($dATAbASE).
This Cmdlet also Searchs for 'Unquoted service paths' (EoP vulnerability) and
recursive search for folders with Everyone:(F) permissions ($Env:PROGRAMFILES)
.NOTES
Vulnerabilitys/CVE's to test
----------------------------
MS10-015, MS10-092, MS13-053, MS13-081
MS14-058, MS15-051, MS15-078, MS16-016
MS16-032, MS16-034, MS16-135
CVE-2017-7199, CVE-2019-1215, CVE-2019-1458
CVE-2020-005, CVE-2020-0624, CVE-2020-0642
CVE-2020-1048, CVE-2020-1054, CVE-2020-5752
CVE-2020-13162, CVE-2020-17382, CVE-2020-17008
CVE-2020-25106, CVE-2021-1642
.EXAMPLE
PS C:\> Get-Help .\Sherlock.ps1 -full
Access This cmdlet Comment_Based_Help
.EXAMPLE
PS C:\> Import-Module $Env:TMP\Sherlock.ps1 -Force
Force the reload of this Module if allready exists
Remark: Importing Module its Mandatory condiction
.EXAMPLE
PS C:\> Get-GroupNames
List ALL Group Names Available
.EXAMPLE
PS C:\> Get-HotFixs
Find missing security KB packages (HotFix Id)
.EXAMPLE
PS C:\> Get-Rotten
Find Rotten Potato vuln privilege settings (EoP)
.EXAMPLE
PS C:\> Get-Unquoted
Find Unquoted service paths (EoP vulnerability)
.EXAMPLE
PS C:\> Get-Paths
Find weak directory permissions - Everyone:(F)
.EXAMPLE
PS C:\> Get-Paths Modify
SYNTAX: Get-Paths <FileSystemRigths>
Get-Paths 1º arg accepts Everyone:(FileSystemRigths) value.
.EXAMPLE
PS C:\> Get-Paths FullControl BUILTIN\Users
SYNTAX: Get-Paths <FileSystemRigths> <IdentityReference>
Get-Paths 2º arg accepts the Group Name (Everyone|BUILTIN\Users)
.EXAMPLE
PS C:\> Get-RegPaths
Find Weak Services Registry Permissions Everyone:(F)
.EXAMPLE
PS C:\> Get-RegPaths BUILTIN\Users
SYNTAX: Get-RegPaths <IdentityReference>
Get-RegPaths arg accepts the Group Name (Everyone|BUILTIN\Users)
.EXAMPLE
PS C:\> Get-ModifiableRegPaths
Checks the permissions of a given registry key and
returns the ones that the current user can modify.
.EXAMPLE
PS C:\> Get-DllHijack
Find DLL's prone to hijacking (EoP).
.EXAMPLE
PS C:\> Get-DllHijack EnvPaths
SYNTAX: Get-DllHijack <EnvPaths-Argument>
Checks if the current %PATH% has any directories
that Migth be writeable (W) by the current user.
.EXAMPLE
PS C:\> Find-AllVulns
Scan pre-defined CVE's using Sherlock $dATAbASE
.EXAMPLE
PS C:\> Use-AllModules
Run ALL Sherlock enumeration modules (defaultRecon)
.EXAMPLE
PS C:\> Use-AllModules FullRecon
Run ALL Sherlock enumeration modules (FullRecon)
.INPUTS
None. You cannot pipe objects into Sherlock.ps1
.OUTPUTS
Title : TrackPopupMenu Win32k Null Point Dereference
MSBulletin : MS14-058
CVEID : 2014-4113
Link : https://www.exploit-db.com/exploits/35101/
VulnStatus : Appers Vulnerable
Title : Win32k Elevation of Privileges
MSBulletin : MS13-036
CVEID : 2020-0624
Link : https://tinyurl.com/ybpz7k6y
VulnStatus : Not Vulnerable
.LINK
https://www.exploit-db.com/
https://github.com/r00t-3xp10it/venom
http://www.catalog.update.microsoft.com/
https://packetstormsecurity.com/files/os/windows/
https://github.com/r00t-3xp10it/venom/tree/master/aux/Sherlock.ps1
https://github.com/r00t-3xp10it/venom/wiki/Find-missing-software-patchs%5CPaths-for-privilege-escalation-(windows)
#>
## Var declarations
$CveDataBaseId = "25" ## 25 CVE's entrys available ($dATAbASE)
$CmdletVersion = "v1.3.4" ## Sherlock CmdLet develop version number
$CVEdataBase = "13/01/2021" ## Global $dATAbASE (CVE) last update date
$Global:ExploitTable = $null ## Global Output DataTable
$ProcessArchitecture = $env:PROCESSOR_ARCHITECTURE
$OSVersion = (Get-WmiObject Win32_OperatingSystem).version
$host.UI.RawUI.WindowTitle = "@Sherlock $CmdletVersion {SSA@RedTeam}"
$IsClientAdmin = [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -Match "S-1-5-32-544")
function Use-AllModules {
$UserImput = $args[0] ## User Imputs
<#
.SYNOPSIS
Author: r00t-3xp10it
Helper - Run ALL Sherlock enumeration modules
.EXAMPLE
PS C:\> Use-AllModules
.EXAMPLE
PS C:\> Use-AllModules FullRecon
Permissions to scan: FullControl(F), Write(W), Modify(M)
Group Names to scan: Everyone, BUILTIN\Users, NT AUTHORITY\INTERACTIVE
.NOTES
Be prepaired for huge outputs If used the 'FullRecon' @argument.
Because it will loop through all permissions and all Group Names.
#>
## Get Group Name in diferent languages
# NOTE: England, Portugal, France, Germany, Bielorussia, Indonesia, Holland, Romania, Russia, Croacia
$FindGroup = whoami /groups|findstr /C:"Everyone" /C:"Todos" /C:"Tout" /C:"Alle" /C:"YÑе" /C:"Semua" /C:"Allemaal" /C:"Toate" /C:"Bce" /C:"Svi"|Select-Object -First 1
$SplitString = $FindGroup -split(" ");$GroupEveryone = $SplitString[0] -replace ' ',''
## Get Group Name (BUILTIN\users) in diferent languages
# NOTE: England, Portugal, France, Germany, Indonesia, Holland, Romania, Croacia
$FindGroupUser = whoami /groups|findstr /C:"BUILTIN\Users" /C:"BUILTIN\Utilizadores" /C:"BUILTIN\Utilisateurs" /C:"BUILTIN\Benutzer" /C:"BUILTIN\Pengguna" /C:"BUILTIN\Gebruikers" /C:"BUILTIN\Utilizatori" /C:"BUILTIN\Korisnici"|Select-Object -First 1
$SplitStringUser = $FindGroupUser -split(" ");$GroupNameUsers = $SplitStringUser[0] -replace ' ',''
## Default values if none string its found in permissions/groupname query
If(-not($GroupEveryone) -or $GroupEveryone -ieq $null){$GroupEveryone = "Everyone"}
If(-not($GroupNameUsers) -or $GroupNameUsers -ieq $null){$GroupNameUsers = "BUILTIN\Users"}
## Permissions/GroupName database
$Permissions = @(## Permissions List
"FullControl","Write","Modify"
)
$GroupsList = @(## Group Name List
"$GroupEveryone","$GroupNameUsers",
"NT AUTHORITY\INTERACTIVE"
)
## Run ALL modules
Get-HotFixs;Get-Rotten;Get-Unquoted
If($UserImput -ieq "FullRecon"){## Agressive enumeration
## Be prepaired for huge outputs with this test :)
ForEach($PrivsToken in $Permissions){## Loop through permissions list
ForEach($ItemToken in $GroupsList){## Loop through Group Names List
Get-Paths $PrivsToken $ItemToken
}
}
ForEach($GroupsToken in $GroupsList){## Loop through Group Names List
Get-RegPaths $GroupsToken
}
Get-ModifiableRegPaths;Get-DllHijack;Find-AllVulns
Get-DllHijack EnvPaths;cmdkey /List ## Get stored credentials to use with RUNAS
}ElseIf(-not($UserImput) -or $UserImput -ieq $null){## Default Enumeration
Get-Paths FullControl $GroupEveryone
Get-RegPaths $GroupEveryone
Get-DllHijack;Find-AllVulns
}
Write-Host ""
}
function Get-GroupNames {
<#
.SYNOPSIS
Author: r00t-3xp10it
Helper - List ALL Group Names Available
.EXAMPLE
PS C:\> Get-GroupNames
.OUTPUTS
Group Name Type SID Attributes
========================================================== ================ ============ ==================================================
Todos Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Conta local e membro do grupo Administradores Well-known group S-1-5-114 Group used for deny only
BUILTIN\Administradores Alias S-1-5-32-544 Group used for deny only
BUILTIN\Utilizadores Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
BUILTIN\Utilizadores do registo de desempenho Alias S-1-5-32-559 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group
INICIO DE SESSAO NA CONSOLA Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Utilizadores Autenticados Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Esta organizacao Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Conta local Well-known group S-1-5-113 Mandatory group, Enabled by default, Enabled group
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Autenticacao NTLM Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group
#>
## Display available Groups
$ListGroups = whoami /groups|findstr /V "GROUP INFORMATION ----- Label"
echo $ListGroups > $Env:TMP\Groups.log
Get-Content -Path "$Env:TMP\Groups.log"
Remove-Item -Path "$Env:TMP\Groups.log" -Force
Start-Sleep -Seconds 1;Write-Host ""
}
function Sherlock-Banner {
<#
.SYNOPSIS
Author: r00t-3xp10it
Sherlock CVE function banner
#>
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("Entrys")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("DataBase")|Out-Null
$mytable.Rows.Add("Sherlock",
"$CveDataBaseId",
"W$MajorVersion",
"$ProcessArchitecture",
"$CVEdataBase")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
Start-sleep -Seconds 2
}
function Get-Unquoted {
<#
.SYNOPSIS
Author: r00t-3xp10it
Find Unquoted service vulnerable paths (EoP)
.NOTES
This function searchs for Unquoted service vuln paths.
Remark: Its required an 'exe-service' (msfvenom) payload
to successfuly exploit Unquoted service paths vulnerability.
.EXAMPLE
PS C:\> Get-Unquoted
Find Unquoted service vulnerable paths (EoP vulnerability)
#>
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("SearchFor")|Out-Null
$mytable.Rows.Add("Sherlock",
"W$MajorVersion",
"$ProcessArchitecture",
"UnquotedPaths")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
## Search for Unquoted service paths (StartMode = Auto StartName = LocalSystem)
gwmi -class Win32_Service -Property Name,DisplayName,PathName,StartMode,StartName|Where {
$_.StartMode -eq "Auto" -and $_.StartName -eq 'LocalSystem' -and $_.PathName -NotLike "C:\Windows*" -and $_.PathName -NotMatch '"*"'
}|Select PathName,Name > $Env:TMP\GetPaths.log
If(Test-Path -Path "$Env:TMP\GetPaths.log" -EA SilentlyContinue){
Get-Content -Path "$Env:TMP\GetPaths.log"
Remove-Item -path "$Env:TMP\GetPaths.log" -Force
Start-Sleep -Seconds 2
}
}
function Get-Paths {
[int]$Count = 0 ## Loop counter
<#
.SYNOPSIS
Author: r00t-3xp10it
Find weak Directory permissions (EoP)
.EXAMPLE
PS C:\> Get-Paths
Search recursive for folders with Everyone:(F) permissions
.EXAMPLE
PS C:\> Get-Paths Modify
SYNTAX: Get-Paths <FileSystemRigths>
Get-Paths 1º arg accepts Everyone:(FileSystemRigths) value.
.EXAMPLE
PS C:\> Get-Paths FullControl BUILTIN\Users
Get-Paths 2º arg accepts the Group Name (Everyone|BUILTIN\Users)
REMARK: Use double quotes if Group Name contains any empty spaces in Name
#>
## Search for weak directory permissions
$param1 = $args[0] ## User Imput => FileSystemRights (ReadAndExecute)
$param2 = $args[1] ## User Imput => Group Name (BUILTIN\Users)
If($param1 -ieq $null){$param1 = "FullControl"}## Default FileSystemRights value
If($param2 -ieq $null){$param2 = "Everyone"}## Default Group Name value
## Escaping backslash's and quotes because of:
# NT AUTHORITY\INTERACTIVE empty spaces in User Imputs
If($param2 -Match '"' -and $param2 -Match '\\'){
$UserGroup = $param2 -replace '\\','\\' -replace '"',''
}ElseIf($param2 -Match '\\'){
$UserGroup = $param2 -replace '\\','\\'
}ElseIf($param2 -Match '"'){
$UserGroup = $param2 -replace '"',''
}Else{## Group Name without backslash's
$UserGroup = $param2
}
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("SearchDACL")|Out-Null
$mytable.Columns.Add("GroupName")|Out-Null
$mytable.Rows.Add("Sherlock",
"W$MajorVersion",
"$ProcessArchitecture",
"$param1",
"$param2")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
## Directorys to search recursive: $Env:PROGRAMFILES, ${Env:PROGRAMFILES(x86)}, $Env:LOCALAPPDATA\Programs\
$dAtAbAsEList = Get-ChildItem -Path "$Env:PROGRAMFILES", "${Env:PROGRAMFILES(x86)}", "$Env:LOCALAPPDATA\Programs\" -Recurse -ErrorAction SilentlyContinue -Force|Where { $_.PSIsContainer }|Select -ExpandProperty FullName
ForEach($Token in $dAtAbAsEList){## Loop truth Get-ChildItem Items (Paths)
If(-not($Token -Match 'WindowsApps')){## Exclude => WindowsApps folder [UnauthorizedAccessException]
$IsInHerit = (Get-Acl "$Token").Access.IsInherited|Select -First 1
(Get-Acl "$Token").Access|Where {## Search for Everyone:(F) folder permissions (default)
$CleanOutput = $_.FileSystemRights -Match "$param1" -and $_.IdentityReference -Match "$UserGroup" ## <-- In my system the IdentityReference is: 'Todos'
If($CleanOutput){$Count++ ## Write the Table 'IF' found any vulnerable permissions
Write-Host "`nVulnId : ${Count}::ACL (Mitre T1222)"
Write-Host "FolderPath : $Token" -ForegroundColor Yellow
Write-Host "FileSystemRights : $param1"
Write-Host "IdentityReference : $UserGroup"
Write-Host "IsInherited : $IsInHerit"
}
}## End of Get-Acl loop
}## End of Exclude WindowsApps
}## End of ForEach loop
Write-Host "`n`nWeak Directory Permissions"
Write-Host "--------------------------"
If(-not($Count -gt 0) -or $Count -ieq $null){## Weak directorys permissions report banner
Write-Host "None directorys found with '${UserGroup}:($param1)' permissions!" -ForegroundColor Red -BackgroundColor Black
}Else{
Write-Host "Found $Count directorys with '${UserGroup}:($param1)' permissions!" -ForegroundColor Green -BackgroundColor Black
}
Write-Host "";Start-Sleep -Seconds 2
}
function Get-RegPaths {
[int]$Count = 0 ## Loop counter
<#
.SYNOPSIS
Author: r00t-3xp10it
Find Weak Services Registry Permissions (EoP)
.EXAMPLE
PS C:\> Get-RegPaths
Find Weak Services Registry Permissions Everyone:(F)
.EXAMPLE
PS C:\> Get-RegPaths BUILTIN\Users
Get-RegPaths arg accepts the Group Name (Everyone|BUILTIN\Users)
REMARK: Use double quotes if Group Name contains any empty spaces in Name
#>
## Var declarations
$UserImput = $args[0]
If(-not($UserImput)){$UserImput = "Everyone"}
## Escaping backslash's and quotes because of:
# NT AUTHORITY\INTERACTIVE empty spaces in User Imputs
If($UserImput -Match '"' -and $UserImput -Match '\\'){
$UserGroup = "$UserImput" -replace '\\','\\' -replace '"',''
}ElseIf($UserImput -Match '\\'){
$UserGroup = "$UserImput" -replace '\\','\\'
}ElseIf($UserImput -Match '"'){
$UserGroup = "$UserImput" -replace '"',''
}Else{## Group Name without backslash's
$UserGroup = "$UserImput"
}
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("SrvPermissions")|Out-Null
$mytable.Columns.Add("GroupName")|Out-Null
$mytable.Rows.Add("Sherlock",
"W$MajorVersion",
"$ProcessArchitecture",
"FullControl",
"$UserGroup")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
Start-Sleep -Seconds 1
## Get ALL services under HKLM hive key
$GetPath = (Get-Acl -Path "HKLM:\SYSTEM\CurrentControlSet\services\*" -EA SilentlyContinue).PSPath
$ParseData = $GetPath -replace 'Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\','HKLM:\'
ForEach($Token in $ParseData){## Loop truth $ParseData services database List
$IsInHerit = (Get-Acl -Path "$Token").Access.IsInherited|Select -First 1
$CleanOutput = (Get-Acl -Path "$Token").Access|Where {## Search for Everyone:(F) registry service permissions (default)
$_.IdentityReference -Match "$UserGroup" -and $_.RegistryRights -Match 'FullControl' -and $_.IsInherited -Match 'False'
}
If($CleanOutput){$Count++ ## Write the Table 'IF' found any vulnerable permissions
Write-Host "`nVulnId : ${Count}::SRV"
Write-Host "RegistryPath : $Token" -ForegroundColor Yellow
Write-Host "IdentityReference : $UserGroup"
Write-Host "RegistryRights : FullControl"
Write-Host "AccessControlType : Allow"
Write-Host "IsInherited : $IsInHerit"
}
}
Write-Host "`n`nWeak Services Registry Permissions"
Write-Host "----------------------------------"
If(-not($Count -gt 0) -or $Count -ieq $null){## Weak directorys permissions report banner
Write-Host "None registry services found with '${UserGroup}:(FullControl)' permissions!" -ForegroundColor Red -BackgroundColor Black
}Else{
Write-Host "Found $Count registry services with '${UserGroup}:(FullControl)' permissions!" -ForegroundColor Green -BackgroundColor Black
}
Start-Sleep -Seconds 2;Write-Host ""
}
function Get-ModifiableRegPaths {
<#
.SYNOPSIS
Author: @itm4n|@r00t-3xp10it
Helper - Checks the permissions of a given registry key
and returns the ones that the current user can modify.
.DESCRIPTION
Any registry path that the current user has modification rights
on is returned in a custom object that contains the modifiable path,
associated permission set, and the IdentityReference with the specified
rights. The SID of the current user and any group he/she are a part of
are used as the comparison set against the parsed path DACLs.
.EXAMPLE
PS C:\> Get-ModifiableRegPaths
.OUTPUTS
Name : VulnService
ImagePath : C:\APPS\MyApp\service.exe
User : NT AUTHORITY\NetworkService
ModifiablePath : HKLM:\SYSTEM\CurrentControlSet\Services\VulnService
IdentityReference : NT AUTHORITY\INTERACTIVE
Permissions : ReadControl, AppendData/AddSubdirectory, ReadExtendedAttributes, ReadData/ListDirectory
Status : Running
UserCanStart : True
UserCanRestart : False
#>
BEGIN {
If($IsClientAdmin){## This module cant not run under admin privs
write-host "[error] This module cant not run under administrator privs!" -ForegroundColor Red -BackgroundColor Black
Write-Host "";Start-Sleep -Seconds 1
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("SearchFor")|Out-Null
$mytable.Rows.Add("Sherlock",
"W$MajorVersion",
"$ProcessArchitecture",
"ModifiableRegPaths")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
# from http://stackoverflow.com/questions/28029872/retrieving-security-descriptor-and-getting-number-for-filesystemrights
$AccessMask = @{
[uint32]'0x80000000' = 'GenericRead'
[uint32]'0x40000000' = 'GenericWrite'
[uint32]'0x20000000' = 'GenericExecute'
[uint32]'0x10000000' = 'GenericAll'
[uint32]'0x02000000' = 'MaximumAllowed'
[uint32]'0x01000000' = 'AccessSystemSecurity'
[uint32]'0x00100000' = 'Synchronize'
[uint32]'0x00080000' = 'WriteOwner'
[uint32]'0x00040000' = 'WriteDAC'
[uint32]'0x00020000' = 'ReadControl'
[uint32]'0x00010000' = 'Delete'
[uint32]'0x00000100' = 'WriteAttributes'
[uint32]'0x00000080' = 'ReadAttributes'
[uint32]'0x00000040' = 'DeleteChild'
[uint32]'0x00000020' = 'Execute/Traverse'
[uint32]'0x00000010' = 'WriteExtendedAttributes'
[uint32]'0x00000008' = 'ReadExtendedAttributes'
[uint32]'0x00000004' = 'AppendData/AddSubdirectory'
[uint32]'0x00000002' = 'WriteData/AddFile'
[uint32]'0x00000001' = 'ReadData/ListDirectory'
}
$UserIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$CurrentUserSids = $UserIdentity.Groups | Select-Object -ExpandProperty Value
$CurrentUserSids += $UserIdentity.User.Value
$TranslatedIdentityReferences = @{}
}
PROCESS {
[string]$Path = "HKLM:\SYSTEM\CurrentControlSet\Services\*"
$KeyAcl = Get-Acl -Path $Path -ErrorAction SilentlyContinue -ErrorVariable GetAclError
If(-not $GetAclError){
$KeyAcl|Select-Object -ExpandProperty Access|Where-Object {($_.AccessControlType -Match 'Allow')}|ForEach-Object {
$RegistryRights = $_.RegistryRights.value__
$Permissions = $AccessMask.Keys|Where-Object { $RegistryRights -band $_ }|ForEach-Object { $accessMask[$_] }
# the set of permission types that allow for modification
$Comparison = Compare-Object -ReferenceObject $Permissions -DifferenceObject @('GenericWrite', 'GenericAll', 'MaximumAllowed', 'WriteOwner', 'WriteDAC', 'WriteData/AddFile', 'AppendData/AddSubdirectory') -IncludeEqual -ExcludeDifferent
If($Comparison){
If($_.IdentityReference -NotMatch '^S-1-5.*'){
If(-not($TranslatedIdentityReferences[$_.IdentityReference])){
# translate the IdentityReference if it's a username and not a SID
$IdentityUser = New-Object System.Security.Principal.NTAccount($_.IdentityReference)
$TranslatedIdentityReferences[$_.IdentityReference] = $IdentityUser.Translate([System.Security.Principal.SecurityIdentifier]) | Select-Object -ExpandProperty Value
}
$IdentitySID = $TranslatedIdentityReferences[$_.IdentityReference]
}Else{
$IdentitySID = $_.IdentityReference
}
If($CurrentUserSids -Contains $IdentitySID){
$State = $True ## Mark that we have found a vulnerable service
$ParseData = $Path -replace '{Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE','HKLM:' -replace '}',''
$parsePerm = $Permissions -replace '{','' -replace '}',''
New-Object -TypeName PSObject -Property @{
ModifiablePath = $ParseData
IdentityReference = $_.IdentityReference
Permissions = $parsePerm
}
}
}
}
}
If(-not($State)){## None vuln Service registry found
Write-Host "`n`nModifiable Registry Service Paths"
Write-Host "---------------------------------"
write-host "None Service Insecure Registry Permissions Found!" -ForegroundColor Red -BackgroundColor Black
}
Write-Host ""
}
}## This module cant not run under admin privs
}
function Get-Rotten {
[int]$Count = 0 ## Loop counter
<#
.SYNOPSIS
Author: r00t-3xp10it
Find Rotten Potato vulnerable settings (EoP)
.NOTES
Rotten Potato tests can 'NOT' run under Admin privs
.EXAMPLE
PS C:\> Get-Rotten
Find Rotten Potato vuln privilege settings (EoP)
#>
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("SearchFor")|Out-Null
$mytable.Rows.Add("Sherlock",
"W$MajorVersion",
"$ProcessArchitecture",
"RottenPotato")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
## Make sure we are NOT running tests under Administrator privs
$IsClientAdmin = [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -Match "S-1-5-32-544")
If(-not($IsClientAdmin)){## Running tests Under UserLand Privileges => OK
$ListPrivsDb = whoami /priv|findstr /V "PRIVILEGES INFORMATION -----"
## Display privileges List onscreen
echo $ListPrivsDb > "$Env:TMP\ListPrivsDb.txt"
Get-Content -Path "$Env:TMP\ListPrivsDb.txt"
Remove-Item -Path "$Env:TMP\ListPrivsDb.txt" -Force
## Search for vulnerable settings in command output to build LogFile
# MyLocalVulnTest: whoami /priv|findstr /C:"SeChangeNotifyPrivilege" > $Env:TMP\DCprivs.log
whoami /priv|findstr /C:"SeImpersonatePrivilege" /C:"SeAssignPrimaryPrivilege" /C:"SeTcbPrivilege" /C:"SeBackupPrivilege" /C:"SeRestorePrivilege" /C:"SeCreateTokenPrivilege" /C:"SeLoadDriverPrivilege" /C:"SeTakeOwnershipPrivilege" /C:"SeDebugPrivileges" > $Env:TMP\DCprivs.log
$CheckVulnSet = Get-Content -Path "$Env:TMP\DCprivs.log"|findstr /I /C:"Enabled"
ForEach($Item in $CheckVulnSet){## Id every vulnerable settings found
$Count++
}
Write-Host "`n`nRotten Potato Vulnerability"
Write-Host "---------------------------";Start-Sleep -Seconds 1
If($CheckVulnSet){## Check if there are vulnerable settings to report them
Write-Host "Found $Count Rotten Potato Vulnerable Setting(s)" -ForegroundColor Green -BackgroundColor Black
Write-Host "----------------------------- --------------------------------------------- --------"
Get-Content "$Env:TMP\DCprivs.log"|findstr /I /C:"Enabled";remove-item "$Env:TMP\DCprivs.log" -Force
}Else{
Write-Host "None Rotten Potato vulnerable settings found under current system!" -ForegroundColor Red -BackgroundColor Black
}
}Else{## Rotten Potato can NOT run under Admin privs
Write-Host "`n`nRotten Potato Vulnerability"
Write-Host "---------------------------";Start-Sleep -Seconds 1
Write-Host "Rotten Potato tests can NOT run under Administrator privileges!" -ForegroundColor Red -BackgroundColor Black
}
## Clean old LogFiles
If(Test-Path -Path "$Env:TMP\DCprivs.log"){remove-item "$Env:TMP\DCprivs.log" -Force}
Start-Sleep -Seconds 2;Write-Host ""
}
function Get-HotFixs {
$KBDataEntrys = "null"
[int]$Count = 0 ## Loop counter
<#
.SYNOPSIS
Author: r00t-3xp10it
Find missing KB security packages
.NOTES
Sherlock KB tests will compare installed KB
Id patches againts Sherlock $dATAbASE Id list
Special thanks to @youhacker55 (W7 x64 database)
Special thanks to @TroyDTaylor (W8 x64 database)
.EXAMPLE
PS C:\> Get-HotFixs
Find missing security KB packages (HotFix Id)
#>
## Variable declarations
$MajorVersion = [int]$OSVersion.split(".")[0]
$CPUArchitecture = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
## Number of KB's entrys (db)
If($MajorVersion -eq "vista"){
$KBDataEntrys = "16" ## Credits: @r00t-3xp10it (fully patch)
$KB_dataBase = "23/12/2020" ## KB entrys database last update date
}ElseIf($MajorVersion -eq '7' -and $CPUArchitecture -eq "64 bits"){
$KBDataEntrys = "102" ## Credits: @youhacker55 (fully patch)
$KB_dataBase = "25/12/2020" ## KB entrys database last update date
}ElseIf($MajorVersion -eq '7' -and $CPUArchitecture -eq "32 bits"){
$KBDataEntrys = "16" ## <-- TODO: confirm
$KB_dataBase = "23/12/2020" ## KB entrys database last update date
}ElseIf($MajorVersion -eq '8'){
$KBDataEntrys = "44" ## Credits: @TroyDTaylor (fully patch)
$KB_dataBase = "06/01/2021" ## KB entrys database last update date
}ElseIf($MajorVersion -eq '10' -and $CPUArchitecture -eq "64 bits"){
$KBDataEntrys = "19" ## Credits: @r00t-3xp10it (fully patch)
$KB_dataBase = "13/01/2021" ## KB entrys database last update date
}
## Create Data Table for output
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("Entrys")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("DataBase")|Out-Null
$mytable.Rows.Add("Sherlock",
"$KBDataEntrys",
"W$MajorVersion",
"$ProcessArchitecture",
"$KB_dataBase")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
## Generates List of installed HotFixs
$GetKBId = (Get-HotFix).HotFixID
## Sherlock $dATAbASE Lists
# Supported versions: Windows (vista|7|8|8.1|10)
If($MajorVersion -eq 10){## Windows 10
If($CPUArchitecture -eq "64 bits" -or $ProcessArchitecture -eq "AMD64"){
$dATAbASE = @(## Windows 10 x64 bits
"KB4586878","KB4497165","KB4515383","KB4516115",
"KB4517245","KB4521863","KB4524569","KB4528759",
"KB4535680","KB4537759","KB4538674","KB4541338",
"KB4552152","KB4559309","KB4560959","KB4561600",
"KB4580325","KB4598479","KB4598229"#"KB3245007", ## Fake KB entry for debug
)
}Else{## Windows 10 x32 bits
$dATAbASE = "Not supported under W$MajorVersion ($CPUArchitecture) architecture"
$bypassTest = "True" ## Architecture 'NOT' supported by this test
}
}ElseIf($MajorVersion -eq 8){## Windows (8|8.1)
If($CPUArchitecture -eq "64 bits" -or $ProcessArchitecture -eq "AMD64"){
$dATAbASE = @(## Windows 8.1 x64 bits (@TroyDTaylor)
"KB2920189","KB2931358","KB2931366","KB2949621","KB2961072","KB2976627",
"KB2977629","KB2987107","KB3003057","KB3004545","KB3019978","KB3035126",
"KB3045685","KB3045999","KB3046017","KB3046737","KB3059317","KB3061512",
"KB3062760","KB3071756","KB3076949","KB3084135","KB3086255","KB3109103",
"KB3109560","KB3110329","KB3126434","KB3126587","KB3138910","KB3138962",
"KB3139398","KB3139914","KB3146723","KB3155784","KB3156059","KB3159398",
"KB3161949","KB3172729","KB3175024","KB3178539","KB3187754","KB4566425",
"KB4580325","KB4592484"
)
}Else{## Windows 8.1 x32 bits
$dATAbASE = "Not supported under W$MajorVersion ($CPUArchitecture) architecture"
$bypassTest = "True" ## Architecture 'NOT' supported by this test
}
}ElseIf($MajorVersion -eq 7){## Windows 7
If($CPUArchitecture -eq "64 bits" -or $ProcessArchitecture -eq "AMD64"){
$dATAbASE = @(## Windows 7 x64 bits (@youhacker55 KB List)
"KB2479943","KB2491683","KB2506212","KB2560656","KB2564958","KB2579686",
"KB2585542","KB2604115","KB2620704","KB2621440","KB2631813","KB2653956",
"KB2654428","KB2656356","KB2667402","KB2685939","KB2690533","KB2698365",
"KB2705219","KB2706045","KB2727528","KB2729452","KB2736422","KB2742599",
"KB2758857","KB2770660","KB2789645","KB2807986","KB2813430","KB2840631",
"KB2847927","KB2861698","KB2862330","KB2862335","KB2864202","KB2868038",
"KB2871997","KB2884256","KB2893294","KB2894844","KB2900986","KB2911501",
"KB2931356","KB2937610","KB2943357","KB2968294","KB2972100","KB2972211",
"KB2973112","KB2973201","KB2977292","KB2978120","KB2978742","KB2984972",
"KB2991963","KB2992611","KB3004375","KB3010788","KB3011780","KB3019978",
"KB3021674","KB3023215","KB3030377","KB3031432","KB3035126","KB3037574",
"KB3045685","KB3046017","KB3046269","KB3055642","KB3059317","KB3060716",
"KB3067903","KB3071756","KB3072305","KB3074543","KB3075220","KB3086255",
"KB3092601","KB3093513","KB3097989","KB3101722","KB3108371","KB3108664",
"KB3109103","KB3109560","KB3110329","KB3115858","KB3122648","KB3124275",
"KB3126587","KB3127220","KB3138910","KB3139398","KB3139914","KB3150220",
"KB3155178","KB3156016","KB3159398","KB3161949","KB4474419","KB4054518"
)
}Else{
$dATAbASE = @(## Windows 7 x32 bits
"KB4033342","KB4078130","KB4074906",
"KB3186497","KB4020513","KB4020507",
"KB4020503","KB3216523","KB3196686",
"KB3083186","KB3074233","KB3074230",
"KB3037581","KB3035490","KB3023224",
"KB2979578"
)
}
}ElseIf($MajorVersion -eq "Vista"){
$dATAbASE = @(## Windows Vista x32/x64 bits
"KB3033890","KB3045171","KB3046002",
"KB3050945","KB3051768","KB3055642",
"KB3057839","KB3059317","KB3061518",
"KB3063858","KB3065979","KB3067505",
"KB3067903","KB3069392","KB3070102",
"KB3072630"
)
}Else{
$dATAbASE = "Not supported under W$MajorVersion ($CPUArchitecture) systems"
$bypassTest = "True" ## Operative System Flavor 'NOT' supported by this test
}
## Put Installed KB Id patches into an array list
[System.Collections.ArrayList]$LocalKBLog = $GetKBId
Write-Host "Id HotFixID Status VulnState"
Write-Host "-- --------- --------- ---------"
## Compare the two KB Lists
ForEach($KBkey in $dATAbASE){
Start-Sleep -Milliseconds 500
If(-not($LocalKBLog -Match $KBkey)){$Count++
If($bypassTest -eq "True"){## Operative System OR Arch NOT supported output
Write-Host "$Count <$KBkey>" -ForeGroundColor Red -BackGroundColor Black
Start-Sleep -Milliseconds 200
}Else{## KB security Patch not found output (not patched)
Write-Host "$Count $KBkey <Missing> <NotFound>" -ForeGroundColor Red -BackGroundColor Black
Start-Sleep -Milliseconds 200
}
}Else{## KB security Patch found output (patched)
Write-Host "+ $KBkey Installed Patched" -ForeGroundColor Green
}
}
Start-Sleep -Seconds 2;Write-Host ""
}
function Get-DllHijack {
<#
.SYNOPSIS
Author: r00t-3xp10it|@Adam_Kramer
Find service DLL's prone to Hijacking
.NOTES
dll_hijack_detect_x64.exe created by @Adam_Kramer
https://github.com/adamkramer/dll_hijack_detect
.EXAMPLE
PS C:\> Get-DllHijack
Find DLL's prone to hijacking (EoP).
.EXAMPLE
PS C:\> Get-DllHijack EnvPaths
Checks if the current %PATH% has any directories
that Migth be writeable (W) by the current user.
#>
Write-Host ""
## Create Data Table for output
$MajorVersion = [int]$OSVersion.split(".")[0]
$mytable = New-Object System.Data.DataTable
$mytable.Columns.Add("ModuleName")|Out-Null
$mytable.Columns.Add("OS")|Out-Null
$mytable.Columns.Add("Arch")|Out-Null
$mytable.Columns.Add("SearchFor")|Out-Null
$mytable.Rows.Add("Sherlock",
"W$MajorVersion",
"$ProcessArchitecture",
"DLL-Hijack")|Out-Null
## Display Data Table
$mytable|Format-Table -AutoSize > $Env:TMP\MyTable.log
Get-Content -Path "$Env:TMP\MyTable.log"
Remove-Item -Path "$Env:TMP\MyTable.log" -Force
Start-sleep -Seconds 2
## User Imputs
$ModuleSelection = $args[0]
If($ModuleSelection -ieq "EnvPaths"){## Finds all %PATH% .DLL hijacking opportunities.
<#
.SYNOPSIS
Phantom DLL hijacking
Checks if the current %PATH% has any directories
that are writeable (W) by the current user.
.EXAMPLE
PS C:\> Get-DllHijack EnvPaths
Finds all %PATH% .DLL hijacking opportunities.
#>
## Variable declarations
$OrigError = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
$Paths = (Get-Item Env:Path).value.split(';')|Where-Object {$_ -ne ""}
ForEach($Path in $Paths){
$Path = $Path.Replace('"',"")
If(-not $Path.EndsWith("\")){
$Path = $Path + "\"
}
## reference - http://stackoverflow.com/questions/9735449/how-to-verify-whether-the-share-has-write-access
# This function writes a random file on $Path to test if user as 'Write (W)' privileges on $Path
$TestPath = Join-Path $Path ([IO.Path]::GetRandomFileName())
## if the path doesn't exist
# try to create the folder before testing it for write
if(-not $(Test-Path -Path $Path)){
try {
## try to create the folder
$Null = New-Item -ItemType directory -Path $Path
echo $Null > $TestPath
$Out = New-Object PSObject
$Out|Add-Member Noteproperty 'Permissions' 'Write'
$Out|Add-Member Noteproperty 'HijackablePath' $Path
$Out #|Format-Table -AutoSize
}
catch {}
finally {
## remove the directory
Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue
}
}
Else{
try {
## if the folder already exists
echo $Null > $TestPath
$Out = New-Object PSObject
$Out|Add-Member Noteproperty 'Permissions' 'Write'
$Out|Add-Member Noteproperty 'HijackablePath' $Path
$Out #|Format-Table -AutoSize
}
catch {}
finally {
## Try to remove the item again just to be safe
Remove-Item $TestPath -Force -ErrorAction SilentlyContinue
}
}
}
Start-Sleep -Seconds 2
}Else{## dll_hijack_detect_x64.exe by @Adam_Kramer
<#
.SYNOPSIS
Author: r00t-3xp10it
Find service DLL's prone to Hijacking
.NOTES
dll_hijack_detect_x64.exe created by @Adam_Kramer
https://github.com/adamkramer/dll_hijack_detect
.EXAMPLE
PS C:\> Get-DllHijack
Find service DLL's prone to Hijacking (DLL-Hijack)
#>
## Variable declarations
$Architecture = Get-Architecture
$ArchBuildBits = $Architecture[0]
If($ArchBuildBits -eq "64 bits"){## Download x64 binary
$ArchiveName = "dll_hijack_detect_x64"
$limmitKbytes = "26" ## Archive is: 26,9130859375/KB
}Else{## Download x86 binary
$ArchiveName = "dll_hijack_detect_x86"
$limmitKbytes = "5" ## Archive is: 5,6396484375/KB
}
## Download dll_hijack_detect.zip (x86|x64) archive from my GitHub repository
# Repository: https://github.com/r00t-3xp10it/venom/blob/master/bin/dll_hijack_detect_x64.zip
Start-BitsTransfer -priority foreground -Source https://raw.githubusercontent.com/r00t-3xp10it/venom/master/bin/${ArchiveName}.zip -Destination $Env:TMP\${ArchiveName}.zip -ErrorAction SilentlyContinue|Out-Null
## Check for Failed/Corrupted archive download
If(Test-Path -Path "$Env:TMP\${ArchiveName}.zip"){
$SizeDump = ((Get-Item "$Env:TMP\${ArchiveName}.zip" -EA SilentlyContinue).length/1KB)
If($SizeDump -lt $limmitKbytes){## Archive corrupted detected
Write-Host "`n`nDll Hijacking"
Write-Host "-------------";Start-Sleep -Seconds 1
Write-Host "[corrupted] Fail to download '${ArchiveName}.zip' archive ($SizeDump/KB)" -ForegroundColor Red -BackgroundColor Black
Start-Sleep -Seconds 1
}Else{## Remote execute dll_hijack_detect.exe binary
## De-Compress dll_hijack_detect Archive into $Env:TMP remote directory
Expand-Archive -LiteralPath "$Env:TMP\${ArchiveName}.zip" -DestinationPath "$Env:TMP" -Force