-
Notifications
You must be signed in to change notification settings - Fork 756
Add lockout-safe password spraying controls #1353
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
base: main
Are you sure you want to change the base?
Changes from all commits
b136578
8bd2a66
4fa1a97
14ff6bb
9320782
4857f08
11d253c
9e2a9d6
65fcdb6
f83e711
b5544ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -375,6 +375,11 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="", | |
| f"{self.domain}\\{self.username}{used_ccache} {error!s}", | ||
| color="magenta" if error in ldap_error_status else "red", | ||
| ) | ||
| if error == "KDC_ERR_CLIENT_REVOKED": | ||
| self.inc_failed_login(self.username) | ||
| self.register_lockout(self.username) | ||
| elif error not in ldap_error_status: | ||
| self.inc_failed_login(self.username) | ||
| return False | ||
| except (KeyError, KerberosException, OSError) as e: | ||
| self.logger.fail( | ||
|
|
@@ -422,20 +427,33 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="", | |
| f"{self.domain}\\{self.username}{' from ccache' if useCache else f':{process_secret(kerb_pass)}'} {error!s}", | ||
| color="magenta" if error in ldap_error_status else "red", | ||
| ) | ||
| if error == "KDC_ERR_CLIENT_REVOKED": | ||
| self.inc_failed_login(self.username) | ||
| self.register_lockout(self.username) | ||
| elif error not in ldap_error_status: | ||
| self.inc_failed_login(self.username) | ||
| return False | ||
| except Exception as e: | ||
| error_code = str(e).split()[-2][:-1] | ||
| self.logger.fail( | ||
| f"{self.domain}\\{self.username}:{process_secret(self.password)} {ldap_error_status.get(error_code, '')}", | ||
| color="magenta" if error_code in ldap_error_status else "red", | ||
| ) | ||
| if error_code == "775": | ||
| self.inc_failed_login(self.username) | ||
| self.register_lockout(self.username) | ||
| elif error_code not in ldap_error_status: | ||
| self.inc_failed_login(self.username) | ||
| return False | ||
| else: | ||
| error_code = str(e).split()[-2][:-1] | ||
| self.logger.fail( | ||
| f"{self.domain}\\{self.username}{' from ccache' if useCache else f':{process_secret(kerb_pass)}'} {error_code!s}", | ||
| color="magenta" if error_code in ldap_error_status else "red", | ||
| ) | ||
| self.inc_failed_login(self.username) | ||
| if error_code == "775": | ||
| self.register_lockout(self.username) | ||
| return False | ||
|
|
||
| def plaintext_login(self, domain, username, password): | ||
|
|
@@ -513,6 +531,9 @@ def plaintext_login(self, domain, username, password): | |
| f"{self.domain}\\{self.username}:{process_secret(self.password)} {ldap_error_status.get(error_code, '')}", | ||
| color="magenta" if (error_code in ldap_error_status and error_code != 1) else "red", | ||
| ) | ||
| self.inc_failed_login(self.username) | ||
| if error_code == "775": | ||
| self.register_lockout(self.username) | ||
|
Comment on lines
+534
to
+536
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would NTLM return a "KDC_ERR_CLIENT_REVOKED"?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wouldn't, good catch. That branch parses a numeric LDAP code, so the Kerberos string was dead; the real Kerberos path is handled separately via |
||
| return False | ||
| except OSError as e: | ||
| self.logger.fail(f"{self.domain}\\{self.username}:{process_secret(self.password)} {'Error connecting to the domain, are you sure LDAP service is running on the target?'} \nError: {e}") | ||
|
|
@@ -607,6 +628,9 @@ def hash_login(self, domain, username, ntlm_hash): | |
| f"{self.domain}\\{self.username}:{process_secret(nthash)} {ldap_error_status.get(error_code, '')}", | ||
| color="magenta" if (error_code in ldap_error_status and error_code != 1) else "red", | ||
| ) | ||
| self.inc_failed_login(self.username) | ||
| if error_code == "775": | ||
| self.register_lockout(self.username) | ||
|
Comment on lines
+631
to
+633
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same fix here as above. Also spotted the identical copy-paste in two Kerberos-fallback branches (442/455) that parse numeric codes too, so I cleaned those for consistency.. all four numeric sites are now just |
||
| return False | ||
| except OSError as e: | ||
| self.logger.fail(f"{self.domain}\\{self.username}:{process_secret(self.password)} {'Error connecting to the domain, are you sure LDAP service is running on the target?'} \nError: {e}") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.