blob: 2a1118ffcfa835c29a7c52126cccab58351cef9a (
plain)
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
|
# Get-ModifiablePath
## SYNOPSIS
Parses a passed string containing multiple possible file/folder paths and returns
the file paths where the current user has modification rights.
Author: Will Schroeder (@harmj0y)
License: BSD 3-Clause
Required Dependencies: None
## SYNTAX
```
Get-ModifiablePath [-Path] <String[]> [-Literal]
```
## DESCRIPTION
Takes a complex path specification of an initial file/folder path with possible
configuration files, 'tokenizes' the string in a number of possible ways, and
enumerates the ACLs for each path that currently exists on the system.
Any 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.
## EXAMPLES
### -------------------------- EXAMPLE 1 --------------------------
```
'"C:\Temp\blah.exe" -f "C:\Temp\config.ini"' | Get-ModifiablePath
```
Path Permissions IdentityReference
---- ----------- -----------------
C:\Temp\blah.exe {ReadAttributes, ReadCo...
NT AUTHORITY\Authentic...
C:\Temp\config.ini {ReadAttributes, ReadCo...
NT AUTHORITY\Authentic...
### -------------------------- EXAMPLE 2 --------------------------
```
Get-ChildItem C:\Vuln\ -Recurse | Get-ModifiablePath
```
Path Permissions IdentityReference
---- ----------- -----------------
C:\Vuln\blah.bat {ReadAttributes, ReadCo...
NT AUTHORITY\Authentic...
C:\Vuln\config.ini {ReadAttributes, ReadCo...
NT AUTHORITY\Authentic...
...
## PARAMETERS
### -Path
The string path to parse for modifiable files.
Required
```yaml
Type: String[]
Parameter Sets: (All)
Aliases: FullName
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### -Literal
Switch.
Treat all paths as literal (i.e.
don't do 'tokenization').
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: LiteralPaths
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
## OUTPUTS
### PowerUp.TokenPrivilege.ModifiablePath
Custom PSObject containing the Permissions, ModifiablePath, IdentityReference for
a modifiable path.
## NOTES
## RELATED LINKS
|