-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add Exploit Support for ESC9, ESC10 & ESC16 #20189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jheysel-r7
wants to merge
24
commits into
rapid7:master
Choose a base branch
from
jheysel-r7:feat/mod/esc9-esc10-exploit
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
50fe418
ESC9 and ESC10 WIP
jheysel-r7 941e326
add todo
jheysel-r7 d809b11
docs, dnshostname compatibility
jheysel-r7 f6a902f
Revert ldap_query debug statements
jheysel-r7 9d5fa9d
Refactor ESC9 and 10 to separate module
jheysel-r7 1fcc1b1
Refactored and fixed ESC9 scenario B
jheysel-r7 9c94ad0
ESC10 scenario 2
jheysel-r7 865424e
Minor clean up
jheysel-r7 f622500
update ldap_update_object
jheysel-r7 9bb2dd8
Address TODO
jheysel-r7 6e673e8
Refactored code - needs doc update
jheysel-r7 3326cd4
Renamed ldap_update.md
jheysel-r7 b758060
Added flow chart and minor fixes
jheysel-r7 b080766
erroneous space removal
jheysel-r7 615c007
Update Attacking-AD-CS-ESC-Vulnerabilities.md
jheysel-r7 d398f4f
Changed ldap_object to ldap_object_attribute
jheysel-r7 73b79b7
Rubocop fixes
jheysel-r7 0eb7c26
Apply suggestions from code review
jheysel-r7 946e892
Apply suggestions from code review
jheysel-r7 b2d7ec9
Merge branch 'feat/mod/esc9-esc10-exploit' of github.com:jheysel-r7/m…
jheysel-r7 9e952c5
Revert unnecessary change
jheysel-r7 536702f
ESC16 Scenario 1 update
jheysel-r7 364488c
ESC16 Scenario 2 update
jheysel-r7 b7b7d7d
Fixed tests
jheysel-r7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
509 changes: 506 additions & 3 deletions
509
...etasploit-framework.wiki/ad-certificates/Attacking-AD-CS-ESC-Vulnerabilities.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
172 changes: 172 additions & 0 deletions
172
documentation/modules/auxiliary/gather/ldap_object_attribute.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
## Description | ||
|
||
The `ldap_object_attribute` module allows users to read, create, update or delete attributes of LDAP objects in an Active Directory environment. | ||
This module is flexible, enabling users to specify the target object and the attribute they wish to interact with. | ||
|
||
## Verification Steps | ||
|
||
### Action Update | ||
1. On the target host determine the current UPN value of the user you wish to update: | ||
```powershell | ||
PS C:\Users\Administrator> Get-ADUser -Identity user2 -Properties UserPrincipalName | Select-Object UserPrincipalName | ||
|
||
UserPrincipalName | ||
----------------- | ||
user2 | ||
``` | ||
1. Start `msfconsole` | ||
1. Do: `use auxiliary/gather/ldap_object_attribute` | ||
1. Do: `set RHOST [IP]` | ||
1. Do: `set LDAPDomain [DOMAIN]` | ||
1. Do: `set LDAPUsername [USERNAME]` | ||
1. Do: `set LDAPPassword [PASSWORD]` | ||
1. Do: `set TARGET_USERNAME [TARGET_USERNAME]` | ||
1. Do: `set ATTRIBUTE userPrincipalName` | ||
1. Do: `set OBJECT_LOOKUP sAMAccountName` | ||
1. Do: `set OBJECT [User you wish to update]` | ||
1. Do: `set VALUE [New value for the attribute (e.g., Administrator)]` | ||
1. Do: `set ACTION update` | ||
1. Do: `run` | ||
1. Verify the attribute has been updated successfully: | ||
```powershell | ||
PS C:\Users\Administrator> Get-ADUser -Identity user2 -Properties UserPrincipalName | Select-Object UserPrincipalName | ||
|
||
UserPrincipalName | ||
----------------- | ||
Administrator | ||
``` | ||
|
||
## Options | ||
|
||
### OBJECT | ||
The username of the target LDAP object whose attribute you want to update. This is used to locate the specific object in the LDAP directory. | ||
|
||
### OBJECT_LOOKUP | ||
How to look up the target LDAP object. This can either be done by specifying a DN or by specifying `sAMAaccountName` in order to work with AD account attributes. | ||
|
||
### ATTRIBUTE | ||
The LDAP attribute to update. For example, `userPrincipalName` can be used to update the User Principal Name of the target object. | ||
|
||
### VALUE | ||
Required when running "Update" or "Create" actions and is the value of the specified attribute that you want to set for the target object. | ||
|
||
## Scenarios | ||
### Action `Update` | ||
|
||
``` | ||
msf6 auxiliary(gather/ldap_object_attribute) > set action update | ||
action => update | ||
msf6 auxiliary(gather/ldap_object_attribute) > set rhost 172.16.199.200 | ||
rhost => 172.16.199.200 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPDomain kerberos.issue | ||
LDAPDomain => kerberos.issue | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPUsername user1 | ||
LDAPUsername => user1 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPPassword N0tpassword! | ||
LDAPPassword => N0tpassword! | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT user2 | ||
OBJECT => user2 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT_LOOKUP sAMAccountName | ||
OBJECT_LOOKUP => sAMAccountName | ||
msf6 auxiliary(gather/ldap_object_attribute) > set ATTRIBUTE userPrincipalName | ||
ATTRIBUTE => userPrincipalName | ||
msf6 auxiliary(gather/ldap_object_attribute) > set VALUE Administrator | ||
VALUE => Administrator | ||
msf6 auxiliary(gather/ldap_object_attribute) > run | ||
[*] Running module against 172.16.199.200 | ||
[*] Discovering base DN automatically | ||
[*] Original value of user2's userPrincipalName: | ||
[*] Attempting to update userPrincipalName for CN=user2,CN=Users,DC=kerberos,DC=issue to Administrator... | ||
[+] Successfully updated CN=user2,CN=Users,DC=kerberos,DC=issue's userPrincipalName to Administrator | ||
[+] The operation completed successfully! | ||
[*] Auxiliary module execution completed | ||
``` | ||
|
||
### Action `Read` | ||
``` | ||
msf6 auxiliary(gather/ldap_object_attribute) > set action read | ||
action => read | ||
msf6 auxiliary(gather/ldap_object_attribute) > set rhost 172.16.199.200 | ||
rhost => 172.16.199.200 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPDomain kerberos.issue | ||
LDAPDomain => kerberos.issue | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPUsername user1 | ||
LDAPUsername => user1 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPPassword N0tpassword! | ||
LDAPPassword => N0tpassword! | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT user2 | ||
OBJECT => user2 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT_LOOKUP sAMAccountName | ||
OBJECT_LOOKUP => sAMAccountName | ||
msf6 auxiliary(gather/ldap_object_attribute) > set ATTRIBUTE userPrincipalName | ||
ATTRIBUTE => userPrincipalName | ||
msf6 auxiliary(gather/ldap_object_attribute) > run | ||
[*] Running module against 172.16.199.200 | ||
[*] Discovering base DN automatically | ||
[+] Found CN=user2,CN=Users,DC=kerberos,DC=issue with userPrincipalName set to Administrator | ||
[+] The operation completed successfully! | ||
[*] Auxiliary module execution completed | ||
``` | ||
|
||
### Action `Delete` | ||
``` | ||
msf6 auxiliary(gather/ldap_object_attribute) > set action delete | ||
action => delete | ||
msf6 auxiliary(gather/ldap_object_attribute) > set rhost 172.16.199.200 | ||
rhost => 172.16.199.200 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPDomain kerberos.issue | ||
LDAPDomain => kerberos.issue | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPUsername user1 | ||
LDAPUsername => user1 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPPassword N0tpassword! | ||
LDAPPassword => N0tpassword! | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT user2 | ||
OBJECT => user2 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT_LOOKUP sAMAccountName | ||
OBJECT_LOOKUP => sAMAccountName | ||
msf6 auxiliary(gather/ldap_object_attribute) > set ATTRIBUTE userPrincipalName | ||
ATTRIBUTE => userPrincipalName | ||
msf6 auxiliary(gather/ldap_object_attribute) > run | ||
[*] Running module against 172.16.199.200 | ||
[*] Discovering base DN automatically | ||
[*] Attempting to delete attribute userPrincipalName from CN=user2,CN=Users,DC=kerberos,DC=issue... | ||
[+] Successfully deleted attribute userPrincipalName from CN=user2,CN=Users,DC=kerberos,DC=issue | ||
[+] The operation completed successfully! | ||
[*] Auxiliary module execution completed | ||
``` | ||
|
||
### Action `Create` | ||
``` | ||
msf6 auxiliary(gather/ldap_object_attribute) > set action create | ||
action => create | ||
msf6 auxiliary(gather/ldap_object_attribute) > set rhost 172.16.199.200 | ||
rhost => 172.16.199.200 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPDomain kerberos.issue | ||
LDAPDomain => kerberos.issue | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPUsername user1 | ||
LDAPUsername => user1 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set LDAPPassword N0tpassword! | ||
LDAPPassword => N0tpassword! | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT user2 | ||
OBJECT => user2 | ||
msf6 auxiliary(gather/ldap_object_attribute) > set OBJECT_LOOKUP sAMAccountName | ||
OBJECT_LOOKUP => sAMAccountName | ||
msf6 auxiliary(gather/ldap_object_attribute) > set ATTRIBUTE userPrincipalName | ||
ATTRIBUTE => userPrincipalName | ||
msf6 auxiliary(gather/ldap_object_attribute) > set VALUE Administrator | ||
VALUE => Administrator | ||
msf6 auxiliary(gather/ldap_object_attribute) > run | ||
[*] Reloading module... | ||
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST | ||
[*] Running module against 172.16.199.200 | ||
[*] Discovering base DN automatically | ||
[*] Attempting to add attribute userPrincipalName with value asdfasdf to CN=user2,CN=Users,DC=kerberos,DC=issue... | ||
[+] Successfully added attribute userPrincipalName with value asdfasdf to CN=user2,CN=Users,DC=kerberos,DC=issue | ||
[+] The operation completed successfully! | ||
[*] Auxiliary module execution completed | ||
``` | ||
|
||
## Notes | ||
|
||
- Ensure the user account used for authentication has sufficient privileges to modify the specified attribute. | ||
- Use caution when modifying LDAP attributes, as incorrect changes can disrupt directory services. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The top of this doc has a list of all the ESC flaws that Metasploit supports and a flow chart. ESC9 and ESC10 should be added to that chart and the full list of ESC vulnerabilities with links to their exploit sections.