- Notifications
You must be signed in to change notification settings - Fork 818
T1075 pass the hash #341
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
Merged
itaymmguardicore merged 12 commits into guardicore:develop from VakarisZ:attack_pass_the_hash Jul 7, 2019
Merged
T1075 pass the hash #341
Changes from all commits
Commits
Show all changes
12 commits Select commit Hold shift + click to select a range
7c67ee4 Merge branch 'brute_force_report' into attack_pass_the_hash
VakarisZ ed23fd3 Merge branch 'brute_force_report' into attack_pass_the_hash
VakarisZ c4d5aed PTH implementation finished, helper methods added
VakarisZ 75d52a7 Merge branch 'brute_force_report' into attack_pass_the_hash
VakarisZ af63e93 Table not shown if no hashes were used.
VakarisZ 881911e Merge remote-tracking branch 'upstream/develop' into attack_pass_the_…
VakarisZ 676eca6 Merge remote-tracking branch 'upstream/develop' into attack_pass_the_…
VakarisZ 8505ad0 Refactored AttackTechnique methods to use @classmethod and minor impr…
VakarisZ 9367e64 Merge remote-tracking branch 'upstream/develop' into attack_pass_the_…
VakarisZ 8ec5a6a Readability improvements
VakarisZ 3cab7ba Merge remote-tracking branch 'upstream/develop' into attack_pass_the_…
VakarisZ 737c735 Updated attack report in pass the hash
VakarisZ 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
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
44 changes: 44 additions & 0 deletions 44 monkey/monkey_island/cc/services/attack/technique_reports/T1075.py
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,44 @@ | ||
| from monkey_island.cc.services.attack.technique_reports import AttackTechnique | ||
| from common.utils.attack_utils import ScanStatus | ||
| from monkey_island.cc.database import mongo | ||
| | ||
| __author__ = "VakarisZ" | ||
| | ||
| | ||
| class T1075(AttackTechnique): | ||
| | ||
| tech_id = "T1075" | ||
| unscanned_msg = "Monkey didn't try to use pass the hash attack." | ||
| scanned_msg = "Monkey tried to use hashes while logging in but didn't succeed." | ||
| used_msg = "Monkey successfully used hashed credentials." | ||
| | ||
| login_attempt_query = {'data.attempts': {'$elemMatch': {'$or': [{'ntlm_hash': {'$ne': ''}}, | ||
| {'lm_hash': {'$ne': ''}}]}}} | ||
| | ||
| # Gets data about successful PTH logins | ||
| query = [{'$match': {'telem_category': 'exploit', | ||
| 'data.attempts': {'$not': {'$size': 0}, | ||
| '$elemMatch': {'$and': [{'$or': [{'ntlm_hash': {'$ne': ''}}, | ||
| {'lm_hash': {'$ne': ''}}]}, | ||
| {'result': True}]}}}}, | ||
| {'$project': {'_id': 0, | ||
| 'machine': '$data.machine', | ||
| 'info': '$data.info', | ||
| 'attempt_cnt': {'$size': '$data.attempts'}, | ||
| 'attempts': {'$filter': {'input': '$data.attempts', | ||
| 'as': 'attempt', | ||
| 'cond': {'$eq': ['$$attempt.result', True]}}}}}] | ||
| | ||
| @staticmethod | ||
| def get_report_data(): | ||
| data = {'title': T1075.technique_title()} | ||
| successful_logins = list(mongo.db.telemetry.aggregate(T1075.query)) | ||
| data.update({'successful_logins': successful_logins}) | ||
| if successful_logins: | ||
itaymmguardicore marked this conversation as resolved. Show resolved Hide resolved | ||
| status = ScanStatus.USED | ||
| elif mongo.db.telemetry.count_documents(T1075.login_attempt_query): | ||
| status = ScanStatus.SCANNED | ||
| else: | ||
| status = ScanStatus.UNSCANNED | ||
| data.update(T1075.get_message_and_status(status)) | ||
| return data | ||
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
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
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
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
7 changes: 7 additions & 0 deletions 7 monkey/monkey_island/cc/ui/src/components/attack/techniques/Helpers.js
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,7 @@ | ||
| import React from "react"; | ||
| | ||
| export function renderMachine(val){ | ||
| return ( | ||
| <span>{val.ip_addr} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")}</span> | ||
| ) | ||
| }; |
49 changes: 49 additions & 0 deletions 49 monkey/monkey_island/cc/ui/src/components/attack/techniques/T1075.js
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,49 @@ | ||
| import React from 'react'; | ||
| import '../../../styles/Collapse.scss' | ||
| import ReactTable from "react-table"; | ||
| import { renderMachine } from "./Helpers" | ||
| | ||
| | ||
| class T1075 extends React.Component { | ||
| | ||
| constructor(props) { | ||
| super(props); | ||
| this.props.data.successful_logins.forEach((login) => this.setLoginHashType(login)) | ||
| } | ||
| | ||
| setLoginHashType(login){ | ||
| if(login.attempts[0].ntlm_hash !== ""){ | ||
| login.attempts[0].hashType = 'NTLM'; | ||
| } else if(login.attempts[0].lm_hash !== ""){ | ||
| login.attempts[0].hashType = 'LM'; | ||
| } | ||
| } | ||
| | ||
| static getHashColumns() { | ||
| return ([{ | ||
| columns: [ | ||
| {Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), style: { 'whiteSpace': 'unset' }}, | ||
| {Header: 'Service', id: 'service', accessor: x => x.info.display_name, style: { 'whiteSpace': 'unset' }}, | ||
| {Header: 'Username', id: 'attempts', accessor: x => x.attempts[0].user, style: { 'whiteSpace': 'unset' }}, | ||
| {Header: 'Hash type', id: 'credentials', accessor: x => x.attempts[0].hashType, style: { 'whiteSpace': 'unset' }}, | ||
| ] | ||
| }])}; | ||
| | ||
| render() { | ||
| return ( | ||
| <div> | ||
| <div>{this.props.data.message}</div> | ||
| <br/> | ||
| {this.props.data.status === 'USED' ? | ||
| <ReactTable | ||
| columns={T1075.getHashColumns()} | ||
| data={this.props.data.successful_logins} | ||
| showPagination={false} | ||
| defaultPageSize={this.props.data.successful_logins.length} | ||
| /> : ""} | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
| | ||
| export default T1075; |
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.