PyADRecon-ADWS 0.4.7__tar.gz → 0.4.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/CHANGELOG.md +10 -10
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PKG-INFO +2 -2
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PyADRecon_ADWS.egg-info/PKG-INFO +2 -2
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/README.md +1 -1
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/dashboard_generator.py +19 -1
- pyadrecon_adws-0.4.9/package.json +3 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/pyadrecon_adws.py +86 -19
- pyadrecon_adws-0.4.7/package.json +0 -3
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.dockerignore +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.github/FUNDING.yml +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.github/pyadrecon.png +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.github/workflows/conventional-commits.yml +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.github/workflows/pypi.yml +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/.gitignore +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/Dockerfile +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/LICENSE +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PyADRecon_ADWS.egg-info/SOURCES.txt +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PyADRecon_ADWS.egg-info/dependency_links.txt +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PyADRecon_ADWS.egg-info/entry_points.txt +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PyADRecon_ADWS.egg-info/requires.txt +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/PyADRecon_ADWS.egg-info/top_level.txt +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/__init__.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/__init__.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/adws.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/__init__.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/encoder.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/__init__.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/attributes.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/constants.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/datatypes.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/elements.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/record.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/text.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/records/utils.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/encoder/xml_parser.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/ms_nmf.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/ms_nns.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws/soap_templates.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/helpers/adws_wrapper.py +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/pyproject.toml +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/requirements.txt +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/setup.cfg +0 -0
- {pyadrecon_adws-0.4.7 → pyadrecon_adws-0.4.9}/windows/README.md +0 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
## [0.4.
|
|
1
|
+
## [0.4.9](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.4.8...v0.4.9) (2026-02-21)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* refactor ESC9 detection ([25edd71](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/25edd71178dc0525520225678283deee06e2817a))
|
|
7
7
|
|
|
8
|
-
## [0.4.
|
|
8
|
+
## [0.4.8](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.4.7...v0.4.8) (2026-02-21)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
### Bug Fixes
|
|
12
12
|
|
|
13
|
-
*
|
|
13
|
+
* refactor ESC2, ESC3, ESC4 detection; add manager approval to dashboard ([9f2a78b](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/9f2a78b513d0b4c5edb97037fbff9e5e2cd0905f))
|
|
14
14
|
|
|
15
|
-
## [0.4.
|
|
15
|
+
## [0.4.7](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.4.6...v0.4.7) (2026-02-21)
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
### Bug Fixes
|
|
19
19
|
|
|
20
|
-
*
|
|
20
|
+
* add laps readers to table and adjust maq text ([4572632](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/457263232199c1e7fd1c94986b6600fa128438fc))
|
|
21
21
|
|
|
22
|
-
## [0.4.
|
|
22
|
+
## [0.4.6](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.4.5...v0.4.6) (2026-02-21)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
### Bug Fixes
|
|
26
26
|
|
|
27
|
-
*
|
|
27
|
+
* hide non-issue tiles and add maq finding ([e7bfff7](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/e7bfff77ea57bf3eb88718189eb94123a25fc346))
|
|
28
28
|
|
|
29
|
-
## [0.4.
|
|
29
|
+
## [0.4.5](https://github.com/l4rm4nd/PyADRecon-ADWS/compare/v0.4.4...v0.4.5) (2026-02-21)
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
### Bug Fixes
|
|
33
33
|
|
|
34
|
-
*
|
|
34
|
+
* counter for security findings in navigation ([f762720](https://github.com/l4rm4nd/PyADRecon-ADWS/commit/f762720bb1d8d1bd63e69aab2b4c71c43b22e64b))
|
|
35
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyADRecon-ADWS
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.9
|
|
4
4
|
Summary: Python Active Directory Reconnaissance Tool (ADRecon port) using ADWS with NTLM support.
|
|
5
5
|
Author: LRVT
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: license-file
|
|
|
22
22
|
|
|
23
23
|
A Python3 implementation of [PyADRecon](https://github.com/l4rm4nd/PyADRecon) using ADWS instead of LDAP for Pentesters, Red and Blue Teams
|
|
24
24
|
|
|
25
|
-
> PyADRecon is a tool which gathers information about MS Active Directory and generates an XSLX report to provide a holistic picture of the current state of the target AD environment.
|
|
25
|
+
> PyADRecon is a tool which gathers information about MS Active Directory and generates an XSLX + HTML report to provide a holistic picture of the current security state of the target AD environment.
|
|
26
26
|
|
|
27
27
|
>[!TIP]
|
|
28
28
|
>Queries Active Directory Web Services (ADWS) over TCP/9389 instead of LDAP to fly under the EDR radar.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyADRecon-ADWS
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.9
|
|
4
4
|
Summary: Python Active Directory Reconnaissance Tool (ADRecon port) using ADWS with NTLM support.
|
|
5
5
|
Author: LRVT
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: license-file
|
|
|
22
22
|
|
|
23
23
|
A Python3 implementation of [PyADRecon](https://github.com/l4rm4nd/PyADRecon) using ADWS instead of LDAP for Pentesters, Red and Blue Teams
|
|
24
24
|
|
|
25
|
-
> PyADRecon is a tool which gathers information about MS Active Directory and generates an XSLX report to provide a holistic picture of the current state of the target AD environment.
|
|
25
|
+
> PyADRecon is a tool which gathers information about MS Active Directory and generates an XSLX + HTML report to provide a holistic picture of the current security state of the target AD environment.
|
|
26
26
|
|
|
27
27
|
>[!TIP]
|
|
28
28
|
>Queries Active Directory Web Services (ADWS) over TCP/9389 instead of LDAP to fly under the EDR radar.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A Python3 implementation of [PyADRecon](https://github.com/l4rm4nd/PyADRecon) using ADWS instead of LDAP for Pentesters, Red and Blue Teams
|
|
4
4
|
|
|
5
|
-
> PyADRecon is a tool which gathers information about MS Active Directory and generates an XSLX report to provide a holistic picture of the current state of the target AD environment.
|
|
5
|
+
> PyADRecon is a tool which gathers information about MS Active Directory and generates an XSLX + HTML report to provide a holistic picture of the current security state of the target AD environment.
|
|
6
6
|
|
|
7
7
|
>[!TIP]
|
|
8
8
|
>Queries Active Directory Web Services (ADWS) over TCP/9389 instead of LDAP to fly under the EDR radar.
|
|
@@ -842,7 +842,7 @@ class DashboardGenerator:
|
|
|
842
842
|
</p>
|
|
843
843
|
<h3 class="font-semibold text-orange-800 dark:text-orange-200 mb-2">💡 Remediation</h3>
|
|
844
844
|
<p class="text-orange-700 dark:text-orange-300 text-sm">
|
|
845
|
-
<strong>Secure template permissions:</strong> Remove enrollment rights from Domain Users/Authenticated Users. Enable Manager Approval for high-risk templates. Set "This number of authorized signatures" to ≥1
|
|
845
|
+
<strong>Secure template permissions:</strong> Remove enrollment rights from Domain Users/Authenticated Users. Enable Manager Approval for high-risk templates. Set "This number of authorized signatures" to ≥1. Disable "Enrollee Supplies Subject" or require manager approval. For ESC9 configure certificate mapping to Strong (preventing certificate theft impersonation) or remove the CT_FLAG_NO_SECURITY_EXTENSION flag from enrollment flags. Regularly audit certificate templates against ESC vulnerabilities using <a href="https://github.com/GhostPack/Certify" target="_blank" class="tool-link">Certify</a>, <a href="https://github.com/ly4k/Certipy" target="_blank" class="tool-link">Certipy</a> or <a href="https://github.com/TrimarcJake/Locksmith" target="_blank" class="tool-link">Locksmith</a>.
|
|
846
846
|
</p>
|
|
847
847
|
</div>
|
|
848
848
|
<div class="table-container">
|
|
@@ -869,6 +869,11 @@ class DashboardGenerator:
|
|
|
869
869
|
<i v-if="vulnCertTemplateSortColumn === 'Enrollment Rights'" :class="vulnCertTemplateSortDirection === 'asc' ? 'fas fa-sort-up' : 'fas fa-sort-down'" class="ml-1"></i>
|
|
870
870
|
<i v-else class="fas fa-sort ml-1 opacity-30"></i>
|
|
871
871
|
</th>
|
|
872
|
+
<th @click="sortVulnCertTemplates('Requires Manager Approval')" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700">
|
|
873
|
+
Manager Approval
|
|
874
|
+
<i v-if="vulnCertTemplateSortColumn === 'Requires Manager Approval'" :class="vulnCertTemplateSortDirection === 'asc' ? 'fas fa-sort-up' : 'fas fa-sort-down'" class="ml-1"></i>
|
|
875
|
+
<i v-else class="fas fa-sort ml-1 opacity-30"></i>
|
|
876
|
+
</th>
|
|
872
877
|
<th @click="sortVulnCertTemplates('Risk Level')" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700">
|
|
873
878
|
Risk Level
|
|
874
879
|
<i v-if="vulnCertTemplateSortColumn === 'Risk Level'" :class="vulnCertTemplateSortDirection === 'asc' ? 'fas fa-sort-up' : 'fas fa-sort-down'" class="ml-1"></i>
|
|
@@ -887,6 +892,10 @@ class DashboardGenerator:
|
|
|
887
892
|
</td>
|
|
888
893
|
<td class="px-6 py-4 text-sm">{{{{ template['Risk Factors'] !== 'None' ? template['Risk Factors'] : '-' }}}}</td>
|
|
889
894
|
<td class="px-6 py-4 text-sm">{{{{ template['Enrollment Rights'] }}}}</td>
|
|
895
|
+
<td class="px-6 py-4">
|
|
896
|
+
<span v-if="template['Requires Manager Approval'] === true || template['Requires Manager Approval'] === 'True'" class="badge badge-low">Yes</span>
|
|
897
|
+
<span v-else class="badge badge-high">No</span>
|
|
898
|
+
</td>
|
|
890
899
|
<td class="px-6 py-4">
|
|
891
900
|
<span v-if="template['Risk Level'] === 'CRITICAL'" class="badge badge-critical">CRITICAL</span>
|
|
892
901
|
<span v-else-if="template['Risk Level'] === 'HIGH'" class="badge badge-high">HIGH</span>
|
|
@@ -1502,6 +1511,11 @@ class DashboardGenerator:
|
|
|
1502
1511
|
<i v-if="certTemplateSortColumn === 'Enrollment Rights'" :class="certTemplateSortDirection === 'asc' ? 'fas fa-sort-up' : 'fas fa-sort-down'" class="ml-1"></i>
|
|
1503
1512
|
<i v-else class="fas fa-sort ml-1 opacity-30"></i>
|
|
1504
1513
|
</th>
|
|
1514
|
+
<th @click="sortCertTemplates('Requires Manager Approval')" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700">
|
|
1515
|
+
Manager Approval
|
|
1516
|
+
<i v-if="certTemplateSortColumn === 'Requires Manager Approval'" :class="certTemplateSortDirection === 'asc' ? 'fas fa-sort-up' : 'fas fa-sort-down'" class="ml-1"></i>
|
|
1517
|
+
<i v-else class="fas fa-sort ml-1 opacity-30"></i>
|
|
1518
|
+
</th>
|
|
1505
1519
|
</tr>
|
|
1506
1520
|
</thead>
|
|
1507
1521
|
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
@@ -1517,6 +1531,10 @@ class DashboardGenerator:
|
|
|
1517
1531
|
</td>
|
|
1518
1532
|
<td class="px-6 py-4 text-sm">{{{{ template['ESC Vulnerabilities'] || 'None' }}}}</td>
|
|
1519
1533
|
<td class="px-6 py-4 text-sm">{{{{ template['Enrollment Rights'] || 'N/A' }}}}</td>
|
|
1534
|
+
<td class="px-6 py-4">
|
|
1535
|
+
<span v-if="template['Requires Manager Approval'] === true || template['Requires Manager Approval'] === 'True'" class="badge badge-low">Yes</span>
|
|
1536
|
+
<span v-else class="badge badge-high">No</span>
|
|
1537
|
+
</td>
|
|
1520
1538
|
</tr>
|
|
1521
1539
|
</tbody>
|
|
1522
1540
|
</table>
|
|
@@ -77,7 +77,7 @@ except ImportError:
|
|
|
77
77
|
DASHBOARD_AVAILABLE = False
|
|
78
78
|
|
|
79
79
|
# Constants
|
|
80
|
-
VERSION = "v0.4.
|
|
80
|
+
VERSION = "v0.4.9" # Automatically updated by CI/CD pipeline during release
|
|
81
81
|
BANNER = f"""
|
|
82
82
|
╔═══════════════════════════════════════════════════════════════════
|
|
83
83
|
║ PyADRecon-ADWS {VERSION} - Python AD Reconnaissance Tool (ADWS)
|
|
@@ -1546,9 +1546,9 @@ class PyADRecon:
|
|
|
1546
1546
|
|
|
1547
1547
|
def _is_low_privilege_principal(self, principal_name: str) -> bool:
|
|
1548
1548
|
"""Check if a principal is low-privileged based on SID resolution."""
|
|
1549
|
-
# Extract SID from principal name if it's in [
|
|
1550
|
-
if '[SID]' in principal_name:
|
|
1551
|
-
# Extract SID from "[SID] S-1-..."
|
|
1549
|
+
# Extract SID from principal name if it's in [SID] or [domain SID] format
|
|
1550
|
+
if '[SID]' in principal_name or 'SID]' in principal_name:
|
|
1551
|
+
# Extract SID from "[SID] S-1-..." or "[domain.name SID] S-1-..."
|
|
1552
1552
|
sid_match = re.search(r'S-1-[0-9-]+', principal_name)
|
|
1553
1553
|
if sid_match:
|
|
1554
1554
|
sid = sid_match.group(0)
|
|
@@ -1568,7 +1568,23 @@ class PyADRecon:
|
|
|
1568
1568
|
'[group] domain guests',
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
|
-
|
|
1571
|
+
if principal_lower in low_priv_names:
|
|
1572
|
+
return True
|
|
1573
|
+
|
|
1574
|
+
# Check if this is an individual user account (not a well-known admin)
|
|
1575
|
+
# Individual users who are not privileged accounts should be considered low-priv for ESC detection
|
|
1576
|
+
if '[user]' in principal_lower:
|
|
1577
|
+
# Exclude well-known privileged user accounts
|
|
1578
|
+
admin_users = {
|
|
1579
|
+
'[user] administrator',
|
|
1580
|
+
'[user] krbtgt',
|
|
1581
|
+
'[user] guest'
|
|
1582
|
+
}
|
|
1583
|
+
if principal_lower not in admin_users:
|
|
1584
|
+
# This is a regular user account, consider it low-privilege
|
|
1585
|
+
return True
|
|
1586
|
+
|
|
1587
|
+
return False
|
|
1572
1588
|
|
|
1573
1589
|
def _initialize_sid_mappings(self):
|
|
1574
1590
|
"""Initialize SID to domain name mappings for cross-domain SID resolution.
|
|
@@ -4341,6 +4357,11 @@ class PyADRecon:
|
|
|
4341
4357
|
# Check authorization flags
|
|
4342
4358
|
no_security_extension = bool(enrollment_flag & 0x80000000) # ESC9
|
|
4343
4359
|
auto_enroll = bool(enrollment_flag & 0x00000020)
|
|
4360
|
+
requires_manager_approval = bool(enrollment_flag & 0x00000002)
|
|
4361
|
+
|
|
4362
|
+
# Check if authorized signatures are required (ESC3 check)
|
|
4363
|
+
ra_signature_count = safe_int(get_attr(entry, 'msPKI-RA-Signature', 0))
|
|
4364
|
+
requires_authorized_signatures = ra_signature_count > 0
|
|
4344
4365
|
|
|
4345
4366
|
# Check if exportable
|
|
4346
4367
|
exportable_key = bool(private_key_flag & 0x00000010) # CT_FLAG_EXPORTABLE_KEY
|
|
@@ -4420,44 +4441,86 @@ class PyADRecon:
|
|
|
4420
4441
|
|
|
4421
4442
|
# ESC1: Domain escalation via Subject Alternative Name
|
|
4422
4443
|
if enrollee_supplies_subject and has_client_auth and enrollment_principals and not only_admins_can_enroll:
|
|
4423
|
-
|
|
4444
|
+
esc_vulns.append('ESC1')
|
|
4445
|
+
if requires_manager_approval:
|
|
4446
|
+
# Manager approval mitigates but doesn't eliminate the risk
|
|
4447
|
+
if risk_level == 'Low':
|
|
4448
|
+
risk_level = 'MEDIUM'
|
|
4449
|
+
risk_factors.append('ESC1: Enrollee supplies subject + Client Auth (mitigated by manager approval)')
|
|
4450
|
+
elif low_priv_can_enroll:
|
|
4424
4451
|
risk_level = 'CRITICAL'
|
|
4425
|
-
esc_vulns.append('ESC1')
|
|
4426
4452
|
risk_factors.append('ESC1: Enrollee supplies subject + Client Auth + Low-priv enrollment')
|
|
4427
4453
|
else:
|
|
4428
4454
|
risk_level = 'HIGH'
|
|
4429
|
-
esc_vulns.append('ESC1')
|
|
4430
4455
|
risk_factors.append('ESC1: Enrollee supplies subject + Client Auth')
|
|
4431
4456
|
|
|
4432
4457
|
# ESC2: Any Purpose EKU
|
|
4433
4458
|
if has_any_purpose_eku and enrollment_principals and not only_admins_can_enroll:
|
|
4434
|
-
|
|
4459
|
+
esc_vulns.append('ESC2')
|
|
4460
|
+
if requires_manager_approval:
|
|
4461
|
+
# Manager approval mitigates but doesn't eliminate the risk
|
|
4462
|
+
if risk_level == 'Low':
|
|
4463
|
+
risk_level = 'Low'
|
|
4464
|
+
risk_factors.append('ESC2: Any Purpose EKU (mitigated by manager approval requirement)')
|
|
4465
|
+
elif low_priv_can_enroll:
|
|
4435
4466
|
if risk_level != 'CRITICAL':
|
|
4436
4467
|
risk_level = 'HIGH'
|
|
4437
|
-
|
|
4468
|
+
risk_factors.append('ESC2: Any Purpose EKU allows arbitrary certificate usage')
|
|
4469
|
+
else:
|
|
4470
|
+
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4471
|
+
risk_level = 'MEDIUM'
|
|
4438
4472
|
risk_factors.append('ESC2: Any Purpose EKU allows arbitrary certificate usage')
|
|
4439
4473
|
|
|
4440
4474
|
# ESC3: Enrollment Agent template
|
|
4475
|
+
# ESC3 requires: Certificate Request Agent EKU + No authorized signatures + No manager approval
|
|
4441
4476
|
if has_enrollment_agent and enrollment_principals and not only_admins_can_enroll:
|
|
4442
|
-
|
|
4477
|
+
esc_vulns.append('ESC3')
|
|
4478
|
+
# Check if both manager approval AND authorized signatures are missing (both mitigations absent)
|
|
4479
|
+
if not requires_manager_approval and not requires_authorized_signatures:
|
|
4480
|
+
# No mitigations in place - this is exploitable
|
|
4481
|
+
if low_priv_can_enroll:
|
|
4482
|
+
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4483
|
+
risk_level = 'HIGH'
|
|
4484
|
+
risk_factors.append('ESC3: Certificate Request Agent EKU with no approval/signature requirements')
|
|
4485
|
+
else:
|
|
4486
|
+
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4487
|
+
risk_level = 'MEDIUM'
|
|
4488
|
+
risk_factors.append('ESC3: Certificate Request Agent EKU with no approval/signature requirements')
|
|
4489
|
+
elif requires_manager_approval and requires_authorized_signatures:
|
|
4490
|
+
# Both mitigations present
|
|
4491
|
+
if risk_level == 'Low':
|
|
4492
|
+
risk_level = 'Low'
|
|
4493
|
+
risk_factors.append('ESC3: Certificate Request Agent EKU (mitigated by manager approval + authorized signatures)')
|
|
4494
|
+
elif requires_manager_approval or requires_authorized_signatures:
|
|
4495
|
+
# One mitigation present
|
|
4496
|
+
if risk_level == 'Low':
|
|
4497
|
+
risk_level = 'Low'
|
|
4498
|
+
mitigation = 'manager approval' if requires_manager_approval else 'authorized signatures'
|
|
4499
|
+
risk_factors.append(f'ESC3: Certificate Request Agent EKU (partially mitigated by {mitigation})')
|
|
4500
|
+
else:
|
|
4501
|
+
# Edge case - shouldn't reach here
|
|
4443
4502
|
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4444
|
-
risk_level = '
|
|
4445
|
-
|
|
4446
|
-
risk_factors.append('ESC3: Certificate Request Agent EKU (enrollment agent)')
|
|
4503
|
+
risk_level = 'MEDIUM'
|
|
4504
|
+
risk_factors.append('ESC3: Certificate Request Agent EKU')
|
|
4447
4505
|
|
|
4448
4506
|
# ESC4: Vulnerable template ACLs
|
|
4449
4507
|
if low_priv_can_write:
|
|
4508
|
+
# ESC4 is not mitigated by manager approval - attackers can modify the template to disable it
|
|
4450
4509
|
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4451
4510
|
risk_level = 'HIGH'
|
|
4452
4511
|
esc_vulns.append('ESC4')
|
|
4453
4512
|
risk_factors.append('ESC4: Non-admin principals have write access to template')
|
|
4454
4513
|
|
|
4455
|
-
# ESC9: No security extension
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4514
|
+
# ESC9: No security extension + Client Auth + No approvals + Low-priv enrollment
|
|
4515
|
+
# Requires ALL of: CT_FLAG_NO_SECURITY_EXTENSION, Client Authentication EKU,
|
|
4516
|
+
# No Manager Approval, No Authorized Signatures, Low-privileged enrollment
|
|
4517
|
+
if (vulnerable_to_esc9 and has_client_auth and
|
|
4518
|
+
not requires_manager_approval and not requires_authorized_signatures and
|
|
4519
|
+
low_priv_can_enroll):
|
|
4459
4520
|
esc_vulns.append('ESC9')
|
|
4460
|
-
|
|
4521
|
+
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4522
|
+
risk_level = 'HIGH'
|
|
4523
|
+
risk_factors.append('ESC9: No security extension + Client Auth + No approvals (allows certificate theft & impersonation)')
|
|
4461
4524
|
|
|
4462
4525
|
# Additional risk factors
|
|
4463
4526
|
if only_admins_can_enroll and (enrollee_supplies_subject and has_client_auth):
|
|
@@ -4479,8 +4542,11 @@ class PyADRecon:
|
|
|
4479
4542
|
|
|
4480
4543
|
# Check if owner is low-privileged (potential ESC4 variant)
|
|
4481
4544
|
if owner_principal and self._is_low_privilege_principal(owner_principal):
|
|
4545
|
+
# ESC4 is not mitigated by manager approval - owner can modify the template
|
|
4482
4546
|
if risk_level not in ['CRITICAL', 'HIGH']:
|
|
4483
4547
|
risk_level = 'HIGH'
|
|
4548
|
+
if 'ESC4' not in esc_vulns:
|
|
4549
|
+
esc_vulns.append('ESC4')
|
|
4484
4550
|
risk_factors.append('ESC4: Low-privileged owner can modify template')
|
|
4485
4551
|
|
|
4486
4552
|
# If no ESC vulnerabilities and no risk factors, set risk level to None
|
|
@@ -4511,6 +4577,7 @@ class PyADRecon:
|
|
|
4511
4577
|
"Exportable Key": exportable_key,
|
|
4512
4578
|
"Auto-Enrollment": auto_enroll,
|
|
4513
4579
|
"Requires Manager Approval": bool(enrollment_flag & 0x00000002),
|
|
4580
|
+
"Authorized Signatures Required": ra_signature_count,
|
|
4514
4581
|
"Enrollment Flag": hex(enrollment_flag),
|
|
4515
4582
|
"Certificate Name Flag": hex(cert_name_flag),
|
|
4516
4583
|
"Private Key Flag": hex(private_key_flag),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|